1

Is it true or false in Verilog? I do not understand what does it mean by mixing..Does it changes the output directly if it works?

skream117
  • 11
  • 2

1 Answers1

3

The rule needs to be clarified.

Do not assign the same variable using both blocking and non-blocking assignments within the same block. The problem usually manifests itself when describing an asynchronous reset.

always @(posedge clk or negedge rst)
  if (!reset)
    q = 0;
  else
    q < = d;

If the two events occur at the same time, but q<= d gets processed before the q=0, then there is a pending update to q after it gets set to 0, so that gets lost. There are a number of other scenarios.

dave_59
  • 39,096
  • 3
  • 24
  • 63
  • Can you please be more clear? When the TWO events (I guess you are talking about posedge clk and negedge rst) occur at the same time, only q = 0 will get executed. q <= d will not. Why are you talking that q <= d might execuute and then q=0 might execute? – user3219492 Sep 12 '19 at 06:25
  • Yes, those are the two events. `q<=d` might get executed because `rst` is still 1, the `negedge rst` has not happened yet. – dave_59 Sep 12 '19 at 07:17