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

Subversion Repositories vg_z80_sbc

[/] [vg_z80_sbc/] [trunk/] [rtl/] [z80_core_top.v] - Blame information for rev 35

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 hharte
///////////////////////////////////////////////////////////////////////////////////////////////
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
//  $Id: z80_core_top.v,v 1.1 2008-12-01 02:00:10 hharte Exp $
41
//
42
//  $Date: 2008-12-01 02:00:10 $
43
//  $Revision: 1.1 $
44
//  $Author: hharte $
45
//  $Locker:  $
46
//  $State: Exp $
47
//
48
// Change History:
49
//      $Log: not supported by cvs2svn $
50
//      Revision 1.6  2004/05/27 14:23:36  bporcella
51
//      Instruction test (with interrupts) runs!!!
52
//
53
//      Revision 1.5  2004/05/21 02:51:25  bporcella
54
//      inst test  got to the worked macro
55
//
56
//      Revision 1.4  2004/05/18 22:31:21  bporcella
57
//      instruction test getting to final stages
58
//
59
//      Revision 1.3  2004/05/13 14:58:53  bporcella
60
//      testbed built and verification in progress
61
//
62
//      Revision 1.2  2004/04/27 21:38:22  bporcella
63
//      test lint on core
64
//
65
//      Revision 1.1  2004/04/27 21:27:13  bporcella
66
//      first core build
67
//
68
//      Revision 1.1.1.1  2004/04/13 23:47:42  bporcella
69
//      import first files
70
//
71
//
72
//
73
// connects modules:
74
//  z80_memstate2.v        main state machine for z8  pc - sp  and wishbone regiters
75
//  z80_inst_exec.v        main execution engine for z80 general programming registers - alu's
76
//  z80_sram.v             main memory  (on board)
77
//  z80_bist_logic.v       memory initialization and some simple test peripherals.
78
//
79
//  WARNING   be sure the "test peripherals" in the bist_logic do not interfere with your
80
//    system.   
81
//  
82
//-------1---------2---------3--------Module Name and Port List------7---------8---------9--------0
83
module z80_core_top(
84
                      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,
91
                      wb_clk_i,
92
                      wb_dat_i,
93
                      wb_rst_i,
94
`ifdef COMPILE_BIST
95
                      bist_ack_o,
96
                      bist_err_o,
97
                      bist_req_i,
98
`endif
99
                      int_req_i
100
 
101
);
102
 
103
//-------1---------2---------3--------Output Ports---------6---------7---------8---------9--------0
104
 
105
output [7:0]    wb_dat_o;
106
output          wb_stb_o;
107
output          wb_cyc_o;
108
output          wb_we_o;
109
output [15:0]   wb_adr_o;
110
output [1:0]    wb_tga_o;
111
 
112
 
113
//-------1---------2---------3--------Input Ports----------6---------7---------8---------9--------0
114
 
115
input           wb_ack_i;
116
input           wb_clk_i;
117
input  [7:0]    wb_dat_i;
118
input           wb_rst_i;
119
input           int_req_i;
120
 
121
 
122
`ifdef COMPILE_BIST
123
output          bist_err_o;
124
output          bist_ack_o;
125
input           bist_req_i;
126
`endif
127
 
128
 
129
//-------1---------2---------3--------Parameters-----------6---------7---------8---------9--------0
130
//-------1---------2---------3--------Wires------5---------6---------7---------8---------9--------0
131
wire   [15:0]    wb_adr_o;
132
wire   [9:0]     ir1, ir2;
133
wire   [15:0]    nn;
134
wire   [15:0]    sp;
135
wire   [7:0]     ar, fr, br, cr, dr, er, hr, lr, intr;
136
wire   [15:0]    ixr, iyr;
137
wire   [7:0]     wb_dat_i, wb_dat_o, sdram_do, cfg_do, bist_do;
138
wire   [15:0]    add16;     //  ir2 execution engine output for sp updates
139
wire   [15:0]    adr_alu;   //  address alu to inst to update hl and de on block moves      
140
wire   [7:0]     alu8_out, sh_alu, bit_alu;  //  gotta move these to data out register
141
                                             //  for memory operations.  
142
 
143
wire          sram_addr;
144
wire          ce_sram;
145
wire    [7:0] wb_rd_dat;
146
wire          wb_ack;
147
//-------1---------2---------3--------Registers--5---------6---------7---------8---------9--------0
148
//-------1---------2---------3--------Assignments----------6---------7---------8---------9--------0
149
//-------1---------2---------3--------State Machines-------6---------7---------8---------9--------0
150
 
151
 
