I have a little confusion about sensitivity list rule: all signals that are read in the always block must be included in the list. When including the posedge CLK and EN in my sensitivity list, I get value of x changed when either of signals in the sensitivity list changes. Thus, if EN changes in the middle of the clock cycle, x changes accordingly, which is expected. However, this is not the outcome I wish to get:
always @(posedge CLK, EN)
if(EN)
x <= 1;
else
x <= 0;
I need the value of x to change only at the rising edge. Therefore, I remove the EN from the list to achieve desired outcome. But then, this violates the rule.
This is, probably, a very trivial question, but could someone clarify what's the proper way to implement it?