// Exercise B7, chip-level version: the chip and wires of schematic 2 and
// of the breadboard.  Same ports as seven_segment.sv.  The display and its
// resistors are not in the design: its outputs are the outputs of the 4511.
//
// Generated by tools/bb_lib.py from the checked breadboard wire list;
// change the layout in tools/bb_b7.py, not this file.  Synthesizable.

module seven_segment_chips
(
    input  logic [3:0] bcd,
    output logic [6:0] abcdefg
);

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

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

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

    // U1: CD4511 BCD-to-7-segment latch, decoder and driver, pin 1 in column 8

    cd4511 i_u1
    (
        .bcd_b        ( bcd [1]     ),  // Pin 1 <- button B
        .bcd_c        ( bcd [2]     ),  // Pin 2 <- button C
        .lamp_test_n  ( vdd         ),  // Pin 3 <- +5V
        .blank_n      ( vdd         ),  // Pin 4 <- +5V
        .latch_enable ( gnd         ),  // Pin 5 <- GND
        .bcd_d        ( bcd [3]     ),  // Pin 6 <- button D
        .bcd_a        ( bcd [0]     ),  // Pin 7 <- button A
        .seg_e        ( abcdefg [2] ),  // Pin 9 -> e
        .seg_d        ( abcdefg [3] ),  // Pin 10 -> d
        .seg_c        ( abcdefg [4] ),  // Pin 11 -> c
        .seg_b        ( abcdefg [5] ),  // Pin 12 -> b
        .seg_a        ( abcdefg [6] ),  // Pin 13 -> a
        .seg_g        ( abcdefg [0] ),  // Pin 14 -> g
        .seg_f        ( abcdefg [1] )   // Pin 15 -> f
    );

endmodule
