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 27

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 27 bporcella
//  $Id: z80_testbed.v,v 1.4 2004-05-27 14:25:04 bporcella Exp $
42 22 bporcella
//
43 27 bporcella
//  $Date: 2004-05-27 14:25:04 $
44
//  $Revision: 1.4 $
45 22 bporcella
//  $Author: bporcella $
46
//  $Locker:  $
47
//  $State: Exp $
48
//
49
// Change History:
50
//      $Log: not supported by cvs2svn $
51 27 bporcella
//      Revision 1.3  2004/05/21 02:51:25  bporcella
52
//      inst test  got to the worked macro
53
//
54 26 bporcella
//      Revision 1.2  2004/05/18 22:31:21  bporcella
55
//      instruction test getting to final stages
56
//
57 25 bporcella
//      Revision 1.1  2004/05/13 14:57:35  bporcella
58
//      testbed files
59
//
60 22 bporcella
//      Revision 1.1.1.1  2004/04/13 23:47:42  bporcella
61
//      import first files
62
//
63
//
64
//
65
//-------1---------2---------3--------Module Name and Port List------7---------8---------9--------0
66
 
67
 
68
`timescale 1ns/10ps
69
`define  COMPILE_BIST   // need this for this file to work
70
 
71
// testbench - do not synthesize.  this just sequences the bist signals
72
module z80_testbed();
73
 
74
reg      rst, bist_req, clk;
75
wire     bist_ack;
76
wire     bist_err;
77
 
78
 
79
 
80
//-------   CAUTION  TEST RESULTS DEPEND ON INITIAL CONDITIONS -------
81
//  bist will not pass if some of these imputs are not as specified.
82
//
83
z80_core_top i_z80_core_top(
84 27 bporcella
    .wb_dat_o(),
85
    .wb_stb_o(),
86
    .wb_cyc_o(),
87
    .wb_we_o(),
88
    .wb_adr_o(),
89
    .wb_tga_o(),
90
    .wb_ack_i(1'b0),
91 22 bporcella
    .wb_clk_i(clk),
92 27 bporcella
    .wb_dat_i(8'h0),
93 22 bporcella
    .wb_rst_i(rst),
94
    .bist_ack_o(bist_ack),
95
    .bist_err_o(bist_err),
96
    .bist_req_i(bist_req),
97 27 bporcella
    .int_req_i(1'b0)        //  
98 22 bporcella
    );
99
 
100
 
101
initial
102
begin
103
    clk = 0;
104
    //  timeout if u hang up  -- always a good idea.
105 25 bporcella
    #500000     $finish;
106 22 bporcella
    $display("simulation timeout");
107
end
108
 
109
always   #5 clk = ~clk;
110
 
111
// The bist sequencer  --- pertty trivial
112
initial
113
begin
114
    rst = 1'b0;
115
    bist_req = 1'b0;
116
    @( posedge clk)  rst = 1'b1;
117
    @( posedge clk)  rst = 1'b0;
118
    @( posedge clk)  bist_req = 1'b1;
119
    @( bist_ack ) ;
120
    @( posedge clk)
121 27 bporcella
        if ( bist_err ) $display("TB bist error");
122
        else            $display( "TB bist ok"    );
123 22 bporcella
    $finish;
124
end
125
 
126
 
127
initial
128
begin
129
    $dumpfile("dump.vcd");
130
    $dumpvars;
131
end
132
 
133
endmodule

powered by: WebSVN 2.1.0

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