Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
20687 Discussions

Verilog "case" collision problem

Altera_Forum
Honored Contributor II
1,251 Views

case( 1'b1 ) // synthesis parallel_case 

a:value <= 4'd1; 

b:value <= 4'd2; 

c:value <= 4'd3; 

d:value <= 4'd4; 

endcase 

 

if there is only 1 condition equals,the synthesis result is parallel. 

My question is:when there are 2 or more condition hit,for example,b=1 and a=1,How the "value" turn out to be? It's 4'hxx or 4'd2 ? 

Does the value depend on the first statement when multiple hits? 

 

thank U!
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
286 Views

your case statement must cater for all cases including default. 

So your question is not right. Your case variable cannot have two values at same time. 

 

Edit: looks like your case statement is upside down
0 Kudos
Altera_Forum
Honored Contributor II
286 Views

actually,in my design,there are 8 case variables ,so if I use the priority structure like "if(a==1)..else if(b==1)...else if(c==1)...",the path delay will be very long! 

So I want to use the parallel structure as above described. 

"looks like your case statement is upside down"----I have tested the codes,it will be synthesised as parallel circuit because of the "synthesis parallel_case" .
0 Kudos
Altera_Forum
Honored Contributor II
286 Views

If you mean your case subject is 8 bits then you can say: 

 

case subject 

"00000000": do this 

"00000001": do that 

...etc 

 

you may use better syntax than me as my Verilog is rusty.
0 Kudos
Reply