Skip to content

Commit 9749c43

Browse files
authored
[major] Add special substitutions (#288)
Add special substitutions. These look like `{{Name}}`. Add two special substitutions that we want to enable going forward: - `{{SimulationTime}}` - `{{HierarchicalModuleName}}` This includes an escape sequence that can be used to get a literal `{{` in the output. Over time, these are expected to be changed to include more special substitutions on an as-need basis. This is a major change as it is backwards-incompatible with old FIRRTL versions. This will break compilation of any code which used `{{` previously. Signed-off-by: Schuyler Eldridge <[email protected]>
1 parent 172fc6d commit 9749c43

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

revision-history.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ revisionHistory:
55
# additions to the specification should append entries here.
66
thisVersion:
77
spec:
8+
- Add special substitutions (`{{}}`) for format strings.
89
abi:
910
# Information about the old versions. This should be static.
1011
oldVersions:

spec.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2349,6 +2349,15 @@ Format strings support the following escape characters:
23492349

23502350
- `\'` : Single quote
23512351

2352+
The following special substitutions are also allowed.
2353+
These substitutions do not have corresponding operands:
2354+
2355+
- `{{SimulationTime}}` : Prints the current simulation time
2356+
2357+
- `{{HierarchicalModuleName}}` : Prints the complete hierarchical path from the root module to the module that contains this `printf`.
2358+
2359+
- `\{{` : Prints a literal `{{`. This can be used to escape a special substitution if you desire to have a literal `{{` appear in the output.
2360+
23522361
## Verification
23532362

23542363
To facilitate simulation, model checking and formal methods, there are three non-synthesizable verification statements available: assert, assume and cover.

0 commit comments

Comments
 (0)