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

Subversion Repositories de1_olpcl2294_system

[/] [de1_olpcl2294_system/] [trunk/] [src/] [top.v] - Blame information for rev 10

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 6 qaztronic
// --------------------------------------------------------------------
2
//
3
// --------------------------------------------------------------------
4
 
5
`include "timescale.v"
6
`include "gpio_defines.v"
7
 
8
 
9
module top(
10
  ////////////////////////  Clock Input     ////////////////////////
11
  input [1:0]       clock_24,               //  24 MHz
12
  input [1:0]       clock_27,               //  27 MHz
13
  input             clock_50,               //  50 MHz
14
  input             ext_clock,              //  External Clock
15
  ////////////////////////  Push Button     ////////////////////////
16
  input [3:0]       key,                    //  Pushbutton[3:0]
17
  ////////////////////////  DPDT Switch     ////////////////////////
18
  input [9:0]       sw,                     //  Toggle Switch[9:0]
19
  ////////////////////////  7-SEG Dispaly   ////////////////////////
20
  output    [6:0]   hex0,                   //  Seven Segment Digit 0
21
  output    [6:0]   hex1,                   //  Seven Segment Digit 1
22
  output    [6:0]   hex2,                   //  Seven Segment Digit 2
23
  output    [6:0]   hex3,                   //  Seven Segment Digit 3
24
  ////////////////////////////  LED     ////////////////////////////
25
  output    [7:0]   ledg,                   //  LED Green[7:0]
26
  output    [9:0]   ledr,                   //  LED Red[9:0]
27
  ////////////////////////////  UART    ////////////////////////////
28
  output            uart_txd,               //  UART Transmitter
29
  input             uart_rxd,               //  UART Receiver
30
  ///////////////////////       SDRAM Interface ////////////////////////
31
  inout [15:0]      dram_dq,                //  SDRAM Data bus 16 Bits
32
  output    [11:0]  dram_addr,              //  SDRAM Address bus 12 Bits
33 10 qaztronic
  output            dram_ldqm,              //  SDRAM Low-byte Data Mask
34 6 qaztronic
  output            dram_udqm,              //  SDRAM High-byte Data Mask
35
  output            dram_we_n,              //  SDRAM Write Enable
36
  output            dram_cas_n,             //  SDRAM Column Address Strobe
37
  output            dram_ras_n,             //  SDRAM Row Address Strobe
38
  output            dram_cs_n,              //  SDRAM Chip Select
39
  output            dram_ba_0,              //  SDRAM Bank Address 0
40
  output            dram_ba_1,              //  SDRAM Bank Address 0
41
  output            dram_clk,               //  SDRAM Clock
42
  output            dram_cke,               //  SDRAM Clock Enable
43
  ////////////////////////  Flash Interface ////////////////////////
44
  inout [7:0]       fl_dq,                  //  FLASH Data bus 8 Bits
45
  output    [21:0]  fl_addr,                //  FLASH Address bus 22 Bits
46
  output            fl_we_n,                //  FLASH Write Enable
47
  output            fl_rst_n,               //  FLASH Reset
48
  output            fl_oe_n,                //  FLASH Output Enable
49
  output            fl_ce_n,                //  FLASH Chip Enable
50
  ////////////////////////  SRAM Interface  ////////////////////////
51
  inout   [15:0]    sram_dq,                //  SRAM Data bus 16 Bits
52
  output  [17:0]    sram_addr,              //  SRAM Address bus 18 Bits
53 10 qaztronic
  output            sram_ub_n,              //  SRAM High-byte Data Mask
54
  output            sram_lb_n,              //  SRAM Low-byte Data Mask
55 6 qaztronic
  output            sram_we_n,              //  SRAM Write Enable
56
  output            sram_ce_n,              //  SRAM Chip Enable
57
  output            sram_oe_n,              //  SRAM Output Enable
58
  ////////////////////  SD Card Interface   ////////////////////////
59
  inout             sd_dat,                 //  SD Card Data
60
  inout             sd_dat3,                //  SD Card Data 3
61
  inout             sd_cmd,                 //  SD Card Command Signal
62
  output            sd_clk,                 //  SD Card Clock
63
  ////////////////////////  I2C     ////////////////////////////////
64
  inout             i2c_sdat,               //  I2C Data
65 10 qaztronic
  inout             i2c_sclk,               //  I2C Clock
66 6 qaztronic
  ////////////////////////  PS2     ////////////////////////////////
67
  input             ps2_dat,                //  PS2 Data
68
  input             ps2_clk,                //  PS2 Clock
69
  ////////////////////  USB JTAG link   ////////////////////////////
70
  input             tdi,                    // CPLD -> FPGA (data in)
71
  input             tck,                    // CPLD -> FPGA (clk)
72
  input             tcs,                    // CPLD -> FPGA (CS)
73
  output            tdo,                    // FPGA -> CPLD (data out)
74
  ////////////////////////  VGA         ////////////////////////////
75
  output            vga_hs,                 //  VGA H_SYNC
76
  output            vga_vs,                 //  VGA V_SYNC
77
  output    [3:0]   vga_r,                  //  VGA Red[3:0]
78
  output    [3:0]   vga_g,                  //  VGA Green[3:0]
79
  output    [3:0]   vga_b,                  //  VGA Blue[3:0]
80
  ////////////////////  Audio CODEC     ////////////////////////////
81
  inout             aud_adclrck,            //  Audio CODEC ADC LR Clock
82
  input             aud_adcdat,             //  Audio CODEC ADC Data
83
  inout             aud_daclrck,            //  Audio CODEC DAC LR Clock
84
  output            aud_dacdat,             //  Audio CODEC DAC Data
85
  inout             aud_bclk,               //  Audio CODEC Bit-Stream Clock
86
  output            aud_xck,                //  Audio CODEC Chip Clock
87
  ////////////////////////  GPIO    ////////////////////////////////
88
  inout [35:0]      gpio_0,                 //  GPIO Connection 0
89
  inout [35:0]      gpio_1                  //  GPIO Connection 1
90
);
91
 
