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: source/SpinalHDL/Libraries/logic.rst
+21-7Lines changed: 21 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,27 +3,41 @@ Logic Simplification Utilities
3
3
A minimal Boolean simplification and decode-table utility for decoders using quine-mcklusky.
4
4
Provides masked pattern matching, Quine McCluskey style logic reduction, and a high-level decode-table builder.
5
5
--- # Masked
6
-
Represents a bit pattern with care (significant) and don t-care bits. `value` = bit values `care` = which bits must match (1 = match, 0 = don t care)
7
-
**Main API:** * `covers(that)` check if one pattern includes another * `intersects(that)` check if patterns overlap * `mergeOneBitDifSmaller` merge patterns differing by one bit * `=== (bits)` hardware match under mask * `toString(bitCount)` shows bits with - for don t-care
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
+
**Main API:**
10
+
* `covers(that)` check if one pattern includes another
11
+
* `intersects(that)` check if patterns overlap
12
+
* `mergeOneBitDifSmaller` merge patterns differing by one bit
13
+
* `=== (bits)` hardware match under mask
14
+
* `toString(bitCount)` shows bits with - for don't-care
* `trueAndDontCare(...)` simplified Boolean with explicit don-t-care terms Based on Quine McCluskey; runs at elaboration time.
25
+
15
26
--- # DecodingSpec High-level builder for decode tables using `Masked` patterns.
16
27
**API:** * `setDefault(value)`
17
28
* `addNeeds(key, value)`
18
29
* `addNeeds(keys, value)`
19
30
* `build(sel, coverAll)`
20
-
generate simplified decode logic **Example:**
31
+
generate simplified decode logic
32
+
**Example:**
21
33
.. code-block:: scala ```
22
34
val spec = new DecodingSpec(UInt(4 bits))
23
35
spec.setDefault(Masked(U"0011"))
24
36
spec.addNeeds(Masked(B"000"), Masked(U"1000"))
25
37
result := spec.build(sel, allPatterns)
26
38
27
39
Generates minimized combinational decode logic.
28
-
--- # Practical Use Define instruction patterns as `Masked` and feed them into `DecodingSpec` or `Symplify` to build compact decode logic for CPU instruction sets (e.g., RISC-V).
29
-
--- # Notes * Simplification is cached and fast for large decode tables * Output hardware is minimized (fewer LUTs / simpler gates)
40
+
--- # Practical Use
41
+
Define bit patterns as `Masked` and feed them into `DecodingSpec` or `Symplify` to build compact decode logic for CPU instruction sets (e.g., RISC-V).
42
+
43
+
* Output hardware is minimized (fewer LUTs / simpler gates)
0 commit comments