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