152
`ifdef COMPILE_BIST
153
wire [7:0] bist_dat_o;
154
wire bist_io_ack;
155
 
156
z80_bist_logic i_z80_bist_logic(
157
        .bist_err_o(bist_err_o),
158
        .bist_ack_o(bist_ack_o),
159
        .wb_dat_o(bist_dat_o),
160
        .wb_ack_o(bist_io_ack),
161
        .int_req_o(bist_int_req),
162
        .wb_adr_i(wb_adr_o),
163
        .wb_dat_i(wb_dat_o),
164
        .wb_we_i(wb_we_o),
165
        .wb_cyc_i(wb_cyc_o),
166
        .wb_stb_i(wb_stb_o),
167
        .wb_tga_i(wb_tga_o),
168
        .int_req_i(int_req_i),
169
        .wb_clk_i(wb_clk_i),
170
        .wb_rst_i(wb_rst_i)
171
        );
172
 
173
`else
174
wire bist_io_ack = 1'b0;
175
wire [7:0] bist_dat_o = 8'b0;
176
`endif
177
 
178
 
179
 
180
z80_memstate2 i_z80_memstate2(
181
                .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),
182
                .exec_ir2(exec_ir2),
183
                .exec_decbc(exec_decbc), .exec_decb(exec_decb),
184
                .ir1(ir1), .ir2(ir2), .ir1dd(ir1dd), .ir1fd(ir1fd), .ir2dd(ir2dd), .ir2fd(ir2fd), .nn(nn), .sp(sp),
185
                .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),
186
                .beq0(br_eq0), .ceq0(cr_eq0),
187
                .ar(ar), .fr(fr), .br(br), .cr(cr), .dr(dr), .er(er), .hr(hr), .lr(lr),
188
                .ixr(ixr), .iyr(iyr), .intr(intr),
189
                .wb_dat_i(wb_rd_dat), .wb_ack_i(wb_ack),
190
                .int_req_i(bist_int_req),
191
                .add16(add16),
192
                .alu8_out(alu8_out),
193
                .adr_alu(adr_alu),
194
                .blk_mv_upd_hl(blk_mv_upd_hl),
195
                .blk_mv_upd_de(blk_mv_upd_de),
196
                .sh_alu(sh_alu),
197
                .bit_alu(bit_alu),
198
                .wb_clk_i(wb_clk_i),
199
                .rst_i(wb_rst_i)         // keep this generic - may turn out to be different from wb_rst
200
                 );
201
 
202
 
203
z80_inst_exec i_z80_inst_exec(
204
                  .br_eq0(br_eq0),
205
                  .cr_eq0(cr_eq0),
206
                  .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),
207
                  .ar(ar), .fr(fr), .br(br), .cr(cr), .dr(dr), .er(er), .hr(hr), .lr(lr), .intr(intr),
208
                  .ixr(ixr), .iyr(iyr), .add16(add16), .alu8_out(alu8_out),
209
                  .adr_alu(adr_alu),
210
                  .blk_mv_upd_hl(blk_mv_upd_hl),
211
                  .blk_mv_upd_de(blk_mv_upd_de),
212
                   .sh_alu(sh_alu),
213
                   .bit_alu(bit_alu),
214
                   .exec_ir2(exec_ir2),
215
                   .exec_decbc(exec_decbc), .exec_decb(exec_decb),
216
                   .ir2(ir2),
217
                   .clk(wb_clk_i),
218
                   .rst(wb_rst_i),
219
                   .nn(nn), .sp(sp),
220
                   .ir2dd(ir2dd),
221
                   .ir2fd(ir2fd)
222
                   );
223
 
224
//-------------------  routing logic for the wishbone ------------------------
225
//
226
// I guess purists would prefer this logic in a lower module  --- "no logic on top level"
227
// Somehow I tend to think that this is the kind of logic that belongs on the top 
228
// level. 
229
 
230
assign       sram_addr   = 1'b0; //= ~wb_adr_o[15] & (wb_tga_o == 2'b00);
231
assign       ce_sram     = sram_addr & wb_cyc_o & wb_stb_o;
232
assign       wb_rd_dat   =  sram_addr   ? sdram_do :
233
                            bist_io_ack ? bist_dat_o :
234
                                          wb_dat_i;
235
assign       wb_ack = ce_sram | bist_io_ack | wb_ack_i;
236
 
237
 
238
 
239
//z80_sram #(11) i_z80_sram(
240
//    // Generic synchronous single-port RAM interface
241
//    .clk(wb_clk_i), .rst(wb_rst_i), .ce(ce_sram), .we(wb_we_o), .oe(1'b1), 
242
//    .addr(wb_adr_o[14:0]), .di(wb_dat_o), .do(sdram_do)
243
//    );
244
 
245
endmodule

powered by: WebSVN 2.1.0

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