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

Subversion Repositories wb_z80

[/] [wb_z80/] [trunk/] [rtl/] [z80_core_top.v] - Blame information for rev 25

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

Line No. Rev Author Line
1 17 bporcella
///////////////////////////////////////////////////////////////////////////////////////////////
2
////                                                                                           
3
////  file name:   z80_core_top.v                                                                   
4
////  description: interconnect module for z80 core.                                          
5
////  project:     wb_z80                                                                                       ////
6
////                                                                                           
7
////  Author: B.J. Porcella                                                                    
8
////          bporcella@sbcglobal.net                                                          
9
////                                                                                           
10
////                                                                                           
11
////                                                                                           
12
///////////////////////////////////////////////////////////////////////////////////////////////
13
////                                                                                           
14
//// Copyright (C) 2000-2002 B.J. Porcella                                                     
15
////                         Real Time Solutions                                               
16
////                                                                                           
17
////                                                                                           
18
//// This source file may be used and distributed without                                      
19
//// restriction provided that this copyright statement is not                                 
20
//// removed from the file and that any derivative work contains                               
21
//// the original copyright notice and the associated disclaimer.                              
22
////                                                                                           
23
////     THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY                                   
24
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED                                 
25
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS                                 
26
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR                                    
27
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,                                       
28
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES                                  
29
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE                                 
30
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR                                      
31
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF                                
32
//// LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT                                
33
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT                                
34
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE                                       
35
//// POSSIBILITY OF SUCH DAMAGE.                                                               
36
////                                                                                           
37
///////////////////////////////////////////////////////////////////////////////////////////////
38
//  CVS Log
39
//
40 25 bporcella
//  $Id: z80_core_top.v,v 1.4 2004-05-18 22:31:21 bporcella Exp $
41 17 bporcella
//
42 25 bporcella
//  $Date: 2004-05-18 22:31:21 $
43
//  $Revision: 1.4 $
44 17 bporcella
//  $Author: bporcella $
45
//  $Locker:  $
46
//  $State: Exp $
47
//
48
// Change History:
49
//      $Log: not supported by cvs2svn $
50 25 bporcella
//      Revision 1.3  2004/05/13 14:58:53  bporcella
51
//      testbed built and verification in progress
52
//
53 23 bporcella
//      Revision 1.2  2004/04/27 21:38:22  bporcella
54
//      test lint on core
55
//
56 18 bporcella
//      Revision 1.1  2004/04/27 21:27:13  bporcella
57
//      first core build
58
//
59 17 bporcella
//      Revision 1.1.1.1  2004/04/13 23:47:42  bporcella
60
//      import first files
61
//
62
//
63
//
64
// connects modules:
65
//  memstate2.v       // main state machine for z8 
66
//  inst_exec.v       // main execution engine for z80
67
//  generic_spram.v   // main memory  (on board)
68
//  z80_sdram_config.v // fundamentally wishbone glue logic - not on top per design guidelines
69 18 bporcella
//  add a comment test lint
70 17 bporcella
//-------1---------2---------3--------Module Name and Port List------7---------8---------9--------0
71 23 bporcella
module z80_core_top(
72
                      wb_dat_o,
73 17 bporcella
                      wb_stb_o,
74
                      wb_cyc_o,
75
                      wb_we_o,
76
                      wb_adr_o,
77
                      wb_tga_o,
78
                      wb_ack_i,
79
                      wb_clk_i,
80
                      wb_dat_i,
81 23 bporcella
                      wb_rst_i,
82
`ifdef COMPILE_BIST
83
                      bist_ack_o,
84
                      bist_err_o,
85 17 bporcella
                      bist_req_i,
86 23 bporcella
`endif
87 17 bporcella
                      int_req_i
88
 
89
);
90
 
91
//-------1---------2---------3--------Output Ports---------6---------7---------8---------9--------0
92
 
93
output [7:0]    wb_dat_o;
94
output          wb_stb_o;
95
output          wb_cyc_o;
96
output          wb_we_o;
97
output [15:0]   wb_adr_o;
98
output [1:0]    wb_tga_o;
99
 
100
 
101
//-------1---------2---------3--------Input Ports----------6---------7---------8---------9--------0
102
 
103
input           wb_ack_i;
104
input           wb_clk_i;
105
input  [7:0]    wb_dat_i;
106 23 bporcella
input           wb_rst_i;
107 17 bporcella
input           int_req_i;
108
 
109
 
110 23 bporcella
`ifdef COMPILE_BIST
111
output          bist_err_o;
112
output          bist_ack_o;
113
input           bist_req_i;
114
`endif
115
 
116
 
117 17 bporcella
//-------1---------2---------3--------Parameters-----------6---------7---------8---------9--------0
118
//-------1---------2---------3--------Wires------5---------6---------7---------8---------9--------0
119
wire   [15:0]    wb_adr_o;
120
wire   [9:0]     ir1, ir2;
121
wire   [15:0]    nn;
122
wire   [15:0]    sp;
123 23 bporcella
wire   [7:0]     ar, fr, br, cr, dr, er, hr, lr, intr;
124 17 bporcella
wire   [15:0]    ixr, iyr;
125
wire   [7:0]     wb_dat_i, wb_dat_o, sdram_do, cfg_do;
126
wire   [15:0]    add16;         //  ir2 execution engine output for sp updates
127 25 bporcella
wire   [7:0]     alu8_out, sh_alu, bit_alu;
128 17 bporcella
 
129
 
130
 
131
 
132
 
133
 
134
//-------1---------2---------3--------Registers--5---------6---------7---------8---------9--------0
135
//-------1---------2---------3--------Assignments----------6---------7---------8---------9--------0
136
//-------1---------2---------3--------State Machines-------6---------7---------8---------9--------0
137
 
