simple_interface_tb.v 886 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
`default_nettype none

module top;

    reg [7:0] dataIn;
    wire [31:0] dataOut;

    reg clock, clear;

    Device dut(
        .dataIn(dataIn),
        .dataOut(dataOut),
        .clock(clock),
        .clear(clear)
    );

    // Just some random test bench code to make sure it works as expected
    initial begin
        clock = 1;
        forever #5 clock = ~clock;
    end

    initial begin
        $monitor($time," dataIn: %h dataOut: %h shift: %b", dataIn, dataOut, dut.consumer.local_shift);
        clear <= 1'b1;
        dataIn <= 8'h0;
        repeat(5) @(posedge clock);
        clear <= 1'b0;
        @(posedge clock);
        dataIn <= 8'h44;
        @(posedge clock);
        dataIn <= 8'h77;
        @(posedge clock);
        dataIn <= 8'h11;
        @(posedge clock);
        dataIn <= 8'h0;
        repeat(5) @(posedge clock);
        $finish;
    end

endmodule