Skip to content

Commit 74f5854

Browse files
authored
Merge pull request #281 from MahirAbbas/master
include note about driving n0.valid
2 parents dbeb558 + 22737e8 commit 74f5854

2 files changed

Lines changed: 63 additions & 0 deletions

File tree

source/SpinalHDL/Libraries/Pipeline/introduction.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,4 +1025,20 @@ Here is a simple testbench which implement a loop which will make the led counti
10251025
}
10261026
10271027
1028+
Note
1029+
======
1030+
When building a pipeline, only ``node(0).valid`` or ``node(n).ready`` (where ``n`` is the last stage in the pipeline) may be driven by user logic. It is possible for the builder to optimise away ``node.ready`` or ``node.valid`` signals if they are not used. To guarantee ``node.ready`` or ``node.valid`` signal creation (important if you use ``CtrlLink()`` or any other link where you want flow control) ``node(0).valid`` must be driven manually.
10281031

1032+
.. code-block:: scala
1033+
1034+
n0.valid := io.up.valid
1035+
// or
1036+
n0.valid := True/False
1037+
1038+
//Example with CtrlLink()
1039+
case class inputStage(stage: CtrlLink) extends Area {
1040+
stage.up.valid := True
1041+
}
1042+
1043+
1044+
This is sufficient to ensure halting and ``CtrlLink`` behaviour works as intended (``node.valid`` or ``node.ready`` signals are not optimised away).
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
Logic Simplification Utilities and Decoder
2+
===============================
3+
A minimal Boolean simplification and decode-table utility for decoders using quine-mcklusky.
4+
Provides masked pattern matching, Quine McCluskey style logic reduction, and a high-level decode-table builder.
5+
--- # Masked
6+
Represents a bit pattern with care (significant) and don't-care bits.
7+
`value` = bit values
8+
`care` = which bits must match (1 = match, 0 = don't care)
9+
--- Example:
10+
11+
.. code-block:: scala
12+
Masked(0010),
13+
Masked(11-1),
14+
Masked(1--0)
15+
16+
e.g RISC-V instrs
17+
18+
.. code-block:: scala
19+
val ADD = M"0000000----------000-----0110011"
20+
val ADDI = M"-----------------000-----0010011"
21+
22+
Used to define instruction encodings for decode tables.
23+
24+
25+
--- # DecodingSpec
26+
High-level builder for decode tables using `Masked` patterns.
27+
`` val decoder = new DecodingSpec()
28+
**API:**
29+
30+
* `addNeeds(key : Masked, value : Masked)`
31+
* `addNeeds(keys : Seq[Masked], value : Masked)`
32+
* `build(sel, coverAll)`
33+
* ``def setDefault(value : Masked)``
34+
35+
generate simplified decode logic
36+
**Example:**
37+
.. code-block:: scala ```
38+
val spec = new DecodingSpec(UInt(4 bits))
39+
spec.setDefault(Masked(U"0011"))
40+
spec.addNeeds(Masked(B"000"), Masked(U"1000"))
41+
result := spec.build(sel, allPatterns)
42+
43+
Generates minimized combinational decode logic.
44+
--- # Practical Use
45+
Define bit patterns as `Masked` and feed them into `DecodingSpec` to build compact decode logic (e.g., RISC-V).
46+
47+
* Output hardware is minimized (fewer LUTs / simpler gates)

0 commit comments

Comments
 (0)