3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-07-17 04:35:44 +00:00
Commit graph

143 commits

Author SHA1 Message Date
Emil J. Tywoniak
7656347b44 patch: split into single-output patch + multi-output patch_ports; drop input-cone gc 2026-06-10 14:53:37 +02:00
Emil J. Tywoniak
ea41e61a36 utils: add BitGrouper for shared bit-partition logic 2026-06-10 14:53:13 +02:00
Emil J. Tywoniak
d952b04e54 opt_expr: convert remaining rewrites to patcher 2026-06-10 14:53:05 +02:00
Emil J. Tywoniak
e2a77db87a opt_expr: evener morer patcherer 2026-06-10 14:53:03 +02:00
Emil J. Tywoniak
edeb649154 opt_expr: even more patcher 2026-06-10 14:53:02 +02:00
Emil J. Tywoniak
fb021b1a6b opt_expr: more patcher again 2026-06-10 14:53:00 +02:00
Emil J. Tywoniak
dab9a386cc opt_expr: WIP use patcher more 2026-05-28 22:51:30 +02:00
Emil J. Tywoniak
b594196a48 opt_expr: cleanup 2026-05-28 14:56:27 +02:00
Emil J. Tywoniak
5cdb189ea0 opt_expr: cleanup 2026-05-28 14:53:21 +02:00
Emil J. Tywoniak
cef8186c4a patch: infer leaves for gc 2026-05-28 12:56:13 +02:00
Emil J. Tywoniak
1cd0d37511 patch: instead of cell->cell, use port->sig rewrites 2026-05-27 18:07:01 +02:00
Emil J. Tywoniak
b3a33aeeba opt_expr: use patcher for xor constant folding 2026-05-27 18:06:55 +02:00
Emil J. Tywoniak
9abee44602 opt_expr: replace invert_map with signorm traversal 2026-05-22 18:41:49 +02:00
Emil J. Tywoniak
5bfb631085 opt_expr: with -keepdc disable equality optimization rules that break when ports are sigmapped 2026-05-22 18:38:37 +02:00
Emil J. Tywoniak
4d2a6f2b7a opt_expr: fix invert_map 2026-05-22 18:37:58 +02:00
Jannis Harder
423c8be71b WIP half broken snapshot 2026-05-22 18:37:11 +02:00
Codexplorer
e41b969da2 Refactored uses of log_id() 2026-05-08 20:59:24 -07:00
Emil J. Tywoniak
35ccaa60d7 newcelltypes: TurboCellTypes -> StaticCellTypes 2026-03-04 12:22:14 +01:00
Emil J. Tywoniak
6adc08b0e5 opt_expr: use newcelltypes 2026-03-04 12:22:14 +01:00
Emil J. Tywoniak
3bfeaee8ca opt_expr: fix const lhs of $pow to $shl 2026-02-03 11:59:00 +01:00
Robert O'Callahan
638e904f91 Remove cover() coverage tracking 2025-12-04 16:27:13 +01:00
Robert O'Callahan
5600eb2e5b Update passes/opt to avoid bits() 2025-09-16 03:17:23 +00:00
Robert O'Callahan
c7df6954b9 Remove .c_str() from stringf parameters 2025-09-01 23:34:42 +00:00
George Rennie
6331f92d00
Merge pull request #5101 from georgerennie/george/opt_expr_shift_ovfl
opt_expr: fix shift optimization with overflowing shift amount
2025-05-22 15:16:19 +01:00
George Rennie
748600c167
small whitespace cleanup (#5119) 2025-05-14 15:18:57 +02:00
George Rennie
0dcd94b6ad opt_expr: saturate shift amount instead of overflowing for large shifts 2025-05-07 14:41:13 +02:00
George Rennie
c952ab417f opt_expr: only sign extend shift arguments for arithmetic right shift 2025-04-26 12:40:04 +02:00
Krystine Sherwin
406b400458
opt_expr: Fix #4590
If all the (non-select) inputs of a `$_MUX{4,8,16}_` are undefined, replace it, just like we do for `$mux` and `$_MUX_`.
Add `tests/opt/opt_expr_mux_undef.ys` to verify this.

This doesn't do any const folding on the wide muxes, or shrinking to less wide muxes.  It only handles the case where all inputs are 'x and the mux can be completely removed.
2025-04-04 12:25:31 +13:00
Anhijkt
6b5507139e opt_expr: requsted changes 2025-04-01 20:37:22 +03:00
Anhijkt
83b095ab6c opt_expr: optimize pow of 2 cells 2025-03-30 15:43:41 +03:00
Krystine Sherwin
4c728968a3
Fix runtime error on shr INT_MAX 2025-02-14 14:01:36 +13:00
Emil J. Tywoniak
785bd44da7 rtlil: represent Const strings as std::string 2024-10-14 06:28:12 +02:00
Emil J. Tywoniak
532188f239 opt_expr: change info message 2024-07-15 11:14:47 +02:00
Emil J. Tywoniak
01f332e750 opt_expr: reduce mostly harmless warning to log 2024-06-25 20:18:49 +02:00
Martin Povišer
fa4a2b6b0d opt_expr: In clkinv loop ignore irrelevant cells early
Each call to `handle_clkpol_celltype_swap` has a conversion of the
cell's type ID to an allocated string. This can sum up to a
non-negligible time being spent in the clkpol code even for a design
which doesn't have any flip-flop gates.
2024-06-24 18:32:33 +02:00
Martin Povišer
7a8a69b65c opt_expr: Revisit sorting in replace_const_cells
Avoid building a cell-to-inbit map when sorting the cells, add a warning
if we are unable to sort, and move the code treating non-combinational
cells ahead of the rest (this means we don't need to pass
non-combinational cells to the TopoSort object at all).
2024-06-24 18:32:33 +02:00
Rasmus Munk Larsen
0a37c2a301 Fix translation bug: The old code really checks for the presense of a node, not an edge in glift and flatten.
Add back statement that inserts nodes in order in opt_expr.cc.
2023-10-05 17:01:42 -07:00
Rasmus Munk Larsen
e0042bdff7 Speed up TopoSort. The main sorting algorithm implementation in TopoSort::sort_worker is 11-12x faster. Overall, the complete sequence of building the graph and sorting is about 2.5-3x faster. The overall impact in e.g. the replace_const_cells optimization pass is a ~25% speedup. End-to-end impact on our synthesis flow is about 3%. 2023-09-20 15:49:05 -07:00
Martin Povišer
f8325f66b7 opt_expr: Fix 'signed X>=0' replacement for wide output ports
If the `$ge` cell we are replacing has wide output port, the upper bits
on the port should be driven to zero. That's not what a `$not` cell with
a single-bit input does. Instead opt for a `$logic_not` cell, which does
zero-pad its output.

Fixes #3867.
2023-08-01 13:50:12 +01:00
Jannis Harder
3ecf85e32c opt_expr: Optimizations for $bweqx and $bwmux 2022-11-30 18:50:53 +01:00
Jannis Harder
1e67c3a3c2 opt_expr: Fix shift/shiftx optimizations 2022-11-30 18:24:25 +01:00
Jannis Harder
fd56d1f79e opt_expr: Constant fold mux, pmux, bmux, demux, eqx, nex cells 2022-11-29 19:06:45 +01:00
Jannis Harder
c08242ba41 opt_expr: Optimize bitwise logic ops with one fully const input 2022-11-29 19:06:45 +01:00
Jannis Harder
c77b7343d0 Consistent $mux undef handling
* Change simlib's $mux cell to use the ternary operator as $_MUX_
  already does
* Stop opt_expr -keepdc from changing S=x to S=0
* Change const eval of $mux and $pmux to match the updated simlib
  (fixes sim)
* The sat behavior of $mux already matches the updated simlib

The verilog frontend uses $mux for the ternary operators and this
changes all interpreations of the $mux cell (that I found) to match the
verilog simulation behavior for the ternary operator. For 'if' and
'case' expressions the frontend may also use $mux but uses $eqx if the
verilog simulation behavior is requested with the '-ifx' option.

For $pmux there is a remaining mismatch between the sat behavior and the
simlib behavior. Resolving this requires more discussion, as the $pmux
cell does not directly correspond to a specific verilog construct.
2022-10-24 12:03:01 +02:00
Marcelina Kościelnicka
e7d89e653c Hook up $aldff support in various passes. 2021-10-02 21:01:21 +02:00
Marcelina Kościelnicka
fd79217763 Add v2 memory cells. 2021-08-11 13:34:10 +02:00
Marcelina Kościelnicka
436d42c00c opt_expr: Propagate constants to port connections.
This adds one simple piece of functionality to opt_expr: when a cell
port is connected to a fully-constant signal (as determined by sigmap),
the port is reconnected directly to the constant value.  This is just
enough optimization to fix the "non-constant $meminit input" problem
without requiring a full opt_clean or a separate pass.
2021-07-27 20:44:26 +02:00
Marcelina Kościelnicka
1667ad658b opt_expr: Fix mul/div/mod by POT patterns to support >= 32 bits.
The previous code, in addition to being needlessly limitted to 32 bits
in the first place, also had UB for the 31th bit (doing 1 << 31).
2021-06-09 19:53:44 +02:00
Marcelina Kościelnicka
12b3a9765d opt_expr: Optimize div/mod by const 1.
Turns out the code for div by a power of 2 is already almost capable of
optimizing this to a shift-by-0 or and-with-0, which will be further
folded into nothingness; let's beef it up to handle div by 1 as well.

Fixes #2820.
2021-06-09 17:42:30 +02:00
Claire Xenia Wolf
72787f52fc Fixing old e-mail addresses and deadnames
s/((Claire|Xen|Xenia|Clifford)\s+)+(Wolf|Xen)\s+<(claire|clifford)@(symbioticeda.com|clifford.at|yosyshq.com)>/Claire Xenia Wolf <claire@yosyshq.com>/gi;
s/((Nina|Nak|N\.)\s+)+Engelhardt\s+<nak@(symbioticeda.com|yosyshq.com)>/N. Engelhardt <nak@yosyshq.com>/gi;
s/((David)\s+)+Shah\s+<(dave|david)@(symbioticeda.com|yosyshq.com|ds0.me)>/David Shah <dave@ds0.me>/gi;
s/((Miodrag)\s+)+Milanovic\s+<(miodrag|micko)@(symbioticeda.com|yosyshq.com)>/Miodrag Milanovic <micko@yosyshq.com>/gi;
s,https?://www.clifford.at/yosys/,http://yosyshq.net/yosys/,g;
2021-06-08 00:39:36 +02:00