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

Subversion Repositories eco32

[/] [eco32/] [trunk/] [fpga/] [mc/] [boards/] [xsa-xst-3/] [src/] [toplevel/] [eco32.v] - Blame information for rev 323

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

Line No. Rev Author Line
1 27 hellwig
//
2 68 hellwig
// eco32.v -- ECO32 top-level description
3 27 hellwig
//
4
 
5
 
6 290 hellwig
`timescale 1ns/10ps
7
`default_nettype none
8
 
9
 
10 27 hellwig
module eco32(clk_in,
11 290 hellwig
             rst_inout_n,
12 27 hellwig
             sdram_clk,
13
             sdram_fb,
14
             sdram_cke,
15
             sdram_cs_n,
16
             sdram_ras_n,
17
             sdram_cas_n,
18
             sdram_we_n,
19
             sdram_ba,
20
             sdram_a,
21 125 hellwig
             sdram_udqm,
22
             sdram_ldqm,
23 27 hellwig
             sdram_dq,
24
             flash_ce_n,
25
             flash_oe_n,
26
             flash_we_n,
27
             flash_rst_n,
28
             flash_byte_n,
29
             flash_a,
30
             flash_d,
31 68 hellwig
             vga_hsync,
32
             vga_vsync,
33
             vga_r,
34
             vga_g,
35
             vga_b,
36 27 hellwig
             ps2_clk,
37
             ps2_data,
38
             rs232_0_rxd,
39
             rs232_0_txd,
40
             rs232_1_rxd,
41
             rs232_1_txd,
42
             pbus_d,
43
             pbus_a,
44
             pbus_read_n,
45
             pbus_write_n,
46
             ata_cs0_n,
47
             ata_cs1_n,
48
             ata_intrq,
49
             ata_dmarq,
50
             ata_dmack_n,
51
             ata_iordy,
52 231 hellwig
             dac_mclk,
53
             dac_sclk,
54
             dac_lrck,
55
             dac_sdti,
56 27 hellwig
             slot1_cs_n,
57
             slot2_cs_n,
58 191 hellwig
             ether_cs_n,
59 192 hellwig
             sw1_3,
60
             sw1_4,
61 191 hellwig
             sw2_n,
62
             sw3_n);
63 27 hellwig
 
64
    // clock and reset
65
    input clk_in;
66 290 hellwig
    inout rst_inout_n;
67 27 hellwig
    // SDRAM
68
    output sdram_clk;
69
    input sdram_fb;
70
    output sdram_cke;
71
    output sdram_cs_n;
72
    output sdram_ras_n;
73
    output sdram_cas_n;
74
    output sdram_we_n;
75
    output [1:0] sdram_ba;
76
    output [12:0] sdram_a;
77 125 hellwig
    output sdram_udqm;
78
    output sdram_ldqm;
79 27 hellwig
    inout [15:0] sdram_dq;
80
    // flash ROM
81
    output flash_ce_n;
82
    output flash_oe_n;
83
    output flash_we_n;
84
    output flash_rst_n;
85
    output flash_byte_n;
86
    output [19:0] flash_a;
87
    input [15:0] flash_d;
88
    // VGA display
89 68 hellwig
    output vga_hsync;
90
    output vga_vsync;
91
    output [2:0] vga_r;
92
    output [2:0] vga_g;
93
    output [2:0] vga_b;
94 27 hellwig
    // keyboard
95
    input ps2_clk;
96
    input ps2_data;
97
    // serial line 0
98
    input rs232_0_rxd;
99
    output rs232_0_txd;
100
    // serial line 1
101
    input rs232_1_rxd;
102
    output rs232_1_txd;
103
    // peripheral bus
104
    inout [15:0] pbus_d;
105
    output [4:0] pbus_a;
106
    output pbus_read_n;
107
    output pbus_write_n;
108
    // ATA adapter
109
    output ata_cs0_n;
110
    output ata_cs1_n;
111
    input ata_intrq;
