Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)

Verilog Assignment

Altera_Forum
Honored Contributor II
1,022 Views

Hi all, 

I have a very basic question, I think. 

I develop in VHDL but in this moment I have to port a Verilog crunk of code.... the problem is that I don't know the Verilog... :( ! 

Can anyone help me to understand this assignment (conditional statement I presume): 

 

module xxx( . . input z, . . ); wire x; reg y; assign x = y == z; .....  

 

Thank you
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
326 Views

This is logically equivalent to: 

 

if (y == z) 

x = 1; 

else 

x =0; 

 

A clearer way to write it would have been: 

 

assign x = (y == z); // x assigned result of Boolean equality comparison 

 

or 

 

assign x = (y == z) ? : 1'b1 : 1'b0; // Called a conditional assignment in verilog
0 Kudos
Altera_Forum
Honored Contributor II
326 Views

 

--- Quote Start ---  

This is logically equivalent to: 

 

if (y == z) 

x = 1; 

else 

x =0; 

 

A clearer way to write it would have been: 

 

assign x = (y == z); // x assigned result of Boolean equality comparison 

 

or 

 

assign x = (y == z) ? : 1'b1 : 1'b0; // Called a conditional assignment in verilog 

--- Quote End ---  

 

 

Thank you very much.
0 Kudos
Reply