138 23 bporcella
 
139
`ifdef COMPILE_BIST
140
z80_bist_logic i_z80_bist_logic(
141
        .bist_err_o(bist_err_o), .bist_ack_o(bist_ack_o),
142
        .wb_adr_i(wb_adr_o), .wb_dat_i(wb_dat_o), .wb_we_i(wb_we_o), .wb_cyc_i(wb_cyc_o),
143
        .wb_stb_i(wb_stb_o), .wb_tga_i(wb_tga_o), .wb_clk_i(wb_clk_i), .wb_rst_i(wb_rst_i)
144
        );
145
`endif
146
 
147
 
148
 
149 17 bporcella
z80_memstate2 i_z80_memstate2(
150
                .wb_adr_o(wb_adr_o), .wb_we_o(wb_we_o), .wb_cyc_o(wb_cyc_o), .wb_stb_o(wb_stb_o), .wb_tga_o(wb_tga_o), .wb_dat_o(wb_dat_o),
151
                .exec_ir2(exec_ir2), .ir1(ir1), .ir2(ir2), .ir1dd(ir1dd), .ir1fd(ir1fd), .ir2dd(ir2dd), .ir2fd(ir2fd), .nn(nn), .sp(sp),
152
                .upd_ar(upd_ar), .upd_br(upd_br), .upd_cr(upd_cr), .upd_dr(upd_dr), .upd_er(upd_er), .upd_hr(upd_hr), .upd_lr(upd_lr),.upd_fr(upd_fr),
153 23 bporcella
                .beq0(br_eq0), .ceq0(cr_eq0),
154 17 bporcella
                .ar(ar), .fr(fr), .br(br), .cr(cr), .dr(dr), .er(er), .hr(hr), .lr(lr),
155
                .ixr(ixr), .iyr(iyr),
156 23 bporcella
                .wb_dat_i(cfg_do), .wb_ack_i(cfg_ack_o),
157 17 bporcella
                .int_req_i(int_req_i),
158
                .add16(add16),
159 25 bporcella
                .alu8_out(alu8_out),
160
                .sh_alu(sh_alu),
161
                .bit_alu(bit_alu),
162 17 bporcella
                .wb_clk_i(wb_clk_i),
163 23 bporcella
                .rst_i(wb_rst_i)         // keep this generic - may turn out to be different from wb_rst
164
                 );
165 17 bporcella
 
166
 
167
z80_inst_exec i_z80_inst_exec(
168
                  .br_eq0(br_eq0),
169
                  .cr_eq0(cr_eq0),
170
                  .upd_ar(upd_ar), .upd_br(upd_br), .upd_cr(upd_cr), .upd_dr(upd_dr), .upd_er(upd_er), .upd_hr(upd_hr), .upd_lr(upd_lr),.upd_fr(upd_fr),
171 23 bporcella
                  .ar(ar), .fr(fr), .br(br), .cr(cr), .dr(dr), .er(er), .hr(hr), .lr(lr), .intr(intr),
172 25 bporcella
                  .ixr(ixr), .iyr(iyr), .add16(add16), .alu8_out(alu8_out),
173
                   .sh_alu(sh_alu),
174
                   .bit_alu(bit_alu),
175 17 bporcella
                   .exec_ir2(exec_ir2),
176
                   .exec_decbc(exec_decbc), .exec_decb(exec_decb),
177
                   .ir2(ir2),
178
                   .clk(wb_clk_i),
179 23 bporcella
                   .rst(wb_rst_i),
180 17 bporcella
                   .nn(nn), .sp(sp),
181 23 bporcella
                   .ir2dd(ir2dd),
182
                   .ir2fd(ir2fd)
183 17 bporcella
                   );
184
 
185
// The parameter passed to i_generic_sprem specifies the number of address bits used by the
186
// memory  -- and thus the memory size.   We expect to use 15 here in the released documentation -
187
// giving an onboard 32k SRAM and allowing 32k space for off-chip memory.  Note that any change to
188
// this parameter requires modifications to the decode logic in z80_sdram_cfg.
189
//
190
// The generic_spram is being used here per Open Cores coding guidelines.  I'm not sure I'm totally
191
// happy with this......    Depending on which target technology is specified, read behavior changes.
192
// It is easy to insure all possible behavior will in fact operate properly  -- see the data reduction
193
// logic in sdram_cfg.v --  but still...   I guess the important thing to be aware of is that 
194 23 bporcella
// big memories like this typically require special back-end handeling.   This is likely to prove
195 17 bporcella
// no exception  - despite the work that has been done to make this file as generally useful as 
196
// possible.
197
 
198 23 bporcella
generic_spram #(15) i_generic_spram(
199 17 bporcella
    // Generic synchronous single-port RAM interface
200 23 bporcella
    .clk(wb_clk_i), .rst(wb_rst_i), .ce(cfg_ce_spram_o), .we(wb_we_o), .oe(1'b1), .addr(wb_adr_o[14:0]), .di(wb_dat_o), .do(sdram_do)
201
    );
202 17 bporcella
 
203
 
204
 
205
z80_sdram_cfg i_z80_sdram_cfg(
206
    .cfg_ce_spram_o(cfg_ce_spram_o), .cfg_do(cfg_do),  .cfg_ack_o(cfg_ack_o), .sdram_di(sdram_do),
207 23 bporcella
    .wb_adr_i(wb_adr_o), .wb_dat_i(wb_dat_i), .wb_ack_i(wb_ack_i),  .wb_stb_i(wb_stb_o),
208
    .wb_cyc_i(wb_cyc_o), .wb_tga_i(wb_tga_o)
209
    );
210 17 bporcella
 
211
 
212
endmodule

powered by: WebSVN 2.1.0

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