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

Subversion Repositories wb_size_bridge

[/] [wb_size_bridge/] [trunk/] [tb/] [test/] [debug/] [tb_top.v] - Blame information for rev 5

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 qaztronic
// --------------------------------------------------------------------
2
//
3
// --------------------------------------------------------------------
4
 
5
`timescale 1ns/10ps
6
 
7
 
8
module tb_top();
9
 
10
  parameter CLK_PERIOD = 10;
11
 
12
  reg tb_clk, tb_rst;
13
 
14
  initial
15
    begin
16
      tb_clk <= 1'b1;
17
      tb_rst <= 1'b1;
18
 
19
      #(CLK_PERIOD); #(CLK_PERIOD/3);
20
      tb_rst = 1'b0;
21
 
22
    end
23
 
24
  always
25
    #(CLK_PERIOD/2) tb_clk = ~tb_clk;
26
 
27
// --------------------------------------------------------------------
28
// tb_dut
29
  tb_dut dut( tb_clk, tb_rst );
30
 
31
 
32
// --------------------------------------------------------------------
33
// insert test below
34
 
35
  initial
36
    begin
37
 
38
      wait( ~tb_rst );
39
 
40
      repeat(2) @(posedge tb_clk);
41
 
42
      // 8 bit if    
43
      $display("\n^^^- testing 8 bit interface\n");
44
 
45
      dut.wbm.wb_cmp(0, 0, 32'h6000_0000, 32'h3322_1100);
46
      dut.wbm.wb_cmp(0, 0, 32'h6000_0004, 32'h7766_5544);
47
      dut.wbm.wb_cmp(0, 0, 32'h6000_0008, 32'hbbaa_9988);
48
      dut.wbm.wb_cmp(0, 0, 32'h6000_000c, 32'hffee_ddcc);
49
 
50
      dut.wbm.wb_write(0, 0, 32'h6000_0010, 32'habba_beef);
51
      dut.wbm.wb_write(0, 0, 32'h6000_0014, 32'h1a2b_3c4d);
52
      dut.wbm.wb_write(0, 0, 32'h6000_0018, 32'hcafe_1a7e);
53
      dut.wbm.wb_write(0, 0, 32'h6000_001c, 32'h5a5a_0f0f);
54
 
55
      dut.wbm.wb_cmp(0, 0, 32'h6000_0010, 32'habba_beef);
56
      dut.wbm.wb_cmp(0, 0, 32'h6000_0014, 32'h1a2b_3c4d);
57
      dut.wbm.wb_cmp(0, 0, 32'h6000_0018, 32'hcafe_1a7e);
58
      dut.wbm.wb_cmp(0, 0, 32'h6000_001c, 32'h5a5a_0f0f);
59
 
60
      dut.wbm.wb_write_sel(0, 0, 4'b0001, 32'h6000_0010, 32'hxxxx_xx00);
61
      dut.wbm.wb_write_sel(0, 0, 4'b0010, 32'h6000_0014, 32'hxxxx_11xx);
62
      dut.wbm.wb_write_sel(0, 0, 4'b0100, 32'h6000_0018, 32'hxx22_xxxx);
63
      dut.wbm.wb_write_sel(0, 0, 4'b1000, 32'h6000_001c, 32'h33xx_xxxx);
64
 
65
      dut.wbm.wb_cmp_sel(0, 0, 4'b0001, 32'h6000_0010, 32'hxxxx_xx00);
66
      dut.wbm.wb_cmp_sel(0, 0, 4'b0010, 32'h6000_0014, 32'hxxxx_11xx);
67
      dut.wbm.wb_cmp_sel(0, 0, 4'b0100, 32'h6000_0018, 32'hxx22_xxxx);
68
      dut.wbm.wb_cmp_sel(0, 0, 4'b1000, 32'h6000_001c, 32'h33xx_xxxx);
69
 
70
      dut.wbm.wb_write_sel(0, 0, 4'b0011, 32'h6000_0000, 32'hxxxx_0ab1);
71
      dut.wbm.wb_write_sel(0, 0, 4'b1100, 32'h6000_0004, 32'h2cd3_xxxx);
72
      dut.wbm.wb_write_sel(0, 0, 4'b0011, 32'h6000_0008, 32'hxxxx_4ef5);
73
      dut.wbm.wb_write_sel(0, 0, 4'b1100, 32'h6000_000c, 32'h0f0f_xxxx);
74
 
75
      dut.wbm.wb_cmp_sel(0, 0, 4'b0011, 32'h6000_0000, 32'hxxxx_0ab1);
76
      dut.wbm.wb_cmp_sel(0, 0, 4'b1100, 32'h6000_0004, 32'h2cd3_xxxx);
77
      dut.wbm.wb_cmp_sel(0, 0, 4'b0011, 32'h6000_0008, 32'hxxxx_4ef5);
78
      dut.wbm.wb_cmp_sel(0, 0, 4'b1100, 32'h6000_000c, 32'h0f0f_xxxx);
79
 
80
      // 16 bit if
81
      $display("\n^^^- testing 16 bit interface\n");
82
 
83
      dut.wbm.wb_cmp(0, 0, 32'ha000_0000, 32'h3322_1100);
84
      dut.wbm.wb_cmp(0, 0, 32'ha000_0004, 32'h7766_5544);
85
      dut.wbm.wb_cmp(0, 0, 32'ha000_0008, 32'hbbaa_9988);
86
      dut.wbm.wb_cmp(0, 0, 32'ha000_000c, 32'hffee_ddcc);
87
 
88
      dut.wbm.wb_write(0, 0, 32'ha000_0010, 32'habba_beef);
89
      dut.wbm.wb_write(0, 0, 32'ha000_0014, 32'h1a2b_3c4d);
90
      dut.wbm.wb_write(0, 0, 32'ha000_0018, 32'hcafe_1a7e);
91
      dut.wbm.wb_write(0, 0, 32'ha000_001c, 32'h5a5a_0f0f);
92
 
93
      dut.wbm.wb_cmp(0, 0, 32'ha000_0010, 32'habba_beef);
94
      dut.wbm.wb_cmp(0, 0, 32'ha000_0014, 32'h1a2b_3c4d);
95
      dut.wbm.wb_cmp(0, 0, 32'ha000_0018, 32'hcafe_1a7e);
96
      dut.wbm.wb_cmp(0, 0, 32'ha000_001c, 32'h5a5a_0f0f);
97
 
98
      dut.wbm.wb_write_sel(0, 0, 4'b0011, 32'ha000_0000, 32'hxxxx_0ab1);
99
      dut.wbm.wb_write_sel(0, 0, 4'b1100, 32'ha000_0004, 32'h2cd3_xxxx);
100
      dut.wbm.wb_write_sel(0, 0, 4'b0011, 32'ha000_0008, 32'hxxxx_4ef5);
101
      dut.wbm.wb_write_sel(0, 0, 4'b1100, 32'ha000_000c, 32'h0f0f_xxxx);
102
 
103
      dut.wbm.wb_cmp_sel(0, 0, 4'b0011, 32'ha000_0000, 32'hxxxx_0ab1);
104
      dut.wbm.wb_cmp_sel(0, 0, 4'b1100, 32'ha000_0004, 32'h2cd3_xxxx);
105
      dut.wbm.wb_cmp_sel(0, 0, 4'b0011, 32'ha000_0008, 32'hxxxx_4ef5);
106
      dut.wbm.wb_cmp_sel(0, 0, 4'b1100, 32'ha000_000c, 32'h0f0f_xxxx);
107
 
108
      dut.wbm.wb_write_sel(0, 0, 4'b0001, 32'h0000_0010, 32'hxxxx_xx00);
109
      dut.wbm.wb_write_sel(0, 0, 4'b0010, 32'h0000_0014, 32'hxxxx_11xx);
110
      dut.wbm.wb_write_sel(0, 0, 4'b0100, 32'h0000_0018, 32'hxx22_xxxx);
111
      dut.wbm.wb_write_sel(0, 0, 4'b1000, 32'h0000_001c, 32'h33xx_xxxx);
112
 
113
      dut.wbm.wb_cmp_sel(0, 0, 4'b0001, 32'h0000_0010, 32'hxxxx_xx00);
114
      dut.wbm.wb_cmp_sel(0, 0, 4'b0010, 32'h0000_0014, 32'hxxxx_11xx);
115
      dut.wbm.wb_cmp_sel(0, 0, 4'b0100, 32'h0000_0018, 32'hxx22_xxxx);
116
      dut.wbm.wb_cmp_sel(0, 0, 4'b1000, 32'h0000_001c, 32'h33xx_xxxx);
117
 
118
      // do illegal byte boundary access
119
      $display("\n^^^- testing illegal byte boundary access\n");
120
      dut.wbm.wb_write_sel(0, 0, 4'b0110, 32'ha000_0020, 32'hxxba_adxx);
121
 
122
      repeat(2) @(posedge tb_clk);
123
 
124
      $display("\n^^^---------------------------------\n");
125
      $display("^^^- Testbench done. %t.\n", $time);
126
 
127
      $stop();
128
 
129
    end
130
 
131
endmodule
132
 

powered by: WebSVN 2.1.0

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