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

Subversion Repositories wb_to_amba

[/] [wb_to_amba/] [trunk/] [sim/] [tests/] [debug/] [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
  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
      //     
43
      $display("\n^^^- \n");
44
 
45
      dut.i_bfm_ahb.bfm_ahb_read32( 32'h00000000, 1'b1, 32'h00000000 );
46
      dut.i_bfm_ahb.bfm_ahb_read32( 32'h00000004, 1'b1, 32'h11111111 );
47
      dut.i_bfm_ahb.bfm_ahb_read32( 32'h00000008, 1'b1, 32'h22222222 );
48
      dut.i_bfm_ahb.bfm_ahb_read32( 32'h0000000c, 1'b1, 32'h33333333 );
49
      dut.i_bfm_ahb.bfm_ahb_read32( 32'h00000010, 1'b1, 32'h44444444 );
50
      dut.i_bfm_ahb.bfm_ahb_read32( 32'h00000014, 1'b1, 32'h55555555 );
51
      dut.i_bfm_ahb.bfm_ahb_read32( 32'h00000018, 1'b1, 32'h66666666 );
52
      dut.i_bfm_ahb.bfm_ahb_read32( 32'h0000001c, 1'b1, 32'h77777777 );
53
 
54
      dut.i_bfm_ahb.bfm_ahb_write32( 32'h000000000, 32'habbabeef );
55
      dut.i_bfm_ahb.bfm_ahb_read32( 32'h00000000, 1'b1, 32'habbabeef );
56
 
57
      dut.i_bfm_ahb.bfm_ahb_write16( 32'h000000004, 16'habcd );
58
      dut.i_bfm_ahb.bfm_ahb_read16( 32'h00000004, 1'b1, 16'habcd );
59
 
60
      dut.i_bfm_ahb.bfm_ahb_write16( 32'h000000006, 16'h1234 );
61
      dut.i_bfm_ahb.bfm_ahb_read16( 32'h00000006, 1'b1, 16'h1234 );
62
 
63
      dut.i_bfm_ahb.bfm_ahb_read32( 32'h00000004, 1'b1, 32'h1234abcd );
64
 
65
      dut.i_bfm_ahb.bfm_ahb_write8( 32'h000000008, 8'ha1 );
66
      dut.i_bfm_ahb.bfm_ahb_read8( 32'h00000008, 1'b1, 8'ha1 );
67
 
68
      dut.i_bfm_ahb.bfm_ahb_write8( 32'h000000009, 8'hb2 );
69
      dut.i_bfm_ahb.bfm_ahb_read8( 32'h00000009, 1'b1, 8'hb2 );
70
 
71
      dut.i_bfm_ahb.bfm_ahb_write8( 32'h00000000a, 8'hc3 );
72
      dut.i_bfm_ahb.bfm_ahb_read8( 32'h0000000a, 1'b1, 8'hc3 );
73
 
74
      dut.i_bfm_ahb.bfm_ahb_write8( 32'h00000000b, 8'hd4 );
75
      dut.i_bfm_ahb.bfm_ahb_read8( 32'h0000000b, 1'b1, 8'hd4 );
76
 
77
      dut.i_bfm_ahb.bfm_ahb_read32( 32'h00000008, 1'b1, 32'hd4c3b2a1 );
78
 
79
      repeat(2) @(posedge tb_clk);
80
 
81
 
82
      if( dut.i_bfm_ahb.read_error )
83
        $display("-!- Read mismatch. Testbench Failed. %t.\n", $time);
84
 
85
      $display("\n^^^---------------------------------\n");
86
      $display("^^^- Testbench done. %t.\n", $time);
87
 
88
      $stop();
89
 
90
    end
91
 
92
endmodule
93
 

powered by: WebSVN 2.1.0

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