Decoding multiple events

D

DW

Guest
Hi,
suppose I have two events which can occur and I want to control a common
register which depends on the event ordering, (so a single always block is
used). How can I decode the two events after they have occurred, so I know
which course of action to take. I have considered using two always blocks
but I'm not sure whether or not this would lead to unexpected behaviour.

e.g.

integer x;

always @ (negedge a or negedge b)
begin
...this is what I want but don't know how to do it:
if x = some value
if a negedge a occured then assign x = 1
otherwise (negedge b must have occured) assign x = 2
else if x = some other value
if a negedge a occured then assign x = 3
otherwise (negedge b must have occured) assign x = 4
end

Thanks for reading
 

Welcome to EDABoard.com

Sponsor

Back
Top