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

module decade_counter_chips
(
    input  logic       clk,
    input  logic       rst,
    output logic [9:0] q,
    output logic       carry_out
);

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

    wire gnd = 1'b0;

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

    // U1: CD4017 decade counter with 10 decoded outputs, pin 1 in column 10

    cd4017 i_u1
    (
        .q5            ( q [5]     ),  // Pin 1 -> Q5
        .q1            ( q [1]     ),  // Pin 2 -> Q1
        .q0            ( q [0]     ),  // Pin 3 -> Q0
        .q2            ( q [2]     ),  // Pin 4 -> Q2
        .q6            ( q [6]     ),  // Pin 5 -> Q6
        .q7            ( q [7]     ),  // Pin 6 -> Q7
        .q3            ( q [3]     ),  // Pin 7 -> Q3
        .q8            ( q [8]     ),  // Pin 9 -> Q8
        .q4            ( q [4]     ),  // Pin 10 -> Q4
        .q9            ( q [9]     ),  // Pin 11 -> Q9
        .carry_out     ( carry_out ),  // Pin 12 -> CO
        .clock_inhibit ( gnd       ),  // Pin 13 <- GND
        .clock         ( clk       ),  // Pin 14 <- 555 clock module
        .reset         ( rst       )   // Pin 15 <- button RESET
    );

endmodule
