Skip to content

Commit

Permalink
[major] Add fd operand to printf statement
Browse files Browse the repository at this point in the history
  • Loading branch information
SpriteOvO committed May 30, 2024
1 parent e53da0c commit cb28546
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions revision-history.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ revisionHistory:
- Restore id and info in printf grammar, add to verif commands.
- Add intrinsic expressions and statements.
- Remove intrinsic modules.
- Add "fd" operand to "printf" statement.
abi:
- Add ABI for public modules and filelist output.
- Changed ABI for group and ref generated files.
Expand Down
6 changes: 4 additions & 2 deletions spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -2218,7 +2218,7 @@ circuit Foo:
The formatted print statement is used to print a formatted string during simulations of the circuit.
Backends are free to generate hardware that relays this information to a hardware test harness, but this is not required by the FIRRTL specification.

A `printf`{.firrtl} statement requires a clock signal, a print condition signal, a format string, and a variable list of argument signals.
A `printf`{.firrtl} statement requires a clock signal, a print condition signal, a file descriptor, a format string, and a variable list of argument signals.
The condition signal must be a single bit unsigned integer type, and the argument signals must each have a ground type.

For information about execution ordering of clocked statements with observable environmental side effects, see [@sec:stops].
Expand All @@ -2236,8 +2236,9 @@ circuit Foo:
wire cond: UInt<1>
wire a: UInt
wire b: UInt
node fd = SInt<32>(-0h7FFFFFFE)
printf(
clk, cond, "a in hex: %x, b in decimal:%d.\n", a, b
clk, cond, fd, "a in hex: %x, b in decimal:%d.\n", a, b
) : optional_name
;; snippetend
```
Expand Down Expand Up @@ -4268,6 +4269,7 @@ command =
| "release_initial" , "(" , expr_probe , ")"
| expr_intrinsic , [ info ]
| "printf" , "(" ,
expr , "," ,
expr , "," ,
expr , "," ,
string_dq ,
Expand Down

0 comments on commit cb28546

Please sign in to comment.