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

module multifunction_gate_chips
(
    input  logic       a,
    input  logic       b,
    input  logic       c,
    input  logic       d,
    input  logic [3:0] rest,
    input  logic [2:0] k,
    output logic       j
);

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

    wire gnd = 1'b0;
    wire vdd = 1'b1;

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

    // U1: CD4048 multifunction expandable 8-input gate, pin 1 in column 9

    cd4048 i_u1
    (
        .j      ( j        ),  // Pin 1 -> J
        .kd     ( vdd      ),  // Pin 2 <- +5V
        .h      ( rest [3] ),  // Pin 3 <- H wire, at +5V on the breadboard
        .g      ( rest [2] ),  // Pin 4 <- G wire, at +5V on the breadboard
        .f      ( rest [1] ),  // Pin 5 <- F wire, at +5V on the breadboard
        .e      ( rest [0] ),  // Pin 6 <- E wire, at +5V on the breadboard
        .kb     ( k [1]    ),  // Pin 7 <- Kb wire, at GND on the breadboard
        .kc     ( k [2]    ),  // Pin 9 <- Kc wire, at GND on the breadboard
        .ka     ( k [0]    ),  // Pin 10 <- Ka wire, at +5V on the breadboard
        .d      ( d        ),  // Pin 11 <- button D
        .c      ( c        ),  // Pin 12 <- button C
        .b      ( b        ),  // Pin 13 <- button B
        .a      ( a        ),  // Pin 14 <- button A
        .expand ( gnd      )   // Pin 15 <- GND
    );

endmodule
