testbench.v 715 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
module testbench;
    reg en;

    initial begin
        // $dumpfile("testbench.vcd");
        // $dumpvars(0, testbench);

        #5 en = 0;
        repeat (10000) begin
            #5 en = 1;
            #5 en = 0;
        end

        $display("OKAY");    
    end
   
    
18 19 20
    reg dinA = 0;
    wire [1:0] dioB;    
    wire [1:0] doutC;
21 22 23 24

    top uut (
        .en (en ),
        .a (dinA ),
25 26
        .b (dioB ),
        .c (doutC )
27 28
    );
    
29 30 31 32
    always @(posedge en) begin
    #3;
    dinA <= !dinA;
    end
33
	
34
	assert_dff b_test(.clk(en), .test(dinA), .pat(dioB[0]));
35
	
36
	assert_dff c_test(.clk(en), .test(dinA), .pat(doutC[0]));
37
	
38
	assert_dff cz_test(.clk(!en), .test(1'bZ), .pat(doutC[0]));
39 40
    
endmodule