// Exercise BB4b: a dual 4-channel multiplexer, like the 4052.
//
// Generic version that matches schematic 1, not tied to any chip: two
// multiplexers with one select, X and Y.  With inh = 1 both outputs are not
// driven (high impedance), as the common pins of the 4052 float.
// Synthesizable; in an FPGA keep inh at 0.

module mux_4_dual
(
    input  logic [3:0] x_ch,   // x_ch [0] is X0
    input  logic [3:0] y_ch,   // y_ch [0] is Y0
    input  logic [1:0] sel,    // B A: sel [1] is B, weight 2
    input  logic       inh,    // 1 = all switches open

    output logic       x_com,
    output logic       y_com
);

    assign x_com = inh ? 1'bz : x_ch [sel];
    assign y_com = inh ? 1'bz : y_ch [sel];

endmodule
