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 11# EBMC 5.7
22
3+ * Verilog: `elsif preprocessor directive
4+
35# EBMC 5.6
46
57* SystemVerilog: [*] and [+] SVA operators
Original file line number Diff line number Diff line change 1- KNOWNBUG
1+ CORE
22elsif1.v
3-
3+ --preprocess
4+ ^IFDEF$
45^EXIT=0$
56^SIGNAL=0$
67--
8+ ^ELSIF$
79--
810The elsif directive is not implemented.
Original file line number Diff line number Diff line change 11`define X 1
22`ifdef X
3+ IFDEF
34`elsif Y
45ELSIF
56`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()
551551 conditional.else_part =true ;
552552 condition=conditional.get_cond ();
553553 }
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+ }
554585 else if (text==" endif" )
555586 {
556587 if (conditionals.empty ())
You can’t perform that action at this time.
0 commit comments