// Exercise B8, chip-level version: the chips and wires of schematic 2 and
// of the breadboard.  Same ports as adder_leds.sv.
//
// Generated by tools/bb_lib.py from the checked breadboard wire list;
// change the layout in tools/bb_b8.py, not this file.  Synthesizable.

module adder_leds_chips
(
    input  logic [3:0] a,
    input  logic [3:0] b,
    output logic [3:0] sum,
    output logic       carry
);

    // The power rails of the breadboard, for tied-off inputs

    wire gnd = 1'b0;

    //------------------------------------------------------------------------

    // U1: CD4008 4-bit full adder, pin 1 in column 22

    cd4008 i_u1
    (
        .a4        ( a [3]   ),  // Pin 1 <- button A4
        .b3        ( b [2]   ),  // Pin 2 <- button B3
        .a3        ( a [2]   ),  // Pin 3 <- button A3
        .b2        ( b [1]   ),  // Pin 4 <- button B2
        .a2        ( a [1]   ),  // Pin 5 <- button A2
        .b1        ( b [0]   ),  // Pin 6 <- button B1
        .a1        ( a [0]   ),  // Pin 7 <- button A1
        .carry_in  ( gnd     ),  // Pin 9 <- GND
        .s1        ( sum [0] ),  // Pin 10 -> S1
        .s2        ( sum [1] ),  // Pin 11 -> S2
        .s3        ( sum [2] ),  // Pin 12 -> S3
        .s4        ( sum [3] ),  // Pin 13 -> S4
        .carry_out ( carry   ),  // Pin 14 -> CO
        .b4        ( b [3]   )   // Pin 15 <- button B4
    );

endmodule