112
    input ata_dmarq;
113
    output ata_dmack_n;
114
    input ata_iordy;
115 231 hellwig
    // audio DAC
116
    output dac_mclk;
117
    output dac_sclk;
118
    output dac_lrck;
119
    output dac_sdti;
120 27 hellwig
    // expansion slot 1
121
    output slot1_cs_n;
122
    // expansion slot 2
123
    output slot2_cs_n;
124
    // ethernet
125
    output ether_cs_n;
126 190 hellwig
    // board I/O
127 192 hellwig
    input sw1_3;
128
    input sw1_4;
129 191 hellwig
    input sw2_n;
130
    input sw3_n;
131 27 hellwig
 
132 225 hellwig
  // clk_rst
133 290 hellwig
  wire clk;                             // system clock
134
  wire clk_ok;                          // clock is stable
135
  wire rst;                             // system reset
136 27 hellwig
  // cpu
137 290 hellwig
  wire bus_stb;                         // bus strobe
138
  wire bus_we;                          // bus write enable
139
  wire [31:2] bus_addr;                 // bus address (word address)
140
  wire [31:0] bus_din;                   // bus data input, for reads
141
  wire [31:0] bus_dout;                  // bus data output, for writes
142
  wire bus_ack;                         // bus acknowledge
143
  wire [15:0] bus_irq;                   // bus interrupt requests
144 27 hellwig
  // ram
145 290 hellwig
  wire ram_stb;                         // ram strobe
146
  wire [31:0] ram_dout;                  // ram data output
147
  wire ram_ack;                         // ram acknowledge
148 27 hellwig
  // rom
149 290 hellwig
  wire rom_stb;                         // rom strobe
150
  wire [31:0] rom_dout;                  // rom data output
151
  wire rom_ack;                         // rom acknowledge
152
  // i/o
153
  wire i_o_stb;                         // i/o strobe
154 70 hellwig
  // tmr0
155 290 hellwig
  wire tmr0_stb;                        // tmr 0 strobe
156
  wire [31:0] tmr0_dout;         // tmr 0 data output
157
  wire tmr0_ack;                        // tmr 0 acknowledge
158
  wire tmr0_irq;                        // tmr 0 interrupt request
159 70 hellwig
  // tmr1
160 290 hellwig
  wire tmr1_stb;                        // tmr 1 strobe
161
  wire [31:0] tmr1_dout;         // tmr 1 data output
162
  wire tmr1_ack;                        // tmr 1 acknowledge
163
  wire tmr1_irq;                        // tmr 1 interrupt request
164 27 hellwig
  // dsp
165 290 hellwig
  wire dsp_stb;                         // dsp strobe
166
  wire [15:0] dsp_dout;                  // dsp data output
167
  wire dsp_ack;                         // dsp acknowledge
168 27 hellwig
  // kbd
169 290 hellwig
  wire kbd_stb;                         // kbd strobe
170
  wire [7:0] kbd_dout;                   // kbd data output
171
  wire kbd_ack;                         // kbd acknowledge
172
  wire kbd_irq;                         // kbd interrupt request
173 27 hellwig
  // ser0
174 290 hellwig
  wire ser0_stb;                        // ser 0 strobe
175
  wire [7:0] ser0_dout;                  // ser 0 data output
176
  wire ser0_ack;                        // ser 0 acknowledge
177
  wire ser0_irq_r;                      // ser 0 rcv interrupt request
178
  wire ser0_irq_t;                      // ser 0 xmt interrupt request
179 27 hellwig
  // ser1
180 290 hellwig
  wire ser1_stb;                        // ser 1 strobe
181
  wire [7:0] ser1_dout;                  // ser 1 data output
182
  wire ser1_ack;                        // ser 1 acknowledge
183
  wire ser1_irq_r;                      // ser 1 rcv interrupt request
184
  wire ser1_irq_t;                      // ser 1 xmt interrupt request
185 27 hellwig
  // dsk
186 290 hellwig
  wire dsk_stb;                         // dsk strobe
187
  wire [31:0] dsk_dout;                  // dsk data output
188
  wire dsk_ack;                         // dsk acknowledge
189
  wire dsk_irq;                         // dsk interrupt request
190 231 hellwig
  // fms
191 290 hellwig
  wire fms_stb;                         // fms strobe
192
  wire [31:0] fms_dout;                  // fms data output
193
  wire fms_ack;                         // fms acknowledge
194 231 hellwig
  // dac
195 290 hellwig
  wire [15:0] dac_sample_l;              // dac sample value, left
196
  wire [15:0] dac_sample_r;              // dac sample value, right
197
  wire dac_next;                        // dac next sample request
198 190 hellwig
  // bio
199 290 hellwig
  wire bio_stb;                         // bio strobe
200
  wire [31:0] bio_dout;                  // bio data output
201
  wire bio_ack;                         // bio acknowledge
202 27 hellwig
 
203 290 hellwig
  //--------------------------------------
204
  // module instances
205
  //--------------------------------------
206
 
207
  clk_rst clk_rst_1(
208 27 hellwig
    .clk_in(clk_in),
209 290 hellwig
    .rst_inout_n(rst_inout_n),
210 27 hellwig
    .sdram_clk(sdram_clk),
211
    .sdram_fb(sdram_fb),
212
    .clk(clk),
213
    .clk_ok(clk_ok),
214 290 hellwig
    .rst(rst)
215 27 hellwig
  );
216
 
217 290 hellwig
  cpu cpu_1(
218 27 hellwig
    .clk(clk),
219 290 hellwig
    .rst(rst),
220
    .bus_stb(bus_stb),
221
    .bus_we(bus_we),
222
    .bus_addr(bus_addr[31:2]),
223
    .bus_din(bus_din[31:0]),
224
    .bus_dout(bus_dout[31:0]),
225
    .bus_ack(bus_ack),
226
    .bus_irq(bus_irq[15:0])
227 27 hellwig
  );
228
 
229 290 hellwig
  ram ram_1(
230 27 hellwig
    .clk(clk),
231
    .clk_ok(clk_ok),
232 290 hellwig
    .rst(rst),
233
    .stb(ram_stb),
234
    .we(bus_we),
235
    .addr(bus_addr[24:2]),
236
    .data_in(bus_dout[31:0]),
237
    .data_out(ram_dout[31:0]),
238
    .ack(ram_ack),
239 27 hellwig
    .sdram_cke(sdram_cke),
240
    .sdram_cs_n(sdram_cs_n),
241
    .sdram_ras_n(sdram_ras_n),
242
    .sdram_cas_n(sdram_cas_n),
243
    .sdram_we_n(sdram_we_n),
244
    .sdram_ba(sdram_ba[1:0]),
245
    .sdram_a(sdram_a[12:0]),
246 125 hellwig
    .sdram_udqm(sdram_udqm),
247
    .sdram_ldqm(sdram_ldqm),
248 27 hellwig
    .sdram_dq(sdram_dq[15:0])
249
  );
250
 
251 290 hellwig
  rom rom_1(
252 27 hellwig
    .clk(clk),
253 290 hellwig
    .rst(rst),
254
    .stb(rom_stb),
255
    .we(bus_we),
256
    .addr(bus_addr[20:2]),
257
    .data_out(rom_dout[31:0]),
258
    .ack(rom_ack),
259 27 hellwig
    .ce_n(flash_ce_n),
260
    .oe_n(flash_oe_n),
261
    .we_n(flash_we_n),
262
    .rst_n(flash_rst_n),
263
    .byte_n(flash_byte_n),
264
    .a(flash_a[19:0]),
265
    .d(flash_d[15:0])
266
  );
267
 
268 290 hellwig
  tmr tmr_1(
269 27 hellwig
    .clk(clk),
270 290 hellwig
    .rst(rst),
271
    .stb(tmr0_stb),
272
    .we(bus_we),
273
    .addr(bus_addr[3:2]),
274
    .data_in(bus_dout[31:0]),
275
    .data_out(tmr0_dout[31:0]),
276
    .ack(tmr0_ack),
277 70 hellwig
    .irq(tmr0_irq)
278 27 hellwig
  );
279
 
280 290 hellwig
  tmr tmr_2(
281 70 hellwig
    .clk(clk),
282 290 hellwig
    .rst(rst),
283
    .stb(tmr1_stb),
284
    .we(bus_we),
285
    .addr(bus_addr[3:2]),
286
    .data_in(bus_dout[31:0]),
287
    .data_out(tmr1_dout[31:0]),
288
    .ack(tmr1_ack),
289 70 hellwig
    .irq(tmr1_irq)
290
  );
291
 
292 290 hellwig
  dsp dsp_1(
293 27 hellwig
    .clk(clk),
294 290 hellwig
    .rst(rst),
295
    .stb(dsp_stb),
296
    .we(bus_we),
297
    .addr(bus_addr[13:2]),
298
    .data_in(bus_dout[15:0]),
299
    .data_out(dsp_dout[15:0]),
300
    .ack(dsp_ack),
301 68 hellwig
    .hsync(vga_hsync),
302
    .vsync(vga_vsync),
303
    .r(vga_r[2:0]),
304
    .g(vga_g[2:0]),
305
    .b(vga_b[2:0])
306 27 hellwig
  );
307
 
308 290 hellwig
  kbd kbd_1(
309 27 hellwig
    .clk(clk),
310 290 hellwig
    .rst(rst),
311
    .stb(kbd_stb),
312
    .we(bus_we),
313
    .addr(bus_addr[2]),
314
    .data_in(bus_dout[7:0]),
315
    .data_out(kbd_dout[7:0]),
316
    .ack(kbd_ack),
317 116 hellwig
    .irq(kbd_irq),
318
    .ps2_clk(ps2_clk),
319
    .ps2_data(ps2_data)
320 27 hellwig
  );
321
 
322 290 hellwig
  ser ser_1(
323 27 hellwig
    .clk(clk),
324 290 hellwig
    .rst(rst),
325
    .stb(ser0_stb),
326
    .we(bus_we),
327
    .addr(bus_addr[3:2]),
328
    .data_in(bus_dout[7:0]),
329
    .data_out(ser0_dout[7:0]),
330
    .ack(ser0_ack),
331 27 hellwig
    .irq_r(ser0_irq_r),
332
    .irq_t(ser0_irq_t),
333
    .rxd(rs232_0_rxd),
334
    .txd(rs232_0_txd)
335
  );
336
 
337 290 hellwig
  ser ser_2(
338 27 hellwig
    .clk(clk),
339 290 hellwig
    .rst(rst),
340
    .stb(ser1_stb),
341
    .we(bus_we),
342
    .addr(bus_addr[3:2]),
343
    .data_in(bus_dout[7:0]),
344
    .data_out(ser1_dout[7:0]),
345
    .ack(ser1_ack),
346 27 hellwig
    .irq_r(ser1_irq_r),
347
    .irq_t(ser1_irq_t),
348
    .rxd(rs232_1_rxd),
349
    .txd(rs232_1_txd)
350
  );
351
 
352 290 hellwig
  assign pbus_a[4:3] = 2'b00;
353
 
354
  dsk dsk_1(
355 27 hellwig
    .clk(clk),
356 290 hellwig
    .rst(rst),
357
    .stb(dsk_stb),
358
    .we(bus_we),
359
    .addr(bus_addr[19:2]),
360
    .data_in(bus_dout[31:0]),
361
    .data_out(dsk_dout[31:0]),
362
    .ack(dsk_ack),
363 27 hellwig
    .irq(dsk_irq),
364
    .ata_d(pbus_d[15:0]),
365
    .ata_a(pbus_a[2:0]),
366
    .ata_cs0_n(ata_cs0_n),
367
    .ata_cs1_n(ata_cs1_n),
368
    .ata_dior_n(pbus_read_n),
369
    .ata_diow_n(pbus_write_n),
370
    .ata_intrq(ata_intrq),
371
    .ata_dmarq(ata_dmarq),
372
    .ata_dmack_n(ata_dmack_n),
373
    .ata_iordy(ata_iordy)
374
  );
375
 
376 290 hellwig
  fms fms_1(
377 231 hellwig
    .clk(clk),
378 290 hellwig
    .rst(rst),
379
    .stb(fms_stb),
380
    .we(bus_we),
381
    .addr(bus_addr[11:2]),
382
    .data_in(bus_dout[31:0]),
383
    .data_out(fms_dout[31:0]),
384
    .ack(fms_ack),
385 231 hellwig
    .next(dac_next),
386
    .sample_l(dac_sample_l[15:0]),
387
    .sample_r(dac_sample_r[15:0])
388
  );
389
 
390 290 hellwig
  dac dac_1(
391 231 hellwig
    .clk(clk),
392 290 hellwig
    .rst(rst),
393 231 hellwig
    .sample_l(dac_sample_l[15:0]),
394
    .sample_r(dac_sample_r[15:0]),
395
    .next(dac_next),
396
    .mclk(dac_mclk),
397
    .sclk(dac_sclk),
398
    .lrck(dac_lrck),
399
    .sdti(dac_sdti)
400
  );
401
 
402 290 hellwig
  assign slot1_cs_n = 1'b1;
403
  assign slot2_cs_n = 1'b1;
404
  assign ether_cs_n = 1'b1;
405 27 hellwig
 
406 290 hellwig
  bio bio_1(
407 190 hellwig
    .clk(clk),
408 290 hellwig
    .rst(rst),
409
    .stb(bio_stb),
410
    .we(bus_we),
411
    .addr(bus_addr[2]),
412
    .data_in(bus_dout[31:0]),
413
    .data_out(bio_dout[31:0]),
414
    .ack(bio_ack),
415 192 hellwig
    .sw1_1(flash_a[19]),
416
    .sw1_2(flash_a[18]),
417
    .sw1_3(sw1_3),
418
    .sw1_4(sw1_4),
419 191 hellwig
    .sw2_n(sw2_n),
420
    .sw3_n(sw3_n)
421 190 hellwig
  );
422
 
423 290 hellwig
  //--------------------------------------
424
  // address decoder
425
  //--------------------------------------
426
 
427
  // RAM: architectural limit  = 512 MB
428
  //      implementation limit =  32 MB
429
  assign ram_stb =
430
    (bus_stb == 1 && bus_addr[31:29] == 3'b000
431
                  && bus_addr[28:25] == 4'b0000) ? 1 : 0;
432
 
433
  // ROM: architectural limit  = 256 MB
434
  //      implementation limit =   2 MB
435
  assign rom_stb =
436
    (bus_stb == 1 && bus_addr[31:28] == 4'b0010
437
                  && bus_addr[27:21] == 7'b0000000) ? 1 : 0;
438
 
439
  // I/O: architectural limit  = 256 MB
440
  assign i_o_stb =
441
    (bus_stb == 1 && bus_addr[31:28] == 4'b0011) ? 1 : 0;
442
  assign tmr0_stb =
443
    (i_o_stb == 1 && bus_addr[27:20] == 8'h00
444
                  && bus_addr[19:12] == 8'h00) ? 1 : 0;
445
  assign tmr1_stb =
446
    (i_o_stb == 1 && bus_addr[27:20] == 8'h00
447
                  && bus_addr[19:12] == 8'h01) ? 1 : 0;
448
  assign dsp_stb =
449
    (i_o_stb == 1 && bus_addr[27:20] == 8'h01) ? 1 : 0;
450
  assign kbd_stb =
451
    (i_o_stb == 1 && bus_addr[27:20] == 8'h02) ? 1 : 0;
452
  assign ser0_stb =
453
    (i_o_stb == 1 && bus_addr[27:20] == 8'h03
454
                  && bus_addr[19:12] == 8'h00) ? 1 : 0;
455
  assign ser1_stb =
456
    (i_o_stb == 1 && bus_addr[27:20] == 8'h03
457
                  && bus_addr[19:12] == 8'h01) ? 1 : 0;
458
  assign dsk_stb =
459
    (i_o_stb == 1 && bus_addr[27:20] == 8'h04) ? 1 : 0;
460
  assign fms_stb =
461
    (i_o_stb == 1 && bus_addr[27:20] == 8'h05
462
                  && bus_addr[19:12] == 8'h00) ? 1 : 0;
463
  assign bio_stb =
464
    (i_o_stb == 1 && bus_addr[27:20] == 8'h10
465
                  && bus_addr[19:12] == 8'h00) ? 1 : 0;
466
 
467
  //--------------------------------------
468
  // data and acknowledge multiplexers
469
  //--------------------------------------
470
 
471
  assign bus_din[31:0] =
472
    (ram_stb == 1)  ? ram_dout[31:0] :
473
    (rom_stb == 1)  ? rom_dout[31:0] :
474
    (tmr0_stb == 1) ? tmr0_dout[31:0] :
475
    (tmr1_stb == 1) ? tmr1_dout[31:0] :
476
    (dsp_stb == 1)  ? { 16'h0000, dsp_dout[15:0] } :
477
    (kbd_stb == 1)  ? { 24'h000000, kbd_dout[7:0] } :
478
    (ser0_stb == 1) ? { 24'h000000, ser0_dout[7:0] } :
479
    (ser1_stb == 1) ? { 24'h000000, ser1_dout[7:0] } :
480
    (dsk_stb == 1)  ? dsk_dout[31:0] :
481
    (fms_stb == 1)  ? fms_dout[31:0] :
482
    (bio_stb == 1)  ? bio_dout[31:0] :
483
    32'h00000000;
484
 
485
  assign bus_ack =
486
    (ram_stb == 1)  ? ram_ack :
487
    (rom_stb == 1)  ? rom_ack :
488
    (tmr0_stb == 1) ? tmr0_ack :
489
    (tmr1_stb == 1) ? tmr1_ack :
490
    (dsp_stb == 1)  ? dsp_ack :
491
    (kbd_stb == 1)  ? kbd_ack :
492
    (ser0_stb == 1) ? ser0_ack :
493
    (ser1_stb == 1) ? ser1_ack :
494
    (dsk_stb == 1)  ? dsk_ack :
495
    (fms_stb == 1)  ? fms_ack :
496
    (bio_stb == 1)  ? bio_ack :
497
    0;
498
 
499
  //--------------------------------------
500
  // bus interrupt request assignments
501
  //--------------------------------------
502
 
503
  assign bus_irq[15] = tmr1_irq;
504
  assign bus_irq[14] = tmr0_irq;
505
  assign bus_irq[13] = 0;
506
  assign bus_irq[12] = 0;
507
  assign bus_irq[11] = 0;
508
  assign bus_irq[10] = 0;
509
  assign bus_irq[ 9] = 0;
510
  assign bus_irq[ 8] = dsk_irq;
511
  assign bus_irq[ 7] = 0;
512
  assign bus_irq[ 6] = 0;
513
  assign bus_irq[ 5] = 0;
514
  assign bus_irq[ 4] = kbd_irq;
515
  assign bus_irq[ 3] = ser1_irq_r;
516
  assign bus_irq[ 2] = ser1_irq_t;
517
  assign bus_irq[ 1] = ser0_irq_r;
518
  assign bus_irq[ 0] = ser0_irq_t;
519
 
520 27 hellwig
endmodule

powered by: WebSVN 2.1.0

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