Skip to content

Commit eb37218

Browse files
authored
Merge pull request #1357 from diffblue/verilog3
netlist: fix further `extractbits` off-by-one errors
2 parents 7a8c7df + 63b7c5c commit eb37218

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# EBMC 5.8
22

3+
* AIG/netlist engine: fix for conversion of extract bits operator
34
* Verilog: semantic fix for output register ports
45
* SystemVerilog: cover sequence
56
* SystemVerilog: labeled immediate assert/assume/cover statements
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
CORE
2+
verilog3.sv
3+
--smv-netlist
4+
^EXIT=0$
5+
^SIGNAL=0$
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module main;
2+
wire [7:0] some_wire;
3+
wire [31:0] something_else;
4+
assign something_else = some_wire[7:1];
5+
endmodule

src/trans-netlist/trans_to_netlist.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,10 @@ void convert_trans_to_netlistt::convert_lhs_rec(
594594
if(!to_integer_non_constant(to_extractbits_expr(expr).index(), new_from))
595595
{
596596
boolbv_widtht boolbv_width(ns);
597-
mp_integer new_to = new_from + boolbv_width(expr.type());
597+
const auto width = boolbv_width(expr.type());
598+
DATA_INVARIANT(
599+
width != 0, "trans_to_netlist got extractbits with zero-width operand");
600+
mp_integer new_to = new_from + width - 1;
598601

599602
from = new_from.to_ulong();
600603
to = new_to.to_ulong();

0 commit comments

Comments
 (0)