Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
17267 Discussions

Assigning value to 7 bits output buffer?

Altera_Forum
Honored Contributor II
1,371 Views

Hi, 

 

I'm doing a Moore FSM, and the outputs are 7 bits buffers (declared as such:  

sum: out STD_LOGIC_VECTOR(6 down to 0); 

 

When writing the output logic, I wrote: 

 

when S2 => sum <= '0001010'; 

 

but that gives me an error for each of these instances. What would be the correct syntax for what I'm trying to do? 

 

Thanks!
0 Kudos
4 Replies
Altera_Forum
Honored Contributor II
677 Views

sum <= "0001010" WHEN S2 = '1'; 

 

Any number that uses more than 1 bit requires double quotes. If that is supposed to be a hex number (not clear but guessing it's binary), you would add an x (x"0001010").
0 Kudos
Altera_Forum
Honored Contributor II
677 Views

 

--- Quote Start ---  

you would add an x (x"0001010") 

--- Quote End ---  

 

Since 'sum' is a 7-bit value and x"0001010" represents a 28-bit value (which wouldn't work), stick with sstrel's first solution. 

 

Cheers, 

Alex
0 Kudos
Altera_Forum
Honored Contributor II
677 Views

' is used for single characters 

" is used for strings 

 

You need to use "
0 Kudos
Altera_Forum
Honored Contributor II
677 Views

Whoops, missed the 7-bit part! Yes, just "0001010".

0 Kudos
Reply