Skip to content

Commit e77de10

Browse files
committed
[FIRRTL] Remove body from domain kind
Remove bodies from domains. Now that fields are specified as attributes, there is no need for domains to have an unused body. This may eventually get revived if we need to model constraints. However, we can cross that bridge when we come to it. Signed-off-by: Schuyler Eldridge <[email protected]>
1 parent 984a444 commit e77de10

File tree

7 files changed

+21
-27
lines changed

7 files changed

+21
-27
lines changed

include/circt/Dialect/FIRRTL/FIRRTLStructure.td

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -604,9 +604,7 @@ def SimulationOp : FIRRTLOp<"simulation", [
604604

605605
def DomainOp : FIRRTLOp<"domain", [
606606
DeclareOpInterfaceMethods<Symbol>,
607-
HasParent<"firrtl::CircuitOp">,
608-
NoTerminator,
609-
SingleBlock
607+
HasParent<"firrtl::CircuitOp">
610608
]> {
611609
let summary = "Define a domain type";
612610
let description = [{
@@ -619,9 +617,8 @@ def DomainOp : FIRRTLOp<"domain", [
619617
DefaultValuedAttr<DomainFieldArrayAttr, "{}">:$fields
620618
);
621619
let results = (outs);
622-
let regions = (region SizedRegion<1>:$body);
623620
let assemblyFormat = [{
624-
$sym_name ( $fields^ )? attr-dict-with-keyword $body
621+
$sym_name ( $fields^ )? attr-dict-with-keyword
625622
}];
626623
}
627624

lib/Dialect/FIRRTL/Import/FIRParser.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5769,9 +5769,7 @@ ParseResult FIRCircuitParser::parseDomain(CircuitOp circuit, unsigned indent) {
57695769
}
57705770

57715771
auto builder = circuit.getBodyBuilder();
5772-
DomainOp::create(builder, info.getLoc(), name, builder.getArrayAttr(fields))
5773-
->getRegion(0)
5774-
.push_back(new Block());
5772+
DomainOp::create(builder, info.getLoc(), name, builder.getArrayAttr(fields));
57755773

57765774
return success();
57775775
}

test/Dialect/FIRRTL/emit-basic.mlir

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -956,7 +956,7 @@ firrtl.circuit "Foo" {
956956
}
957957

958958
// CHECK-LABEL: domain ClockDomain :
959-
firrtl.domain @ClockDomain {}
959+
firrtl.domain @ClockDomain
960960

961961
// CHECK-LABEL: domain PowerDomain :
962962
// CHECK-NEXT: name : String
@@ -966,7 +966,7 @@ firrtl.circuit "Foo" {
966966
#firrtl.domain.field<"name", !firrtl.string>,
967967
#firrtl.domain.field<"voltage", !firrtl.integer>,
968968
#firrtl.domain.field<"alwaysOn", !firrtl.bool>
969-
] {}
969+
]
970970

971971
// CHECK-LABEL: module Domains :
972972
firrtl.module @Domains(

test/Dialect/FIRRTL/errors.mlir

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3047,7 +3047,7 @@ firrtl.circuit "WrongDomainKind" {
30473047
// -----
30483048

30493049
firrtl.circuit "DomainInfoNotArray" {
3050-
firrtl.domain @ClockDomain {}
3050+
firrtl.domain @ClockDomain
30513051
// expected-error @below {{requires valid port domains}}
30523052
firrtl.module @WrongDomainPortInfo(
30533053
in %A: !firrtl.domain of @ClockDomain
@@ -3057,7 +3057,7 @@ firrtl.circuit "DomainInfoNotArray" {
30573057
// -----
30583058

30593059
firrtl.circuit "WrongDomainPortInfo" {
3060-
firrtl.domain @ClockDomain {}
3060+
firrtl.domain @ClockDomain
30613061
// expected-error @below {{domain information for domain port 'A' must be a 'FlatSymbolRefAttr'}}
30623062
firrtl.module @WrongDomainPortInfo(
30633063
in %A: !firrtl.domain of @ClockDomain
@@ -3067,7 +3067,7 @@ firrtl.circuit "WrongDomainPortInfo" {
30673067
// -----
30683068

30693069
firrtl.circuit "WrongNonDomainPortInfo" {
3070-
firrtl.domain @ClockDomain {}
3070+
firrtl.domain @ClockDomain
30713071
// expected-error @below {{domain information for non-domain port 'a' must be an 'ArrayAttr<IntegerAttr>'}}
30723072
firrtl.module @WrongNonDomainPortInfo(
30733073
in %a: !firrtl.uint<1>

test/Dialect/FIRRTL/lower-domains.mlir

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ firrtl.circuit "Foo" {
1616
// CHECK-SAME: out %associations_out: !firrtl.list<path>
1717
// CHECK-NEXT: firrtl.propassign %domainInfo_out, %domainInfo_in
1818
// CHECK-NEXT: firrtl.propassign %associations_out, %associations_in
19-
firrtl.domain @ClockDomain {}
19+
firrtl.domain @ClockDomain
2020
// CHECK-LABEL: firrtl.module @Foo(
2121
// CHECK-SAME: in %A: !firrtl.class<@ClockDomain()>
2222
// CHECK-SAME: out %A_out: !firrtl.class<@ClockDomain_out(
@@ -45,14 +45,14 @@ firrtl.circuit "Foo" {
4545
// CHECK-SAME: out %domainInfo_out: !firrtl.class<@ClockDomain()>
4646
// CHECK-SAME: in %associations_in: !firrtl.list<path>
4747
// CHECK-SAME: out %associations_out: !firrtl.list<path>
48-
firrtl.domain @ClockDomain {}
48+
firrtl.domain @ClockDomain
4949
// CHECK-LABEL: firrtl.class @ResetDomain(
5050
// CHECK-LABEL: firrtl.class @ResetDomain_out(
5151
// CHECK-SAME: in %domainInfo_in: !firrtl.class<@ResetDomain()>
5252
// CHECK-SAME: out %domainInfo_out: !firrtl.class<@ResetDomain()>
5353
// CHECK-SAME: in %associations_in: !firrtl.list<path>
5454
// CHECK-SAME: out %associations_out: !firrtl.list<path>
55-
firrtl.domain @ResetDomain {}
55+
firrtl.domain @ResetDomain
5656
// CHECK-LABEL: firrtl.module @Foo(
5757
// CHECK-SAME: in %A: !firrtl.class<@ClockDomain()>
5858
// CHECK-SAME: out %A_out: !firrtl.class<@ClockDomain_out(
@@ -85,7 +85,7 @@ firrtl.circuit "Foo" {
8585
// intentionally NOT testing everything here due to the complexity of
8686
// maintaining this test.
8787
firrtl.circuit "Foo" {
88-
firrtl.domain @ClockDomain {}
88+
firrtl.domain @ClockDomain
8989
// CHECK-LABEL: firrtl.module @Foo
9090
// CHECK-SAME: in %A:
9191
// CHECK-SAME: out %A_out:
@@ -147,7 +147,7 @@ firrtl.circuit "Foo" {
147147
// TODO: This is currently insufficient as we don't yet have domain connection
148148
// operations.
149149
firrtl.circuit "Foo" {
150-
firrtl.domain @ClockDomain {}
150+
firrtl.domain @ClockDomain
151151
// CHECK-LABEL: firrtl.module @Foo
152152
// CHECK-NOT: in %A: !firrtl.class<@ClockDomain()>
153153
// CHECK-SAME: out %A_out: !firrtl.class<@ClockDomain_out(
@@ -169,7 +169,7 @@ firrtl.circuit "Foo" {
169169

170170
// Check the behavior of the lowering of an instance.
171171
firrtl.circuit "Foo" {
172-
firrtl.domain @ClockDomain {}
172+
firrtl.domain @ClockDomain
173173
// CHECK-LABEL: firrtl.module @Bar(
174174
// CHECK-SAME: in %A: !firrtl.class<@ClockDomain()>
175175
// CHECK-SAME: out %A_out: !firrtl.class<@ClockDomain_out(
@@ -202,7 +202,7 @@ firrtl.circuit "Foo" {
202202

203203
// Check the behavior of external modules.
204204
firrtl.circuit "Foo" {
205-
firrtl.domain @ClockDomain {}
205+
firrtl.domain @ClockDomain
206206
// CHECK-LABEL: firrtl.extmodule @Bar(
207207
// CHECK-SAME: in A: !firrtl.class<@ClockDomain()>
208208
// CHECK-SAME: out A_out: !firrtl.class<@ClockDomain_out(

test/Dialect/FIRRTL/parse-basic.fir

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2195,14 +2195,14 @@ circuit NullaryCat:
21952195
;// -----
21962196
FIRRTL version 5.1.0
21972197
circuit Domains:
2198-
; CHECK-LABEL: firrtl.domain @ClockDomain {
2198+
; CHECK-LABEL: firrtl.domain @ClockDomain
21992199
domain ClockDomain:
22002200

22012201
; CHECK-LABEL: firrtl.domain @PowerDomain [
22022202
; CHECK-SAME: #firrtl.domain.field<"name", !firrtl.string>
22032203
; CHECK-SAME: #firrtl.domain.field<"voltage", !firrtl.integer>
22042204
; CHECK-SAME: #firrtl.domain.field<"alwaysOn", !firrtl.bool>
2205-
; CHECK-SAME: ] {
2205+
; CHECK-SAME: ]
22062206
domain PowerDomain:
22072207
name : String
22082208
voltage : Integer

test/Dialect/FIRRTL/round-trip.mlir

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,20 +196,19 @@ firrtl.module @Fprintf(
196196
firrtl.fprintf %clock, %a, "test%d.txt"(%a), "%x, %b"(%a, %reset) {name = "foo"} : !firrtl.clock, !firrtl.uint<1>, !firrtl.uint<1>, !firrtl.uint<1>, !firrtl.reset
197197
}
198198

199-
// CHECK-LABEL: firrtl.domain @ClockDomain {
200-
firrtl.domain @ClockDomain {
201-
}
199+
// CHECK-LABEL: firrtl.domain @ClockDomain
200+
firrtl.domain @ClockDomain
202201

203202
// CHECK-LABEL: firrtl.domain @PowerDomain [
204203
// CHECK-SAME: #firrtl.domain.field<"name", !firrtl.string>
205204
// CHECK-SAME: #firrtl.domain.field<"voltage", !firrtl.integer>
206205
// CHECK-SAME: #firrtl.domain.field<"alwaysOn", !firrtl.bool>
207-
// CHECK-SAME: ] {
206+
// CHECK-SAME: ]
208207
firrtl.domain @PowerDomain [
209208
#firrtl.domain.field<"name", !firrtl.string>,
210209
#firrtl.domain.field<"voltage", !firrtl.integer>,
211210
#firrtl.domain.field<"alwaysOn", !firrtl.bool>
212-
] {}
211+
]
213212

214213
firrtl.module @DomainsSubmodule(
215214
in %A: !firrtl.domain of @ClockDomain,

0 commit comments

Comments
 (0)