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

Subversion Repositories zx_ula

[/] [zx_ula/] [branches/] [xilinx/] [spectrum_16k_with_rom_game_for_ols/] [spectrum16k_TOP.v] - Blame information for rev 27

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 mcleod_ide
`timescale 1ns / 1ps
2
//////////////////////////////////////////////////////////////////////////////////
3
// Company:        Dept. Architecture and Computing Technology. University of Seville
4
// Engineer:       Miguel Angel Rodriguez Jodar. rodriguj@atc.us.es
5
// Revision:       Joseba Epalza Ramos (Company: INGEPAL) <jepalza@gmail.com> 
6
//                 
7
// Create Date:    20-December-2012 
8
// Design Name:    ZX Spectrum
9
// Module Name:    tld_spartan3_sp16k
10
// Project Name: 
11
// Target Devices: 
12
// Tool versions: 
13
// Description:    Spectrum 16k OLS (Open Logic Sniffer) Dangerous Prototypes, "http://dangerousprototypes.com"
14
//
15
// Dependencies: 
16
//
17
// Revision: 
18
// Revision 2.00 - File Created
19
// Additional Comments: GPL License policies apply to the contents of this file.
20
//
21
//////////////////////////////////////////////////////////////////////////////////
22
module tld_spartan3_sp16k (
23
    input clk50,
24
         input reset,
25
    output r,
26
    output g,
27
    output b,
28
    output i,
29
    output csync,
30
        // ULA I/O 
31
         input ear,
32
         output audio_out,
33
         output [7:0] kbd_rows,
34
         input  [4:0] kbd_columns
35
    );
36
 
37
        // CPU signals
38
        wire [15:0] a;
39
        wire [7:0] cpudout;
40
        wire [7:0] cpudin;
41
        wire clkcpu;
42
        wire mreq_n;
43
        wire iorq_n;
44
        wire wr_n;
45
        wire rd_n;
46
        wire rfsh_n;
47
        wire int_n;
48
 
49
        // VRAM signals
50
        wire [13:0] va;
51
        wire [7:0] vramdin;
52
        wire [7:0] vramdout;
53
        wire vramoe;
54
        wire vramcs;
55
        wire vramwe;
56
 
57
        // I/O
58
        wire mic;
59
        wire spk;
60
        assign audio_out = spk;
61
 
62
        // ULA data bus
63
        wire [7:0] uladout;
64
        wire [7:0] uladin;
65
 
66
        // SRAM data bus: only for compatibility issue
67
        wire [7:0] sramdout;
68
 
69
        // ROM data bus
70
        wire [7:0] romdout;
71
 
72
   // Chip Select
73
        wire sram_cs = a[15] & !mreq_n;
74
        wire ula_cs = !a[0] & !iorq_n;
75
        wire vram_cs = !a[15] & a[14] & !mreq_n;
76
        wire port255_cs = !iorq_n && a[7:0]==8'hFF && !rd_n;
77
        wire rom_cs = !a[15] & !a[14] & !mreq_n & !rd_n;
78
 
79
        /////////////////////////////////////
80
        // Master clock (14MHz) generation
81
        /////////////////////////////////////
82
        wire clk28mhz;
83
   master_clock clock28mhz (
84
    .CLKIN_IN(clk50),
85
    .CLKFX_OUT(clk28mhz),
86
    .CLKIN_IBUFG_OUT(),
87
    .CLK0_OUT()
88
    );
89
        reg clk14 = 0;
90
        always @(posedge clk28mhz) begin
91
                clk14 = !clk14;
92
        end
93
        wire clkula = clk14;
94
        wire clkmem = clk28mhz;
95
 
96
 
97
 
98
   /////////////////////////////////////
99
   // ROM
100
   /////////////////////////////////////        
101
        rom the_rom (
102
                .clka(clkmem),
103
                .ena(rom_cs),
104
                .addra(a[13:0]),
105
                .douta(romdout)
106
        );
107
 
108
   //////////////////////////////////////////////
109
   // Lower 16k VRAM (not upper RAM in 16k model)
110
   //////////////////////////////////////////////
111
   ram_controller vram_and_upper_ram (
112
                .clk(clkmem),
113
                .a1({2'b00,va}),
114
                .cs1_n(!vramcs),
115
                .oe1_n(!vramoe),
116
                .we1_n(!vramwe),
117
                .din1 (vramdin),
118
                .dout1(vramdout)
119
        );
120
 
121
 
122
   /////////////////////////////////////
123
   // The ULA
124
   /////////////////////////////////////        
125
        ula the_ula (
126
                .clk14(clkula),
127
                .a(a),
128
                .din(uladin),
129
                .dout(uladout),
130
                .mreq_n(mreq_n),
131
                .iorq_n(iorq_n),
132
                .rd_n(rd_n),
133
                .wr_n(wr_n),
134
                .rfsh_n(rfsh_n),
135
                .clkcpu(clkcpu),
136
                .msk_int_n(int_n),
137
                .va(va),
138
                .vramdout(vramdout),
139
                .vramdin(vramdin),
140
                .vramoe(vramoe),
141
                .vramcs(vramcs),
142
                .vramwe(vramwe),
143
                .ear(ear),
144
                .mic(mic),
145
                .spk(spk),
146
                .kbrows(kbd_rows),
147
                .kbcolumns(kbd_columns),
148
                .r(r),
149
                .g(g),
150
                .b(b),
151
                .i(i),
152
                .csync(csync)
153
        );
154
 
155
   /////////////////////////////////////
156
   // The CPU Z80A
157
   /////////////////////////////////////        
158
   tv80n cpu (
159
                // Outputs
160
                .m1_n(),
161
                .mreq_n(mreq_n),
162
                .iorq_n(iorq_n),
163
                .rd_n(rd_n),
164
                .wr_n(wr_n),
165
                .rfsh_n(rfsh_n),
166
                .halt_n(),
167
                .busak_n(),
168
                .A(a),
169
                .dout(cpudout),
170
                // Inputs
171
                .reset_n(!reset),
172
                .clk(clkcpu),
173
                .wait_n(1'b1),
174
                .int_n(int_n),
175
                .nmi_n(1'b1),
176
                .busrq_n(1'b1),
177
                .di(cpudin)
178
   );
179
 
180
   /////////////////////////////////////
181
   // Connecting all togther
182
   /////////////////////////////////////        
183
        assign sramdin = cpudout;
184
        assign uladin  = cpudout;
185
        assign cpudin  = (rom_cs)? romdout :
186
                         (ula_cs | vram_cs | port255_cs)? uladout :
187
                                                  (sram_cs)? sramdout : // dont' has any Upper 32kb SRAM, but it's neccesary in order to void garbage.
188
                                                   8'hFF;
189
 
190
endmodule

powered by: WebSVN 2.1.0

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