SamV
Newbie level 6
Hi All,
Today I thought I was clever by using a high impedance state in verilog. It doesn't work when I simulate it. Below is effectively what I was trying to do. Based on the simulation it seems that the if statement in the second always block which should check if the register set has a value of 1'bz doesn't work even though the value in the register is 1'bz. Is this what I should expect? If so, is there a way of doing this?
Thanks,
Sam
Today I thought I was clever by using a high impedance state in verilog. It doesn't work when I simulate it. Below is effectively what I was trying to do. Based on the simulation it seems that the if statement in the second always block which should check if the register set has a value of 1'bz doesn't work even though the value in the register is 1'bz. Is this what I should expect? If so, is there a way of doing this?
Thanks,
Sam
Code Verilog - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 always @(a or b or c) begin if(a|b|c)begin if(a == 1'b1) set <= 1'b1; else if (b == 1'b1) set <= 1'b0; else if (c == 1'b1) set <= 1'bz; end end always @(posedge clk) begin if(set == 1'b1) x <= 1'b1; else if(set == 1'b0) y <= 1'b1; else if(set == 1'bz) q <= 1'b1; end
Last edited by a moderator: