-
-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathgenerate_case_with_label.sv
46 lines (46 loc) · 1.21 KB
/
generate_case_with_label.sv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
module M;
case (2'd0) // No begin/end delimiters.
2'd1:
logic a = 1'b0;
default:
logic a = 1'b0;
endcase
endmodule
////////////////////////////////////////////////////////////////////////////////
module M;
case (2'd1) // begin/end delimiters, but no label.
2'd1: begin
logic b = 1'b0;
end
default: begin
logic b = 1'b0;
end
endcase
endmodule
////////////////////////////////////////////////////////////////////////////////
module M;
case (2'd2) // With label, but no prefix.
2'd1: begin: foo
logic c = 1'b0;
end: foo // NOTE: With optional label on end.
default: begin: bar
logic c = 1'b0;
end // NOTE: Without optional label on end.
endcase
endmodule
////////////////////////////////////////////////////////////////////////////////
module M;
case (2'd4) // Without default arm.
2'd1: begin: foo
logic e = 1'b0;
end
endcase
endmodule
////////////////////////////////////////////////////////////////////////////////
module M;
case (2'd5) // Without non-default arm.
default: begin: bar
logic f = 1'b0;
end
endcase
endmodule