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

Subversion Repositories wb_lpc

[/] [wb_lpc/] [trunk/] [sim/] [serirq_sim/] [tb_serirq_top.v] - Blame information for rev 13

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

Line No. Rev Author Line
1 13 hharte
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  tb_serirq_top.v                                             ////
4
////                                                              ////
5
////  This file is part of the Wishbone LPC Bridge project        ////
6
////  http://www.opencores.org/projects/wb_lpc/                   ////
7
////                                                              ////
8
////  Author:                                                     ////
9
////      - Howard M. Harte (hharte@opencores.org)                ////
10
////                                                              ////
11
//////////////////////////////////////////////////////////////////////
12
////                                                              ////
13
//// Copyright (C) 2008 Howard M. Harte                           ////
14
////                                                              ////
15
//// This source file may be used and distributed without         ////
16
//// restriction provided that this copyright statement is not    ////
17
//// removed from the file and that any derivative work contains  ////
18
//// the original copyright notice and the associated disclaimer. ////
19
////                                                              ////
20
//// This source file is free software; you can redistribute it   ////
21
//// and/or modify it under the terms of the GNU Lesser General   ////
22
//// Public License as published by the Free Software Foundation; ////
23
//// either version 2.1 of the License, or (at your option) any   ////
24
//// later version.                                               ////
25
////                                                              ////
26
//// This source is distributed in the hope that it will be       ////
27
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
28
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
29
//// PURPOSE.  See the GNU Lesser General Public License for more ////
30
//// details.                                                     ////
31
////                                                              ////
32
//// You should have received a copy of the GNU Lesser General    ////
33
//// Public License along with this source; if not, download it   ////
34
//// from http://www.opencores.org/lgpl.shtml                     ////
35
////                                                              ////
36
//////////////////////////////////////////////////////////////////////
37
 
38
`timescale 1 ns / 1 ns
39
 
40
`include "../../rtl/verilog/serirq_defines.v"
41
 
42
// Define Module for Test Fixture
43
module serirq_host_bench();
44
 
45
// SERIRQ Host Inputs
46
    reg clk_i;
47
    reg nrst_i;
48
    reg serirq_mode;
49
// SERIRQ Host Outputs
50
    wire serirq_o;
51
    wire serirq_oe;
52
    wire [31:0] irq_o;
53
// Bidirs
54
    wire serirq;
55
 
56
// SERIRQ Slave
57
    wire slave_serirq_o;
58
    wire slave_serirq_oe;
59
 
60
    reg [31:0] irq_i;
61
 
62
task Reset;
63
begin
64
    nrst_i = 1; # 1000;
65
    nrst_i = 0; # 1000;
66
    nrst_i = 1; # 1000;
67
end
68
endtask
69
 
70
   always begin
71
       #50 clk_i = 0;
72
       #50 clk_i = 1;
73
   end
74
 
75
// Instantiate the UUT
76
    serirq_host UUT_Serirq_Host (
77
        .clk_i(clk_i),
78
        .nrst_i(nrst_i),
79
        .serirq_mode_i(serirq_mode),
80
        .irq_o(irq_o),
81
        .serirq_o(serirq_o),
82
        .serirq_i(serirq),
83
        .serirq_oe(serirq_oe)
84
        );
85
 
86
// Instantiate the UUT Slave
87
    serirq_slave UUT_Serirq_Slave (
88
        .clk_i(clk_i),
89
        .nrst_i(nrst_i),
90
        .irq_i(irq_i),
91
        .serirq_o(slave_serirq_o),
92
        .serirq_i(serirq),
93
        .serirq_oe(slave_serirq_oe)
94
        );
95
 
96
assign serirq = (serirq_oe ? serirq_o : (slave_serirq_oe ? slave_serirq_o : 1'bz));
97
 
98
// Initialize Inputs
99
    initial begin
100
//      $monitor("Time: %d clk_i=%b",
101
//          $time, clk_i);
102
            clk_i = 0;
103
            nrst_i = 1;
104
                irq_i = 32'hA5a51234;
105
                serirq_mode = `SERIRQ_MODE_CONTINUOUS;
106
 
107
    Reset();
108
 
109
    $display($time, " Testing SERIRQ Accesses in Continuous mode.");
110
    # 40000;
111
 
112
    if(irq_i != irq_o) begin
113
        $display($time, " Error, irq_i: expected %x, got %x", irq_i, irq_o); $stop(1);
114
    end
115
 
116
    irq_i = 32'h5a5a4321;
117
    $display($time, " Testing SERIRQ Accesses, Switch to Quiet Mode");
118
 
119
    serirq_mode = `SERIRQ_MODE_QUIET;
120
    # 40000;
121
 
122
    if(irq_i != irq_o) begin
123
        $display($time, " Error, irq_i: expected %x, got %x", irq_i, irq_o); $stop(1);
124
    end
125
 
126
    irq_i = 32'h5555aaaa;
127
    $display($time, " Slave should start serirq sequence");
128
 
129
    # 15000;
130
 
131
    irq_i = 32'ha5a5a5a5;
132
    $display($time, " Testing SERIRQ Accesses");
133
    # 40000;
134
 
135
    $display($time, " Switch back to Continuous");
136
    serirq_mode = `SERIRQ_MODE_CONTINUOUS;
137
 
138
    # 80000;
139
 
140
    if(irq_i != irq_o) begin
141
        $display($time, " Error, irq_i: expected %x, got %x", irq_i, irq_o); $stop(1);
142
    end
143
 
144
    $display($time, " Simulation passed"); $stop(1);
145
 
146
end
147
 
148
endmodule // serirq_tb

powered by: WebSVN 2.1.0

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