bharat_in
Member level 4

Till now, i was under impression that case statment will generate non-priority encoder hardware both in simulation and synthesis, but following coding shows that in simulation in works like proirity encoder... :-(
module m ();
wire [3:0] w1 = 4'b1101 ;
initial
begin
#4;
case(1'b1)
w1[0]: $display("0") ;
w1[1]: $display("1") ;
w1[2]: $display("2") ;
w1[3]: $display("3") ;
default: $display("Default") ;
endcase
end
endmodule
Output:
0
I guess, in this case it will have pre-synthesis and post-synthesis simulation mismatch.
Can anyone please explain, how to get parallel hardware in simulation using case statment?
module m ();
wire [3:0] w1 = 4'b1101 ;
initial
begin
#4;
case(1'b1)
w1[0]: $display("0") ;
w1[1]: $display("1") ;
w1[2]: $display("2") ;
w1[3]: $display("3") ;
default: $display("Default") ;
endcase
end
endmodule
Output:
0
I guess, in this case it will have pre-synthesis and post-synthesis simulation mismatch.
Can anyone please explain, how to get parallel hardware in simulation using case statment?