Reputation: 23
I'd like to know how to use the unique statement in verilog .
for example
if (in0) se1 = 2'b00;
else if (in1) se1 = 2'b00;
else if (in2) se1 = 2'b00;
else if (in3) se1 = 2'b00;
If in0 and in1 are true then in0 is selected.
unique if (in0) se1 = 2'b00;
else if (in1) se1 = 2'b00;
else if (in2) se1 = 2'b00;
else if (in3) se1 = 2'b00;
If in0, in1 are true then how is this handled?
Upvotes: 2
Views: 4195
Reputation: 71
First of all I want to tell you that unique feature is for system-verilog not for verilog. The SystemVerilog unique keyword can be applied to an if…else statement to convey the same uniqueness properties. For a unique if statement, a simulator will generate a run-time warning if any of the following is false:
Upvotes: 2
Reputation: 42788
The unique
keyword added to an if
or case
statement does two things:
If it turns out that both in0 and in1 are true, simulation will still take the first branch, but you will get an error message. The actual hardware will generate unpredictable results.
Upvotes: 3