Skip to content

Commit

Permalink
[NFC][HW] Fix parsing of nullary hw.triggered ops (#7291)
Browse files Browse the repository at this point in the history
Make the variadic inputs argument of the hw.triggered operation optional in the declarative assembly format. Without this change the generated parser fails on nullary instances due to the empty/missing type list.
  • Loading branch information
fzi-hielscher authored Jul 9, 2024
1 parent 0899943 commit dd93f06
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion include/circt/Dialect/HW/HWStructure.td
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ def TriggeredOp : HWOp<"triggered", [
let results = (outs);

let assemblyFormat = [{
$event $trigger `(` $inputs `)` `:` type($inputs) $body attr-dict
$event $trigger (`(` $inputs^ `)` `:` type($inputs))? $body attr-dict
}];

let extraClassDeclaration = [{
Expand Down
10 changes: 10 additions & 0 deletions test/Conversion/HWToSV/test_trigger.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,13 @@ hw.module @foo(in %trigger : i1, in %in : i32) {
"some.user" (%arg0) : (i32) -> ()
}
}

hw.module @bar(in %trigger : i1) {
// CHECK: sv.always posedge %trigger {
// CHECK-NEXT: "some.user"() : () -> ()
// CHECK-NEXT: }
hw.triggered posedge %trigger {
"some.user"() : () -> ()
}

}

0 comments on commit dd93f06

Please sign in to comment.