Skip to content

Commit

Permalink
[HWToBTOR2] Fix slice lowering argument meanings
Browse files Browse the repository at this point in the history
  • Loading branch information
TaoBi22 committed Nov 19, 2024
1 parent 6754869 commit 064803a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/Conversion/HWToBTOR2/HWToBTOR2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ struct ConvertHWToBTOR2Pass
// Build and return the slice instruction
os << opLID << " "
<< "slice"
<< " " << sid << " " << op0LID << " " << (width - 1) << " " << lowbit
<< " " << sid << " " << op0LID << " " << (lowbit + width - 1) << " " << lowbit
<< "\n";
}

Expand Down
17 changes: 10 additions & 7 deletions test/Conversion/HWToBTOR2/comb.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,21 @@ module {
// CHECK: [[NID10:[0-9]+]] slice [[NID0]] [[NID9]] 31 0
%3 = comb.extract %2 from 0 : (i33) -> i32

// CHECK: [[NID11:[0-9]+]] ugt [[NID3]] [[NID10]] 2
%4 = comb.icmp bin ugt %3, %a : i32
// CHECK: [[NID11:[0-9]+]] slice [[NID3]] [[NID9]] 16 16
%4 = comb.extract %2 from 16 : (i33) -> i1

// CHECK: [[NID12:[0-9]+]] implies [[NID3]] [[NID5]] [[NID11]]
// CHECK: [[NID13:[0-9]+]] not [[NID3]] [[NID12]]
// CHECK: [[NID14:[0-9]+]] bad [[NID13:[0-9]+]]
// CHECK: [[NID12:[0-9]+]] ugt [[NID3]] [[NID10]] 2
%5 = comb.icmp bin ugt %3, %a : i32

// CHECK: [[NID13:[0-9]+]] implies [[NID3]] [[NID5]] [[NID12]]
// CHECK: [[NID14:[0-9]+]] not [[NID3]] [[NID13]]
// CHECK: [[NID15:[0-9]+]] bad [[NID14:[0-9]+]]
sv.always posedge %0 {
sv.if %true {
sv.assert %4, immediate message "a + 1 should be greater than a"
sv.assert %5, immediate message "a + 1 should be greater than a"
}
}
hw.output %4 : i1
hw.output %5 : i1
}
}

0 comments on commit 064803a

Please sign in to comment.