3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-07 01:54:10 +00:00
yosys/tests/simple/ifdef_1.v
Zachary Snow 1ec5994100 verilog: fix handling of nested ifdef directives
- track depth so we know whether to consider higher-level elsifs
- error on unmatched endif/elsif/else
2021-03-01 12:28:33 -05:00

89 lines
967 B
Verilog

module top(o1, o2, o3, o4);
`define FAIL input wire not_a_port;
`ifdef COND_1
`FAIL
`elsif COND_2
`FAIL
`elsif COND_3
`FAIL
`elsif COND_4
`FAIL
`else
`define COND_4
output wire o4;
`ifdef COND_1
`FAIL
`elsif COND_2
`FAIL
`elsif COND_3
`FAIL
`elsif COND_4
`define COND_3
output wire o3;
`ifdef COND_1
`FAIL
`elsif COND_2
`FAIL
`elsif COND_3
`define COND_2
output wire o2;
`ifdef COND_1
`FAIL
`elsif COND_2
`define COND_1
output wire o1;
`ifdef COND_1
`ifdef COND_1
`elsif COND_2
`FAIL
`elsif COND_3
`FAIL
`elsif COND_4
`FAIL
`else
`FAIL
`endif
`elsif COND_2
`FAIL
`elsif COND_3
`FAIL
`elsif COND_4
`FAIL
`else
`FAIL
`endif
`elsif COND_3
`FAIL
`elsif COND_4
`FAIL
`else
`FAIL
`endif
`elsif COND_4
`FAIL
`else
`FAIL
`endif
`else
`FAIL
`endif
`endif
endmodule