92 10 qaztronic
        parameter DW    = 32;
93
        parameter AW    = 32;
94 6 qaztronic
 
95
 
96
  //---------------------------------------------------
97
  // system wires
98 10 qaztronic
        wire sys_rst;
99
//      wire sys_clk = clock_27[0];
100
        wire sys_clk;
101
        wire sys_audio_clk_en;
102
 
103
 
104
  //---------------------------------------------------
105
  // pll
106
  qaz_pll
107
    i_qaz_pll
108
    (
109
      .clock_24(clock_24),               //  24 MHz
110
      .clock_27(clock_27),               //  27 MHz
111
      .clock_50(clock_50),               //  50 MHz
112
      .ext_clock(ext_clock),              //  External Clock
113
 
114
      .sys_audio_clk_en(sys_audio_clk_en),
115
 
116
      .aud_xck(aud_xck),
117
      .sys_clk(sys_clk)
118
    );
119
 
120
 
121 8 qaztronic
//   //---------------------------------------------------
122 10 qaztronic
//   // audio clock
123
//   wire       CLK_18_4, outclk_sig;
124 6 qaztronic
 
125 10 qaztronic
//   PLL
126
//     u0(
127
//         .inclk0(clock_27[0]),
128
//         .c0(CLK_18_4)
129
//       );
130
//
131
//   clk_buffer clk_buffer_inst (
132
//      .ena ( sys_audio_clk_en ),
133
//      .inclk ( CLK_18_4 ),
134
//      .outclk ( outclk_sig )
135
//      );
136
//
137
//   assign  aud_xck =  outclk_sig;
138
 
139
 
140 6 qaztronic
  //---------------------------------------------------
141
  // FLED
142
        reg [24:0] counter;
143
        wire [7:0]  fled;
144
 
145
        always @(posedge sys_clk or posedge sys_rst)
146
          if(sys_rst)
147
                counter <= 25'b0;
148
        else
149
                counter <= counter + 1;
150 10 qaztronic
 
151 6 qaztronic
        assign fled[0]  = sw[0];
152
        assign fled[1]  = sw[1];
153
        assign fled[2]  = sw[2];
154
        assign fled[3]  = sw[3];
155
        assign fled[4]  = sw[4];
156
        assign fled[5]  = sw[5];
157
        assign fled[6]  = sw[6];
158
        assign fled[7]  = counter[24];
159 10 qaztronic
 
160
 
161 6 qaztronic
// --------------------------------------------------------------------
162
//  wb_async_mem_bridge
163
  wire [31:0] m0_data_i;
164
  wire [31:0] m0_data_o;
165
  wire [31:0] m0_addr_o;
166
  wire [3:0]  m0_sel_o;
167
  wire        m0_we_o;
168
  wire        m0_cyc_o;
169
  wire        m0_stb_o;
170
  wire        m0_ack_i;
171
  wire        m0_err_i;
172
  wire        m0_rty_i;
173 10 qaztronic
 
174 6 qaztronic
  wb_async_mem_bridge #( .AW(24) )
