3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-07-15 03:35:40 +00:00
Commit graph

995 commits

Author SHA1 Message Date
Akash Levy
a022ca524d Fix flaky opt_priokey -strict and cover binary exclusive scan
ASLR-dependent ConstEval seeding let E4 miss OOR counterexamples; use a
deterministic seed and force OOR key collisions. Add I9 (NB=12) for the
thermometer fallback path Greptile flagged.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-08 23:20:22 -07:00
Akash Levy
665bd1099a opt_first_fit_alloc updates + tests + some nice refactoring 2026-07-08 22:33:13 -07:00
Akash Levy
0a69890e3f opt_prienc: require ConstEval fingerprint inputs to be a valid cut
The round-robin (and PE/CLZ/CTZ) fingerprints pin candidate request/
start/select signals as free ConstEval inputs and evaluate the encoder
output cone. ConstEval::eval() re-computes and re-set()s the FULL output
of every combinational cell it needs. If a pinned bit is a combinational
cell output and a sibling output bit of that same cell is pulled into the
cone, evaluating the sibling re-sets the pinned bit to the cell's real
value, contradicting the free value we pinned and tripping the assertion
`current_val[i].wire != NULL || current_val[i] == value[i]` in
kernel/consteval.h.

The earlier clean_set_signals() guard only rejected constant/aliased
bits; it did not ensure the pinned signals form a valid cut. Candidates
are gathered purely by width, so an internal combinational wire (e.g. a
slice of a wider arithmetic result) can be pinned, which is exactly what
crashed on veer_speed1/picorv32/murax/raygentop.

Add is_valid_consteval_cut(): a pinned bit is a safe leaf when it is a
primary input, sequential-cell output or undriven (absent from
bit_to_driver, which holds combinational drivers only); a combinational
output is safe only if that cell's entire output lies within the pinned
cut. Apply it in both fingerprint() and fingerprint_rr(). Declining an
unclean cut only forgoes a possible rewrite, never yields a wrong one,
and the intended arbiter inputs (request ports, idx_last flop outputs)
remain valid cuts so real round-robin patterns still rewrite.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-07 00:00:24 -07:00
Akash Levy
676ac184ed opt_prienc: guard ConstEval fingerprint inputs against constant/aliased bits
The round-robin detector fed sigmap(wire) signals straight into
ConstEval::set() while sweeping test vectors. On real designs a candidate
bus can have bits tied to constants, repeated bits, or a req/start pair
that alias to the same net after sigmap. ConstEval::set() asserts
(current_val[i].wire != NULL || current_val[i] == value[i]) when asked to
re-pin such a bit to a conflicting value, crashing the pass
(consteval.h:83) on designs like veer/picorv32/murax/raygentop under
formal synthesis.

Add clean_set_signals() and reject any fingerprint candidate whose
set-signals contain constant bits, repeated bits, or overlap each other,
in both the priority-encoder and round-robin paths. Skipping an unclean
candidate only forgoes a possible rewrite; it never produces an incorrect
one. Clean candidates (the intended patterns) are unaffected.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-06 21:35:51 -07:00
Akash Levy
f5c54e5905 opt_prienc: give each round-robin req candidate its own fingerprint budget
The max_pairs budget was a single running counter shared across all
req_wire iterations, so once a start-candidate-heavy first req size
exhausted it, every later req size broke on its first start candidate and
was silently skipped. Reset the budget per req_wire so all req sizes get
a fair chance. (Completeness only; fingerprint_rr still validates every
match, so this never affected correctness.)

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-06 13:28:54 -07:00
Akash Levy
00e48706df opt: recognize three QoR logic-depth patterns
Extend two existing opt passes and add one new pass to collapse
serial/dynamic-index structures that were leaving high logic depth:

- opt_first_fit_alloc: recognize the "coalesce-matrix" first-fit
  allocator variant (same_cat[i][k] coalescing gated on the leader's
  enable, driven from a raw input enable). Rewrite both the lane_slot
  allocation and the xbar field gather from one shared log-depth scan.

- opt_prienc: detect round-robin / rotated-priority scans (req scanned
  from idx_last downward with wraparound) and rewrite the depth-N
  idx--/req[idx] mux chain to rotate -> log-depth priority-encode ->
  unrotate.

- opt_priokey (new): recognize priority-by-key one-hot accumulators and
  replace each dynamic taken[key] read ($shiftx/$bmux) with the
  equivalent pairwise-key-compare reduction, dropping the wide dynamic
  indexing. Supports -strict for full-key-range formal validation.

