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

module gates_8_input_chips
(
    input  logic       a,
    input  logic       b,
    input  logic       c,
    input  logic       d,
    input  logic [3:0] rest_and,
    input  logic [3:0] rest_or,
    output logic       y_and,
    output logic       y_nand,
    output logic       y_or,
    output logic       y_nor
);



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

    // U2: CD4078 8-input OR/NOR, pin 1 in column 8

    cd4078 i_u2
    (
        .k ( y_or        ),  // Pin 1 -> OR
        .a ( a           ),  // Pin 2 <- button A
        .b ( c           ),  // Pin 3 <- button C
        .c ( b           ),  // Pin 4 <- button B
        .d ( d           ),  // Pin 5 <- button D
        .e ( rest_or [0] ),  // Pin 9 <- E wire, at GND on the breadboard
        .f ( rest_or [1] ),  // Pin 10 <- F wire, at GND on the breadboard
        .g ( rest_or [2] ),  // Pin 11 <- G wire, at GND on the breadboard
        .h ( rest_or [3] ),  // Pin 12 <- H wire, at GND on the breadboard
        .j ( y_nor       )   // Pin 13 -> NOR
    );

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

    // U1: CD4068 8-input AND/NAND, pin 1 in column 16

    cd4068 i_u1
    (
        .k ( y_and        ),  // Pin 1 -> AND
        .a ( a            ),  // Pin 2 <- button A
        .b ( b            ),  // Pin 3 <- button B
        .c ( c            ),  // Pin 4 <- button C
        .d ( d            ),  // Pin 5 <- button D
        .e ( rest_and [0] ),  // Pin 9 <- E wire, at +5V on the breadboard
        .f ( rest_and [1] ),  // Pin 10 <- F wire, at +5V on the breadboard
        .g ( rest_and [2] ),  // Pin 11 <- G wire, at +5V on the breadboard
        .h ( rest_and [3] ),  // Pin 12 <- H wire, at +5V on the breadboard
        .j ( y_nand       )   // Pin 13 -> NAND
    );

endmodule
