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

module comparator_chips
(
    input  logic [3:0] a,
    input  logic [3:0] b,
    output logic       a_gt_b,
    output logic       a_eq_b,
    output logic       a_lt_b
);

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

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

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

    // U1: CD4063 4-bit magnitude comparator, pin 1 in column 8

    cd4063 i_u1
    (
        .b3     ( b [3]  ),  // Pin 1 <- button B3
        .lt_in  ( gnd    ),  // Pin 2 <- GND
        .eq_in  ( vdd    ),  // Pin 3 <- +5V
        .gt_in  ( gnd    ),  // Pin 4 <- GND
        .gt_out ( a_gt_b ),  // Pin 5 -> A>B
        .eq_out ( a_eq_b ),  // Pin 6 -> A=B
        .lt_out ( a_lt_b ),  // Pin 7 -> A<B
        .b0     ( b [0]  ),  // Pin 9 <- button B0
        .a0     ( a [0]  ),  // Pin 10 <- button A0
        .b1     ( b [1]  ),  // Pin 11 <- button B1
        .a1     ( a [1]  ),  // Pin 12 <- button A1
        .a2     ( a [2]  ),  // Pin 13 <- button A2
        .b2     ( b [2]  ),  // Pin 14 <- button B2
        .a3     ( a [3]  )   // Pin 15 <- button A3
    );

endmodule