175
    i_wb_async_mem_bridge(
176
      .wb_data_i(m0_data_i),
177
      .wb_data_o(m0_data_o),
178
      .wb_addr_o(m0_addr_o[23:0]),
179
      .wb_sel_o(m0_sel_o),
180
      .wb_we_o(m0_we_o),
181
      .wb_cyc_o(m0_cyc_o),
182
      .wb_stb_o(m0_stb_o),
183
      .wb_ack_i(m0_ack_i),
184
      .wb_err_i(m0_err_i),
185
      .wb_rty_i(m0_rty_i),
186 10 qaztronic
 
187 6 qaztronic
      .mem_d( gpio_1[31:0] ),
188
      .mem_a( gpio_0[23:0] ),
189
      .mem_oe_n( gpio_0[30] ),
190
      .mem_bls_n( { gpio_0[26], gpio_0[27], gpio_0[28], gpio_0[29] } ),
191
      .mem_we_n( gpio_0[25] ),
192
      .mem_cs_n( gpio_0[24] ),
193 10 qaztronic
 
194 6 qaztronic
      .wb_clk_i(sys_clk),
195
      .wb_rst_i(sys_rst)
196
    );
197 10 qaztronic
 
198
 
199 6 qaztronic
  //---------------------------------------------------
200
  // wb_conmax_top
201
 
202
  // Slave 0 Interface
203
 
204
  wire  [DW-1:0]  s0_data_i;
205
  wire  [DW-1:0]  s0_data_o;
206
  wire  [AW-1:0]  s0_addr_o;
207
  wire  [3:0]     s0_sel_o;
208
  wire            s0_we_o;
209
  wire            s0_cyc_o;
210
  wire            s0_stb_o;
211
  wire            s0_ack_i;
212
  wire            s0_err_i;
213
  wire            s0_rty_i;
214
 
215
  wire  [DW-1:0]  s1_data_i;
216
  wire  [DW-1:0]  s1_data_o;
217
  wire  [AW-1:0]  s1_addr_o;
218
  wire  [3:0]     s1_sel_o;
219
  wire            s1_we_o;
220
  wire            s1_cyc_o;
221
  wire            s1_stb_o;
222
  wire            s1_ack_i;
223
  wire            s1_err_i;
224
  wire            s1_rty_i;
225
 
226
  wire  [DW-1:0]  s2_data_i;
227
  wire  [DW-1:0]  s2_data_o;
228
  wire  [AW-1:0]  s2_addr_o;
229
  wire  [3:0]     s2_sel_o;
230
  wire            s2_we_o;
231
  wire            s2_cyc_o;
232
  wire            s2_stb_o;
233
  wire            s2_ack_i;
234
  wire            s2_err_i;
235
  wire            s2_rty_i;
236
 
237
  wire  [DW-1:0]  s3_data_i;
238
  wire  [DW-1:0]  s3_data_o;
239
  wire  [AW-1:0]  s3_addr_o;
240
  wire  [3:0]     s3_sel_o;
241
  wire            s3_we_o;
242
  wire            s3_cyc_o;
243
  wire            s3_stb_o;
244
  wire            s3_ack_i;
245
  wire            s3_err_i;
246
  wire            s3_rty_i;
247
 
248
  wire  [DW-1:0]  s4_data_i;
249
  wire  [DW-1:0]  s4_data_o;
250
  wire  [AW-1:0]  s4_addr_o;
251
  wire  [3:0]     s4_sel_o;
252
  wire            s4_we_o;
253
  wire            s4_cyc_o;
254
  wire            s4_stb_o;
255
  wire            s4_ack_i;
256
  wire            s4_err_i;
257
  wire            s4_rty_i;
258
 
259
  wire  [DW-1:0]  s5_data_i;
260
  wire  [DW-1:0]  s5_data_o;
261
  wire  [AW-1:0]  s5_addr_o;
262
  wire  [3:0]     s5_sel_o;
263
  wire            s5_we_o;
264
  wire            s5_cyc_o;
265
  wire            s5_stb_o;
266
  wire            s5_ack_i;
267
  wire            s5_err_i;
268
  wire            s5_rty_i;
269
 
270
  wire  [DW-1:0]  s6_data_i;
271
  wire  [DW-1:0]  s6_data_o;
272
  wire  [AW-1:0]  s6_addr_o;
273
  wire  [3:0]     s6_sel_o;
274
  wire            s6_we_o;
275
  wire            s6_cyc_o;
276
  wire            s6_stb_o;
277
  wire            s6_ack_i;
278
  wire            s6_err_i;
279
  wire            s6_rty_i;
280 10 qaztronic
 
281 6 qaztronic
  wb_conmax_top
