diff --git a/regression/verilog/synthesis/posedge_vector.desc b/regression/verilog/synthesis/posedge_vector.desc index d2d9e5de..00743f45 100644 --- a/regression/verilog/synthesis/posedge_vector.desc +++ b/regression/verilog/synthesis/posedge_vector.desc @@ -1,8 +1,8 @@ CORE posedge_vector.v --module main -^file posedge_vector.v line \d+: pos/negedge expected to have Boolean as operand, but got \[7:0\]$ -^EXIT=2$ +^no properties$ +^EXIT=10$ ^SIGNAL=0$ -- ^warning: ignoring diff --git a/regression/verilog/synthesis/posedge_vector.v b/regression/verilog/synthesis/posedge_vector.v index e9923c2a..c8f978cc 100644 --- a/regression/verilog/synthesis/posedge_vector.v +++ b/regression/verilog/synthesis/posedge_vector.v @@ -1,5 +1,6 @@ module main(input [7:0] data); + // Allowed; only the LSB will be considered. always @(posedge data); endmodule diff --git a/src/verilog/verilog_synthesis.cpp b/src/verilog/verilog_synthesis.cpp index f125b773..b2e0606c 100644 --- a/src/verilog/verilog_synthesis.cpp +++ b/src/verilog/verilog_synthesis.cpp @@ -2729,22 +2729,6 @@ void verilog_synthesist::synth_event_guard( << "pos/negedge expected to have one operand"; } - if(to_unary_expr(*it).op().id() != ID_symbol) - { - throw errort().with_location(it->source_location()) - << "pos/negedge expected to have symbol as operand, " - "but got " + - to_unary_expr(*it).op().pretty(); - } - - if(to_unary_expr(*it).op().type().id() != ID_bool) - { - throw errort().with_location(it->source_location()) - << "pos/negedge expected to have Boolean as operand, " - "but got " + - to_string(to_unary_expr(*it).op().type()); - } - irep_idt identifier="conf::clock_enable_mode"; // check symbol_table for clock guard @@ -2753,7 +2737,15 @@ void verilog_synthesist::synth_event_guard( { // found! we make it a guard - guards.push_back(to_unary_expr(*it).op()); + auto &op = to_unary_expr(*it).op(); + + if(op.type().id() == ID_bool) + guards.push_back(op); + else + { + // get LSB + guards.push_back(extractbit_exprt{op, integer_typet{}.zero_expr()}); + } throw errort() << "Notice: using clock guard " << identifier; }