Each includes self-contained tests (equiv_opt / sat -prove-asserts,
mux-bound and negative cases) in tests/opt/.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-06 12:56:38 -07:00
Akash Levy
63dd7b7ee9
Merge pull request #201 from Silimate/merge5
Merge from upstream
2026-07-06 08:30:57 -07:00
Akash Levy
a2e38e2022 Merge from upstream 2026-07-06 07:47:32 -07:00
Akash Levy
bab0ee6bf8 Speed up opt_* using cut_region with shared_ce 2026-07-06 07:42:47 -07:00
Akash Levy
b600028644 Reduce verbosity of opt_dff 2026-07-06 07:40:47 -07:00
Akash Levy
3783a820ee Merge remote-tracking branch 'upstream' into merge3 2026-06-25 04:51:46 -07:00
Miodrag Milanovic
a689342207 Remove trailing whitespaces 2026-06-23 07:24:59 +02:00
Miodrag Milanovic
48a3dcc02a End of file fix 2026-06-23 07:23:41 +02:00
nella
3d0c868af0
Merge pull request #5952 from YosysHQ/nella/vector-index
Optimize upto vector indexing (Fix #892).
2026-06-22 09:05:26 +00:00
Mohamed Gaber
0e7671c1b3 Merge remote-tracking branch 'origin/main' into update_from_upstream 2026-06-21 15:07:32 +03:00
Akash Levy
8cdbd62394 opt_first_fit_alloc: address Greptile review
- pack_lanes: assert elem_w < 32 and pack the full element width instead
  of silently dropping bits >= 31.
- Remove the dead `cell` struct member and its unused assignment in run()
  (every emit helper shadows it with its own local `cell`).
- Decorrelate the pseudo-random bc bits from en (independent mix) so they
  no longer share an LFSR bit (e.g. en[7]/bc[0] for n=8).
- Add purpose comments to fingerprint_dsel and lane_of_bit.

Declined the std::stoi/std::stoll arg-parsing suggestion: it matches the
established convention in sibling passes (opt_argmax, opt_priority_onehot).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-21 01:21:06 -07:00
Akash Levy
dc995eba98 opt_first_fit_alloc 2026-06-21 00:56:39 -07:00
Mohamed Gaber
4db5fe5f6d
Merge remote-tracking branch 'silimate/main' into update_from_upstream 2026-06-19 00:07:08 +03:00
Akash Levy
db7cfd404d Fix cut_region.h debug 2026-06-18 04:02:52 -07:00
Akash Levy
9df378f8ac opt_carry_select pass 2026-06-18 02:36:29 -07:00
Mohamed Gaber
569ab1231b
Merge remote-tracking branch 'silimate/main' into update_from_upstream 2026-06-16 02:02:41 +03:00
Akash Levy
1cc985314a Cleanup 2026-06-15 09:09:27 -07:00
Emil J. Tywoniak
6032b064e2 opt_muxtree: optimize for single driver, error on multiple drivers 2026-06-15 15:08:26 +02:00
Akash Levy
83baed6731 Generalize and refactor opt_* passes of Silimate 2026-06-12 16:31:41 -07:00
Mohamed Gaber
0217efb67d
Merge remote-tracking branch 'silimate/main' into update_from_upstream 2026-06-10 20:33:33 +03:00
Mohamed Gaber
d986ee91ac
CMake: integrate silimate additions and extensions
- update CMakeLists.txt to load two new files:
  - SilimateConfig.cmake: sets Silimate configuration options and defaults
  - SilimateVerific.cmake: compiles Verific library, optionally with Silimate modifications
- include silimate tests in test Makefile
2026-06-10 20:27:52 +03:00
nella
d52670e58b Replace suitable (2^k-1)-x with ~x. 2026-06-10 11:29:55 +02:00
Akash Levy
3743c4795a opt_priority_onehot 2026-06-09 22:18:20 -07:00
Mohamed Gaber
e58125b605
Merge remote-tracking branch 'upstream/main' into silimate 2026-06-09 16:22:51 +03:00
Akash Levy
4a35c0ab87 opt_argmax fixes 2026-06-09 01:57:11 -07:00
Miodrag Milanovic
a599999d1f Fixed warnings found by gcc-16 2026-06-03 13:09:38 +02:00
Catherine
a727e7f6e7 Migrate build system to CMake
See #5895 for details.

This commit does not include CI or documentation changes.
2026-06-03 08:58:10 +00:00
Akash Levy
b3ea5770cd opt_argmax pass 2026-06-02 04:11:17 -07:00
Akash Levy
0c3446e8af Fixups for Greptile 2026-06-01 19:03:52 -07:00
Akash Levy
9cc69a3c49 Improvement to opt_balance_tree 2026-06-01 17:56:44 -07:00
Philippe Sauter
c89cfe1e6e peepopt: add shiftpow2 pattern
Rewrite power-of-two indexed word selects to $bmux when the shift
amount already carries the scale as low zero bits.

Keep the rule to non-overlapping selections and bound the generated
mux ways. Add regressions for aligned shifts, padding, signed
extension, and shiftmul handoff cases.
2026-05-31 02:01:32 +02:00
KrystalDelusion
4230ebff71
Merge pull request #5912 from YosysHQ/krys/opt_clean_docs
opt_clean: Set group for docs gen
2026-05-28 08:35:52 +00:00
Krystine Sherwin
680bb69d85
opt_clean: Set group for docs gen 2026-05-28 14:50:11 +12:00
Akash Levy
6a8d800e63 Fixes for filtering small cases and catching more larger ones with trickier signatures 2026-05-27 03:40:44 -07:00
Akash Levy
69edb27ab3 muxpack fix 2026-05-27 03:07:24 -07:00
Akash Levy
5c3fbd2d63 Merge branch 'main' into opt_addcin 2026-05-27 01:52:11 -07:00
Akash Levy
89717069fe Fixup 2026-05-27 01:51:54 -07:00
Akash Levy
46a697e608
Merge pull request #169 from Silimate/opt_andor_pmux
opt_andor_pmux pass
2026-05-27 01:03:58 -07:00
Akash Levy
e39395132d opt_addcin pass 2026-05-27 00:39:25 -07:00
Akash Levy
42d257e523 opt_andor_pmux pass 2026-05-27 00:11:54 -07:00
Akash Levy
5c3c342ea0 Fixup NEW_ID usage 2026-05-27 00:09:12 -07:00
Akash Levy
9ded74751c
Update passes/opt/opt.cc
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-05-26 06:38:27 -07:00
Akash Levy
9a225025d4 opt -max_iter 2026-05-26 06:23:40 -07:00
Akash Levy
a5617f90ac Speed fix 2026-05-20 15:42:26 -07:00
Akash Levy
7eff462881 Make opt_prienc a bit faster 2026-05-20 13:33:19 -07:00