Skip to content

Commit 191e3e4

Browse files
author
Oron Port
committed
docs: wip
1 parent f7f52e4 commit 191e3e4

File tree

1 file changed

+51
-3
lines changed

1 file changed

+51
-3
lines changed

docs/user-guide/connectivity/index.md

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,10 @@ Just like any Scala class parameter blocks, the DFHDL design accepts a sequence
182182
```
183183

184184
* __`_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.
187187
* __`_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.
189189
* __`_access_`__ is the optional Scala parameter access modifier. By default, a Scala class parameter access is `#!scala private val`.
190190
<!--TODO access information -->
191191
<!-- If the parameter affects the type of a public value (e.g., width of a DFHDL port) then the -->
@@ -305,6 +305,54 @@ children = [
305305
///
306306
///
307307

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+
import dfhdl.*
318+
class CustomArg
319+
@top class Foo(
320+
val pureIntArg: Int = 5,
321+
val dfhdlIntArg: Int <> CONST = 7,
322+
val ignored: CustomArg = CustomArg(),
323+
val dfhdlIgnored: Bits[8] <> CONST = all(0)
324+
) extends DFDesign
325+
```
326+
``` title="CLI output, when running via sbt (truncated)"
327+
Design Name: Foo
328+
Usage: sbt runMain "top_Foo [design-args] <mode> [options]"
329+
Design arguments:
330+
--pureIntArg <Int> (default = 5)
331+
--dfhdlIntArg <Int> (default = 7)
332+
```
333+
334+
/// details | Runnable example
335+
type: dfhdl
336+
```scastie
337+
import dfhdl.*
338+
//this option forces the top-app to run help mode
339+
//by default
340+
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+
308356
### Design Class Inheritance
309357
It is possible to leverage the power of Scala inheritance to share design functionality between design class declarations.
310358

0 commit comments

Comments
 (0)