File tree Expand file tree Collapse file tree 2 files changed +17
-7
lines changed
test/Conversion/HWToBTOR2 Expand file tree Collapse file tree 2 files changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -301,9 +301,15 @@ struct ConvertHWToBTOR2Pass
301301 auto operands = op->getOperands ();
302302 size_t sid = sortToLIDMap.at (width);
303303
304- if (operands.size () < 2 ) {
305- op->emitError (" variadic operations with less than 2 operands are not "
306- " currently supported" );
304+ // No need to consider 0-operand case as it'll be rejected by the verifier
305+ // If there's only one operand, then we don't generate a BTOR2 instruction,
306+ // we just reuse the operand's existing LID
307+ if (operands.size () == 1 ) {
308+ auto existingLID = getOpLID (operands[0 ]);
309+ // Check that we haven't somehow got a value that doesn't have a
310+ // corresponding LID
311+ assert (existingLID != noLID);
312+ opLIDMap[op] = existingLID;
307313 return ;
308314 }
309315
Original file line number Diff line number Diff line change @@ -55,10 +55,14 @@ module {
5555 // CHECK: [[NID18:[0-9]+]] and [[NID0]] [[NID17]] [[NID10]]
5656 %10 = comb.and %a , %3 , %3 : i32
5757
58-
59- // CHECK: [[NID19:[0-9]+]] implies [[NID3]] [[NID5]] [[NID12]]
60- // CHECK: [[NID20:[0-9]+]] not [[NID3]] [[NID19]]
61- // CHECK: [[NID21:[0-9]+]] bad [[NID20:[0-9]+]]
58+ // Variadic ops with one operand should be forwarded to the operand's LID
59+ // CHECK: [[NID19:[0-9]+]] and [[NID0]] 2 [[NID18]]
60+ %11 = comb.and %10 : i32
61+ %12 = comb.and %a , %11 : i32
62+
63+ // CHECK: [[ASSERTNID1:[0-9]+]] implies [[NID3]] [[NID5]] [[NID12]]
64+ // CHECK: [[ASSERTNID2:[0-9]+]] not [[NID3]] [[ASSERTNID1]]
65+ // CHECK: [[ASSERTNID3:[0-9]+]] bad [[ASSERTNID2:[0-9]+]]
6266 sv.always posedge %0 {
6367 sv.if %true {
6468 sv.assert %5 , immediate message " a + 1 should be greater than a"
You can’t perform that action at this time.
0 commit comments