Commit Graph
14 Commits
Author SHA1 Message Date
Daniel M Bouyou e5c56c6400 arith_tree: do not flatten a chain link narrower than its consumer
sole_chainable_consumer folded a cell into its consumer without ever
comparing widths. A link truncates its result at its own Y width, and that
truncation is invisible only when the consumer truncates at least as hard,
since (x % 2**link) % 2**parent == x % 2**parent holds only when
parent <= link. When the consumer is wider, the carry the link discards
becomes observable, and flattening the chain silently recovers it.

For

  module top(input [7:0] a, b, c, output [8:0] o);
    wire [7:0] t = a + b;
    assign o = t + c;
  endmodule

synth -arith_tree computes a + b + c where the design specifies
((a + b) % 256) + c. The two differ by 256 whenever a + b overflows,
for example at a=169 b=135 c=7.

alumacc already guards the structurally identical $macc merge using
macc_may_overflow(); arith_tree carried no equivalent check.

Add two cases to tests/arith_tree/arith_tree_equiv.ys: equiv_double_neg
widened to a 5 bit result, and a dedicated equiv_narrow_intermediate.
2026-08-18 12:06:48 +02:00
Miodrag Milanovic 48a3dcc02a End of file fix 2026-06-23 07:23:41 +02:00
nella 135c2a4113 Get rid of normalize_to_width. 2026-06-11 01:12:35 +02:00
nella c47ed4bc31 Fix help. 2026-06-08 13:47:56 +02:00
nella 3c6900a570 Depth-schedule finar adder. 2026-06-08 13:47:56 +02:00
nella f8d2252735 Use ripple as default final adder, gate fma. 2026-06-08 13:47:56 +02:00
nella d40431f249 Remove black boxes for now. 2026-06-08 13:29:05 +02:00
nella 5e4e5a1d40 Arith tree - parallel prefix. 2026-06-08 13:29:05 +02:00
nella 862e9fc54e Remove elarith-fast for now. 2026-06-08 13:29:05 +02:00
nella 25eb394ad0 Collapse signed*signed or combined nodes via BW. 2026-06-08 13:29:05 +02:00
nella bc07c6b1b0 Improve arith_tree: FMA add, elarith WIP. 2026-06-08 13:29:05 +02:00
Codexplorer e41b969da2 Refactored uses of log_id() 2026-05-08 20:59:24 -07:00
nella 4506dffa9f Fix use after free. 2026-04-13 12:48:05 +02:00
nella fc71719e6e Rename csa_tree to arith_tree. 2026-04-13 12:48:05 +02:00