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

Subversion Repositories i2s_to_wb

[/] [i2s_to_wb/] [trunk/] [sim/] [src/] [tb_top.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 qaztronic
// --------------------------------------------------------------------
2
//
3
// --------------------------------------------------------------------
4
 
5
`timescale 1ns/10ps
6
 
7
 
8
module tb_top();
9
 
10
  // --------------------------------------------------------------------
11
  // clock & reset
12
 
13
  parameter CLK_PERIOD = 54; // use ~18.4MHZ for main clk
14
 
15
  wire tb_clk;
16
  tb_clk #( .CLK_PERIOD(CLK_PERIOD) ) i_tb_clk ( tb_clk );
17
 
18
 
19
  wire tb_rst;
20
 
21
  tb_reset #( .ASSERT_TIME(CLK_PERIOD*10) ) i_tb_rst( tb_rst );
22
 
23
  initial
24
    begin
25
      $display("\n^^^---------------------------------");
26
      #(CLK_PERIOD/3);
27
      i_tb_rst.assert_reset();
28
    end
29
 
30
 
31
  // --------------------------------------------------------------------
32
  // system wires
33
 
34
 
35
 
36
// --------------------------------------------------------------------
37
// dut
38
  wire  [31:0]  wbs_tx_data_i;
39
  wire  [31:0]  wbs_tx_data_o;
40
  wire  [31:0]  wbs_tx_addr_i;
41
  wire  [3:0]   wbs_tx_sel_i;
42
  wire          wbs_tx_we_i;
43
  wire          wbs_tx_cyc_i;
44
  wire          wbs_tx_stb_i;
45
  wire          wbs_tx_ack_o;
46
  wire          wbs_tx_err_o;
47
  wire          wbs_tx_rty_o;
48
 
49
  wire          i2s_tx_sck;
50
  wire          i2s_tx_ws;
51
  wire          i2s_tx_sd;
52
 
53
  i2s_to_wb_top
54
    i_i2s_to_wb_top
55
    (
56
      .wbs_data_i(wbs_tx_data_i),
57
      .wbs_data_o(wbs_tx_data_o),
58
      .wbs_addr_i(wbs_tx_addr_i),
59
      .wbs_sel_i(wbs_tx_sel_i),
60
      .wbs_we_i(wbs_tx_we_i),
61
      .wbs_cyc_i(wbs_tx_cyc_i),
62
      .wbs_stb_i(wbs_tx_stb_i),
63
      .wbs_ack_o(wbs_tx_ack_o),
64
      .wbs_err_o(wbs_tx_err_o),
65
      .wbs_rty_o(wbs_tx_rty_o),
66
 
67
      .i2s_sck_i(i2s_tx_sck),
68
      .i2s_ws_i(i2s_tx_ws),
69
      .i2s_sd_o(i2s_tx_sd),
70
 
71
      .i2s_clk_i(tb_clk),
72
      .i2s_rst_i(tb_rst)
73
    );
74
 
75
 
76
  // --------------------------------------------------------------------
77
  // i2s_rx_bfm
78
  i2s_rx_bfm
79
    rx_bfm
80
    (
81
      .bfm_data_i(wbs_tx_data_o),
82
      .bfm_data_o(wbs_tx_data_i),
83
      .bfm_addr_i(wbs_tx_addr_i),
84
      .bfm_sel_i(wbs_tx_sel_i),
85
      .bfm_we_i(wbs_tx_we_i),
86
      .bfm_cyc_i(wbs_tx_cyc_i),
87
      .bfm_stb_i(wbs_tx_stb_i),
88
      .bfm_ack_o(wbs_tx_ack_o),
89
      .bfm_err_o(wbs_tx_err_o),
90
      .bfm_rty_o(wbs_tx_rty_o),
91
 
92
      .bfm_sck_o(i2s_tx_sck),
93
      .bfm_ws_o(i2s_tx_ws),
94
      .bfm_sck_i(i2s_tx_sck),
95
      .bfm_ws_i(i2s_tx_ws),
96
      .bfm_sd_i(i2s_tx_sd),
97
 
98
      .bfm_clk_i(tb_clk),
99
      .bfm_rst_i(tb_rst)
100
    );
101
 
102
 
103
  // --------------------------------------------------------------------
104
  //  wb_hi_master_model
105
  wb_master_model
106
    wbm
107
    (
108
      .clk(tb_clk),
109
      .rst(tb_rst),
110
      .adr(wbs_tx_addr_i),
111
      .din(wbs_tx_data_o),
112
      .dout(wbs_tx_data_i),
113
      .cyc(wbs_tx_cyc_i),
114
      .stb(wbs_tx_stb_i),
115
      .we(wbs_tx_we_i),
116
      .sel(wbs_tx_sel_i),
117
      .ack(wbs_tx_ack_o),
118
      .err(wbs_tx_err_o),
119
      .rty(wbs_tx_rty_o)
120
    );
121
 
122
 
123
// dut
124
// --------------------------------------------------------------------
125
 
126
 
127
// --------------------------------------------------------------------
128
// test 
129
 
130
  the_test test( tb_clk, tb_rst );
131
 
132
  initial
133
    begin
134
 
135
      wait( ~tb_rst );
136
 
137
      repeat(2) @(posedge tb_clk);
138
 
139
      test.run_the_test();
140
 
141
      $display("\n^^^---------------------------------");
142
      $display("^^^ %15.t | Testbench done.\n", $time);
143
 
144
      $stop();
145
 
146
    end
147
 
148
endmodule
149
 

powered by: WebSVN 2.1.0

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