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

module mux_4_dual_chips
(
    input  logic [3:0] x_ch,
    input  logic [3:0] y_ch,
    input  logic [1:0] sel,
    input  logic       inh,
    output logic       x_com,
    output logic       y_com
);



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

    // U1: CD4052 dual 4-channel analog multiplexer, pin 1 in column 12

    cd4052 i_u1
    (
        .y0    ( y_ch [0] ),  // Pin 1 <- Y0 wire, at GND on the breadboard
        .y2    ( y_ch [2] ),  // Pin 2 <- Y2 wire, at +5V on the breadboard
        .y_com ( y_com    ),  // Pin 3 -> Y COM
        .y3    ( y_ch [3] ),  // Pin 4 <- Y3 wire, at GND on the breadboard
        .y1    ( y_ch [1] ),  // Pin 5 <- Y1 wire, at +5V on the breadboard
        .inh   ( inh      ),  // Pin 6 <- button INH
        .b     ( sel [1]  ),  // Pin 9 <- button B
        .a     ( sel [0]  ),  // Pin 10 <- button A
        .x3    ( x_ch [3] ),  // Pin 11 <- X3 wire, at +5V on the breadboard
        .x0    ( x_ch [0] ),  // Pin 12 <- X0 wire, at +5V on the breadboard
        .x_com ( x_com    ),  // Pin 13 -> X COM
        .x1    ( x_ch [1] ),  // Pin 14 <- X1 wire, at GND on the breadboard
        .x2    ( x_ch [2] )   // Pin 15 <- X2 wire, at +5V on the breadboard
    );

endmodule
