circt/docs
Hideto Ueno b937bcfab0
[Seq] Add initial value to compreg (#7553)
This PR extends compreg's powerOnValue operand to be able to capture more complicated initialization such as firreg's randomized initialization or DPI calls. This change should make register initialization more modular and a step forward towards https://github.com/llvm/circt/issues/7213. 

While ASICs might not have explicit initial values, they are crucial for simulation
and FPGA implementation. FPGA designs often require constant initial values, while
simulation allows for more complex initialization using expressions like function calls
`$random`, `$readmem`, and `$fopen`.

seq.compreg has a (optional) powerOn operand that is lowered into inlined assignment in SV which allows users to initialize registers with user-specified values. However this representation is not sufficient for initialization with function calls. 

In order to represent various kinds of initialization, `seq.initial` op and `!seq.immutable` type
are introduced. The `seq.initial` operation produces values with types wrapped in `!seq.immutable`.
The `!seq.immutable` type wrapper prevents initial values from depending on time-variant values.
Stateful operations typically require corresponding initial values with the `!seq.immutable` type.
This ensures that the initial state of the operation is well-defined and independent of time-variant factors.

Example Input:
```mlir
%r_init, %u_init = seq.initial {
  %rand = sv.macro.ref.se @RANDOM() : () -> i32
  %c0_i32 = hw.constant 0 : i32
  seq.yield %rand, %c0_i32 : i32, i32
} : !seq.immutable<i32>, !seq.immutable<i32>
%r = seq.compreg %i, %clk initial %r_init : i32
%u = seq.compreg %i, %clk initial %u_init : i32
```

Output Verilog:
```verilog
reg [31:0] r;
initial
  r = `RANDOM;
reg [31:0] u = 32'h0;
```
2024-08-30 14:08:34 +09:00
..
CommandGuide add heading for handshake-runner 2021-01-12 21:59:28 +05:30
Dialects [Seq] Add initial value to compreg (#7553) 2024-08-30 14:08:34 +09:00
PyCDE [ESI] Remove last references to capnp (#7315) 2024-07-12 06:36:10 -07:00
includes [LLHD] Remove llhd-sim (#7351) 2024-07-19 17:54:14 +01:00
CMakeLists.txt [DOC] Add Doxygen documentation support (#362) 2020-12-27 09:44:58 +05:30
Charter.md [Docs] Fix hw, comb and sv dialect links (#3638) 2022-08-02 11:06:57 +02:00
FormalVerification.md [Docs] Apply some review comments from PR 2024-03-21 21:19:28 +01:00
GettingStarted.md [ESI] Remove last references to capnp (#7315) 2024-07-12 06:36:10 -07:00
HLS.md Update HLS.md 2023-11-03 10:08:43 +01:00
Passes.md [ESI][HW][DC][OM][Comb][Ibis] Documentation refactoring and fixes (#5767) 2023-08-02 21:29:51 -07:00
PythonBindings.md [Docs] Update Python bindings pip instructions (#7147) 2024-06-09 10:29:28 -06:00
RationaleSymbols.md [docs] Add text describing the inner symbol classes/traits/verif. (#3743) 2022-08-19 10:38:55 -05:00
Scheduling.md [Scheduling] Define problem to model operator chaining in cyclic problem. (#6485) 2023-12-12 09:43:26 +01:00
ToolsWorkarounds.md [NFC] document Automatic variable bugs in tools. 2023-03-20 10:14:22 -05:00
VerilogGeneration.md [ExportVerilog] Add a lowering option to fix up empty modules (#7454) 2024-08-08 15:39:05 +09:00
dialects.dot [LLHD] Remove llhd-sim (#7351) 2024-07-19 17:54:14 +01:00
dialects.drawio [StaticLogic] Rename dialect to 'Pipeline' (#3648) 2022-08-04 10:58:40 +02:00
doxygen-mainpage.dox [DOC] Add Doxygen documentation support (#362) 2020-12-27 09:44:58 +05:30
doxygen.cfg.in [DOC] Add Doxygen documentation support (#362) 2020-12-27 09:44:58 +05:30