Skip to content

Commit ed07c6d

Browse files
author
Oron Port
committed
docs: add main examples headers and section anchors in design hierarchy documentation
1 parent 268f282 commit ed07c6d

File tree

1 file changed

+8
-7
lines changed
  • docs/user-guide/design-hierarchy

1 file changed

+8
-7
lines changed

docs/user-guide/design-hierarchy/index.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ end _name_ //optional `end` marker
119119

120120
* __`_modifiers_`__ - Optional Scala modifiers. See [Design Class Modifier Rules][design-class-modifier-rules] for details.
121121

122+
### `LeftShift2` example {#LeftShift2}
122123
/// admonition | Basic top-app design example: a two-bits left shifter
123124
type: example
124125
The DFHDL code below implements a two-bit left shifter design named `LeftShift2`. The design:
@@ -236,7 +237,7 @@ The DFHDL design parameter block follows standard Scala syntax, accepting a comm
236237

237238
* __`_access_`__ - Optional [Scala access modifier](https://docs.scala-lang.org/scala3/book/domain-modeling-oop.html#access-modifiers){target="_blank"}. Usually `#!scala val` to make the parameter public. See [Design Parameter Access Rules][design-parameter-access-rules] for details.
238239

239-
[](){#LeftShiftBasic}
240+
#### `LeftShiftBasic` example {#LeftShiftBasic}
240241
/// admonition | Scala-parameterized top-app design example: a basic left shifter
241242
type: example
242243
The DFHDL code below implements a basic left shifter design named `LeftShiftBasic`. This design is similar to the earlier example of `LeftShift2` except here the design has the shift value as an input, and its input and output port widths are set according to the Scala parameter `width`.
@@ -296,7 +297,7 @@ children = [
296297

297298
The basic code shifter above did not generate the `width` parameter in the Verilog and VHDL backend code. The following example shows how to preserve the `width` parameter:
298299

299-
[](){#LeftShiftGen}
300+
#### `LeftShiftGen` example {#LeftShiftGen}
300301
/// admonition | DFHDL-parameterized top-app design example: a generic left shifter
301302
type: example
302303
The DFHDL code below implements a generic left shifter design named `LeftShiftGen`. This design is similar to the earlier example of [`LeftShiftBasic`][LeftShiftBasic], except here the `width` parameter is now a DFHDL parameter, as indicated by its `Int <> CONST` type. This enables the DFHDL compiler to preserve the parameter name and directly use it in the generated backend code where applicable.
@@ -552,7 +553,7 @@ All other Scala class modifiers have no special effect or limitation from a DFHD
552553
### Design Class Inheritance
553554
DFHDL leverages Scala inheritance to enable sharing functionality between design classes.
554555

555-
[](){#ShiftGen}
556+
#### `ShiftGen` example {#ShiftGen}
556557
/// admonition | Generic left and right shifters, design class inheritance example
557558
type: example
558559
The DFHDL code below demonstrates how to implement both left and right generic shifters efficiently by using a common `#!scala abstract class` named `ShiftGen`. The `width` parameter is declared as an abstract class field (without an assigned value) inside the `ShiftGen` class body. By extending `ShiftGen`, both `LeftShiftGen` and `RightShiftGen` can utilize the IOs already declared in `ShiftGen`. They only need to explicitly declare the `width` parameter and implement the shift functionality in their respective class bodies.
@@ -623,7 +624,7 @@ DFHDL supports three mechanisms to form a design hierarchy through design instan
623624

624625
The following sections explore these composition mechanisms using our running example of a bit shifter. First, let's examine a more complex shifter with both left and right shift capabilities, implemented as a flat (composition-less) design:
625626

626-
[](){#LRShiftFlat}
627+
### `LRShiftFlat` example {#LRShiftFlat}
627628
/// admonition | Generic left-right shifter, flat design example
628629
type: example
629630
The DFHDL code below implements a generic left-right shifter flat design named `LRShiftFlat`. This design expands on [`LeftShiftGen`][LeftShiftGen] by adding a `dir` enum port value that specifies the shift direction and a shift operation multiplexer through a `#!scala match` statement.
@@ -748,7 +749,7 @@ Where:
748749

749750
The `<>` connection operator has no explicit directionality - it automatically infers producer/consumer relationships based on the connected value types and scope. See the [connectivity][connectivity] section for details.
750751

751-
[](){#LRShiftDirect}
752+
#### `LRShiftDirect` example {#LRShiftDirect}
752753
/// admonition | Generic left-right shifter using direct connection composition
753754
type: example
754755
The code below implements a generic left-right shifter named `LRShiftDirect`. This design provides the same functionality as [`LRShiftFlat`][LRShiftFlat], but uses composition to split left and right shift operations into separate designs. The implementation leverages the design class inheritance shown in the [`ShiftGen`][ShiftGen] example.
@@ -927,7 +928,7 @@ When connecting ports with the same name in parent and child designs, Scala's na
927928
To solve this, we use Scala's class self reference feature and name it `parent`, as shown in the [`LRShiftVia`][LRShiftVia] example below.
928929
///
929930

930-
[](){#LRShiftVia}
931+
#### `LRShiftVia` example {#LRShiftVia}
931932
/// admonition | Generic left-right shifter, via composition example
932933
type: example
933934
The DFHDL code below implements the same generic left-right shifter composition seen in the [`LRShiftDirect`][LRShiftDirect] example, but uses via composition instead of direct composition. We define a `parent` self reference for the `LRShiftVia` design to refer to the `LRShiftVia` design within the `lshifter: LeftShiftGen` and `rshifter: RightShiftGen` child designs. We also use intermediate variables for the `oBits` ports of the `lshifter` and `rshifter` child designs and apply the multiplexer logic to select between them.
@@ -1028,7 +1029,7 @@ Where:
10281029
* `<> DFRET` - Marks the return type as a design output port
10291030
* `_expression_` - The design functionality
10301031

1031-
[](){#LRShiftFunc}
1032+
#### `LRShiftFunc` example {#LRShiftFunc}
10321033
/// admonition | Generic left-right shifter using functional composition
10331034
type: example
10341035
The code below implements the same generic left-right shifter functionality seen in previous examples, but uses functional composition. The implementation is split into three function designs:

0 commit comments

Comments
 (0)