Skip to content

Commit c9e048c

Browse files
committed
[FIRRTL] Parse GC View Annos w/o Circuit
Change the parsing of Grand Central View annotations to _not_ require a circuit to be included in the "ref" part of the annotation. Upstream Chisel has dropped support for the circuit part of targets [[1]] and the internal Grand Central code base must follow suit. This change is necessary to make this work with the internal code base. Note: this permissively ignore a circuit if present, so this is backwards compatible. While unnecessary, clean up all tests and documentation to _not_ include the circuit in the "ref". [1]: chipsalliance/chisel@4cc4ab8 Signed-off-by: Schuyler Eldridge <[email protected]>
1 parent 51a69bc commit c9e048c

File tree

8 files changed

+3
-35
lines changed

8 files changed

+3
-35
lines changed

docs/Dialects/FIRRTL/FIRRTLAnnotations.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1122,7 +1122,6 @@ Example:
11221122
"tpe": {
11231123
"class": "sifive.enterprise.grandcentral.AugmentedGroundType",
11241124
"ref": {
1125-
"circuit": "GCTInterface",
11261125
"module": "GCTInterface",
11271126
"path": [],
11281127
"ref": "a",

lib/Dialect/FIRRTL/Transforms/GrandCentral.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -807,22 +807,19 @@ parseAugmentedType(ApplyState &state, DictionaryAttr augmentedType,
807807
/// To:
808808
/// {"~Foo|Foo>a", {".b", "[0]"}}
809809
/// The format of a ReferenceTarget object like:
810-
/// circuit: String
811810
/// module: String
812811
/// path: Seq[(Instance, OfModule)]
813812
/// ref: String
814813
/// component: Seq[TargetToken]
815814
auto refToTarget =
816815
[&](DictionaryAttr refTarget) -> std::optional<std::string> {
817-
auto circuitAttr =
818-
tryGetAs<StringAttr>(refTarget, refTarget, "circuit", loc, clazz, path);
819816
auto moduleAttr =
820817
tryGetAs<StringAttr>(refTarget, refTarget, "module", loc, clazz, path);
821818
auto pathAttr =
822819
tryGetAs<ArrayAttr>(refTarget, refTarget, "path", loc, clazz, path);
823820
auto componentAttr = tryGetAs<ArrayAttr>(refTarget, refTarget, "component",
824821
loc, clazz, path);
825-
if (!circuitAttr || !moduleAttr || !pathAttr || !componentAttr)
822+
if (!moduleAttr || !pathAttr || !componentAttr)
826823
return {};
827824

828825
// Parse non-local annotations.
@@ -906,8 +903,8 @@ parseAugmentedType(ApplyState &state, DictionaryAttr augmentedType,
906903
if (!refAttr)
907904
return {};
908905

909-
return (Twine("~" + circuitAttr.getValue() + "|" + moduleAttr.getValue() +
910-
strpath + ">" + refAttr.getValue()) +
906+
return (Twine("~|" + moduleAttr.getValue() + strpath + ">" +
907+
refAttr.getValue()) +
911908
componentStr)
912909
.str();
913910
};

test/Dialect/FIRRTL/SFCTests/GrandCentralInterfaces/Companion.fir

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ circuit Foo : %[[
1919
"tpe": {
2020
"class": "sifive.enterprise.grandcentral.AugmentedGroundType",
2121
"ref": {
22-
"circuit": "Foo",
2322
"module": "Foo",
2423
"path": [],
2524
"ref": "a",

test/Dialect/FIRRTL/SFCTests/GrandCentralInterfaces/HWRename.anno.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"tpe": {
1414
"class": "sifive.enterprise.grandcentral.AugmentedGroundType",
1515
"ref": {
16-
"circuit": "Top",
1716
"module": "DUT",
1817
"path": [],
1918
"ref": "signed",

test/Dialect/FIRRTL/SFCTests/GrandCentralInterfaces/PortDelete.fir

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ circuit PortDelete : %[[
1717
"tpe": {
1818
"class": "sifive.enterprise.grandcentral.AugmentedGroundType",
1919
"ref": {
20-
"circuit": "PortDelete",
2120
"module": "PortDelete",
2221
"path": [
2322
{

test/Dialect/FIRRTL/SFCTests/GrandCentralInterfaces/Wire.fir.anno.json

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
"tpe": {
1515
"class": "sifive.enterprise.grandcentral.AugmentedGroundType",
1616
"ref": {
17-
"circuit": "Top",
1817
"module": "DUT",
1918
"path": [],
2019
"ref": "w",
@@ -39,7 +38,6 @@
3938
{
4039
"class": "sifive.enterprise.grandcentral.AugmentedGroundType",
4140
"ref": {
42-
"circuit": "Top",
4341
"module": "DUT",
4442
"path": [],
4543
"ref": "w",
@@ -61,7 +59,6 @@
6159
{
6260
"class": "sifive.enterprise.grandcentral.AugmentedGroundType",
6361
"ref": {
64-
"circuit": "Top",
6562
"module": "DUT",
6663
"path": [],
6764
"ref": "w",
@@ -95,7 +92,6 @@
9592
{
9693
"class": "sifive.enterprise.grandcentral.AugmentedGroundType",
9794
"ref": {
98-
"circuit": "Top",
9995
"module": "DUT",
10096
"path": [],
10197
"ref": "w",
@@ -121,7 +117,6 @@
121117
{
122118
"class": "sifive.enterprise.grandcentral.AugmentedGroundType",
123119
"ref": {
124-
"circuit": "Top",
125120
"module": "DUT",
126121
"path": [],
127122
"ref": "w",
@@ -147,7 +142,6 @@
147142
{
148143
"class": "sifive.enterprise.grandcentral.AugmentedGroundType",
149144
"ref": {
150-
"circuit": "Top",
151145
"module": "DUT",
152146
"path": [],
153147
"ref": "w",
@@ -178,7 +172,6 @@
178172
{
179173
"class": "sifive.enterprise.grandcentral.AugmentedGroundType",
180174
"ref": {
181-
"circuit": "Top",
182175
"module": "DUT",
183176
"path": [],
184177
"ref": "w",
@@ -204,7 +197,6 @@
204197
{
205198
"class": "sifive.enterprise.grandcentral.AugmentedGroundType",
206199
"ref": {
207-
"circuit": "Top",
208200
"module": "DUT",
209201
"path": [],
210202
"ref": "w",
@@ -230,7 +222,6 @@
230222
{
231223
"class": "sifive.enterprise.grandcentral.AugmentedGroundType",
232224
"ref": {
233-
"circuit": "Top",
234225
"module": "DUT",
235226
"path": [],
236227
"ref": "w",
@@ -273,7 +264,6 @@
273264
"tpe": {
274265
"class": "sifive.enterprise.grandcentral.AugmentedGroundType",
275266
"ref": {
276-
"circuit": "Top",
277267
"module": "DUT",
278268
"path": [],
279269
"ref": "w",
@@ -302,7 +292,6 @@
302292
"tpe": {
303293
"class": "sifive.enterprise.grandcentral.AugmentedGroundType",
304294
"ref": {
305-
"circuit": "Top",
306295
"module": "DUT",
307296
"path": [],
308297
"ref": "w",
@@ -337,7 +326,6 @@
337326
"tpe": {
338327
"class": "sifive.enterprise.grandcentral.AugmentedGroundType",
339328
"ref": {
340-
"circuit": "Top",
341329
"module": "DUT",
342330
"path": [],
343331
"ref": "w",
@@ -366,7 +354,6 @@
366354
"tpe": {
367355
"class": "sifive.enterprise.grandcentral.AugmentedGroundType",
368356
"ref": {
369-
"circuit": "Top",
370357
"module": "DUT",
371358
"path": [],
372359
"ref": "w",
@@ -413,7 +400,6 @@
413400
"tpe": {
414401
"class": "sifive.enterprise.grandcentral.AugmentedGroundType",
415402
"ref": {
416-
"circuit": "Top",
417403
"module": "DUT",
418404
"path": [],
419405
"ref": "w",
@@ -442,7 +428,6 @@
442428
"tpe": {
443429
"class": "sifive.enterprise.grandcentral.AugmentedGroundType",
444430
"ref": {
445-
"circuit": "Top",
446431
"module": "DUT",
447432
"path": [],
448433
"ref": "w",
@@ -478,7 +463,6 @@
478463
"tpe": {
479464
"class": "sifive.enterprise.grandcentral.AugmentedGroundType",
480465
"ref": {
481-
"circuit": "Top",
482466
"module": "Submodule",
483467
"path": [],
484468
"ref": "w",
@@ -503,7 +487,6 @@
503487
{
504488
"class": "sifive.enterprise.grandcentral.AugmentedGroundType",
505489
"ref": {
506-
"circuit": "Top",
507490
"module": "Submodule",
508491
"path": [],
509492
"ref": "w",
@@ -525,7 +508,6 @@
525508
{
526509
"class": "sifive.enterprise.grandcentral.AugmentedGroundType",
527510
"ref": {
528-
"circuit": "Top",
529511
"module": "Submodule",
530512
"path": [],
531513
"ref": "w",
@@ -562,7 +544,6 @@
562544
"tpe": {
563545
"class": "sifive.enterprise.grandcentral.AugmentedGroundType",
564546
"ref": {
565-
"circuit": "Top",
566547
"module": "Submodule",
567548
"path": [],
568549
"ref": "w",
@@ -591,7 +572,6 @@
591572
"tpe": {
592573
"class": "sifive.enterprise.grandcentral.AugmentedGroundType",
593574
"ref": {
594-
"circuit": "Top",
595575
"module": "Submodule",
596576
"path": [],
597577
"ref": "w",
@@ -626,7 +606,6 @@
626606
"tpe": {
627607
"class": "sifive.enterprise.grandcentral.AugmentedGroundType",
628608
"ref": {
629-
"circuit": "Top",
630609
"module": "Submodule",
631610
"path": [],
632611
"ref": "w",
@@ -655,7 +634,6 @@
655634
"tpe": {
656635
"class": "sifive.enterprise.grandcentral.AugmentedGroundType",
657636
"ref": {
658-
"circuit": "Top",
659637
"module": "Submodule",
660638
"path": [],
661639
"ref": "w",
@@ -690,7 +668,6 @@
690668
"tpe": {
691669
"class": "sifive.enterprise.grandcentral.AugmentedGroundType",
692670
"ref": {
693-
"circuit": "Top",
694671
"module": "ExtModuleWithPort",
695672
"path": [],
696673
"ref": "source",

test/firtool/blackbox-directories.fir

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ circuit TestHarness: %[[
5959
"tpe": {
6060
"class": "sifive.enterprise.grandcentral.AugmentedGroundType",
6161
"ref": {
62-
"circuit": "TestHarness",
6362
"module": "DUT",
6463
"path": [],
6564
"ref": "a",

test/firtool/lower-layers-directories.fir

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ circuit Testbench: %[[
2525
"tpe": {
2626
"class": "sifive.enterprise.grandcentral.AugmentedGroundType",
2727
"ref": {
28-
"circuit": "Testbench",
2928
"module": "DUT",
3029
"path": [],
3130
"ref": "a",

0 commit comments

Comments
 (0)