Skip to content

Commit 22737e8

Browse files
authored
Update logic.rst
1 parent 748ad19 commit 22737e8

1 file changed

Lines changed: 25 additions & 21 deletions

File tree

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,37 @@
1-
Logic Simplification Utilities
1+
Logic Simplification Utilities and Decoder
22
===============================
33
A minimal Boolean simplification and decode-table utility for decoders using quine-mcklusky.
44
Provides masked pattern matching, Quine McCluskey style logic reduction, and a high-level decode-table builder.
55
--- # Masked
66
Represents a bit pattern with care (significant) and don't-care bits.
77
`value` = bit values
88
`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
15-
**Example:**
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+
1618
.. code-block:: scala
17-
Masked(BigInt("0010", 2), Masked("1111", 2)), Masked(1--0)
19+
val ADD = M"0000000----------000-----0110011"
20+
val ADDI = M"-----------------000-----0010011"
1821
1922
Used to define instruction encodings for decode tables.
20-
--- # Symplify Performs Boolean logic minimization for decode circuits.
21-
**Main API:**
22-
* `apply(input, mapping, resultWidth)` simplified decode logic
23-
* `apply(input, trueTerms)` simplified Boolean output
24-
* `trueAndDontCare(...)` simplified Boolean with explicit don-t-care terms Based on Quine McCluskey; runs at elaboration time.
25-
26-
--- # DecodingSpec High-level builder for decode tables using `Masked` patterns.
27-
**API:** * `setDefault(value)`
28-
* `addNeeds(key, value)`
29-
* `addNeeds(keys, value)`
30-
* `build(sel, coverAll)`
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+
3135
generate simplified decode logic
3236
**Example:**
3337
.. code-block:: scala ```
@@ -38,6 +42,6 @@ Used to define instruction encodings for decode tables.
3842

3943
Generates minimized combinational decode logic.
4044
--- # 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).
45+
Define bit patterns as `Masked` and feed them into `DecodingSpec` to build compact decode logic (e.g., RISC-V).
4246

4347
* Output hardware is minimized (fewer LUTs / simpler gates)

0 commit comments

Comments
 (0)