File tree Expand file tree Collapse file tree 6 files changed +52
-2
lines changed
regression/verilog/preprocessor Expand file tree Collapse file tree 6 files changed +52
-2
lines changed Original file line number Diff line number Diff line change 1
1
# EBMC 5.7
2
2
3
+ * Verilog: `elsif preprocessor directive
4
+
3
5
# EBMC 5.6
4
6
5
7
* SystemVerilog: [*] and [+] SVA operators
Original file line number Diff line number Diff line change 1
- KNOWNBUG
1
+ CORE
2
2
elsif1.v
3
-
3
+ --preprocess
4
+ ^IFDEF$
4
5
^EXIT=0$
5
6
^SIGNAL=0$
6
7
--
8
+ ^ELSIF$
7
9
--
8
10
The elsif directive is not implemented.
Original file line number Diff line number Diff line change 1
1
`define X 1
2
2
`ifdef X
3
+ IFDEF
3
4
`elsif Y
4
5
ELSIF
5
6
`endif
Original file line number Diff line number Diff line change
1
+ CORE
2
+ elsif2.v
3
+ --preprocess
4
+ ^ELSIF$
5
+ ^EXIT=0$
6
+ ^SIGNAL=0$
7
+ --
8
+ ^IFDEF$
9
+ --
Original file line number Diff line number Diff line change
1
+ `define Y 1
2
+ `ifdef X
3
+ `elsif Y
4
+ ELSIF
5
+ `endif
Original file line number Diff line number Diff line change @@ -551,6 +551,37 @@ void verilog_preprocessort::directive()
551
551
conditional.else_part =true ;
552
552
condition=conditional.get_cond ();
553
553
}
554
+ else if (text == " elsif" )
555
+ {
556
+ if (conditionals.empty ())
557
+ throw verilog_preprocessor_errort () << " `elsif without `ifdef/`ifndef" ;
558
+
559
+ // skip whitespace
560
+ tokenizer ().skip_ws ();
561
+
562
+ // we expect an identifier
563
+ const auto identifier_token = tokenizer ().next_token ();
564
+
565
+ if (!identifier_token.is_identifier ())
566
+ throw verilog_preprocessor_errort ()
567
+ << " expecting an identifier after `elsif" ;
568
+
569
+ auto &identifier = identifier_token.text ;
570
+
571
+ tokenizer ().skip_until_eol ();
572
+
573
+ bool defined = defines.find (identifier) != defines.end ();
574
+
575
+ conditionalt &conditional = conditionals.back ();
576
+
577
+ if (conditional.else_part )
578
+ {
579
+ throw verilog_preprocessor_errort () << " `elsif after `else" ;
580
+ }
581
+
582
+ conditional.condition = defined ;
583
+ condition = conditional.get_cond ();
584
+ }
554
585
else if (text==" endif" )
555
586
{
556
587
if (conditionals.empty ())
You can’t perform that action at this time.
0 commit comments