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/design-hierarchy/index.md
+74-74Lines changed: 74 additions & 74 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -550,80 +550,6 @@ case class Bar() extends DFDesign
550
550
551
551
All other Scala class modifiers have no special effect or limitation from a DFHDL compiler perspective. Nonetheless, these modifiers can be relevant when defining a more complex design API, as part of the DFHDL meta-programming capabilities through the Scala language (e.g., changing class access to `#!scala protected`).
552
552
553
-
### Design Class Inheritance
554
-
DFHDL leverages Scala inheritance to enable sharing functionality between design classes.
555
-
556
-
#### `ShiftGen` example {#ShiftGen}
557
-
/// admonition | Generic left and right shifters, design class inheritance example
558
-
type: example
559
-
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.
DFHDL supports three mechanisms to form a design hierarchy through design instantiation and composition:
618
-
619
-
*[Direct Connection Composition][direct-connection-composition] - The recommended mechanism for complex design hierarchies with multiple inputs and outputs. Design instantiation and port connection can be done separately, allowing child design ports to be referenced without intermediate variables.
620
-
621
-
*[Via Connection Composition][via-connection-composition] - A legacy mechanism that connects ports only within a design instantiation. This exists for compatibility with Verilog module instancing and VHDL component instancing. The DFHDL compiler automatically transforms direct connections into via connections.
622
-
623
-
*[Functional Composition][functional-composition] - A method-call mechanism for dataflow designs, primarily used for arithmetic/logic functionality with a single output port. The DFHDL compiler automatically transforms functional composition into direct design composition.
624
-
625
-
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:
626
-
627
553
### `LRShiftFlat` example {#LRShiftFlat}
628
554
/// admonition | Generic left-right shifter, flat design example
629
555
type: example
@@ -711,6 +637,80 @@ children = [
711
637
///
712
638
///
713
639
640
+
### Design Class Inheritance
641
+
DFHDL leverages Scala inheritance to enable sharing functionality between design classes.
642
+
643
+
#### `ShiftGen` example {#ShiftGen}
644
+
/// admonition | Generic left and right shifters, design class inheritance example
645
+
type: example
646
+
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.
DFHDL supports three mechanisms to form a design hierarchy through design instantiation and composition:
705
+
706
+
*[Direct Connection Composition][direct-connection-composition] - The recommended mechanism for complex design hierarchies with multiple inputs and outputs. Design instantiation and port connection can be done separately, allowing child design ports to be referenced without intermediate variables.
707
+
708
+
*[Via Connection Composition][via-connection-composition] - A legacy mechanism that connects ports only within a design instantiation. This exists for compatibility with Verilog module instancing and VHDL component instancing. The DFHDL compiler automatically transforms direct connections into via connections.
709
+
710
+
*[Functional Composition][functional-composition] - A method-call mechanism for dataflow designs, primarily used for arithmetic/logic functionality with a single output port. The DFHDL compiler automatically transforms functional composition into direct design composition.
711
+
712
+
The following sections explore these composition mechanisms using our running example of a bit shifter:
713
+
714
714
### Direct Connection Composition
715
715
Direct connection composition is the recommended approach for building hierarchical designs in DFHDL. It offers several key advantages:
0 commit comments