stanford
Full Member level 2
For example, if you want such behavior: you want a = 1, b = 0, c = 0, d = 0, when in = 0, and you want everything to = 0 if in = 1, I'm having to repeat writing a=0; b=0; c=0; d=0;. Once at the top to set them to 0 if they are not set within one of the case statements, and another in the default case statement, in case 'in' does not match any case. I'm just wondering if there is a better way to write this and avoid this duplicate default value assignment.
Code:
always_comb
[B]a=0;
b=0;
c=0;
d=0;[/B]
case (in)
0: a=1;
2: b=1;
4: c=1;
5: d=1;
default: [B]a=0; b=0; c=0; d=0;[/B]
endcase