@@ -223,6 +223,68 @@ You can filter an asynchronous reset by using an asynchronously asserted synchro
223223
224224There is also an ``ResetCtrl.asyncAssertSyncDeassertDrive `` version of tool which directly assign the ``clockDomain `` reset with the filtered value.
225225
226+ Logic simplification utilities
227+ ------------------------------
228+
229+ `DecodingSpec ` with `Masked ` provide a minimal Boolean simplification and decode-table
230+ utility using the `Quine–McCluskey algorithm <https://en.wikipedia.org/wiki/Quine%E2%80%93McCluskey_algorithm >`_.
231+
232+ Provides masked pattern matching, Quine–McCluskey style logic reduction,
233+ and a high-level decode-table builder.
234+
235+ `Masked `
236+ ^^^^^^^^
237+
238+ Represents a bit pattern with care (significant) and don't-care bits.
239+ - `value ` = bit values
240+ - `care ` = which bits must match (1 = match, 0 = don't care)
241+
242+ Example:
243+
244+ .. code-block :: scala
245+
246+ Masked(0010),
247+ Masked(11-1),
248+ Masked(1--0)
249+
250+ e.g RISC-V instructions:
251+
252+ .. code-block :: scala
253+
254+ val ADD = M"0000000----------000-----0110011"
255+ val ADDI = M"-----------------000-----0010011"
256+
257+ Used to define instruction encodings for decode tables.
258+
259+ `DecodingSpec `
260+ ^^^^^^^^^^^^^^
261+
262+ High-level builder for decode tables using `Masked ` patterns.
263+
264+ Methods:
265+ * `addNeeds(key : Masked, value : Masked) `
266+ * `addNeeds(keys : Seq[Masked], value : Masked) `
267+ * `build(sel, coverAll) `
268+ * `setDefault(value : Masked) `
269+
270+ This generate simplified decode logic.
271+
272+ Example:
273+
274+ .. code-block :: scala
275+
276+ val spec = new DecodingSpec(UInt(4 bits))
277+ spec.setDefault(Masked(U"0011"))
278+ spec.addNeeds(Masked(B"000"), Masked(U"1000"))
279+ result := spec.build(sel, allPatterns)
280+
281+ Generates minimized combinational decode logic.
282+
283+ The practical use is to define bit patterns as `Masked ` and feed them into
284+ `DecodingSpec ` to build compact decode logic (e.g., RISC-V). The output hardware
285+ is then minimized (fewer LUTs / simpler gates).
286+
287+
226288Special utilities
227289-----------------
228290
0 commit comments