282
    i_wb_conmax_top(
283
      // Master 0 Interface
284
      .m0_data_i(m0_data_o),
285
      .m0_data_o(m0_data_i),
286
      .m0_addr_i( {m0_addr_o[23:20], 8'b0, m0_addr_o[19:0]} ),
287
      .m0_sel_i(m0_sel_o),
288
      .m0_we_i(m0_we_o),
289
      .m0_cyc_i(m0_cyc_o),
290
      .m0_stb_i(m0_stb_o),
291
      .m0_ack_o(m0_ack_i),
292
      .m0_err_o(m0_err_i),
293
      .m0_rty_o(m0_rty_i),
294 10 qaztronic
      // Master 1 Interface
295 6 qaztronic
      .m1_data_i(32'h0000_0000),
296
      .m1_addr_i(32'h0000_0000),
297
      .m1_sel_i(4'h0),
298
      .m1_we_i(1'b0),
299
      .m1_cyc_i(1'b0),
300
      .m1_stb_i(1'b0),
301
      // Master 2 Interface
302
      .m2_data_i(32'h0000_0000),
303
      .m2_addr_i(32'h0000_0000),
304
      .m2_sel_i(4'h0),
305
      .m2_we_i(1'b0),
306
      .m2_cyc_i(1'b0),
307
      .m2_stb_i(1'b0),
308
      // Master 3 Interface
309
      .m3_data_i(32'h0000_0000),
310
      .m3_addr_i(32'h0000_0000),
311
      .m3_sel_i(4'h0),
312
      .m3_we_i(1'b0),
313
      .m3_cyc_i(1'b0),
314
      .m3_stb_i(1'b0),
315
      // Master 4 Interface
316
      .m4_data_i(32'h0000_0000),
317
      .m4_addr_i(32'h0000_0000),
318
      .m4_sel_i(4'h0),
319
      .m4_we_i(1'b0),
320
      .m4_cyc_i(1'b0),
321
      .m4_stb_i(1'b0),
322
      // Master 5 Interface
323
      .m5_data_i(32'h0000_0000),
324
      .m5_addr_i(32'h0000_0000),
325
      .m5_sel_i(4'h0),
326
      .m5_we_i(1'b0),
327
      .m5_cyc_i(1'b0),
328
      .m5_stb_i(1'b0),
329
      // Master 6 Interface
330
      .m6_data_i(32'h0000_0000),
331
      .m6_addr_i(32'h0000_0000),
332
      .m6_sel_i(4'h0),
333
      .m6_we_i(1'b0),
334
      .m6_cyc_i(1'b0),
335
      .m6_stb_i(1'b0),
336
      // Master 7 Interface
337
      .m7_data_i(32'h0000_0000),
338
      .m7_addr_i(32'h0000_0000),
339
      .m7_sel_i(4'h0),
340
      .m7_we_i(1'b0),
341
      .m7_cyc_i(1'b0),
342
      .m7_stb_i(1'b0),
343 10 qaztronic
 
344 6 qaztronic
      // Slave 0 Interface
345
      .s0_data_i(s0_data_i),
346
      .s0_data_o(s0_data_o),
347
      .s0_addr_o(s0_addr_o),
348
      .s0_sel_o(s0_sel_o),
349
      .s0_we_o(s0_we_o),
350
      .s0_cyc_o(s0_cyc_o),
351
      .s0_stb_o(s0_stb_o),
352
      .s0_ack_i(s0_ack_i),
353
      .s0_err_i(s0_err_i),
354
      .s0_rty_i(s0_rty_i),
355
      // Slave 1 Interface
356
      .s1_data_i(s1_data_i),
357
      .s1_data_o(s1_data_o),
358
      .s1_addr_o(s1_addr_o),
359
      .s1_sel_o(s1_sel_o),
360
      .s1_we_o(s1_we_o),
361
      .s1_cyc_o(s1_cyc_o),
362
      .s1_stb_o(s1_stb_o),
363
      .s1_ack_i(s1_ack_i),
364
      .s1_err_i(s1_err_i),
365
      .s1_rty_i(s1_rty_i),
366
      // Slave 2 Interface
367
      .s2_data_i(s2_data_i),
368
      .s2_data_o(s2_data_o),
369
      .s2_addr_o(s2_addr_o),
370
      .s2_sel_o(s2_sel_o),
371
      .s2_we_o(s2_we_o),
372
      .s2_cyc_o(s2_cyc_o),
373
      .s2_stb_o(s2_stb_o),
374
      .s2_ack_i(s2_ack_i),
375
      .s2_err_i(s2_err_i),
376
      .s2_rty_i(s2_rty_i),
377
      // Slave 3 Interface
378 8 qaztronic
      .s3_data_i(s3_data_i),
379
      .s3_data_o(s3_data_o),
380
      .s3_addr_o(s3_addr_o),
381
      .s3_sel_o(s3_sel_o),
382
      .s3_we_o(s3_we_o),
383
      .s3_cyc_o(s3_cyc_o),
384
      .s3_stb_o(s3_stb_o),
385
      .s3_ack_i(s3_ack_i),
386
      .s3_err_i(s3_err_i),
387
      .s3_rty_i(s3_rty_i),
388 6 qaztronic
      // Slave 4 Interface
389 10 qaztronic
      .s4_data_i(s4_data_i),
390
      .s4_data_o(s4_data_o),
391
      .s4_addr_o(s4_addr_o),
392
      .s4_sel_o(s4_sel_o),
393
      .s4_we_o(s4_we_o),
394
      .s4_cyc_o(s4_cyc_o),
395
      .s4_stb_o(s4_stb_o),
396
      .s4_ack_i(s4_ack_i),
397
      .s4_err_i(s4_err_i),
398
      .s4_rty_i(s4_rty_i),
399 6 qaztronic
      // Slave 5 Interface
400 10 qaztronic
      .s5_data_i(s5_data_i),
401
      .s5_data_o(s5_data_o),
402
      .s5_addr_o(s5_addr_o),
403
      .s5_sel_o(s5_sel_o),
404
      .s5_we_o(s5_we_o),
405
      .s5_cyc_o(s5_cyc_o),
406
      .s5_stb_o(s5_stb_o),
407
      .s5_ack_i(s5_ack_i),
408
      .s5_err_i(s5_err_i),
409
      .s5_rty_i(s5_rty_i),
410 6 qaztronic
      // Slave 6 Interface
411
      .s6_data_i(32'h0000_0000),
412
      .s6_ack_i(1'b0),
413
      .s6_err_i(1'b0),
414
      .s6_rty_i(1'b0),
415
      // Slave 7 Interface
416
      .s7_data_i(32'h0000_0000),
417
      .s7_ack_i(1'b0),
418
      .s7_err_i(1'b0),
419
      .s7_rty_i(1'b0),
420
      // Slave 8 Interface
421
      .s8_data_i(32'h0000_0000),
422
      .s8_ack_i(1'b0),
423
      .s8_err_i(1'b0),
424
      .s8_rty_i(1'b0),
425
      // Slave 9 Interface
426
      .s9_data_i(32'h0000_0000),
427
      .s9_ack_i(1'b0),
428
      .s9_err_i(1'b0),
429
      .s9_rty_i(1'b0),
430
      // Slave 10 Interface
431
      .s10_data_i(32'h0000_0000),
432
      .s10_ack_i(1'b0),
433
      .s10_err_i(1'b0),
434
      .s10_rty_i(1'b0),
435
      // Slave 11 Interface
436
      .s11_data_i(32'h0000_0000),
437
      .s11_ack_i(1'b0),
438
      .s11_err_i(1'b0),
439
      .s11_rty_i(1'b0),
440
      // Slave 12 Interface
441
      .s12_data_i(32'h0000_0000),
442
      .s12_ack_i(1'b0),
443
      .s12_err_i(1'b0),
444
      .s12_rty_i(1'b0),
445
      // Slave 13 Interface
446
      .s13_data_i(32'h0000_0000),
447
      .s13_ack_i(1'b0),
448
      .s13_err_i(1'b0),
449
      .s13_rty_i(1'b0),
450
      // Slave 14 Interface
451
      .s14_data_i(32'h0000_0000),
452
      .s14_ack_i(1'b0),
453
      .s14_err_i(1'b0),
454
      .s14_rty_i(1'b0),
455
      // Slave 15 Interface
456
      .s15_data_i(32'h0000_0000),
457
      .s15_ack_i(1'b0),
458
      .s15_err_i(1'b0),
459
      .s15_rty_i(1'b0),
460 10 qaztronic
 
461 6 qaztronic
      .clk_i(sys_clk),
462
      .rst_i(sys_rst)
463 10 qaztronic
    );
464
 
465
 
466 6 qaztronic
  //---------------------------------------------------
467
  // async_mem_if
468
  assign s0_err_i = 1'b0;
469
  assign s0_rty_i = 1'b0;
470 10 qaztronic
 
471 6 qaztronic
  async_mem_if #( .AW(18), .DW(16) )
472
    i_sram (
473 10 qaztronic
      .async_dq(sram_dq),
474
      .async_addr(sram_addr),
475
      .async_ub_n(sram_ub_n),
476
      .async_lb_n(sram_lb_n),
477
      .async_we_n(sram_we_n),
478
      .async_ce_n(sram_ce_n),
479
      .async_oe_n(sram_oe_n),
480
      .wb_clk_i(sys_clk),
481 6 qaztronic
      .wb_rst_i(sys_rst),
482
      .wb_adr_i( {14'h0000, s0_addr_o[17:0]} ),
483
      .wb_dat_i(s0_data_o),
484
      .wb_we_i(s0_we_o),
485
      .wb_stb_i(s0_stb_o),
486
      .wb_cyc_i(s0_cyc_o),
487
      .wb_sel_i(s0_sel_o),
488
      .wb_dat_o(s0_data_i),
489
      .wb_ack_o(s0_ack_i),
490 10 qaztronic
      .ce_setup(4'h0),
491
      .op_hold(4'h1),
492 6 qaztronic
      .ce_hold(4'h0),
493
      .big_endian_if_i(1'b0),
494
      .lo_byte_if_i(1'b0)
495
    );
496
 
497 10 qaztronic
 
498 6 qaztronic
  //---------------------------------------------------
499
  // GPIO a
500
  assign s1_rty_i = 1'b0;
501 10 qaztronic
 
502 6 qaztronic
  wire        gpio_a_inta_o;
503
  wire        gpio_a_clk_i;
504
  wire [31:0] gpio_a_aux_i;
505
  wire [31:0] gpio_a_ext_pad_i;
506
  wire [31:0] gpio_a_ext_pad_o;
507
  wire [31:0] gpio_a_ext_padoe_o;
508 10 qaztronic
 
509 6 qaztronic
  gpio_top
510
    i_gpio_a(
511
                  .wb_clk_i(sys_clk),
512
                  .wb_rst_i(sys_rst),
513
                  .wb_cyc_i(s1_cyc_o),
514 8 qaztronic
                  .wb_adr_i( s1_addr_o[7:0] ),
515 6 qaztronic
                  .wb_dat_i(s1_data_o),
516
                  .wb_sel_i(s1_sel_o),
517
                  .wb_we_i(s1_we_o),
518
                  .wb_stb_i(s1_stb_o),
519
                  .wb_dat_o(s1_data_i),
520
                  .wb_ack_o(s1_ack_i),
521
                  .wb_err_o(s1_err_i),
522
                  .wb_inta_o(gpio_a_inta_o),
523 10 qaztronic
 
524 6 qaztronic
`ifdef GPIO_AUX_IMPLEMENT
525
                  .aux_i(gpio_a_aux_i),
526
`endif // GPIO_AUX_IMPLEMENT
527 10 qaztronic
 
528 6 qaztronic
`ifdef GPIO_CLKPAD
529
              .clk_pad_i(gpio_a_clk_i),
530
`endif //  GPIO_CLKPAD
531 10 qaztronic
 
532 6 qaztronic
                  .ext_pad_i(gpio_a_ext_pad_i),
533
                  .ext_pad_o(gpio_a_ext_pad_o),
534
                  .ext_padoe_o(gpio_a_ext_padoe_o)
535
            );
536 10 qaztronic
 
537
 
538 6 qaztronic
  //---------------------------------------------------
539
  // GPIO b
540
  assign s2_rty_i = 1'b0;
541 10 qaztronic
 
542 6 qaztronic
  wire        gpio_b_inta_o;
543
  wire        gpio_b_clk_i;
544
  wire [31:0] gpio_b_aux_i;
545
  wire [31:0] gpio_b_ext_pad_i;
546
  wire [31:0] gpio_b_ext_pad_o;
547
  wire [31:0] gpio_b_ext_padoe_o;
548 10 qaztronic
 
549 6 qaztronic
  gpio_top
550
    i_gpio_b(
551
                  .wb_clk_i(sys_clk),
552
                  .wb_rst_i(sys_rst),
553
                  .wb_cyc_i(s2_cyc_o),
554 8 qaztronic
                  .wb_adr_i( s2_addr_o[7:0] ),
555 6 qaztronic
                  .wb_dat_i(s2_data_o),
556
                  .wb_sel_i(s2_sel_o),
557
                  .wb_we_i(s2_we_o),
558
                  .wb_stb_i(s2_stb_o),
559
                  .wb_dat_o(s2_data_i),
560
                  .wb_ack_o(s2_ack_i),
561
                  .wb_err_o(s2_err_i),
562
                  .wb_inta_o(gpio_b_inta_o),
563 10 qaztronic
 
564 6 qaztronic
`ifdef GPIO_AUX_IMPLEMENT
565
                  .aux_i(gpio_b_aux_i),
566
`endif // GPIO_AUX_IMPLEMENT
567 10 qaztronic
 
568 6 qaztronic
`ifdef GPIO_CLKPAD
569
              .clk_pad_i(gpio_b_clk_i),
570
`endif //  GPIO_CLKPAD
571 10 qaztronic
 
572 6 qaztronic
                  .ext_pad_i(gpio_b_ext_pad_i),
573
                  .ext_pad_o(gpio_b_ext_pad_o),
574
                  .ext_padoe_o(gpio_b_ext_padoe_o)
575
            );
576 10 qaztronic
 
577
 
578 6 qaztronic
  //---------------------------------------------------
579 10 qaztronic
  // qaz_system
580 8 qaztronic
  qaz_system
581
    i_qaz_system(
582
                    .sys_data_i(s3_data_o),
583
                    .sys_data_o(s3_data_i),
584
                    .sys_addr_i(s3_addr_o),
585
                    .sys_sel_i(s3_sel_o),
586
                    .sys_we_i(s3_we_o),
587
                    .sys_cyc_i(s3_cyc_o),
588
                    .sys_stb_i(s3_stb_o),
589
                    .sys_ack_o(s3_ack_i),
590
                    .sys_err_o(s3_err_i),
591
                    .sys_rty_o(s3_rty_i),
592 10 qaztronic
 
593 8 qaztronic
                    .async_rst_i(~key[0]),
594 10 qaztronic
 
595
                    .sys_audio_clk_en(sys_audio_clk_en),
596
 
597 8 qaztronic
                    .hex0(gpio_a_aux_i[6:0]),
598
                    .hex1(gpio_a_aux_i[14:8]),
599
                    .hex2(gpio_a_aux_i[22:16]),
600
                    .hex3(gpio_a_aux_i[30:24]),
601 10 qaztronic
 
602
                    .sys_clk_i(sys_clk),
603 8 qaztronic
                    .sys_rst_o(sys_rst)
604
                  );
605 10 qaztronic
 
606
 
607 8 qaztronic
  //---------------------------------------------------
608 10 qaztronic
  // simple pic
609
  wire        int_o;
610
  wire [1:0]  irq;
611
 
612
  qaz_pic
613
    i_qaz_pic
614
    (
615
      .sys_data_i(s4_data_o),
616
      .sys_data_o(s4_data_i),
617
      .sys_addr_i(s4_addr_o),
618
      .sys_sel_i(s4_sel_o),
619
      .sys_we_i(s4_we_o),
620
      .sys_cyc_i(s4_cyc_o),
621
      .sys_stb_i(s4_stb_o),
622
      .sys_ack_o(s4_ack_i),
623
      .sys_err_o(s4_err_i),
624
      .sys_rty_o(s4_rty_i),
625
 
626
      .int_o(int_o),
627
      .irq(irq),
628
 
629
      .sys_clk_i(sys_clk),
630
      .sys_rst_i(sys_rst)
631
    );
632
 
633
  //---------------------------------------------------
634
  // i2c_master_top
635
  wire i2c_inta_o;
636
  wire scl_pad_i;
637
  wire scl_pad_o;
638
  wire scl_padoen_o;
639
  wire sda_pad_i;
640
  wire sda_pad_o;
641
  wire sda_padoen_o;
642
 
643
  // i2c data out
644
  wire [7:0] i2c_data_o;
645
 
646
  assign s5_data_i[7:0] = i2c_data_o;
647
  assign s5_data_i[15:8] = i2c_data_o;
648
  assign s5_data_i[23:16] = i2c_data_o;
649
  assign s5_data_i[31:24] = i2c_data_o;
650
 
651
  // i2c data in mux
652
  reg [7:0] i2c_data_i_mux;
653
 
654
  always @(*)
655
    case( s5_sel_o )
656
      4'b0001:  i2c_data_i_mux = s5_data_o[7:0];
657
      4'b0010:  i2c_data_i_mux = s5_data_o[15:8];
658
      4'b0100:  i2c_data_i_mux = s5_data_o[23:16];
659
      4'b1000:  i2c_data_i_mux = s5_data_o[31:24];
660
      default:  i2c_data_i_mux = s5_data_o[7:0];
661
    endcase
662
 
663
  // i2c bus error
664
  reg i2c_bus_error;
665
 
666
  always @(*)
667
    case( s5_sel_o )
668
      4'b0001:  i2c_bus_error = 1'b0;
669
      4'b0010:  i2c_bus_error = 1'b0;
670
      4'b0100:  i2c_bus_error = 1'b0;
671
      4'b1000:  i2c_bus_error = 1'b0;
672
      default:  i2c_bus_error = 1'b1;
673
    endcase
674
 
675
  // i2c_master_top
676
  assign s5_err_i = 1'b0;
677
  assign s5_rty_i = 1'b0;
678
 
679
  i2c_master_top
680
    i_i2c_master_top
681
    (
682
      // wishbone signals
683
      .wb_clk_i(sys_clk),     // master clock input
684
      .wb_rst_i(sys_rst),     // synchronous active high reset
685
      .arst_i(1'b1),       // asynchronous reset
686
      .wb_adr_i(s5_addr_o[2:0]),     // lower address bits
687
      .wb_dat_i(i2c_data_i_mux),     // databus input
688
      .wb_dat_o(i2c_data_o),     // databus output
689
      .wb_we_i(s5_we_o),      // write enable input
690
      .wb_stb_i(s5_stb_o),     // stobe/core select signal
691
      .wb_cyc_i(s5_cyc_o),     // valid bus cycle input
692
      .wb_ack_o(s5_ack_i),     // bus cycle acknowledge output
693
      .wb_inta_o(i2c_inta_o),    // interrupt request signal output
694
 
695
      // i2c clock line
696
      .scl_pad_i(scl_pad_i),       // SCL-line input
697
      .scl_pad_o(scl_pad_o),       // SCL-line output (always 1'b0)
698
      .scl_padoen_o(scl_padoen_o),    // SCL-line output enable (active low)
699
 
700
      // i2c data line
701
      .sda_pad_i(sda_pad_i),       // SDA-line input
702
      .sda_pad_o(sda_pad_o),       // SDA-line output (always 1'b0)
703
      .sda_padoen_o(sda_padoen_o)    // SDA-line output enable (active low)
704
      );
705
 
706
 
707
  //---------------------------------------------------
708
  // i2s_to_wb_tx
709
  i2s_to_wb_tx i_i2s_to_wb_tx
710
  (
711
//     .i2s_data_i(i2s_data_i),
712
//     .i2s_data_o(i2s_data_o),
713
//     .i2s_addr_i(i2s_addr_i),
714
//     .i2s_sel_i(i2s_sel_i),
715
//     .i2s_we_i(i2s_we_i),
716
//     .i2s_cyc_i(i2s_cyc_i),
717
//     .i2s_stb_i(i2s_stb_i),
718
//     .i2s_ack_o(i2s_ack_o),
719
//     .i2s_err_o(i2s_err_o),
720
//     .i2s_rty_o(i2s_rty_o),
721
 
722
    .i2s_sck_i(aud_bclk),
723
    .i2s_ws_i(aud_daclrck),
724
    .i2s_sd_o(aud_dacdat),
725
 
726
    .i2s_clk_i(sys_clk),
727
    .i2s_rst_i(sys_rst)
728
  );
729
 
730
 
731
  //---------------------------------------------------
732 6 qaztronic
  // IO pads
733
  genvar i;
734 10 qaztronic
 
735 6 qaztronic
  // gpio a
736
  wire [31:0] gpio_a_io_buffer_o;
737 10 qaztronic
 
738 6 qaztronic
  generate for( i = 0; i < 32; i = i + 1 )
739
    begin: gpio_a_pads
740
      assign gpio_a_io_buffer_o[i] = gpio_a_ext_padoe_o[i] ? gpio_a_ext_pad_o[i] : 1'bz;
741 10 qaztronic
    end
742
  endgenerate
743 6 qaztronic
 
744
  // gpio b
745
  wire [31:0] gpio_b_io_buffer_o;
746 10 qaztronic
 
747 6 qaztronic
  generate for( i = 0; i < 32; i = i + 1 )
748
    begin: gpio_b_pads
749
      assign gpio_b_io_buffer_o[i] = gpio_b_ext_padoe_o[i] ? gpio_b_ext_pad_o[i] : 1'bz;
750 10 qaztronic
    end
751
  endgenerate
752
 
753
  // i2c
754
  assign i2c_sclk = scl_padoen_o ? 1'bz : scl_pad_o;
755
  assign i2c_sdat = sda_padoen_o ? 1'bz : sda_pad_o;
756
 
757 6 qaztronic
  //---------------------------------------------------
758
  // outputs
759 10 qaztronic
 
760 6 qaztronic
  //  All inout port turn to tri-state
761
  assign  dram_dq     =   16'hzzzz;
762
  assign  fl_dq       =   8'hzz;
763
  assign  sd_dat      =   1'bz;
764 10 qaztronic
//   assign  i2c_sdat    =   1'bz;
765
//   assign  aud_adclrck =   1'bz;
766
//   assign  aud_daclrck =   1'bz;
767
//   assign  aud_bclk    =   1'bz;
768
 
769 6 qaztronic
  assign hex0             = gpio_a_io_buffer_o[6:0];
770
  assign hex1             = gpio_a_io_buffer_o[14:8];
771
  assign hex2             = gpio_a_io_buffer_o[22:16];
772
  assign hex3             = gpio_a_io_buffer_o[30:24];
773 8 qaztronic
  assign gpio_a_aux_i[7]  = 1'b0;
774
  assign gpio_a_aux_i[15] = 1'b0;
775
  assign gpio_a_aux_i[23] = 1'b0;
776
  assign gpio_a_aux_i[31] = 1'b0;
777 6 qaztronic
  assign gpio_a_ext_pad_i = 32'b0;
778 10 qaztronic
 
779 6 qaztronic
  assign ledg             = gpio_b_io_buffer_o[7:0];
780
  assign ledr             = gpio_b_io_buffer_o[17:8];
781
  assign gpio_b_aux_i     = { 24'b0, fled } ;
782 8 qaztronic
  assign gpio_b_ext_pad_i = { key, sw, 18'b0 };
783 10 qaztronic
 
784
//   assign gpio_1[35]       = ~gpio_b_inta_o;
785
  assign gpio_1[35] = ~int_o;
786
  assign irq[0]     = ~gpio_b_inta_o;
787
//   assign irq[1]     = 1'b1;
788
  assign irq[1]     = ~i2c_inta_o;
789
 
790
  assign scl_pad_i = i2c_sclk;
791
  assign sda_pad_i = i2c_sdat;
792
 
793 6 qaztronic
endmodule
794
 

powered by: WebSVN 2.1.0

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