You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/user-guide/connectivity/index.md
+51-3Lines changed: 51 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -182,10 +182,10 @@ Just like any Scala class parameter blocks, the DFHDL design accepts a sequence
182
182
```
183
183
184
184
*__`_type_`__ is either a pure Scala parameter type or a DFHDL parameter type in the form of `DFType <> CONST`.
185
-
- Pure Scala parameters are completely transparent to the DFHDL compiler and are inlined during elaboration. Any type of pure Scala parameter is acceptable, except for top-app design parameters which are currently limited to `#!scala String`, `#!scala Boolean`, `#!scala Int`, and `#!scala Double` types.
186
-
- DFHDL parameters are preserved throughout the compilation process and manifest as parameters in the generated backend code. Top-app design DFHDL parameters are currently limited to `Int <> CONST`, `Bit <> CONST`, and `Boolean <> CONST` types.
185
+
- Pure Scala parameters are completely transparent to the DFHDL compiler and are inlined during elaboration.
186
+
- DFHDL parameters are preserved throughout the compilation process and manifest as parameters in the generated backend code.
187
187
*__`_name_`__ is the Scala parameter name reference. The DFHDL compiler preserves this parameter name for DFHDL parameter types only. For the top-app command-line interface (CLI), these names are also preserved, so that the parameters can be listed and modified through the CLI.
188
-
*__`_default_`__ is the optional default value of the parameter. According to the Scala language rules, once a parameter has a default value defined, all parameters that follow it must also have default values defined. For top-app designs, all parameters must have default values.
188
+
*__`_default_`__ is the optional default value of the parameter.
189
189
*__`_access_`__ is the optional Scala parameter access modifier. By default, a Scala class parameter access is `#!scala private val`.
190
190
<!--TODO access information -->
191
191
<!-- If the parameter affects the type of a public value (e.g., width of a DFHDL port) then the -->
@@ -305,6 +305,54 @@ children = [
305
305
///
306
306
///
307
307
308
+
#### Design Parameter Type Rules
309
+
- Any pure Scala parameter or DFHDL parameter types are acceptable.
310
+
- Top-app design parameters, to be modifiable from the CLI, must be one of the following types:
311
+
- Pure Scala Types: `#!scala String`, `#!scala Boolean`, `#!scala Int`, and `#!scala Double`.
312
+
- DFHDL Types: `#!scala Int <> CONST`, `#!scala Bit <> CONST`, and `#!scala Boolean <> CONST`.
313
+
314
+
/// admonition | Top-app design with accepted and ignored arguments
315
+
type: example
316
+
```scala title="DFHDL code"
317
+
importdfhdl.*
318
+
classCustomArg
319
+
@top classFoo(
320
+
valpureIntArg:Int=5,
321
+
valdfhdlIntArg:Int<>CONST=7,
322
+
valignored:CustomArg=CustomArg(),
323
+
valdfhdlIgnored:Bits[8] <>CONST= all(0)
324
+
) extendsDFDesign
325
+
```
326
+
```title="CLI output, when running via sbt (truncated)"
given options.AppOptions.DefaultMode = options.AppOptions.DefaultMode.help
341
+
class CustomArg
342
+
@top class Foo(
343
+
val pureIntArg: Int = 5,
344
+
val dfhdlIntArg: Int <> CONST = 7,
345
+
val ignored: CustomArg = CustomArg(),
346
+
val dfhdlIgnored: Bits[8] <> CONST = all(0)
347
+
) extends DFDesign
348
+
```
349
+
///
350
+
///
351
+
352
+
#### Design Parameter Default Value Rules
353
+
- According to the Scala language rules, once a parameter has a default value defined, all parameters that follow it must also have default values defined.
354
+
- For top-app designs, all parameters must have default values.
355
+
308
356
### Design Class Inheritance
309
357
It is possible to leverage the power of Scala inheritance to share design functionality between design class declarations.
0 commit comments