Skip to content

Commit b03685f

Browse files
committed
fixup! [nfc] Add documentation of optional groups
1 parent 3b39b00 commit b03685f

File tree

2 files changed

+31
-18
lines changed

2 files changed

+31
-18
lines changed

docs/src/explanations/explanations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ read these documents in the following order:
4646
* [Warnings](warnings)
4747
* [Deep Dive into Legacy Connection Operators](connection-operators)
4848
* [Properties](properties)
49-
49+
* [Optional Groups](optional-groups)

docs/src/explanations/optional-groups.md

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -141,20 +141,8 @@ class Foo extends Module {
141141

142142
```
143143

144-
After compilation, this will produce four Verilog files (one for `Foo` and one
145-
for each optional group definition in module `Foo`):
146-
147-
1. `Foo`
148-
1. `Foo_Verification`
149-
1. `Foo_Verification_Assert`
150-
1. `Foo_Verification_Debug`
151-
152-
The ports of each module created from an optional group will be automatically
153-
determined based on what that group captured from outside the group. In the
154-
example above, the `Verification` group definition captured port `a`. Both the
155-
`Assert` and `Debug` group definitions captured `a` and `a_d0`.
156-
157-
Additionally, three bind files (one for each optional group declaration):
144+
After compilation, this will produce three group include files with the
145+
following filenames. One file is created for each optional group:
158146

159147
1. `groups_Foo_Verification.sv`
160148
1. `groups_Foo_Verification_Assert.sv`
@@ -165,9 +153,34 @@ include the optional functionality describe by the `Verification`, `Assert`, or
165153
`Debug` groups. The `Assert` and `Debug` bind files automatically include the
166154
`Verification` bind file for the user.
167155

168-
_Note: the names of the modules generated for each group are FIRRTL compiler
169-
implementation defined! You should not rely on the names of these modules.
170-
Instead use one of the bind files which do have a stable name._
156+
#### Implementation Notes
157+
158+
_Note: the names of the modules and the names of any files that contain these
159+
modules are FIRRTL compiler implementation defined! The only guarantee is the
160+
existence of the three group include files. The information in this subsection
161+
is for informational purposes to aid understanding._
162+
163+
In implementation, a FIRRTL compiler creates four Verilog modules for the
164+
circuit above (one for `Foo` and one for each optional group definition in
165+
module `Foo`):
166+
167+
1. `Foo`
168+
1. `Foo_Verification`
169+
1. `Foo_Verification_Assert`
170+
1. `Foo_Verification_Debug`
171+
172+
These will typically be created in separate files with names that match the
173+
modules, i.e., `Foo.sv`, `Foo_Verification.sv`, `Foo_Verification_Assert.sv`,
174+
and `Foo_Verification_Debug.sv`.
175+
176+
The ports of each module created from an optional group definition will be
177+
automatically determined based on what that group captured from outside the
178+
group. In the example above, the `Verification` group definition captured port
179+
`a`. Both the `Assert` and `Debug` group definitions captured `a` and `a_d0`.
180+
Groups may be optimized to remove/add ports or to move logic into an optional
181+
group.
182+
183+
#### Verilog Output
171184

172185
The complete Verilog output for this example is reproduced below:
173186

0 commit comments

Comments
 (0)