1 |
46 |
rrred |
-------------------------------------------------------------------------------------------------
|
2 |
|
|
-- Z80SoC (Z80 System on Chip)
|
3 |
|
|
-- Ronivon Candido Costa
|
4 |
|
|
-- ronivon.costa@gmail.com
|
5 |
|
|
--
|
6 |
|
|
-- Version history:
|
7 |
|
|
-------------------
|
8 |
|
|
-- version 0.7.1
|
9 |
|
|
-- 2010 / 11 / 22
|
10 |
|
|
-- Change memory layout and increased Rom, using Megawizard plug in manager
|
11 |
|
|
-- Memory cores redefined
|
12 |
|
|
-- Fixed bug in the video.vhd
|
13 |
|
|
-- New rom demo in C (SDCC)
|
14 |
|
|
--
|
15 |
|
|
-- version 0.7
|
16 |
|
|
-- Release Date: 2010 / 02 / 17
|
17 |
|
|
-- version 0.6 for for Altera DE1
|
18 |
|
|
-- Release Date: 2008 / 05 / 21
|
19 |
|
|
--
|
20 |
|
|
-- Version 0.5 Beta for Altera DE1
|
21 |
|
|
-- Developer: Ronivon Candido Costa
|
22 |
|
|
-- Release Date: 2008 / 04 / 16
|
23 |
|
|
--
|
24 |
|
|
-- Based on the T80 core: http://www.opencores.org/projects.cgi/web/t80
|
25 |
|
|
-- This version developed and tested on: Altera DE1 Development Board
|
26 |
|
|
--
|
27 |
|
|
-- Peripherals configured (Using Ports):
|
28 |
|
|
--
|
29 |
|
|
-- 16 KB Internal ROM Read (0x0000h - 0x3FFFh)
|
30 |
|
|
-- 08 KB INTERNAL VRAM Write (0x4000h - 0x5FFFh)
|
31 |
|
|
-- 32 KB External SRAM Read/Write (0x8000h - 0xFFFFh)
|
32 |
|
|
-- 08 Green Leds Out (Port 0x01h)
|
33 |
|
|
-- 08 Red Leds Out (Port 0x02h)
|
34 |
|
|
-- 04 Seven Seg displays Out (Ports 0x11h and 0x10h)
|
35 |
|
|
-- 36 Pins GPIO0 In/Out (Ports 0xA0h, 0xA1h, 0xA2h, 0xA3h, 0xA4h, 0xC0h)
|
36 |
|
|
-- 36 Pins GPIO1 In/Out (Ports 0xB0h, 0xB1h, 0xB2h, 0xB3h, 0xB4h, 0xC1h)
|
37 |
|
|
-- 08 Switches In (Port 0x20h)
|
38 |
|
|
-- 04 Push buttons In (Port 0x30h)
|
39 |
|
|
-- 01 PS/2 keyboard In (Port 0x80h)
|
40 |
|
|
-- 01 Video write port In (Port 0x90h)
|
41 |
|
|
--
|
42 |
|
|
-- Revision history:
|
43 |
|
|
--
|
44 |
|
|
-- 2008/05/23 - Modified RAM layout to support new and future improvements
|
45 |
|
|
-- - Added port 0x90 to write a character to video.
|
46 |
|
|
-- - Cursor x,y automatically updated after writing to port 0x90
|
47 |
|
|
-- - Added port 0x91 for video cursor X
|
48 |
|
|
-- - Added port 0x92 for video cursor Y
|
49 |
|
|
-- - Updated ROM to demonstrate how to use these new resources
|
50 |
|
|
-- - Changed ROM to support 14 bit addresses (16 Kb)
|
51 |
|
|
--
|
52 |
|
|
-- 2008/05/12 - Added support for the Rotary Knob
|
53 |
|
|
-- - ROT_CENTER push button (Knob) reserved for RESET
|
54 |
|
|
-- - The four push buttons are now available for the user (Port 0x30)
|
55 |
|
|
--
|
56 |
|
|
-- 2008/05/11 - Fixed access to RAM and VRAM,
|
57 |
|
|
-- Released same ROM version for DE1 and S3E
|
58 |
|
|
--
|
59 |
|
|
-- 2008/05/01 - Added LCD support for Spartan 3E
|
60 |
|
|
--
|
61 |
|
|
-- 2008/04(21 - Release of Version 0.5-S3E-Beta for Diligent Spartan 3E
|
62 |
|
|
--
|
63 |
|
|
-- 2008/04/17 - Added Video support for 40x30 mode
|
64 |
|
|
--
|
65 |
|
|
-- 2008/04/16 - Release of Version 0.5-DE1-Beta for Altera DE1
|
66 |
|
|
--
|
67 |
|
|
-- TO-DO:
|
68 |
|
|
-- - Implement hardware control for the A/D and IO pins
|
69 |
|
|
-- - Monitor program to introduce Z80 Assmebly codes and run
|
70 |
|
|
-- - Serial communication, to download assembly code from PC
|
71 |
|
|
-- - Add hardware support for 80x40 Video out
|
72 |
|
|
-- - SD/MMC card interface to read/store data and programs
|
73 |
|
|
-------------------------------------------------------------------------------------------------
|
74 |
|
|
|
75 |
|
|
library IEEE;
|
76 |
|
|
use IEEE.std_logic_1164.all;
|
77 |
|
|
use IEEE.std_logic_arith.all;
|
78 |
|
|
use IEEE.std_logic_unsigned.all;
|
79 |
|
|
use work.z80soc_pack.all;
|
80 |
|
|
|
81 |
|
|
entity Z80SOC is
|
82 |
|
|
port(
|
83 |
|
|
-- Clocks
|
84 |
|
|
CLOCK_50 : in std_logic; -- 50 MHz
|
85 |
|
|
|
86 |
|
|
-- Buttons and switches
|
87 |
|
|
KEY : in std_logic_vector(3 downto 0); -- Push buttons
|
88 |
|
|
SW : in std_logic_vector(17 downto 0); -- Switches
|
89 |
|
|
|
90 |
|
|
-- LED displays
|
91 |
|
|
HEX0, HEX1, HEX2, HEX3, HEX4, HEX5, HEX6, HEX7 -- 7-segment displays
|
92 |
|
|
: out std_logic_vector(6 downto 0);
|
93 |
|
|
LEDG : out std_logic_vector(8 downto 0); -- Green LEDs
|
94 |
|
|
LEDR : out std_logic_vector(17 downto 0); -- Red LEDs
|
95 |
|
|
|
96 |
|
|
-- RS-232 interface
|
97 |
|
|
UART_TXD : out std_logic; -- UART transmitter
|
98 |
|
|
UART_RXD : in std_logic; -- UART receiver
|
99 |
|
|
UART_RTS : in std_logic; -- UART RTS
|
100 |
|
|
UART_CTS : in std_logic; -- UART CTS
|
101 |
|
|
|
102 |
|
|
-- IRDA interface
|
103 |
|
|
|
104 |
|
|
-- IRDA_TXD : out std_logic; -- IRDA Transmitter
|
105 |
|
|
IRDA_RXD : in std_logic; -- IRDA Receiver
|
106 |
|
|
|
107 |
|
|
-- SDRAM
|
108 |
|
|
DRAM_BA_0, -- Bank Address 0
|
109 |
|
|
DRAM_BA_1, -- Bank Address 0
|
110 |
|
|
DRAM_DQM_0, -- Byte Data Mask 0
|
111 |
|
|
DRAM_DQM_1, -- Byte Data Mask 1
|
112 |
|
|
DRAM_DQM_2, -- Byte Data Mask 2
|
113 |
|
|
DRAM_DQM_3, -- Byte Data Mask 3
|
114 |
|
|
DRAM_WE_N, -- Write Enable
|
115 |
|
|
DRAM_CAS_N, -- Column Address Strobe
|
116 |
|
|
DRAM_RAS_N, -- Row Address Strobe
|
117 |
|
|
DRAM_CS_N : out std_logic; -- Chip Select
|
118 |
|
|
DRAM_DQ : inout std_logic_vector(31 downto 0); -- Data Bus
|
119 |
|
|
DRAM_ADDR : out std_logic_vector(12 downto 0); -- Address Bus
|
120 |
|
|
DRAM_CLK, -- Clock
|
121 |
|
|
DRAM_CKE : out std_logic; -- Clock Enable
|
122 |
|
|
|
123 |
|
|
-- FLASH
|
124 |
|
|
FL_DQ : inout std_logic_vector(7 downto 0); -- Data bus
|
125 |
|
|
FL_ADDR : out std_logic_vector(22 downto 0); -- Address bus
|
126 |
|
|
FL_RY : in std_logic;
|
127 |
|
|
FL_WP_N,
|
128 |
|
|
FL_WE_N, -- Write Enable
|
129 |
|
|
FL_RST_N, -- Reset
|
130 |
|
|
FL_OE_N, -- Output Enable
|
131 |
|
|
FL_CE_N : out std_logic; -- Chip Enable
|
132 |
|
|
|
133 |
|
|
-- SRAM
|
134 |
|
|
SRAM_DQ : inout std_logic_vector(15 downto 0); -- Data bus 16 Bits
|
135 |
|
|
SRAM_ADDR : out std_logic_vector(SRAM_width - 1 downto 0); -- Address bus 18 Bits
|
136 |
|
|
SRAM_UB_N, -- High-byte Data Mask
|
137 |
|
|
SRAM_LB_N, -- Low-byte Data Mask
|
138 |
|
|
SRAM_WE_N, -- Write Enable
|
139 |
|
|
SRAM_CE_N, -- Chip Enable
|
140 |
|
|
SRAM_OE_N : out std_logic; -- Output Enable
|
141 |
|
|
|
142 |
|
|
-- SD card interface
|
143 |
|
|
SD_DAT0 : in std_logic; -- SD Card Data SD "DAT 0/DataOut"
|
144 |
|
|
SD_DAT1 : inout std_logic; -- SD Card Data SD "DAT 1"
|
145 |
|
|
SD_DAT2 : inout std_logic; -- SD Card Data 3 SD "DAT 2"
|
146 |
|
|
SD_DAT3 : out std_logic; -- SD Card Data 3 SD "DAT 3/nCS"
|
147 |
|
|
SD_CMD : out std_logic; -- SD Card Command SD "CMD/DataIn"
|
148 |
|
|
SD_CLK : out std_logic; -- SD Card Clock SD "CLK"
|
149 |
|
|
|
150 |
|
|
-- PS/2 port
|
151 |
|
|
PS2_DAT, -- Data
|
152 |
|
|
PS2_CLK : inout std_logic; -- Clock
|
153 |
|
|
PS2_DAT2, -- Data
|
154 |
|
|
PS2_CLK2 : inout std_logic; -- Clock
|
155 |
|
|
|
156 |
|
|
-- VGA output
|
157 |
|
|
VGA_SYNC_N,
|
158 |
|
|
VGA_CLK,
|
159 |
|
|
VGA_BLANK_N,
|
160 |
|
|
VGA_HS, -- H_SYNC
|
161 |
|
|
VGA_VS : out std_logic; -- SYNC
|
162 |
|
|
VGA_R, -- Red[7:0]
|
163 |
|
|
VGA_G, -- Green[7:0]
|
164 |
|
|
VGA_B : out std_logic_vector(7 downto 0); -- Blue[7:0]
|
165 |
|
|
|
166 |
|
|
-- Audio CODEC
|
167 |
|
|
AUD_ADCLRCK : inout std_logic; -- ADC LR Clock
|
168 |
|
|
AUD_ADCDAT : in std_logic; -- ADC Data
|
169 |
|
|
AUD_DACLRCK : inout std_logic; -- DAC LR Clock
|
170 |
|
|
AUD_DACDAT : out std_logic; -- DAC Data
|
171 |
|
|
AUD_BCLK : inout std_logic; -- Bit-Stream Clock
|
172 |
|
|
AUD_XCK : out std_logic; -- Chip Clock
|
173 |
|
|
LCD_RS : OUT std_logic;
|
174 |
|
|
LCD_EN : OUT std_logic;
|
175 |
|
|
LCD_RW : OUT std_logic;
|
176 |
|
|
LCD_ON : OUT std_logic;
|
177 |
|
|
LCD_BLON : OUT std_logic; -- lcd on DE2 do not support this signal
|
178 |
|
|
LCD_DATA : INOUT STD_LOGIC_VECTOR(7 DOWNTO 0));
|
179 |
|
|
end Z80SOC;
|
180 |
|
|
|
181 |
|
|
architecture rtl of Z80SOC is
|
182 |
|
|
|
183 |
|
|
component T80se
|
184 |
|
|
generic(
|
185 |
|
|
Mode : integer := 0; -- 0 => Z80, 1 => Fast Z80, 2 => 8080, 3 => GB
|
186 |
|
|
T2Write : integer := 1; -- 0 => WR_n active in T3, /=0 => WR_n active in T2
|
187 |
|
|
IOWait : integer := 1 -- 0 => Siomngle cycle I/O, 1 => Std I/O cycle
|
188 |
|
|
);
|
189 |
|
|
port(
|
190 |
|
|
RESET_n : in std_logic;
|
191 |
|
|
CLK_n : in std_logic;
|
192 |
|
|
CLKEN : in std_logic;
|
193 |
|
|
WAIT_n : in std_logic;
|
194 |
|
|
INT_n : in std_logic;
|
195 |
|
|
NMI_n : in std_logic;
|
196 |
|
|
BUSRQ_n : in std_logic;
|
197 |
|
|
M1_n : out std_logic;
|
198 |
|
|
MREQ_n : out std_logic;
|
199 |
|
|
IORQ_n : out std_logic;
|
200 |
|
|
RD_n : out std_logic;
|
201 |
|
|
WR_n : out std_logic;
|
202 |
|
|
RFSH_n : out std_logic;
|
203 |
|
|
HALT_n : out std_logic;
|
204 |
|
|
BUSAK_n : out std_logic;
|
205 |
|
|
A : out std_logic_vector(15 downto 0);
|
206 |
|
|
DI : in std_logic_vector(7 downto 0);
|
207 |
|
|
DO : out std_logic_vector(7 downto 0)
|
208 |
|
|
);
|
209 |
|
|
end component;
|
210 |
|
|
|
211 |
|
|
component rom
|
212 |
|
|
port (
|
213 |
|
|
clock : in std_logic;
|
214 |
|
|
address : in std_logic_vector(13 downto 0);
|
215 |
|
|
q : out std_logic_vector(7 downto 0));
|
216 |
|
|
end component;
|
217 |
|
|
|
218 |
|
|
component clk_div
|
219 |
|
|
PORT
|
220 |
|
|
(
|
221 |
|
|
clock_in_50Mhz : IN STD_LOGIC;
|
222 |
|
|
clock_25MHz : OUT STD_LOGIC;
|
223 |
|
|
clock_10MHz : OUT STD_LOGIC;
|
224 |
|
|
clock_357MHz : OUT STD_LOGIC;
|
225 |
|
|
clock_1MHz : OUT STD_LOGIC;
|
226 |
|
|
clock_100KHz : OUT STD_LOGIC;
|
227 |
|
|
clock_10KHz : OUT STD_LOGIC;
|
228 |
|
|
clock_1KHz : OUT STD_LOGIC;
|
229 |
|
|
clock_100Hz : OUT STD_LOGIC;
|
230 |
|
|
clock_10Hz : OUT STD_LOGIC;
|
231 |
|
|
clock_1Hz : OUT STD_LOGIC);
|
232 |
|
|
end component;
|
233 |
|
|
|
234 |
|
|
component decoder_7seg
|
235 |
|
|
port (
|
236 |
|
|
NUMBER : in std_logic_vector(3 downto 0);
|
237 |
|
|
HEX_DISP : out std_logic_vector(6 downto 0));
|
238 |
|
|
end component;
|
239 |
|
|
|
240 |
|
|
component ps2kbd
|
241 |
|
|
port (
|
242 |
|
|
keyboard_clk : inout std_logic;
|
243 |
|
|
keyboard_data : inout std_logic;
|
244 |
|
|
clock : in std_logic;
|
245 |
|
|
clkdelay : in std_logic;
|
246 |
|
|
reset : in std_logic;
|
247 |
|
|
read : in std_logic;
|
248 |
|
|
scan_ready : out std_logic;
|
249 |
|
|
ps2_ascii_code : out std_logic_vector(7 downto 0));
|
250 |
|
|
end component;
|
251 |
|
|
|
252 |
|
|
component vram
|
253 |
|
|
port
|
254 |
|
|
(
|
255 |
|
|
rdaddress : IN STD_LOGIC_VECTOR (12 DOWNTO 0);
|
256 |
|
|
wraddress : IN STD_LOGIC_VECTOR (12 DOWNTO 0);
|
257 |
|
|
rdclock : IN STD_LOGIC;
|
258 |
|
|
wrclock : IN STD_LOGIC;
|
259 |
|
|
data : IN STD_LOGIC_VECTOR (7 DOWNTO 0);
|
260 |
|
|
wren : IN STD_LOGIC;
|
261 |
|
|
q : OUT STD_LOGIC_VECTOR (7 DOWNTO 0)
|
262 |
|
|
);
|
263 |
|
|
end component;
|
264 |
|
|
|
265 |
|
|
component charram
|
266 |
|
|
port (
|
267 |
|
|
data : IN STD_LOGIC_VECTOR (7 DOWNTO 0);
|
268 |
|
|
rdaddress : IN STD_LOGIC_VECTOR (10 DOWNTO 0);
|
269 |
|
|
rdclock : IN STD_LOGIC ;
|
270 |
|
|
wraddress : IN STD_LOGIC_VECTOR (10 DOWNTO 0);
|
271 |
|
|
wrclock : IN STD_LOGIC;
|
272 |
|
|
wren : IN STD_LOGIC;
|
273 |
|
|
q : OUT STD_LOGIC_VECTOR (7 DOWNTO 0));
|
274 |
|
|
end component;
|
275 |
|
|
|
276 |
|
|
COMPONENT video
|
277 |
|
|
PORT (
|
278 |
|
|
CLOCK_25 : IN STD_LOGIC;
|
279 |
|
|
VRAM_DATA : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
|
280 |
|
|
VRAM_ADDR : OUT STD_LOGIC_VECTOR(13 DOWNTO 0);
|
281 |
|
|
VRAM_CLOCK : OUT STD_LOGIC;
|
282 |
|
|
VRAM_WREN : OUT STD_LOGIC;
|
283 |
|
|
CRAM_DATA : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
|
284 |
|
|
CRAM_ADDR : OUT STD_LOGIC_VECTOR(10 DOWNTO 0);
|
285 |
|
|
CRAM_WEB : OUT STD_LOGIC;
|
286 |
|
|
VGA_R,
|
287 |
|
|
VGA_G,
|
288 |
|
|
VGA_B : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
|
289 |
|
|
VGA_HS,
|
290 |
|
|
VGA_VS : OUT STD_LOGIC);
|
291 |
|
|
END COMPONENT;
|
292 |
|
|
|
293 |
|
|
COMPONENT PLL_Clocks
|
294 |
|
|
PORT
|
295 |
|
|
(
|
296 |
|
|
inclk0 : IN STD_LOGIC := '0';
|
297 |
|
|
c0 : OUT STD_LOGIC;
|
298 |
|
|
c1 : OUT STD_LOGIC;
|
299 |
|
|
c2 : OUT STD_LOGIC
|
300 |
|
|
);
|
301 |
|
|
END COMPONENT;
|
302 |
|
|
|
303 |
|
|
COMPONENT LCD
|
304 |
|
|
PORT(
|
305 |
|
|
reset : IN std_logic; -- Map this Port to a Switch within your [Port Declarations / Pin Planer]
|
306 |
|
|
CLOCK_50 : IN std_logic; -- Using the DE2 50Mhz Clk, in order to Genreate the 400Hz signal... clk_count_400hz reset count value must be set to: <= x"0F424"
|
307 |
|
|
LCD_RS : OUT std_logic;
|
308 |
|
|
LCD_EN : OUT std_logic;
|
309 |
|
|
LCD_RW : OUT std_logic;
|
310 |
|
|
LCD_ON : OUT std_logic;
|
311 |
|
|
LCD_BLON : OUT std_logic;
|
312 |
|
|
LCD_DATA : INOUT STD_LOGIC_VECTOR(7 DOWNTO 0);
|
313 |
|
|
lcd_on_sig : IN STD_LOGIC;
|
314 |
|
|
next_char : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
|
315 |
|
|
char_count : OUT STD_LOGIC_VECTOR(4 downto 0);
|
316 |
|
|
clk400hz : OUT STD_LOGIC);
|
317 |
|
|
END COMPONENT;
|
318 |
|
|
|
319 |
|
|
signal MREQ_n : std_logic;
|
320 |
|
|
signal IORQ_n : std_logic;
|
321 |
|
|
signal RD_n : std_logic;
|
322 |
|
|
signal WR_n : std_logic;
|
323 |
|
|
signal MWr_n : std_logic;
|
324 |
|
|
signal Rst_n_s : std_logic;
|
325 |
|
|
signal Clk_Z80 : std_logic;
|
326 |
|
|
signal DI_CPU : std_logic_vector(7 downto 0);
|
327 |
|
|
signal DO_CPU : std_logic_vector(7 downto 0);
|
328 |
|
|
signal A : std_logic_vector(15 downto 0);
|
329 |
|
|
signal One : std_logic;
|
330 |
|
|
|
331 |
|
|
signal D_ROM : std_logic_vector(7 downto 0);
|
332 |
|
|
signal rom_data : std_logic_vector(7 downto 0);
|
333 |
|
|
signal rom_wren : std_logic;
|
334 |
|
|
|
335 |
|
|
signal clk_count_400hz: std_logic_vector(19 downto 0);
|
336 |
|
|
signal clk100mhz : std_logic;
|
337 |
|
|
signal clk25mhz : std_logic;
|
338 |
|
|
signal clk1mhz : std_logic;
|
339 |
|
|
signal clk10mhz : std_logic;
|
340 |
|
|
signal clk100hz : std_logic;
|
341 |
|
|
signal clk10hz : std_logic;
|
342 |
|
|
signal clk1hz : std_logic;
|
343 |
|
|
signal clk357mhz : std_logic;
|
344 |
|
|
|
345 |
|
|
|
346 |
|
|
signal HEX_DISP0 : std_logic_vector(6 downto 0);
|
347 |
|
|
signal HEX_DISP1 : std_logic_vector(6 downto 0);
|
348 |
|
|
signal HEX_DISP2 : std_logic_vector(6 downto 0);
|
349 |
|
|
signal HEX_DISP3 : std_logic_vector(6 downto 0);
|
350 |
|
|
signal HEX_DISP4 : std_logic_vector(6 downto 0);
|
351 |
|
|
signal HEX_DISP5 : std_logic_vector(6 downto 0);
|
352 |
|
|
signal HEX_DISP6 : std_logic_vector(6 downto 0);
|
353 |
|
|
signal HEX_DISP7 : std_logic_vector(6 downto 0);
|
354 |
|
|
|
355 |
|
|
signal NUMBER0 : std_logic_vector(3 downto 0);
|
356 |
|
|
signal NUMBER1 : std_logic_vector(3 downto 0);
|
357 |
|
|
signal NUMBER2 : std_logic_vector(3 downto 0);
|
358 |
|
|
signal NUMBER3 : std_logic_vector(3 downto 0);
|
359 |
|
|
signal NUMBER4 : std_logic_vector(3 downto 0);
|
360 |
|
|
signal NUMBER5 : std_logic_vector(3 downto 0);
|
361 |
|
|
signal NUMBER6 : std_logic_vector(3 downto 0);
|
362 |
|
|
signal NUMBER7 : std_logic_vector(3 downto 0);
|
363 |
|
|
|
364 |
|
|
--signal GPIO_0_buf_in : std_logic_vector(35 downto 0);
|
365 |
|
|
--signal GPIO_1_buf_in : std_logic_vector(35 downto 0);
|
366 |
|
|
|
367 |
|
|
signal vram_addra : std_logic_vector(15 downto 0);
|
368 |
|
|
signal vram_addrb : std_logic_vector(13 downto 0);
|
369 |
|
|
signal vram_dina : std_logic_vector(7 downto 0);
|
370 |
|
|
signal vram_dinb : std_logic_vector(7 downto 0);
|
371 |
|
|
signal vram_douta : std_logic_vector(7 downto 0);
|
372 |
|
|
signal vram_doutb : std_logic_vector(7 downto 0);
|
373 |
|
|
signal vram_wea : std_logic;
|
374 |
|
|
signal vram_web : std_logic;
|
375 |
|
|
signal vram_clka : std_logic;
|
376 |
|
|
signal vram_clkb : std_logic;
|
377 |
|
|
|
378 |
|
|
-- signal vram_douta_reg : std_logic_vector(7 downto 0);
|
379 |
|
|
|
380 |
|
|
signal cram_addra : std_logic_vector(15 downto 0);
|
381 |
|
|
signal cram_addrb : std_logic_vector(15 downto 0);
|
382 |
|
|
signal cram_dina : std_logic_vector(7 downto 0);
|
383 |
|
|
signal cram_dinb : std_logic_vector(7 downto 0);
|
384 |
|
|
signal cram_douta : std_logic_vector(7 downto 0);
|
385 |
|
|
signal cram_doutb : std_logic_vector(7 downto 0);
|
386 |
|
|
signal cram_wea : std_logic;
|
387 |
|
|
signal cram_web : std_logic;
|
388 |
|
|
signal cram_clka : std_logic;
|
389 |
|
|
signal cram_clkb : std_logic;
|
390 |
|
|
|
391 |
|
|
-- PS/2 Keyboard
|
392 |
|
|
signal ps2_read : std_logic;
|
393 |
|
|
signal ps2_scan_ready : std_logic;
|
394 |
|
|
signal ps2_ascii_sig : std_logic_vector(7 downto 0);
|
395 |
|
|
signal ps2_ascii_reg1 : std_logic_vector(7 downto 0);
|
396 |
|
|
signal ps2_ascii_reg : std_logic_vector(7 downto 0);
|
397 |
|
|
|
398 |
|
|
-- LCD signals
|
399 |
|
|
type character_string is array ( 0 to 31 ) of STD_LOGIC_VECTOR( 7 downto 0 );
|
400 |
|
|
signal lcdvram : character_string;
|
401 |
|
|
signal lcdaddr_w_sig : std_logic_vector(15 downto 0);
|
402 |
|
|
signal lcdaddr_sig : std_logic_vector(15 downto 0) := LCD_value;
|
403 |
|
|
signal clk400hz : std_logic;
|
404 |
|
|
signal char_count_sig : std_logic_vector(4 downto 0);
|
405 |
|
|
signal next_char_sig : std_logic_vector(7 downto 0);
|
406 |
|
|
signal temp : std_logic;
|
407 |
|
|
|
408 |
|
|
signal Z80SOC_Arch_reg : std_logic_vector(2 downto 0) := Z80SOC_Arch_value; -- "000" = DE1, "001" = S3E, "010" = DE2115
|
409 |
|
|
signal RAMTOP_reg : std_logic_vector(15 downto 0) := RAMTOP_value;
|
410 |
|
|
signal RAMBOTT_reg : std_logic_vector(15 downto 0) := RAMBOTT_value;
|
411 |
|
|
signal LCD_reg : std_logic_vector(15 downto 0) := LCD_value;
|
412 |
|
|
signal VRAM_reg : std_logic_vector(15 downto 0) := VRAM_value;
|
413 |
|
|
signal STACK_reg : std_logic_vector(15 downto 0) := STACK_value;
|
414 |
|
|
signal CHARRAM_reg : std_logic_vector(15 downto 0) := CHARRAM_value;
|
415 |
|
|
signal VRAMNXTCHAR_reg : std_logic_vector(15 downto 0);
|
416 |
|
|
signal CURX_reg : std_logic_vector(7 downto 0);
|
417 |
|
|
signal CURY_reg : std_logic_vector(7 downto 0);
|
418 |
|
|
signal STDOUT_reg : std_logic_vector(7 downto 0);
|
419 |
|
|
signal LCDON_reg : std_logic;
|
420 |
|
|
begin
|
421 |
|
|
|
422 |
|
|
-- required signals for DE2-115
|
423 |
|
|
VGA_BLANK_N <= '1';
|
424 |
|
|
VGA_CLK <= clk25mhz;
|
425 |
|
|
--
|
426 |
|
|
STDOUT_reg <= DO_CPU when (A = x"57CD" and Wr_n = '0' and MReq_n = '0');
|
427 |
|
|
CURX_reg <= DO_CPU when (A = x"57CF" and Wr_n = '0' and MReq_n = '0');
|
428 |
|
|
CURY_reg <= DO_CPU when (A = x"57CE" and Wr_n = '0' and MReq_n = '0');
|
429 |
|
|
VRAMNXTCHAR_reg(7 DOWNTO 0) <= DO_CPU when (A = x"57D0" and Wr_n = '0' and MReq_n = '0');
|
430 |
|
|
VRAMNXTCHAR_reg(15 DOWNTO 8) <= DO_CPU when (A = x"57D1" and Wr_n = '0' and MReq_n = '0');
|
431 |
|
|
|
432 |
|
|
-- Modo Turbo 10Mhz
|
433 |
|
|
Clk_Z80 <= clk357mhz when SW(16) = '0' else clk10mhz;
|
434 |
|
|
LEDR(17) <= SW(17);
|
435 |
|
|
LEDR(16) <= SW(16);
|
436 |
|
|
|
437 |
|
|
--Z80SOC_Arch_reg <= Z80SOC_Arch_addr; -- "000" = DE1, "001" = S3E, "010" = DE2115
|
438 |
|
|
Rst_n_s <= not SW(17);
|
439 |
|
|
|
440 |
|
|
HEX0 <= HEX_DISP0;
|
441 |
|
|
HEX1 <= HEX_DISP1;
|
442 |
|
|
HEX2 <= HEX_DISP2;
|
443 |
|
|
HEX3 <= HEX_DISP3;
|
444 |
|
|
HEX4 <= HEX_DISP4;
|
445 |
|
|
HEX5 <= HEX_DISP5;
|
446 |
|
|
HEX6 <= HEX_DISP6;
|
447 |
|
|
HEX7 <= HEX_DISP7;
|
448 |
|
|
|
449 |
|
|
-- Write into VRAM and System Variables
|
450 |
|
|
vram_addra <= A - VRAM_value;
|
451 |
|
|
vram_dina <= DO_CPU;
|
452 |
|
|
vram_wea <= '0' when (A >= VRAM_value and A < LCD_value and Wr_n = '0' and MReq_n = '0') else
|
453 |
|
|
'1';
|
454 |
|
|
|
455 |
|
|
-- Write into char ram
|
456 |
|
|
cram_addra <= A - CHARRAM_value;
|
457 |
|
|
cram_dina <= DO_CPU;
|
458 |
|
|
cram_wea <= '0' when (A >= CHARRAM_value and A < RAMBOTT_value and Wr_n = '0' and MReq_n = '0') else '1';
|
459 |
|
|
|
460 |
|
|
-- Write into LCD video ram
|
461 |
|
|
--LCD_ON <= KEY(3);
|
462 |
|
|
lcdvram(CONV_INTEGER(A - LCD_value)) <= DO_CPU when A >= LCD_value and (A < LCD_value + 32) and Wr_n = '0' and MReq_n = '0';
|
463 |
|
|
|
464 |
|
|
-- SRAM control signals
|
465 |
|
|
-- SRAM will store data for video, characters patterns and RAM (only on DE1 version)
|
466 |
|
|
-- Due to limitation in dual-port block rams on this platform
|
467 |
|
|
|
468 |
|
|
SRAM_ADDR(15 downto 0) <= A - RAMBOTT_value;
|
469 |
|
|
SRAM_DQ(7 downto 0) <= DO_CPU when (Wr_n = '0' and MREQ_n = '0' and A >= RAMBOTT_value) else (others => 'Z');
|
470 |
|
|
SRAM_WE_N <= '0' when (Wr_n = '0' and MREQ_n = '0' and A >= RAMBOTT_value) else '1';
|
471 |
|
|
SRAM_OE_N <= '0' when (Rd_n = '0' and MREQ_n = '0' and A >= RAMBOTT_value) else '1';
|
472 |
|
|
SRAM_DQ(15 downto 8) <= (others => 'Z');
|
473 |
|
|
SRAM_ADDR(19 downto 16) <= "0000";
|
474 |
|
|
SRAM_UB_N <= '1';
|
475 |
|
|
SRAM_LB_N <= '0';
|
476 |
|
|
SRAM_CE_N <= '0';
|
477 |
|
|
|
478 |
|
|
-- Input to Z80
|
479 |
|
|
DI_CPU <= ("00000" & Z80SOC_Arch_reg) when (Rd_n = '0' and MREQ_n = '0' and A = Z80SOC_Arch_addr) else
|
480 |
|
|
ps2_ascii_reg when (Rd_n = '0' and MREQ_n = '0' and A = KEYPRESS_addr) else
|
481 |
|
|
RAMTOP_reg(7 downto 0) when (Rd_n = '0' and MREQ_n = '0' and A = RAMTOP_addr) else
|
482 |
|
|
RAMTOP_reg(15 downto 8) when (Rd_n = '0' and MREQ_n = '0' and (A = RAMTOP_addr + 1)) else
|
483 |
|
|
RAMBOTT_reg (7 downto 0) when (Rd_n = '0' and MREQ_n = '0' and A = RAMBOTT_addr) else
|
484 |
|
|
RAMBOTT_reg (15 downto 8) when (Rd_n = '0' and MREQ_n = '0' and (A = RAMBOTT_addr + 1)) else
|
485 |
|
|
LCD_reg (7 downto 0) when (Rd_n = '0' and MREQ_n = '0' and A = LCD_addr) else
|
486 |
|
|
LCD_reg (15 downto 8) when (Rd_n = '0' and MREQ_n = '0' and (A = LCD_addr + 1)) else
|
487 |
|
|
VRAM_reg (7 downto 0) when (Rd_n = '0' and MREQ_n = '0' and A = VRAM_addr) else
|
488 |
|
|
VRAM_reg (15 downto 8) when (Rd_n = '0' and MREQ_n = '0' and (A = VRAM_addr + 1)) else
|
489 |
|
|
CHARRAM_reg (7 downto 0) when (Rd_n = '0' and MREQ_n = '0' and A = CHARRAM_addr) else
|
490 |
|
|
CHARRAM_reg (15 downto 8) when (Rd_n = '0' and MREQ_n = '0' and (A = CHARRAM_addr + 1)) else
|
491 |
|
|
STACK_reg (7 downto 0) when (Rd_n = '0' and MREQ_n = '0' and A = STACK_addr) else
|
492 |
|
|
STACK_reg (15 downto 8) when (Rd_n = '0' and MREQ_n = '0' and (A = STACK_addr + 1)) else
|
493 |
|
|
VRAMNXTCHAR_reg (7 downto 0) when (Rd_n = '0' and MREQ_n = '0' and A = x"57D0") else
|
494 |
|
|
VRAMNXTCHAR_reg (15 downto 8) when (Rd_n = '0' and MREQ_n = '0' and A = x"57D1") else
|
495 |
|
|
CURX_reg when (Rd_n = '0' and MREQ_n = '0' and IORQ_n = '1' and A = x"57CF") else
|
496 |
|
|
CURY_reg when (Rd_n = '0' and MREQ_n = '0' and IORQ_n = '1' and A = x"57CE") else
|
497 |
|
|
STDOUT_reg when (Rd_n = '0' and MREQ_n = '0' and IORQ_n = '1' and A = x"57CD") else
|
498 |
|
|
D_ROM when (Rd_n = '0' and MREQ_n = '0' and IORQ_n = '1' and A < VRAM_value) else
|
499 |
|
|
--vram_doutb when (Rd_n = '0' and MREQ_n = '0' and IORQ_n = '1' and (A >= VRAM_value + 4800) and A < LCD_value) else
|
500 |
|
|
SRAM_DQ(7 downto 0) when (Rd_n = '0' and MREQ_n = '0' and IORQ_n = '1' and A >= RAMBOTT_value) else
|
501 |
|
|
SW(7 downto 0) when (IORQ_n = '0' and MREQ_n = '1' and Rd_n = '0' and A(7 downto 0) = x"20") else
|
502 |
|
|
SW(15 downto 8) when (IORQ_n = '0' and MREQ_n = '1' and Rd_n = '0' and A(7 downto 0) = x"21") else
|
503 |
|
|
("0000" & not KEY) when (IORQ_n = '0' and MREQ_n = '1' and Rd_n = '0' and A(7 downto 0) = x"30") else
|
504 |
|
|
--ps2_ascii_reg when (IORQ_n = '0' and MREQ_n = '1' and Rd_n = '0' and A(7 downto 0) = x"80") else
|
505 |
|
|
"ZZZZZZZZ";
|
506 |
|
|
|
507 |
|
|
-- Process to latch leds and hex displays
|
508 |
|
|
pinout_process: process(Clk_Z80)
|
509 |
|
|
variable NUMBER0_sig : std_logic_vector(3 downto 0);
|
510 |
|
|
variable NUMBER1_sig : std_logic_vector(3 downto 0);
|
511 |
|
|
variable NUMBER2_sig : std_logic_vector(3 downto 0);
|
512 |
|
|
variable NUMBER3_sig : std_logic_vector(3 downto 0);
|
513 |
|
|
variable NUMBER4_sig : std_logic_vector(3 downto 0);
|
514 |
|
|
variable NUMBER5_sig : std_logic_vector(3 downto 0);
|
515 |
|
|
variable NUMBER6_sig : std_logic_vector(3 downto 0);
|
516 |
|
|
variable NUMBER7_sig : std_logic_vector(3 downto 0);
|
517 |
|
|
variable LEDG_sig : std_logic_vector(7 downto 0);
|
518 |
|
|
variable LEDR_sig : std_logic_vector(15 downto 0);
|
519 |
|
|
--variable GPIO_0_buf_out: std_logic_vector(35 downto 0);
|
520 |
|
|
--variable GPIO_1_buf_out: std_logic_vector(35 downto 0);
|
521 |
|
|
begin
|
522 |
|
|
if Clk_Z80'event and Clk_Z80 = '1' then
|
523 |
|
|
if IORQ_n = '0' and MREQ_n = '1' and Wr_n = '0' then
|
524 |
|
|
-- LEDG
|
525 |
|
|
if A(7 downto 0) = x"01" then
|
526 |
|
|
LEDG_sig := DO_CPU;
|
527 |
|
|
-- LEDR
|
528 |
|
|
elsif A(7 downto 0) = x"02" then
|
529 |
|
|
LEDR_sig(7 downto 0) := DO_CPU;
|
530 |
|
|
elsif A(7 downto 0) = x"03" then
|
531 |
|
|
LEDR_sig(15 downto 8) := DO_CPU;
|
532 |
|
|
-- HEX1 and HEX0
|
533 |
|
|
elsif A(7 downto 0) = x"10" then
|
534 |
|
|
NUMBER0_sig := DO_CPU(3 downto 0);
|
535 |
|
|
NUMBER1_sig := DO_CPU(7 downto 4);
|
536 |
|
|
-- HEX3 and HEX2
|
537 |
|
|
elsif A(7 downto 0) = x"11" then
|
538 |
|
|
NUMBER2_sig := DO_CPU(3 downto 0);
|
539 |
|
|
NUMBER3_sig := DO_CPU(7 downto 4);
|
540 |
|
|
-- HEX5 and HEX4
|
541 |
|
|
elsif A(7 downto 0) = x"12" then
|
542 |
|
|
NUMBER4_sig := DO_CPU(3 downto 0);
|
543 |
|
|
NUMBER5_sig := DO_CPU(7 downto 4);
|
544 |
|
|
-- HEX7 and HEX6
|
545 |
|
|
elsif A(7 downto 0) = x"13" then
|
546 |
|
|
NUMBER6_sig := DO_CPU(3 downto 0);
|
547 |
|
|
NUMBER7_sig := DO_CPU(7 downto 4);
|
548 |
|
|
elsif A(7 downto 0) = x"15" then
|
549 |
|
|
LCDON_reg <= DO_CPU(0);
|
550 |
|
|
end if;
|
551 |
|
|
end if;
|
552 |
|
|
end if;
|
553 |
|
|
-- Latches the signals
|
554 |
|
|
NUMBER0 <= NUMBER0_sig;
|
555 |
|
|
NUMBER1 <= NUMBER1_sig;
|
556 |
|
|
NUMBER2 <= NUMBER2_sig;
|
557 |
|
|
NUMBER3 <= NUMBER3_sig;
|
558 |
|
|
NUMBER4 <= NUMBER4_sig;
|
559 |
|
|
NUMBER5 <= NUMBER5_sig;
|
560 |
|
|
NUMBER6 <= NUMBER6_sig;
|
561 |
|
|
NUMBER7 <= NUMBER7_sig;
|
562 |
|
|
LEDR(15 downto 0) <= LEDR_sig;
|
563 |
|
|
LEDG(7 downto 0) <= LEDG_sig;
|
564 |
|
|
end process;
|
565 |
|
|
|
566 |
|
|
-- the following three processes deals with different clock domain signals
|
567 |
|
|
ps2_process1: process(CLOCK_50)
|
568 |
|
|
begin
|
569 |
|
|
if CLOCK_50'event and CLOCK_50 = '1' then
|
570 |
|
|
if ps2_read = '1' then
|
571 |
|
|
if ps2_ascii_sig /= x"FF" then
|
572 |
|
|
ps2_read <= '0';
|
573 |
|
|
ps2_ascii_reg1 <= "00000000";
|
574 |
|
|
end if;
|
575 |
|
|
elsif ps2_scan_ready = '1' then
|
576 |
|
|
if ps2_ascii_sig = x"FF" then
|
577 |
|
|
ps2_read <= '1';
|
578 |
|
|
else
|
579 |
|
|
ps2_ascii_reg1 <= ps2_ascii_sig;
|
580 |
|
|
end if;
|
581 |
|
|
end if;
|
582 |
|
|
end if;
|
583 |
|
|
end process;
|
584 |
|
|
|
585 |
|
|
ps2_process2: process(Clk_Z80)
|
586 |
|
|
begin
|
587 |
|
|
if Clk_Z80'event and Clk_Z80 = '1' then
|
588 |
|
|
ps2_ascii_reg <= ps2_ascii_reg1;
|
589 |
|
|
end if;
|
590 |
|
|
end process;
|
591 |
|
|
|
592 |
|
|
lcd_printchar: process(char_count_sig)
|
593 |
|
|
begin
|
594 |
|
|
next_char_sig <= lcdvram(CONV_INTEGER(char_count_sig));
|
595 |
|
|
end process;
|
596 |
|
|
|
597 |
|
|
One <= '1';
|
598 |
|
|
z80_inst: T80se
|
599 |
|
|
port map (
|
600 |
|
|
M1_n => open,
|
601 |
|
|
MREQ_n => MREQ_n,
|
602 |
|
|
IORQ_n => IORQ_n,
|
603 |
|
|
RD_n => Rd_n,
|
604 |
|
|
WR_n => Wr_n,
|
605 |
|
|
RFSH_n => open,
|
606 |
|
|
HALT_n => open,
|
607 |
|
|
WAIT_n => One,
|
608 |
|
|
INT_n => One,
|
609 |
|
|
NMI_n => One,
|
610 |
|
|
RESET_n => Rst_n_s,
|
611 |
|
|
BUSRQ_n => One,
|
612 |
|
|
BUSAK_n => open,
|
613 |
|
|
CLK_n => Clk_Z80,
|
614 |
|
|
CLKEN => One,
|
615 |
|
|
A => A,
|
616 |
|
|
DI => DI_CPU,
|
617 |
|
|
DO => DO_CPU
|
618 |
|
|
);
|
619 |
|
|
|
620 |
|
|
video_inst: video port map (
|
621 |
|
|
CLOCK_25 => clk25mhz,
|
622 |
|
|
VRAM_DATA => vram_doutb,
|
623 |
|
|
VRAM_ADDR => vram_addrb(13 downto 0),
|
624 |
|
|
VRAM_CLOCK => vram_clkb,
|
625 |
|
|
VRAM_WREN => vram_web,
|
626 |
|
|
CRAM_DATA => cram_doutb,
|
627 |
|
|
CRAM_ADDR => cram_addrb(10 downto 0),
|
628 |
|
|
CRAM_WEB => cram_web,
|
629 |
|
|
VGA_R => VGA_R(7 downto 4),
|
630 |
|
|
VGA_G => VGA_G(7 downto 4),
|
631 |
|
|
VGA_B => VGA_B(7 downto 4),
|
632 |
|
|
VGA_HS => VGA_HS,
|
633 |
|
|
VGA_VS => VGA_VS
|
634 |
|
|
);
|
635 |
|
|
|
636 |
|
|
vram_inst : vram
|
637 |
|
|
port map (
|
638 |
|
|
rdclock => vram_clkb,
|
639 |
|
|
wrclock => Clk_Z80,
|
640 |
|
|
wren => not vram_wea, -- inverted logic so code is similar to SRAM and S3E port
|
641 |
|
|
wraddress => vram_addra(12 downto 0),
|
642 |
|
|
rdaddress => vram_addrb(12 downto 0),
|
643 |
|
|
data => vram_dina,
|
644 |
|
|
q => vram_doutb
|
645 |
|
|
);
|
646 |
|
|
|
647 |
|
|
cram: charram
|
648 |
|
|
port map (
|
649 |
|
|
rdaddress => cram_addrb(10 downto 0),
|
650 |
|
|
wraddress => cram_addra(10 downto 0),
|
651 |
|
|
wrclock => Clk_Z80,
|
652 |
|
|
rdclock => vram_clkb,
|
653 |
|
|
data => cram_dina,
|
654 |
|
|
q => cram_doutb,
|
655 |
|
|
wren => NOT cram_wea
|
656 |
|
|
);
|
657 |
|
|
|
658 |
|
|
rom_inst: rom
|
659 |
|
|
port map (
|
660 |
|
|
clock => clk25mhz,
|
661 |
|
|
address => A(13 downto 0),
|
662 |
|
|
q => D_ROM
|
663 |
|
|
);
|
664 |
|
|
|
665 |
|
|
clkdiv_inst: clk_div
|
666 |
|
|
port map (
|
667 |
|
|
clock_in_50mhz => CLOCK_50,
|
668 |
|
|
clock_25mhz => clk25mhz,
|
669 |
|
|
clock_10MHz => clk10mhz,
|
670 |
|
|
clock_357Mhz => clk357mhz,
|
671 |
|
|
clock_1MHz => clk1mhz,
|
672 |
|
|
clock_100KHz => open,
|
673 |
|
|
clock_10KHz => open,
|
674 |
|
|
clock_1KHz => open,
|
675 |
|
|
clock_100Hz => clk100hz,
|
676 |
|
|
clock_10Hz => clk10hz,
|
677 |
|
|
clock_1Hz => clk1hz
|
678 |
|
|
);
|
679 |
|
|
|
680 |
|
|
DISPHEX0 : decoder_7seg PORT MAP (
|
681 |
|
|
NUMBER => NUMBER0,
|
682 |
|
|
HEX_DISP => HEX_DISP0
|
683 |
|
|
);
|
684 |
|
|
|
685 |
|
|
DISPHEX1 : decoder_7seg PORT MAP (
|
686 |
|
|
NUMBER => NUMBER1,
|
687 |
|
|
HEX_DISP => HEX_DISP1
|
688 |
|
|
);
|
689 |
|
|
|
690 |
|
|
DISPHEX2 : decoder_7seg PORT MAP (
|
691 |
|
|
NUMBER => NUMBER2,
|
692 |
|
|
HEX_DISP => HEX_DISP2
|
693 |
|
|
);
|
694 |
|
|
|
695 |
|
|
DISPHEX3 : decoder_7seg PORT MAP (
|
696 |
|
|
NUMBER => NUMBER3,
|
697 |
|
|
HEX_DISP => HEX_DISP3
|
698 |
|
|
);
|
699 |
|
|
|
700 |
|
|
DISPHEX4 : decoder_7seg PORT MAP (
|
701 |
|
|
NUMBER => NUMBER4,
|
702 |
|
|
HEX_DISP => HEX_DISP4
|
703 |
|
|
);
|
704 |
|
|
|
705 |
|
|
DISPHEX5 : decoder_7seg PORT MAP (
|
706 |
|
|
NUMBER => NUMBER5,
|
707 |
|
|
HEX_DISP => HEX_DISP5
|
708 |
|
|
);
|
709 |
|
|
|
710 |
|
|
DISPHEX6 : decoder_7seg PORT MAP (
|
711 |
|
|
NUMBER => NUMBER6,
|
712 |
|
|
HEX_DISP => HEX_DISP6
|
713 |
|
|
);
|
714 |
|
|
|
715 |
|
|
DISPHEX7 : decoder_7seg PORT MAP (
|
716 |
|
|
NUMBER => NUMBER7,
|
717 |
|
|
HEX_DISP => HEX_DISP7
|
718 |
|
|
);
|
719 |
|
|
|
720 |
|
|
ps2_kbd_inst : ps2kbd PORT MAP (
|
721 |
|
|
keyboard_clk => PS2_CLK,
|
722 |
|
|
keyboard_data => PS2_DAT,
|
723 |
|
|
clock => CLOCK_50,
|
724 |
|
|
clkdelay => clk100hz,
|
725 |
|
|
reset => Rst_n_s,
|
726 |
|
|
read => ps2_read,
|
727 |
|
|
scan_ready => ps2_scan_ready,
|
728 |
|
|
ps2_ascii_code => ps2_ascii_sig
|
729 |
|
|
);
|
730 |
|
|
|
731 |
|
|
-- Component instantiation
|
732 |
|
|
lcd_inst: lcd PORT MAP (
|
733 |
|
|
reset => Rst_n_s,
|
734 |
|
|
CLOCK_50 => CLOCK_50,
|
735 |
|
|
LCD_RS => LCD_RS,
|
736 |
|
|
LCD_EN => LCD_EN,
|
737 |
|
|
LCD_RW => LCD_RW,
|
738 |
|
|
LCD_ON => LCD_ON,
|
739 |
|
|
LCD_DATA => LCD_DATA(7 DOWNTO 0),
|
740 |
|
|
lcd_on_sig => LCDON_reg,
|
741 |
|
|
next_char => next_char_sig,
|
742 |
|
|
char_count => char_count_sig,
|
743 |
|
|
clk400hz => clk400hz
|
744 |
|
|
);
|
745 |
|
|
|
746 |
|
|
--
|
747 |
|
|
UART_TXD <= 'Z';
|
748 |
|
|
DRAM_ADDR <= (others => '0');
|
749 |
|
|
DRAM_DQM_0 <= '0';
|
750 |
|
|
DRAM_DQM_1 <= '0';
|
751 |
|
|
DRAM_DQM_2 <= '0';
|
752 |
|
|
DRAM_DQM_3 <= '0';
|
753 |
|
|
DRAM_WE_N <= '1';
|
754 |
|
|
DRAM_CAS_N <= '1';
|
755 |
|
|
DRAM_RAS_N <= '1';
|
756 |
|
|
DRAM_CS_N <= '1';
|
757 |
|
|
DRAM_BA_0 <= '0';
|
758 |
|
|
DRAM_BA_1 <= '0';
|
759 |
|
|
DRAM_CLK <= '0';
|
760 |
|
|
DRAM_CKE <= '0';
|
761 |
|
|
FL_ADDR <= (others => '0');
|
762 |
|
|
FL_WE_N <= '1';
|
763 |
|
|
FL_RST_N <= '0';
|
764 |
|
|
FL_OE_N <= '1';
|
765 |
|
|
FL_CE_N <= '1';
|
766 |
|
|
AUD_DACDAT <= '0';
|
767 |
|
|
AUD_XCK <= '0';
|
768 |
|
|
-- Set all bidirectional ports to tri-state
|
769 |
|
|
DRAM_DQ <= (others => 'Z');
|
770 |
|
|
FL_DQ <= (others => 'Z');
|
771 |
|
|
|
772 |
|
|
AUD_ADCLRCK <= 'Z';
|
773 |
|
|
AUD_DACLRCK <= 'Z';
|
774 |
|
|
AUD_BCLK <= 'Z';
|
775 |
|
|
--GPIO_0 <= (others => 'Z');
|
776 |
|
|
--GPIO_1 <= (others => 'Z');
|
777 |
|
|
end;
|