⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 i2c_control_top_tf.tf

📁 IIC控制器的verilog实现
💻 TF
字号:


// TOOL:     vlog2tf
// DATE:     08/26/05  13:42:15 
// TITLE:    Lattice Semiconductor Corporation
// MODULE:   i2c_control_top
// DESIGN:   i2c_control_top
// FILENAME: i2c_control_top.tft
// PROJECT:  i2c_slave_top
// VERSION:  1.0
// This file is auto generated by the ispLEVER


`timescale 1 ns / 100 ps

// Define Module for Test Fixture
module i2c_control_top_tf();


parameter period = 40.0;
parameter half_period = 20.0;
parameter quarter_period = 10.0;
parameter hdelay = 5.0;

// Inputs
    reg reset_i;
    reg i2c_scl_i;
    reg [7:0] in_reg0;
    reg [7:0] in_reg1;


// Outputs
    wire [7:0] out_reg0;
    wire [7:0] out_reg1;
    wire [7:0] out_reg2;
    wire [7:0] out_reg3;
    wire [7:0] out_reg4;
    wire [7:0] out_reg5;


// Bidirs
    wire i2c_sda;
    
    reg i2c_sda_stim;
    
    assign i2c_sda = i2c_sda_stim;
    


// Instantiate the UUT
    i2c_control_top UUT (
        .reset_i(reset_i), 
        .i2c_scl_i(i2c_scl_i), 
        .i2c_sda(i2c_sda), 
        .in_reg0(in_reg0), 
        .in_reg1(in_reg1), 
        .out_reg0(out_reg0), 
        .out_reg1(out_reg1), 
        .out_reg2(out_reg2), 
        .out_reg3(out_reg3), 
        .out_reg4(out_reg4), 
        .out_reg5(out_reg5)
        );


// Initialize Inputs
// You can add your stimulus here
    initial begin
            reset_i = 0;
            i2c_scl_i = 1;
            in_reg0 = 8'h55;
            in_reg1 = 8'hAA;
            i2c_sda_stim = 1'b1;
    end
    
    initial begin
    	#(2 * period); reset_i = 1; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 0;
    	#(half_period);  i2c_scl_i = 1; #(half_period);  i2c_scl_i = 0;						// Address7
    	#(quarter_period); i2c_sda_stim = 1; #(quarter_period); i2c_scl_i = 1; #(quarter_period); i2c_scl_i = 1; // Address6
    	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // Address5
    	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // Address4
    	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // Address3
    	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // Address2
    	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 1; #(quarter_period); i2c_scl_i = 1; // Address1
    	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 1; #(quarter_period); i2c_scl_i = 1; // R/Wn read
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // ACK Header 
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // 
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 1'bZ; #(quarter_period); i2c_scl_i = 1; // Data7
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 1'bZ; #(quarter_period); i2c_scl_i = 1; // Data6
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 1'bZ; #(quarter_period); i2c_scl_i = 1; // Data5
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 1'bZ; #(quarter_period); i2c_scl_i = 1; // Data4
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 1'bZ; #(quarter_period); i2c_scl_i = 1; // Data3
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 1'bZ; #(quarter_period); i2c_scl_i = 1; // Data2
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 1'bZ; #(quarter_period); i2c_scl_i = 1; // Data1
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 1'bZ; #(quarter_period); i2c_scl_i = 1; // Data0 (8'HB3)
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // ACK Header
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // another clock
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // another clock
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // another clock
	#(quarter_period); i2c_sda_stim = 1; #(quarter_period); i2c_scl_i = 0; #(half_period); i2c_scl_i = 1; // stop
	#(5 * period); 
	#(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 0;
	#(half_period);  i2c_scl_i = 1; #(half_period);  i2c_scl_i = 0;						// Address7
    	#(quarter_period); i2c_sda_stim = 1; #(quarter_period); i2c_scl_i = 1; #(quarter_period); i2c_scl_i = 1; // Address6
    	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // Address5
    	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // Address4
    	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // Address3
    	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // Address2
    	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // Address1
    	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 1; #(quarter_period); i2c_scl_i = 1; // R/Wn read
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // ACK Header 
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // 
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 1'bZ; #(quarter_period); i2c_scl_i = 1; // Data7
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 1'bZ; #(quarter_period); i2c_scl_i = 1; // Data6
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 1'bZ; #(quarter_period); i2c_scl_i = 1; // Data5
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 1'bZ; #(quarter_period); i2c_scl_i = 1; // Data4
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 1'bZ; #(quarter_period); i2c_scl_i = 1; // Data3
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 1'bZ; #(quarter_period); i2c_scl_i = 1; // Data2
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 1'bZ; #(quarter_period); i2c_scl_i = 1; // Data1
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 1'bZ; #(quarter_period); i2c_scl_i = 1; // Data0 (8'HB3)
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // ACK Header
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // another clock
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // another clock
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // another clock
	#(quarter_period); i2c_sda_stim = 1; #(quarter_period); i2c_scl_i = 0; #(half_period); i2c_scl_i = 1; // stop
	#(5 * period); 
	
	#(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 0;
	#(half_period);  i2c_scl_i = 1; #(half_period);  i2c_scl_i = 0;						// Address7
    	#(quarter_period); i2c_sda_stim = 1; #(quarter_period); i2c_scl_i = 1; #(quarter_period); i2c_scl_i = 1;  // Address6
    	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1;   // Address5
    	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // Address4
    	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // Address3
    	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 1; #(quarter_period); i2c_scl_i = 1; // Address2
    	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 1; #(quarter_period); i2c_scl_i = 1; // Address1
    	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // R/Wn write
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // ACK Header 
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // 
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 1; #(quarter_period); i2c_scl_i = 1; // Data7
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 1; #(quarter_period); i2c_scl_i = 1; // Data6
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // Data5
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // Data4
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 1; #(quarter_period); i2c_scl_i = 1; // Data3
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 1; #(quarter_period); i2c_scl_i = 1; // Data2
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // Data1
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // Data0 (8'HB3)
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // ACK Header
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // another clock
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 1; #(quarter_period); i2c_scl_i = 1; // another clock
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 1; #(quarter_period); i2c_scl_i = 1; // another clock
	#(5 * period); 
	#(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 0;
	#(half_period);  i2c_scl_i = 1; #(half_period);  i2c_scl_i = 0;						// Address7
    	#(quarter_period); i2c_sda_stim = 1; #(quarter_period); i2c_scl_i = 1; #(quarter_period); i2c_scl_i = 1;  // Address6
    	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1;   // Address5
    	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // Address4
    	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 1; #(quarter_period); i2c_scl_i = 1; // Address3
    	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // Address2
    	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // Address1
    	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // R/Wn write
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // ACK Header 
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // 
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // Data7
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 1; #(quarter_period); i2c_scl_i = 1; // Data6
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // Data5
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // Data4
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // Data3
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 1; #(quarter_period); i2c_scl_i = 1; // Data2
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // Data1
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 1; #(quarter_period); i2c_scl_i = 1; // Data0 (8'HB3)
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // ACK Header
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 0; #(quarter_period); i2c_scl_i = 1; // another clock
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 1; #(quarter_period); i2c_scl_i = 1; // another clock
	#(half_period); i2c_scl_i = 0; #(quarter_period); i2c_sda_stim = 1; #(quarter_period); i2c_scl_i = 1; // another clock
	#(5 * period); 
	$stop;
	
	
    end
    

endmodule // i2c_control_top_tf

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -