-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIRRTL] Preserve/Tap all "Named" Nodes or Wires (#2676)
Change end-to-end FIRRTL compilation behavior to preserve (via tapping) all nodes and wires which are "named". A "named" node or wire is one whose name does not begin with an underscore. Tapping is done by creating a "shadow node" that is assigned the value of the actual wire and marked "don't touch". This is done to enable better debug-ability of Chisel designs by enabling users to always have references to named things they define in Chisel. More specifically, anytime a Chisel user defines a `val foo = <expression>`, CIRCT will now produce a wire called "foo" in the output Verilog. Add a parser option for controlling whether or not "named" wires and nodes will be preserved from FIRRTL to Verilog. Add a firtool command-line option for disabling name preservation during FIRRTL parsing. Signed-off-by: Schuyler Eldridge <[email protected]>
- Loading branch information
Showing
8 changed files
with
89 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
; RUN: firtool %s | FileCheck %s --check-prefixes=CHECK,NAMES | ||
; RUN: firtool %s -disable-name-preservation | FileCheck %s --check-prefixes=CHECK,NO_NAMES | ||
|
||
circuit Foo: | ||
; CHECK-LABEL: module Foo | ||
module Foo: | ||
input a: {a: UInt<1>, flip b: UInt<1>} | ||
output b: {a: UInt<1>, flip b: UInt<1>} | ||
|
||
; Unnamed wires are always removed. | ||
; CHECK-NOT: wire _x_a; | ||
; CHECK-NOT: wire _x_b; | ||
|
||
wire _x: {a: UInt<1>, flip b: UInt<1>} | ||
_x <= a | ||
|
||
; Default behavior is to preserve named wires. | ||
; NAMES: wire x_a; | ||
; NAMES: wire x_b; | ||
; With -disable-name-preservation, named wires are removed. | ||
; NO_NAMES-NOT: wire x_b; | ||
; NO_NAMES-NOT: wire x_a; | ||
wire x: {a: UInt<1>, flip b: UInt<1>} | ||
x <= _x | ||
|
||
; Unnamed nodes are always removed. | ||
; CHECK-NOT: wire _y_a; | ||
node _y_a = x.a | ||
|
||
; Default behavior is to preserve named nodes. | ||
; NAMES: wire y; | ||
; With -disable-name-preservation, named nodes are removed. | ||
; NO-NAMES-NOT: wire y; | ||
node y = _y_a | ||
|
||
b.a <= y | ||
x.b <= b.b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters