Rev 121 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
116 | lvd | 1 | // part of NeoGS flash programmer project (c) 2014 lvd^NedoPC |
2 | lvd | 2 | // |
61 | lvd | 3 | // top-level module |
2 | lvd | 4 | |
61 | lvd | 5 | module top( |
2 | lvd | 6 | |
116 | lvd | 7 | input wire clk_fpga, // clocks |
8 | input wire clk_24mhz, // |
||
2 | lvd | 9 | |
116 | lvd | 10 | output wire clksel0, // clock selection |
11 | output wire clksel1, // |
||
2 | lvd | 12 | |
116 | lvd | 13 | input wire warmres_n, // warm reset |
2 | lvd | 14 | |
15 | |||
116 | lvd | 16 | inout wire [ 7:0] d, // Z80 data bus |
130 | lvd | 17 | output wire [15:0] a, // Z80 address bus |
2 | lvd | 18 | |
116 | lvd | 19 | input wire iorq_n, // Z80 control signals |
20 | input wire mreq_n, // |
||
21 | input wire rd_n, // |
||
22 | input wire wr_n, // |
||
23 | input wire m1_n, // |
||
24 | output wire int_n, // |
||
25 | output wire nmi_n, // |
||
26 | output wire busrq_n, // |
||
27 | input wire busak_n, // |
||
28 | output wire z80res_n, // |
||
2 | lvd | 29 | |
30 | |||
116 | lvd | 31 | output wire mema14, // memory control |
32 | output wire mema15, // |
||
33 | output wire mema16, // |
||
34 | output wire mema17, // |
||
35 | output wire mema18, // |
||
36 | output wire ram0cs_n, // |
||
37 | output wire ram1cs_n, // |
||
38 | output wire ram2cs_n, // |
||
39 | output wire ram3cs_n, // |
||
40 | output wire mema21, // |
||
41 | output wire romcs_n, // |
||
42 | output wire memoe_n, // |
||
43 | output wire memwe_n, // |
||
2 | lvd | 44 | |
45 | |||
116 | lvd | 46 | inout wire [7:0] zxid, // zxbus signals |
47 | input wire [7:0] zxa, // |
||
48 | input wire zxa14, // |
||
49 | input wire zxa15, // |
||
50 | input wire zxiorq_n, // |
||
51 | input wire zxmreq_n, // |
||
52 | input wire zxrd_n, // |
||
53 | input wire zxwr_n, // |
||
54 | input wire zxcsrom_n, // |
||
55 | output wire zxblkiorq_n, // |
||
56 | output wire zxblkrom_n, // |
||
57 | output wire zxgenwait_n, // |
||
58 | output wire zxbusin, // |
||
59 | output wire zxbusena_n, // |
||
2 | lvd | 60 | |
61 | |||
116 | lvd | 62 | output wire dac_bitck, // audio-DAC signals |
63 | output wire dac_lrck, // |
||
64 | output wire dac_dat, // |
||
2 | lvd | 65 | |
66 | |||
116 | lvd | 67 | output wire sd_clk, // SD card interface |
68 | output wire sd_cs, // |
||
69 | output wire sd_do, // |
||
70 | input wire sd_di, // |
||
71 | input wire sd_wp, // |
||
72 | input wire sd_det, // |
||
2 | lvd | 73 | |
74 | |||
116 | lvd | 75 | output wire ma_clk, // control interface of MP3 chip |
76 | output wire ma_cs, |
||
77 | output wire ma_do, |
||
78 | input wire ma_di, |
||
2 | lvd | 79 | |
116 | lvd | 80 | output wire mp3_xreset, // data interface of MP3 chip |
81 | input wire mp3_req, // |
||
82 | output wire mp3_clk, // |
||
83 | output wire mp3_dat, // |
||
84 | output wire mp3_sync, // |
||
2 | lvd | 85 | |
116 | lvd | 86 | output wire led_diag // LED driver |
2 | lvd | 87 | ); |
88 | |||
89 | |||
90 | |||
91 | |||
92 | |||
118 | lvd | 93 | wire init, init_in_progress; |
94 | |||
95 | wire zxbus_rst_n; |
||
96 | wire rom_rst_n; |
||
2 | lvd | 97 | |
118 | lvd | 98 | wire wr_addr; |
99 | wire wr_data; |
||
100 | wire rd_data; |
||
101 | wire [7:0] wr_buffer; |
||
102 | wire [7:0] rd_buffer; |
||
2 | lvd | 103 | |
121 | lvd | 104 | wire autoinc_ena; |
2 | lvd | 105 | |
106 | |||
118 | lvd | 107 | |
108 | |||
116 | lvd | 109 | // assign unused pins to safe values |
110 | assign clksel0 = 1'b1; |
||
111 | assign clksel1 = 1'b1; |
||
2 | lvd | 112 | |
116 | lvd | 113 | assign int_n = 1'b1; |
114 | assign nmi_n = 1'b1; |
||
2 | lvd | 115 | |
116 | lvd | 116 | assign ram0cs_n = 1'b1; |
117 | assign ram1cs_n = 1'b1; |
||
118 | assign ram2cs_n = 1'b1; |
||
119 | assign ram3cs_n = 1'b1; |
||
99 | lvd | 120 | |
116 | lvd | 121 | assign mema21 = 1'b0; |
2 | lvd | 122 | |
116 | lvd | 123 | assign zxblkrom_n = 1'b1; |
124 | assign zxgenwait_n = 1'b1; |
||
2 | lvd | 125 | |
116 | lvd | 126 | assign dac_bitck = 1'b0; |
127 | assign dac_lrck = 1'b0; |
||
128 | assign dac_dat = 1'b0; |
||
2 | lvd | 129 | |
116 | lvd | 130 | assign sd_clk = 1'b0; |
131 | assign sd_cs = 1'b1; |
||
132 | assign sd_do = 1'b0; |
||
2 | lvd | 133 | |
116 | lvd | 134 | assign ma_clk = 1'b0; |
135 | assign ma_cs = 1'b1; |
||
136 | assign ma_do = 1'b0; |
||
2 | lvd | 137 | |
116 | lvd | 138 | assign mp3_xreset = 1'b0; |
139 | assign mp3_clk = 1'b0; |
||
140 | assign mp3_sync = 1'b0; |
||
2 | lvd | 141 | |
142 | |||
143 | |||
144 | |||
145 | |||
146 | |||
147 | |||
148 | |||
149 | |||
150 | |||
118 | lvd | 151 | |
152 | |||
153 | |||
154 | |||
155 | |||
156 | |||
157 | |||
158 | |||
159 | // reset controller |
||
160 | reset reset |
||
161 | ( |
||
162 | .clk_fpga (clk_fpga ), |
||
163 | .clk_24mhz(clk_24mhz), |
||
164 | |||
165 | .init (init ), |
||
166 | .init_in_progress(init_in_progress), |
||
167 | |||
168 | .zxbus_rst_n(zxbus_rst_n), |
||
169 | .rom_rst_n (rom_rst_n ), |
||
170 | .z80_rst_n (z80res_n ), |
||
171 | |||
172 | .z80_busrq_n(busrq_n), |
||
173 | .z80_busak_n(busak_n) |
||
174 | ); |
||
175 | |||
176 | |||
177 | |||
178 | |||
179 | |||
180 | |||
181 | // zxbus controller |
||
182 | zxbus zxbus |
||
183 | ( |
||
184 | .clk (clk_24mhz ), |
||
185 | .rst_n(zxbus_rst_n), |
||
186 | |||
187 | .zxid (zxid ), |
||
188 | .zxa (zxa ), |
||
189 | .zxiorq_n (zxiorq_n ), |
||
190 | .zxmreq_n (zxmreq_n ), |
||
191 | .zxrd_n (zxrd_n ), |
||
192 | .zxwr_n (zxwr_n ), |
||
193 | .zxblkiorq_n(zxblkiorq_n), |
||
194 | .zxbusin (zxbusin ), |
||
195 | .zxbusena_n (zxbusena_n ), |
||
196 | |||
197 | .init (init ), |
||
198 | .init_in_progress(init_in_progress), |
||
199 | |||
200 | .led(led_diag), |
||
201 | |||
121 | lvd | 202 | .autoinc_ena(autoinc_ena), |
203 | |||
118 | lvd | 204 | .wr_addr (wr_addr ), |
205 | .wr_data (wr_data ), |
||
206 | .rd_data (rd_data ), |
||
207 | .wr_buffer(wr_buffer), |
||
208 | .rd_buffer(rd_buffer) |
||
209 | ); |
||
210 | |||
211 | |||
212 | |||
213 | |||
214 | // rom controller |
||
215 | rom rom |
||
216 | ( |
||
217 | .clk (clk_24mhz), |
||
218 | .rst_n(rom_rst_n), |
||
219 | |||
220 | .wr_addr (wr_addr ), |
||
221 | .wr_data (wr_data ), |
||
222 | .rd_data (rd_data ), |
||
223 | .wr_buffer(wr_buffer), |
||
224 | .rd_buffer(rd_buffer), |
||
225 | |||
121 | lvd | 226 | .autoinc_ena(autoinc_ena), |
227 | |||
118 | lvd | 228 | .rom_a ({mema18,mema17,mema16,mema15,mema14,a[13:0]}), |
229 | .rom_d (d), |
||
230 | .rom_cs_n(romcs_n), |
||
231 | .rom_oe_n(memoe_n), |
||
232 | .rom_we_n(memwe_n) |
||
233 | ); |
||
234 | |||
130 | lvd | 235 | assign a[15:14] = 2'bZZ; |
118 | lvd | 236 | |
237 | |||
238 | |||
239 | |||
2 | lvd | 240 | endmodule |
241 |