diff --git a/lib/Conversion/HWToBTOR2/HWToBTOR2.cpp b/lib/Conversion/HWToBTOR2/HWToBTOR2.cpp index dd0fce8fc143..1083f24c88a2 100644 --- a/lib/Conversion/HWToBTOR2/HWToBTOR2.cpp +++ b/lib/Conversion/HWToBTOR2/HWToBTOR2.cpp @@ -304,8 +304,8 @@ struct ConvertHWToBTOR2Pass // Build and return the slice instruction os << opLID << " " << "slice" - << " " << sid << " " << op0LID << " " << (width - 1) << " " << lowbit - << "\n"; + << " " << sid << " " << op0LID << " " << (lowbit + width - 1) << " " + << lowbit << "\n"; } // Generates a constant declaration given a value, a width and a name diff --git a/test/Conversion/HWToBTOR2/comb.mlir b/test/Conversion/HWToBTOR2/comb.mlir index 0532590d908f..67a3851a7ba0 100644 --- a/test/Conversion/HWToBTOR2/comb.mlir +++ b/test/Conversion/HWToBTOR2/comb.mlir @@ -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 } }