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

Subversion Repositories wb_z80

[/] [wb_z80/] [trunk/] [rtl/] [z80_testbed.v] - Blame information for rev 32

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

Line No. Rev Author Line
1 22 bporcella
///////////////////////////////////////////////////////////////////////////////////////////////////
2
////                                                                                           ////
3
////  file name:   z80_testbed.v                                                               ////
4
////  description: testbed for Wishbone z80                                                    ////
5
////  project:     wb_z80                                                                      ////
6
////                                                                                           ////
7
////                                                                                           ////
8
////  Author: B.J. Porcella                                                                    ////
9
////          bporcella@sbcglobal.net                                                          ////
10
////                                                                                           ////
11
////                                                                                           ////
12
////                                                                                           ////
13
///////////////////////////////////////////////////////////////////////////////////////////////////
14
////                                                                                           ////
15
//// Copyright (C) 2000-2002 B.J. Porcella                                                     ////
16
////                         Real Time Solutions                                               ////
17
////                                                                                           ////
18
////                                                                                           ////
19
//// This source file may be used and distributed without                                      ////
20
//// restriction provided that this copyright statement is not                                 ////
21
//// removed from the file and that any derivative work contains                               ////
22
//// the original copyright notice and the associated disclaimer.                              ////
23
////                                                                                           ////
24
////     THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY                                   ////
25
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED                                 ////
26
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS                                 ////
27
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR                                    ////
28
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,                                       ////
29
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES                                  ////
30
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE                                 ////
31
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR                                      ////
32
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF                                ////
33
//// LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT                                ////
34
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT                                ////
35
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE                                       ////
36
//// POSSIBILITY OF SUCH DAMAGE.                                                               ////
37
////                                                                                           ////
38
///////////////////////////////////////////////////////////////////////////////////////////////////
39
//  CVS Log
40
//
41 32 bporcella
//  $Id: z80_testbed.v,v 1.5 2007-10-02 20:25:12 bporcella Exp $
42 22 bporcella
//
43 32 bporcella
//  $Date: 2007-10-02 20:25:12 $
44
//  $Revision: 1.5 $
45 22 bporcella
//  $Author: bporcella $
46
//  $Locker:  $
47
//  $State: Exp $
48
//
49
// Change History:
50
//      $Log: not supported by cvs2svn $
51 32 bporcella
//      Revision 1.4  2004/05/27 14:25:04  bporcella
52
//      Instruction test (with interrupts) runs!!!
53
//
54 27 bporcella
//      Revision 1.3  2004/05/21 02:51:25  bporcella
55
//      inst test  got to the worked macro
56
//
57 26 bporcella
//      Revision 1.2  2004/05/18 22:31:21  bporcella
58
//      instruction test getting to final stages
59
//
60 25 bporcella
//      Revision 1.1  2004/05/13 14:57:35  bporcella
61
//      testbed files
62
//
63 22 bporcella
//      Revision 1.1.1.1  2004/04/13 23:47:42  bporcella
64
//      import first files
65
//
66
//
67
//
68
//-------1---------2---------3--------Module Name and Port List------7---------8---------9--------0
69
 
70
 
71
`timescale 1ns/10ps
72
`define  COMPILE_BIST   // need this for this file to work
73
 
74
// testbench - do not synthesize.  this just sequences the bist signals
75
module z80_testbed();
76
 
77
reg      rst, bist_req, clk;
78
wire     bist_ack;
79
wire     bist_err;
80
 
81
 
82
 
83
//-------   CAUTION  TEST RESULTS DEPEND ON INITIAL CONDITIONS -------
84 32 bporcella
//  bist will not pass if some of these inputs are not as specified.
85 22 bporcella
//
86
z80_core_top i_z80_core_top(
87 27 bporcella
    .wb_dat_o(),
88
    .wb_stb_o(),
89
    .wb_cyc_o(),
90
    .wb_we_o(),
91
    .wb_adr_o(),
92
    .wb_tga_o(),
93
    .wb_ack_i(1'b0),
94 22 bporcella
    .wb_clk_i(clk),
95 27 bporcella
    .wb_dat_i(8'h0),
96 22 bporcella
    .wb_rst_i(rst),
97
    .bist_ack_o(bist_ack),
98
    .bist_err_o(bist_err),
99
    .bist_req_i(bist_req),
100 27 bporcella
    .int_req_i(1'b0)        //  
101 22 bporcella
    );
102
 
103
 
104
initial
105
begin
106
    clk = 0;
107
    //  timeout if u hang up  -- always a good idea.
108 25 bporcella
    #500000     $finish;
109 22 bporcella
    $display("simulation timeout");
110
end
111
 
112
always   #5 clk = ~clk;
113
 
114
// The bist sequencer  --- pertty trivial
115
initial
116
begin
117
    rst = 1'b0;
118
    bist_req = 1'b0;
119
    @( posedge clk)  rst = 1'b1;
120
    @( posedge clk)  rst = 1'b0;
121
    @( posedge clk)  bist_req = 1'b1;
122
    @( bist_ack ) ;
123
    @( posedge clk)
124 27 bporcella
        if ( bist_err ) $display("TB bist error");
125
        else            $display( "TB bist ok"    );
126 22 bporcella
    $finish;
127
end
128
 
129
 
130
initial
131
begin
132
    $dumpfile("dump.vcd");
133
    $dumpvars;
134
end
135
 
136
endmodule

powered by: WebSVN 2.1.0

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