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

module serializer_chips
(
    input  logic       clk,
    input  logic       load,
    input  logic [7:0] p,
    output logic       q6,
    output logic       q7,
    output logic       q8
);

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

    wire gnd = 1'b0;

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

    // U1: CD4014 8-stage shift register, parallel or serial in, serial out, pin 1 in column 14

    cd4014 i_u1
    (
        .p8              ( p [7] ),  // Pin 1 <- P8 wire, at GND on the breadboard
        .q6              ( q6    ),  // Pin 2 -> Q6
        .q8              ( q8    ),  // Pin 3 -> Q8
        .p4              ( p [3] ),  // Pin 4 <- P4 wire, at +5V on the breadboard
        .p3              ( p [2] ),  // Pin 5 <- P3 wire, at GND on the breadboard
        .p2              ( p [1] ),  // Pin 6 <- P2 wire, at +5V on the breadboard
        .p1              ( p [0] ),  // Pin 7 <- P1 wire, at +5V on the breadboard
        .parallel_serial ( load  ),  // Pin 9 <- button LOAD
        .clock           ( clk   ),  // Pin 10 <- 555 clock module
        .serial_in       ( gnd   ),  // Pin 11 <- GND
        .q7              ( q7    ),  // Pin 12 -> Q7
        .p5              ( p [4] ),  // Pin 13 <- P5 wire, at GND on the breadboard
        .p6              ( p [5] ),  // Pin 14 <- P6 wire, at GND on the breadboard
        .p7              ( p [6] )   // Pin 15 <- P7 wire, at +5V on the breadboard
    );

endmodule
