OpenCores
URL https://opencores.org/ocsvn/i2c_to_wb/i2c_to_wb/trunk

Subversion Repositories i2c_to_wb

[/] [i2c_to_wb/] [trunk/] [sim/] [src/] [tb_dut.v] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 qaztronic
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
//// Copyright (C) 2009 Authors and OPENCORES.ORG                 ////
4
////                                                              ////
5
//// This source file may be used and distributed without         ////
6
//// restriction provided that this copyright statement is not    ////
7
//// removed from the file and that any derivative work contains  ////
8
//// the original copyright notice and the associated disclaimer. ////
9
////                                                              ////
10
//// This source file is free software; you can redistribute it   ////
11
//// and/or modify it under the terms of the GNU Lesser General   ////
12
//// Public License as published by the Free Software Foundation; ////
13
//// either version 2.1 of the License, or (at your option) any   ////
14
//// later version.                                               ////
15
////                                                              ////
16
//// This source is distributed in the hope that it will be       ////
17
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
18
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
19
//// PURPOSE.  See the GNU Lesser General Public License for more ////
20
//// details.                                                     ////
21
////                                                              ////
22
//// You should have received a copy of the GNU Lesser General    ////
23
//// Public License along with this source; if not, download it   ////
24
//// from http://www.opencores.org/lgpl.shtml                     ////
25
////                                                              ////
26
//////////////////////////////////////////////////////////////////////
27 2 qaztronic
 
28
 
29
`include "timescale.v"
30
 
31
 
32
module tb_dut(
33
                input tb_clk,
34
                input tb_rst
35
              );
36
 
37
 
38
  // --------------------------------------------------------------------
39
  // test bench variables
40
  reg test_it;
41
 
42
 
43
  // --------------------------------------------------------------------
44
  // wires
45
  wire i2c_data;
46
  wire i2c_clk;
47
 
48
 
49
  // --------------------------------------------------------------------
50
  //  async_mem_master
51
        pullup p1(i2c_data); // pullup scl line
52
        pullup p2(i2c_clk); // pullup sda line
53
 
54
  i2c_master_model
55
    i2c(
56
      .i2c_data(i2c_data),
57
      .i2c_clk(i2c_clk)
58
    );
59
 
60
 
61
  // --------------------------------------------------------------------
62
  //  i2c_to_wb_top
63
  wire i2c_data_out;
64
  wire i2c_clk_out;
65
  wire i2c_data_oe;
66
  wire i2c_clk_oe;
67 4 qaztronic
//   wire [31:0] wb_data_i = 32'hd4c3b2a1;
68
  wire [31:0] wb_data_i;
69 2 qaztronic
  wire [31:0] wb_data_o;
70
  wire [31:0] wb_addr_o;
71
  wire [3:0] wb_sel_o;
72
  wire wb_we_o;
73
  wire wb_cyc_o;
74
  wire wb_stb_o;
75 4 qaztronic
//   wire wb_ack_i = 1'b1;
76
//   wire wb_err_i = 1'b0;
77
//   wire wb_rty_i = 1'b0;
78
  wire wb_ack_i;
79
  wire wb_err_i;
80
  wire wb_rty_i;
81 2 qaztronic
 
82
  // tristate buffers
83
  assign i2c_data = i2c_data_oe ? i2c_data_out  : 1'bz;
84
  assign i2c_clk  = i2c_clk_oe  ? i2c_clk_out   : 1'bz;
85
 
86
  i2c_to_wb_top
87
    i_i2c_to_wb_top(
88
      .i2c_data_in(i2c_data),
89
      .i2c_clk_in(i2c_clk),
90
      .i2c_data_out(i2c_data_out),
91
      .i2c_clk_out(i2c_clk_out),
92
      .i2c_data_oe(i2c_data_oe),
93
      .i2c_clk_oe(i2c_clk_oe),
94 3 qaztronic
 
95 2 qaztronic
      .wb_data_i(wb_data_i),
96
      .wb_data_o(wb_data_o),
97 4 qaztronic
      .wb_addr_o(wb_addr_o[7:0]),
98 2 qaztronic
      .wb_sel_o(wb_sel_o),
99
      .wb_we_o(wb_we_o),
100
      .wb_cyc_o(wb_cyc_o),
101
      .wb_stb_o(wb_stb_o),
102
      .wb_ack_i(wb_ack_i),
103
      .wb_err_i(wb_err_i),
104
      .wb_rty_i(wb_rty_i),
105
 
106
      .wb_clk_i(tb_clk),
107
      .wb_rst_i(tb_rst)
108
  );
109
 
110
 
111
  // --------------------------------------------------------------------
112 4 qaztronic
  //  wb_slave_model
113
  wb_slave_model #(.DWIDTH(32), .AWIDTH(8), .ACK_DELAY(0), .SLAVE_RAM_INIT("wb_slave_32_bit.txt") )
114
    i_wb_slave_model(
115
      .clk_i(tb_clk),
116
      .rst_i(tb_rst),
117
      .dat_o(wb_data_i),
118
      .dat_i(wb_data_o),
119
      .adr_i(wb_addr_o),
120
      .cyc_i(wb_cyc_o),
121
      .stb_i(wb_stb_o),
122
      .we_i(wb_we_o),
123
      .sel_i(wb_sel_o),
124
      .ack_o(wb_ack_i),
125
      .err_o(wb_err_i),
126
      .rty_o(wb_rty_i)
127
    );
128
 
129
 
130
  // --------------------------------------------------------------------
131 2 qaztronic
  //  glitch_generator 
132
  glitch_generator i_g1( i2c_data );
133
  glitch_generator i_g2( i2c_clk );
134
 
135
 
136
  // --------------------------------------------------------------------
137
  //  outputs
138
 
139
 
140
 
141
endmodule
142
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.