Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
공지
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 토론

"21'b0" Verilog to VHDL explination please

Altera_Forum
명예로운 기여자 II
1,792 조회수

Hello 

 

In Verilog I got this code: 

cont <= 21'b0; 

oRST <= 1'b1; 

 

What does it mean in VHDL?
0 포인트
3 응답
Altera_Forum
명예로운 기여자 II
681 조회수

 

--- Quote Start ---  

Hello 

 

In Verilog I got this code: 

cont <= 21'b0; 

oRST <= 1'b1; 

 

What does it mean in VHDL? 

--- Quote End ---  

 

 

In VHDL const would have to have 21 bits, eg., 

 

signal const : std_logic_vector(20 downto 0); 

 

and you'd assign all zeros to it using 

 

const <= (others => '0'); 

 

The signal oRST is a 1-bit signal, eg., 

 

signal oRST : std_logic; 

 

and you'd assign a 1 to it via 

 

oRST <= '1'; 

 

Cheers, 

Dave
0 포인트
Altera_Forum
명예로운 기여자 II
681 조회수

Thanks! 

 

Now I have in VHDL: 

cont <= "000000000000000000000"; 

oRST <= '1'; 

 

:)
0 포인트
Altera_Forum
명예로운 기여자 II
681 조회수

 

--- Quote Start ---  

Now I have in VHDL: 

cont <= "000000000000000000000"; 

--- Quote End ---  

 

It's O.K. if you love it long-winded. 

 

You'll notice, that in Verilog also  

cont <= 0; 

is accepted as legal code, but giving a warning about assigning a 32 bit value to a 21 bit signal or something like that.  

 

In VHDL, the assigned constant must have the correct bit length if not using special constructs like OTHERS =>.
0 포인트
응답