1 |
22 |
qaztronic |
// --------------------------------------------------------------------
|
2 |
|
|
//
|
3 |
|
|
// --------------------------------------------------------------------
|
4 |
|
|
|
5 |
24 |
qaztronic |
`include "timescale.v"
|
6 |
|
|
`include "soc_defines.v"
|
7 |
|
|
|
8 |
22 |
qaztronic |
module top(
|
9 |
|
|
//////////////////////// Clock Input ////////////////////////
|
10 |
|
|
input [1:0] clock_24, // 24 MHz
|
11 |
|
|
input [1:0] clock_27, // 27 MHz
|
12 |
|
|
input clock_50, // 50 MHz
|
13 |
|
|
input ext_clock, // External Clock
|
14 |
|
|
//////////////////////// Push Button ////////////////////////
|
15 |
|
|
input [3:0] key, // Pushbutton[3:0]
|
16 |
|
|
//////////////////////// DPDT Switch ////////////////////////
|
17 |
|
|
input [9:0] sw, // Toggle Switch[9:0]
|
18 |
|
|
//////////////////////// 7-SEG Dispaly ////////////////////////
|
19 |
|
|
output [6:0] hex0, // Seven Segment Digit 0
|
20 |
|
|
output [6:0] hex1, // Seven Segment Digit 1
|
21 |
|
|
output [6:0] hex2, // Seven Segment Digit 2
|
22 |
|
|
output [6:0] hex3, // Seven Segment Digit 3
|
23 |
|
|
//////////////////////////// LED ////////////////////////////
|
24 |
|
|
output [7:0] ledg, // LED Green[7:0]
|
25 |
|
|
output [9:0] ledr, // LED Red[9:0]
|
26 |
|
|
//////////////////////////// UART ////////////////////////////
|
27 |
|
|
output uart_txd, // UART Transmitter
|
28 |
|
|
input uart_rxd, // UART Receiver
|
29 |
|
|
/////////////////////// SDRAM Interface ////////////////////////
|
30 |
|
|
inout [15:0] dram_dq, // SDRAM Data bus 16 Bits
|
31 |
|
|
output [11:0] dram_addr, // SDRAM Address bus 12 Bits
|
32 |
|
|
output dram_ldqm, // SDRAM Low-byte Data Mask
|
33 |
|
|
output dram_udqm, // SDRAM High-byte Data Mask
|
34 |
|
|
output dram_we_n, // SDRAM Write Enable
|
35 |
|
|
output dram_cas_n, // SDRAM Column Address Strobe
|
36 |
|
|
output dram_ras_n, // SDRAM Row Address Strobe
|
37 |
|
|
output dram_cs_n, // SDRAM Chip Select
|
38 |
|
|
output dram_ba_0, // SDRAM Bank Address 0
|
39 |
|
|
output dram_ba_1, // SDRAM Bank Address 0
|
40 |
|
|
output dram_clk, // SDRAM Clock
|
41 |
|
|
output dram_cke, // SDRAM Clock Enable
|
42 |
|
|
//////////////////////// Flash Interface ////////////////////////
|
43 |
|
|
inout [7:0] fl_dq, // FLASH Data bus 8 Bits
|
44 |
|
|
output [21:0] fl_addr, // FLASH Address bus 22 Bits
|
45 |
|
|
output fl_we_n, // FLASH Write Enable
|
46 |
|
|
output fl_rst_n, // FLASH Reset
|
47 |
|
|
output fl_oe_n, // FLASH Output Enable
|
48 |
|
|
output fl_ce_n, // FLASH Chip Enable
|
49 |
|
|
//////////////////////// SRAM Interface ////////////////////////
|
50 |
|
|
inout [15:0] sram_dq, // SRAM Data bus 16 Bits
|
51 |
|
|
output [17:0] sram_addr, // SRAM Address bus 18 Bits
|
52 |
|
|
output sram_ub_n, // SRAM High-byte Data Mask
|
53 |
|
|
output sram_lb_n, // SRAM Low-byte Data Mask
|
54 |
|
|
output sram_we_n, // SRAM Write Enable
|
55 |
|
|
output sram_ce_n, // SRAM Chip Enable
|
56 |
|
|
output sram_oe_n, // SRAM Output Enable
|
57 |
|
|
//////////////////// SD Card Interface ////////////////////////
|
58 |
|
|
inout sd_dat, // SD Card Data
|
59 |
|
|
inout sd_dat3, // SD Card Data 3
|
60 |
|
|
inout sd_cmd, // SD Card Command Signal
|
61 |
|
|
output sd_clk, // SD Card Clock
|
62 |
|
|
//////////////////////// I2C ////////////////////////////////
|
63 |
|
|
inout i2c_sdat, // I2C Data
|
64 |
|
|
output i2c_sclk, // I2C Clock
|
65 |
|
|
//////////////////////// PS2 ////////////////////////////////
|
66 |
|
|
input ps2_dat, // PS2 Data
|
67 |
|
|
input ps2_clk, // PS2 Clock
|
68 |
|
|
//////////////////// USB JTAG link ////////////////////////////
|
69 |
|
|
input tdi, // CPLD -> FPGA (data in)
|
70 |
|
|
input tck, // CPLD -> FPGA (clk)
|
71 |
|
|
input tcs, // CPLD -> FPGA (CS)
|
72 |
|
|
output tdo, // FPGA -> CPLD (data out)
|
73 |
|
|
//////////////////////// VGA ////////////////////////////
|
74 |
|
|
output vga_hs, // VGA H_SYNC
|
75 |
|
|
output vga_vs, // VGA V_SYNC
|
76 |
|
|
output [3:0] vga_r, // VGA Red[3:0]
|
77 |
|
|
output [3:0] vga_g, // VGA Green[3:0]
|
78 |
|
|
output [3:0] vga_b, // VGA Blue[3:0]
|
79 |
|
|
//////////////////// Audio CODEC ////////////////////////////
|
80 |
|
|
inout aud_adclrck, // Audio CODEC ADC LR Clock
|
81 |
|
|
input aud_adcdat, // Audio CODEC ADC Data
|
82 |
|
|
inout aud_daclrck, // Audio CODEC DAC LR Clock
|
83 |
|
|
output aud_dacdat, // Audio CODEC DAC Data
|
84 |
|
|
inout aud_bclk, // Audio CODEC Bit-Stream Clock
|
85 |
|
|
output aud_xck, // Audio CODEC Chip Clock
|
86 |
|
|
//////////////////////// GPIO ////////////////////////////////
|
87 |
|
|
inout [35:0] gpio_0, // GPIO Connection 0
|
88 |
|
|
inout [35:0] gpio_1 // GPIO Connection 1
|
89 |
|
|
);
|
90 |
|
|
|
91 |
|
|
|
92 |
|
|
//---------------------------------------------------
|
93 |
|
|
// system wires
|
94 |
24 |
qaztronic |
wire reset_switch = ~key[0];
|
95 |
|
|
wire [3:0] boot_strap = sw[3:0];
|
96 |
|
|
wire sysclk = clock_24[0];
|
97 |
|
|
|
98 |
22 |
qaztronic |
|
99 |
|
|
//---------------------------------------------------
|
100 |
|
|
// FLED
|
101 |
24 |
qaztronic |
reg [24:0] counter;
|
102 |
|
|
wire [7:0] fled;
|
103 |
22 |
qaztronic |
|
104 |
24 |
qaztronic |
always @(posedge sysclk or posedge reset_switch)
|
105 |
|
|
if(reset_switch)
|
106 |
|
|
counter <= 25'b0;
|
107 |
|
|
else
|
108 |
|
|
counter <= counter + 1;
|
109 |
22 |
qaztronic |
|
110 |
24 |
qaztronic |
assign fled[0] = sw[0];
|
111 |
|
|
assign fled[1] = sw[1];
|
112 |
|
|
assign fled[2] = sw[2];
|
113 |
|
|
assign fled[3] = sw[3];
|
114 |
|
|
assign fled[4] = sw[4];
|
115 |
|
|
assign fled[5] = sw[5];
|
116 |
|
|
assign fled[6] = sw[6];
|
117 |
|
|
assign fled[7] = counter[24];
|
118 |
|
|
|
119 |
22 |
qaztronic |
//---------------------------------------------------
|
120 |
|
|
// IO pads
|
121 |
|
|
genvar i;
|
122 |
|
|
|
123 |
|
|
// gpio a
|
124 |
|
|
wire [31:0] gpio_a_aux_i;
|
125 |
|
|
wire [31:0] gpio_a_ext_pad_i;
|
126 |
|
|
wire [31:0] gpio_a_ext_pad_o;
|
127 |
|
|
wire [31:0] gpio_a_ext_padoe_o;
|
128 |
|
|
wire [31:0] gpio_a_io_buffer_o;
|
129 |
|
|
|
130 |
|
|
generate for( i = 0; i < 32; i = i + 1 )
|
131 |
|
|
begin: gpio_a_pads
|
132 |
|
|
assign gpio_a_io_buffer_o[i] = gpio_a_ext_padoe_o[i] ? gpio_a_ext_pad_o[i] : 1'bz;
|
133 |
|
|
end
|
134 |
|
|
endgenerate
|
135 |
|
|
|
136 |
|
|
|
137 |
|
|
//---------------------------------------------------
|
138 |
|
|
// soc_top
|
139 |
24 |
qaztronic |
`ifdef USE_DEBUG_0
|
140 |
22 |
qaztronic |
wire [255 : 0] debug_0;
|
141 |
24 |
qaztronic |
`endif
|
142 |
|
|
|
143 |
|
|
`ifdef USE_EXT_JTAG
|
144 |
|
|
wire jtag_tck_i;
|
145 |
|
|
wire jtag_tms_i;
|
146 |
|
|
wire jtag_tdo_i;
|
147 |
|
|
wire jtag_tdi_o;
|
148 |
|
|
`endif
|
149 |
22 |
qaztronic |
|
150 |
24 |
qaztronic |
soc_top i_or1200_soc_top
|
151 |
|
|
(
|
152 |
|
|
.uart_txd_0(uart_txd), // UART Transmitter
|
153 |
|
|
.uart_rxd_0(uart_rxd), // UART Receiver
|
154 |
|
|
//////////////////////// Flash Interface ////////////////////////
|
155 |
|
|
.fl_dq(fl_dq), // flash data bus 8 bits
|
156 |
|
|
.fl_addr(fl_addr), // flash address bus 22 bits
|
157 |
|
|
.fl_we_n(fl_we_n), // flash write enable
|
158 |
|
|
.fl_rst_n(fl_rst_n), // flash reset
|
159 |
|
|
.fl_oe_n(fl_oe_n), // flash output enable
|
160 |
|
|
.fl_ce_n(fl_ce_n), // flash chip enable
|
161 |
|
|
//////////////////////// sram interface ////////////////////////
|
162 |
|
|
.sram_dq(sram_dq), // sram data bus 16 bits
|
163 |
|
|
.sram_addr(sram_addr), // sram address bus 18 bits
|
164 |
|
|
.sram_ub_n(sram_ub_n), // sram high-byte data mask
|
165 |
|
|
.sram_lb_n(sram_lb_n), // sram low-byte data mask
|
166 |
|
|
.sram_we_n(sram_we_n), // sram write enable
|
167 |
|
|
.sram_ce_n(sram_ce_n), // sram chip enable
|
168 |
|
|
.sram_oe_n(sram_oe_n), // sram output enable
|
169 |
|
|
|
170 |
|
|
.gpio_a_aux_i(gpio_a_aux_i),
|
171 |
|
|
.gpio_a_ext_pad_i(gpio_a_ext_pad_i),
|
172 |
|
|
.gpio_a_ext_pad_o(gpio_a_ext_pad_o),
|
173 |
|
|
.gpio_a_ext_padoe_o(gpio_a_ext_padoe_o),
|
174 |
|
|
|
175 |
|
|
// .gpio_b_aux_i(gpio_b_aux_i),
|
176 |
|
|
// .gpio_b_ext_pad_i(gpio_b_ext_pad_i),
|
177 |
|
|
// .gpio_b_ext_pad_o(gpio_b_ext_pad_o),
|
178 |
|
|
// .gpio_b_ext_padoe_o(gpio_b_ext_padoe_o),
|
179 |
22 |
qaztronic |
|
180 |
24 |
qaztronic |
// .gpio_c_aux_i(gpio_c_aux_i),
|
181 |
|
|
// .gpio_c_ext_pad_i(gpio_c_ext_pad_i),
|
182 |
|
|
// .gpio_c_ext_pad_o(gpio_c_ext_pad_o),
|
183 |
|
|
// .gpio_c_ext_padoe_o(gpio_c_ext_padoe_o),
|
184 |
22 |
qaztronic |
|
185 |
24 |
qaztronic |
// .gpio_d_aux_i(gpio_d_aux_i),
|
186 |
|
|
// .gpio_d_ext_pad_i(gpio_d_ext_pad_i),
|
187 |
|
|
// .gpio_d_ext_pad_o(gpio_d_ext_pad_o),
|
188 |
|
|
// .gpio_d_ext_padoe_o(gpio_d_ext_padoe_o),
|
189 |
22 |
qaztronic |
|
190 |
24 |
qaztronic |
// .gpio_e_aux_i(gpio_e_aux_i),
|
191 |
|
|
// .gpio_e_ext_pad_i(gpio_e_ext_pad_i),
|
192 |
|
|
// .gpio_e_ext_pad_o(gpio_e_ext_pad_o),
|
193 |
|
|
// .gpio_e_ext_padoe_o(gpio_e_ext_padoe_o),
|
194 |
22 |
qaztronic |
|
195 |
24 |
qaztronic |
// .gpio_f_aux_i(gpio_f_aux_i),
|
196 |
|
|
// .gpio_f_ext_pad_i(gpio_f_ext_pad_i),
|
197 |
|
|
// .gpio_f_ext_pad_o(gpio_f_ext_pad_o),
|
198 |
|
|
// .gpio_f_ext_padoe_o(gpio_f_ext_padoe_o),
|
199 |
22 |
qaztronic |
|
200 |
24 |
qaztronic |
// .gpio_g_aux_i(gpio_g_aux_i),
|
201 |
|
|
// .gpio_g_ext_pad_i(gpio_g_ext_pad_i),
|
202 |
|
|
// .gpio_g_ext_pad_o(gpio_g_ext_pad_o),
|
203 |
|
|
// .gpio_g_ext_padoe_o(gpio_g_ext_padoe_o),
|
204 |
22 |
qaztronic |
|
205 |
24 |
qaztronic |
.boot_strap(boot_strap),
|
206 |
|
|
|
207 |
|
|
`ifdef USE_DEBUG_0
|
208 |
|
|
.debug_0(debug_0),
|
209 |
|
|
`endif
|
210 |
22 |
qaztronic |
|
211 |
24 |
qaztronic |
`ifdef USE_EXT_JTAG
|
212 |
|
|
.jtag_tck_i(jtag_tck_i),
|
213 |
|
|
.jtag_tms_i(jtag_tms_i),
|
214 |
|
|
.jtag_tdo_i(jtag_tdo_i),
|
215 |
|
|
.jtag_tdi_o(jtag_tdi_o),
|
216 |
|
|
`endif
|
217 |
|
|
|
218 |
|
|
.sys_clk(sysclk),
|
219 |
|
|
.sys_rst(reset_switch)
|
220 |
|
|
);
|
221 |
|
|
|
222 |
|
|
|
223 |
22 |
qaztronic |
//---------------------------------------------------
|
224 |
|
|
// outputs
|
225 |
|
|
|
226 |
24 |
qaztronic |
// Turn off all display
|
227 |
|
|
assign hex0 = 7'hff;
|
228 |
|
|
assign hex1 = 7'hff;
|
229 |
|
|
assign hex2 = 7'hff;
|
230 |
|
|
assign hex3 = 7'hff;
|
231 |
22 |
qaztronic |
// assign ledg = 8'hff;
|
232 |
24 |
qaztronic |
assign ledr = 10'h000;
|
233 |
22 |
qaztronic |
|
234 |
|
|
// All inout port turn to tri-state
|
235 |
|
|
assign dram_dq = 16'hzzzz;
|
236 |
|
|
assign fl_dq = 8'hzz;
|
237 |
|
|
// assign sram_dq = 16'hzzzz;
|
238 |
|
|
assign sd_dat = 1'bz;
|
239 |
|
|
assign i2c_sdat = 1'bz;
|
240 |
|
|
assign aud_adclrck = 1'bz;
|
241 |
|
|
assign aud_daclrck = 1'bz;
|
242 |
|
|
assign aud_bclk = 1'bz;
|
243 |
|
|
assign gpio_0 = 36'hzzzzzzzzz;
|
244 |
|
|
assign gpio_1 = 36'hzzzzzzzzz;
|
245 |
|
|
|
246 |
|
|
assign ledg[7:0] = gpio_a_io_buffer_o[7:0];
|
247 |
|
|
assign gpio_a_aux_i = { 24'h000000, fled };
|
248 |
|
|
assign gpio_a_ext_pad_i = { 14'h0000, sw, ledg };
|
249 |
|
|
|
250 |
|
|
|
251 |
|
|
endmodule
|
252 |
|
|
|