In a number of sources I've come across, it's mentioned that for sensitivity lists which include an "edge", you cannot include other signals in the sensitivity list if you want synthesis to work.
Thus, for example, consider the code below for an active-low asynchronous-reset DFF:
always @(posedge clk or rstN)
if (!rstN) q <= 0;
else q <= d;
This is legal syntactically and will simulate, but synthesis compilers will not accept it. Instead, one needs to use negedge rstN
. The simulation will be the same, but now it will synthesize as expected.
Why the prohibition by synthesis compilers against things like the snippet I gave above? Is there some fundamental aspect or ambiguity which makes parsing such a snippet hard for compilers?
I follow that this is outside of what is a synthesizable construct but I am hoping to understand why that is. That is, I'm hoping to understand why the compiler would struggle with synthesizing this?
Edit: After reading further, I should note that Sutherland does discuss exactly this case on page 289. Thus, we should emphasize two things: (1) As Tom says in the accepted answer, my snippet above does not even simulate correctly. (2) Even if it did simulate correctly (or, rather, even if we considered an analogous snippet which mixed signal levels with signal edges in the sensitivity list) we would not get the snippet to synthesize because it is a synthesis requirement that if posedge
or negedge
is used for one signal in a sensitivity list, then an edge must be specified for all signals in said sensitivity list.
posedge reset
to the sensitivity list, it will synthesize as asynchronous reset, as it will "trigger" the process on either the clock or thereset
going high. If you don't, it will be synchronous, as the reset signal will only be "probed" on clock edge. \$\endgroup\$