# Tests for opt_addcin. # # opt_addcin recognizes a conservative two-$add, three-leaf pattern that # represents A + B + cin with a one-bit unsigned carry input. It rewrites the # two adders into one WIDTH+1 adder whose artificial LSB produces the carry into # the real bit 0. Each test below states the exact RTLIL shape being built and # why the pass should either rewrite it or leave it alone. # ============================================================================ # Group A: Positive rewrites # ============================================================================ # Test A1: unsigned carry on the B port of the final add. # # Shape: # add_ab : s = a + b # add_cin : y = s + cin # # The intermediate and final add widths are both 4, and cin is exactly one # unsigned bit, so the pass should replace both adders with one 5-bit $add. log -header "A1: unsigned carry on final-add B port" log -push design -reset read_verilog -icells <