data/full_repos/permissive/115920613/rtl/led_and_key/led_and_key.v
1: b"%Error: data/full_repos/permissive/115920613/rtl/led_and_key/led_and_key.v:44: Cannot find file containing module: 'SB_IO'\n    SB_IO #(\n    ^~~~~\n        ... Looked in:\n             data/full_repos/permissive/115920613/rtl/led_and_key,data/full_repos/permissive/115920613/SB_IO\n             data/full_repos/permissive/115920613/rtl/led_and_key,data/full_repos/permissive/115920613/SB_IO.v\n             data/full_repos/permissive/115920613/rtl/led_and_key,data/full_repos/permissive/115920613/SB_IO.sv\n             SB_IO\n             SB_IO.v\n             SB_IO.sv\n             obj_dir/SB_IO\n             obj_dir/SB_IO.v\n             obj_dir/SB_IO.sv\n%Error: data/full_repos/permissive/115920613/rtl/led_and_key/led_and_key.v:74: Cannot find file containing module: 'tm1638'\n    tm1638 u_tm1638 (\n    ^~~~~~\n%Error: Exiting due to 2 error(s)\n"
module ledAndKey(
    input clk,
    input clk_en,
    input rst,

    input [3:0] display,
    input [7:0] digit1,
    input [7:0] digit2,
    input [7:0] digit3,
    input [7:0] digit4,
    input [7:0] digit5,
    input [7:0] digit6,
    input [7:0] digit7,
    input [7:0] digit8,
    input [7:0] leds,

    output reg [7:0] keys,

    output reg tm_cs,
    output tm_clk,
    inout  tm_dio
);

    localparam 
        HIGH    = 1'b1,
        LOW     = 1'b0;

    localparam [7:0]
        C_READ  = 8'b01000010,
        C_WRITE = 8'b01000000,
        C_DISP  = 8'b10001111,
        C_ADDR  = 8'b11000000;

    reg counter;
    reg [5:0] instruction_step;






    reg tm_rw;
    wire dio_in, dio_out;
    SB_IO #(
        .PIN_TYPE(6'b101001),
        .PULLUP(1'b1)
    ) tm_dio_io (
        .PACKAGE_PIN(tm_dio),
        .OUTPUT_ENABLE(tm_rw),
        .D_IN_0(dio_in),
        .D_OUT_0(dio_out)
    );













    reg tm_latch;
    wire busy;
    wire [7:0] tm_data, tm_in;
    reg [7:0] tm_out;

    assign tm_in = tm_data;
    assign tm_data = tm_rw ? tm_out : 8'hZZ;

    tm1638 u_tm1638 (
        .clk(clk),
        .clk_en(clk_en),
        .rst(rst),
        .data_latch(tm_latch),
        .data(tm_data),
        .rw(tm_rw),
        .busy(busy),
        .sclk(tm_clk),
        .dio_in(dio_in),
        .dio_out(dio_out)
    );

    always @(posedge clk) begin
        if (clk_en) begin
            if (rst) begin
                instruction_step <= 6'b0;
                tm_cs <= HIGH;
                tm_rw <= HIGH;

                counter <= 1'b0;
                keys <= 8'b0;

            end else begin
                if (counter && ~busy) begin
                    case (instruction_step)

                        1:  {tm_cs, tm_rw}     <= {LOW, HIGH};
                        2:  {tm_latch, tm_out} <= {HIGH, C_READ};
                        3:  {tm_latch, tm_rw}  <= {HIGH, LOW};


                        4:  {keys[7], keys[3]} <= {tm_in[0], tm_in[4]};
                        5:  {tm_latch}         <= {HIGH};
                        6:  {keys[6], keys[2]} <= {tm_in[0], tm_in[4]};
                        7:  {tm_latch}         <= {HIGH};
                        8:  {keys[5], keys[1]} <= {tm_in[0], tm_in[4]};
                        9:  {tm_latch}         <= {HIGH};
                        10: {keys[4], keys[0]} <= {tm_in[0], tm_in[4]};
                        11: {tm_cs}            <= {HIGH};


                        12: {tm_cs, tm_rw}     <= {LOW, HIGH};
                        13: {tm_latch, tm_out} <= {HIGH, C_WRITE};
                        14: {tm_cs}            <= {HIGH};

                        15: {tm_cs, tm_rw}     <= {LOW, HIGH};
                        16: {tm_latch, tm_out} <= {HIGH, C_ADDR};

                        17: {tm_latch, tm_out} <= {HIGH, digit1};
                        18: {tm_latch, tm_out} <= {HIGH, {7'b0, leds[7]}};

                        19: {tm_latch, tm_out} <= {HIGH, digit2};
                        20: {tm_latch, tm_out} <= {HIGH, {7'b0, leds[6]}};

                        21: {tm_latch, tm_out} <= {HIGH, digit3};
                        22: {tm_latch, tm_out} <= {HIGH, {7'b0, leds[5]}};

                        23: {tm_latch, tm_out} <= {HIGH, digit4};
                        24: {tm_latch, tm_out} <= {HIGH, {7'b0, leds[4]}};

                        25: {tm_latch, tm_out} <= {HIGH, digit5};
                        26: {tm_latch, tm_out} <= {HIGH, {7'b0, leds[3]}};

                        27: {tm_latch, tm_out} <= {HIGH, digit6};
                        28: {tm_latch, tm_out} <= {HIGH, {7'b0, leds[2]}};

                        29: {tm_latch, tm_out} <= {HIGH, digit7};
                        30: {tm_latch, tm_out} <= {HIGH, {7'b0, leds[1]}};

                        31: {tm_latch, tm_out} <= {HIGH, digit8};
                        32: {tm_latch, tm_out} <= {HIGH, {7'b0, leds[0]}};

                        33: {tm_cs}            <= {HIGH};

                        34: {tm_cs, tm_rw}     <= {LOW, HIGH};
                        35: {tm_latch, tm_out} <= {HIGH, {4'b1000, display}};
                        36: {tm_cs, instruction_step} <= {HIGH, 6'b0};

                    endcase

                    instruction_step <= instruction_step + 1;

                end else if (busy) begin


                    tm_latch <= LOW;
                end

                counter <= ~counter;
            end
        end
    end
endmodule
module ledAndKey(
    input clk,
    input clk_en,
    input rst,

    input [3:0] display,
    input [7:0] digit1,
    input [7:0] digit2,
    input [7:0] digit3,
    input [7:0] digit4,
    input [7:0] digit5,
    input [7:0] digit6,
    input [7:0] digit7,
    input [7:0] digit8,
    input [7:0] leds,

    output reg [7:0] keys,

    output reg tm_cs,
    output tm_clk,
    inout  tm_dio
);


    localparam 
        HIGH    = 1'b1,
        LOW     = 1'b0;

    localparam [7:0]
        C_READ  = 8'b01000010,
        C_WRITE = 8'b01000000,
        C_DISP  = 8'b10001111,
        C_ADDR  = 8'b11000000;

    reg counter;
    reg [5:0] instruction_step;






    reg tm_rw;
    wire dio_in, dio_out;
    SB_IO #(
        .PIN_TYPE(6'b101001),
        .PULLUP(1'b1)
    ) tm_dio_io (
        .PACKAGE_PIN(tm_dio),
        .OUTPUT_ENABLE(tm_rw),
        .D_IN_0(dio_in),
        .D_OUT_0(dio_out)
    );













    reg tm_latch;
    wire busy;
    wire [7:0] tm_data, tm_in;
    reg [7:0] tm_out;

    assign tm_in = tm_data;
    assign tm_data = tm_rw ? tm_out : 8'hZZ;

    tm1638 u_tm1638 (
        .clk(clk),
        .clk_en(clk_en),
        .rst(rst),
        .data_latch(tm_latch),
        .data(tm_data),
        .rw(tm_rw),
        .busy(busy),
        .sclk(tm_clk),
        .dio_in(dio_in),
        .dio_out(dio_out)
    );

    always @(posedge clk) begin
        if (clk_en) begin
            if (rst) begin
                instruction_step <= 6'b0;
                tm_cs <= HIGH;
                tm_rw <= HIGH;

                counter <= 1'b0;
                keys <= 8'b0;

            end else begin
                if (counter && ~busy) begin
                    case (instruction_step)

                        1:  {tm_cs, tm_rw}     <= {LOW, HIGH};
                        2:  {tm_latch, tm_out} <= {HIGH, C_READ};
                        3:  {tm_latch, tm_rw}  <= {HIGH, LOW};


                        4:  {keys[7], keys[3]} <= {tm_in[0], tm_in[4]};
                        5:  {tm_latch}         <= {HIGH};
                        6:  {keys[6], keys[2]} <= {tm_in[0], tm_in[4]};
                        7:  {tm_latch}         <= {HIGH};
                        8:  {keys[5], keys[1]} <= {tm_in[0], tm_in[4]};
                        9:  {tm_latch}         <= {HIGH};
                        10: {keys[4], keys[0]} <= {tm_in[0], tm_in[4]};
                        11: {tm_cs}            <= {HIGH};


                        12: {tm_cs, tm_rw}     <= {LOW, HIGH};
                        13: {tm_latch, tm_out} <= {HIGH, C_WRITE};
                        14: {tm_cs}            <= {HIGH};

                        15: {tm_cs, tm_rw}     <= {LOW, HIGH};
                        16: {tm_latch, tm_out} <= {HIGH, C_ADDR};

                        17: {tm_latch, tm_out} <= {HIGH, digit1};
                        18: {tm_latch, tm_out} <= {HIGH, {7'b0, leds[7]}};

                        19: {tm_latch, tm_out} <= {HIGH, digit2};
                        20: {tm_latch, tm_out} <= {HIGH, {7'b0, leds[6]}};

                        21: {tm_latch, tm_out} <= {HIGH, digit3};
                        22: {tm_latch, tm_out} <= {HIGH, {7'b0, leds[5]}};

                        23: {tm_latch, tm_out} <= {HIGH, digit4};
                        24: {tm_latch, tm_out} <= {HIGH, {7'b0, leds[4]}};

                        25: {tm_latch, tm_out} <= {HIGH, digit5};
                        26: {tm_latch, tm_out} <= {HIGH, {7'b0, leds[3]}};

                        27: {tm_latch, tm_out} <= {HIGH, digit6};
                        28: {tm_latch, tm_out} <= {HIGH, {7'b0, leds[2]}};

                        29: {tm_latch, tm_out} <= {HIGH, digit7};
                        30: {tm_latch, tm_out} <= {HIGH, {7'b0, leds[1]}};

                        31: {tm_latch, tm_out} <= {HIGH, digit8};
                        32: {tm_latch, tm_out} <= {HIGH, {7'b0, leds[0]}};

                        33: {tm_cs}            <= {HIGH};

                        34: {tm_cs, tm_rw}     <= {LOW, HIGH};
                        35: {tm_latch, tm_out} <= {HIGH, {4'b1000, display}};
                        36: {tm_cs, instruction_step} <= {HIGH, 6'b0};

                    endcase

                    instruction_step <= instruction_step + 1;

                end else if (busy) begin


                    tm_latch <= LOW;
                end

                counter <= ~counter;
            end
        end
    end
endmodule