I have some query about the priority of if else in verilog. For example.
If (a)
b
else if c
d
else if e
f
else
g
At here, those a,b,c...g are all searched ? How do those have priorities in if~else in verilog?
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It only takes a minute to sign up.
Sign up to join this communityI have some query about the priority of if else in verilog. For example.
If (a)
b
else if c
d
else if e
f
else
g
At here, those a,b,c...g are all searched ? How do those have priorities in if~else in verilog?
An if-else construct infers a priority routing network. Following example is taken directly from a verilog book :
if (m==n) r = a + b + c ; else if (m > n ) r = a - b ; else r = c + 1 ;
The circuit is as shown :
As you can see, the outermost if is given a priority in the sense that it is routed first if a match is found, bypassing others.