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

Subversion Repositories z80control

[/] [z80control/] [trunk/] [DE1/] [rtl/] [VHDL/] [top_de1.vhd] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 tylerapohl
-------------------------------------------------------------------------------------------------
2
-- Z80 Control Microprocessor
3
--
4
-- Version history:
5
-------------------
6
-- Version 0.2 Alpha for for Altera DE1
7
-- Developer: Tyler Pohl
8
-- Release Date: 2010 / 10 / 01
9
--
10
-- Based on the T80 core: http://www.opencores.org/projects.cgi/web/t80
11
-- This version developed and tested on: Altera DE1 Development Board
12
--
13
-- Peripherals configured (Using Ports):
14
--
15
--      40 KB Internal ROM              Read            (0x0000h - 0x9FFFh) -- Location 1FFFH will be used to unlock locked RAM in future
16
--
17
--  08 KB Shared Memory     Read/Write  (0xA000h - 0xBFFFh)
18
--
19
--        Locked Supr1                  (0xC000h - 0xC7FFh)
20
--                Supr2                                     (0xC800h - 0xCFFFh) 
21
--        Supr3                         (0xD000h - 0xD7FFh) 
22
--        Supr4                         (0xD800h - 0xDFFFh) -- Stack starts at DFEA and goes down initialize this in z80 code
23
--        Supr5                         (0xE000h - 0xE7FFh) 
24
--        Supr6                                                 (0xE800h - 0xEFFFh) 
25
--        Lacoked Pram                                  (0xF000h - 0xF7FFh) -- Switched between 5 banks
26
--        Sram                          (0xF800h - 0xF8FFh) -- Switched between 5 banks
27
--                Ram                           (0xF900h - 0xFFFFh) -- Switched between 5 banks
28
 
29
--      08 Green Leds                   Out                     (Port 0x01h)
30
--      08 Red Leds                             Out                     (Port 0x02h)
31
--      04 Seven Seg displays   Out                     (Ports 0x10h and 0x11h)
32
 
33
--  01 Uart0                            In/Out          (Port 0x24h)
34
 
35
--  01 Rom Switching        Out         (Port 0xDDh)
36
--  02 Rom Switching        Out         (Port 0xDDh)
37
--  03 Rom Switching        Out         (Port 0xDDh)
38
 
39
--  00 to 04 Ram Bank Switching  Out         (Port 0xDCh)
40
 
41
-- Future Ports (Registers)
42
--PRF F0h
43
--STATS,RTCIN F0h       --Brown Out and Pwr Fail Stat 60Hz
44
--PFKILL F1h
45
--RTCRST F2h
46
--SFTPRT F3h
47
--MEXPON F4h
48
--MEXPOFF F5h
49
--IOXPON F6h
50
--IOXPOFF F7h
51
--EPPAGE1 FCh
52
--EPPAGE2 FDh
53
--
54
--  Revision history:
55
--
56
-- 2010/10/01 - Modified RAM layout to support new and future improvements
57
--            - Changed ROM to support 16 bit addresses
58
--                        - Serial port Recived works under Interrupt -- Load z80test and data ends up on hex display   
59
--
60
--
61
-- Getting Started
62
        -- Use CII_Starter_USB_API_v1 project to load flash chip - don't forget to erase chip first
63
        -- Load rom.bin to flash chip starting at address 0
64
        -- Connect the serial port up to hyperterminal or minicom
65
        -- Sends data out serial port and displays on hex display data sent
66
        -- Type chars to send from PC serial port - z80 recieves and displays on hex display under interrupt
67
--
68
--
69
-- TO-DO:
70
-- - MOST IMPORTANT !!!! - This is halting my progress
71
-- - Search for this ????? and figure out why it stops the CPU from running 
72
-- -
73
-- - Serial communication, to download assembly code from PC
74
-- - SD/MMC card interface to read/store data and programs
75
-- - Get Flash Write to Work -- Why does the CPU not run when connecting DO_CPU to the FL_DQ pins ?
76
-- - Figure out why cpu does not run when having LED, and uart enabled in the Port output section
77
-- - Get all the memory above working and document.
78
-- - Get the serial Tx Interrupt to work.
79
-- - Add registers to uart so baudrate, parity, interrupts can be modified.
80
-- - Document this project in the form of Microprocessor Datasheets.
81
-- - Design Template of Software to communicate to the Board
82
-------------------------------------------------------------------------------------------------
83
 
84
library IEEE;
85
use IEEE.std_logic_1164.all;
86
use IEEE.std_logic_arith.all;
87
use IEEE.std_logic_unsigned.all;
88
 
89
entity  TOP_DE1 is
90
        port(
91
 
92
    -- Clocks
93
    CLOCK_27,                                           -- 27 MHz
94
    CLOCK_50,                                           -- 50 MHz
95
    EXT_CLOCK : in std_logic;                           -- External Clock
96
 
97
    -- Buttons and switches
98
    KEY : in std_logic_vector(3 downto 0);               -- Push buttons
99
    SW : in std_logic_vector(9 downto 0);                -- Switches
100
 
101
    -- LED displays
102
    HEX0, HEX1, HEX2, HEX3                              -- 7-segment displays
103
                        : out std_logic_vector(6 downto 0);
104
    LEDG : out std_logic_vector(7 downto 0);             -- Green LEDs
105
    LEDR : out std_logic_vector(9 downto 0);             -- Red LEDs
106
 
107
    -- RS-232 interface
108
    UART_TXD : out std_logic;                           -- UART transmitter   
109
    UART_RXD : in std_logic;                            -- UART receiver
110
 
111
    -- IRDA interface
112
 
113
    -- IRDA_TXD : out std_logic;                    -- IRDA Transmitter
114
    IRDA_RXD : in std_logic;                            -- IRDA Receiver
115
 
116
    -- SDRAM
117
    DRAM_DQ : inout std_logic_vector(15 downto 0);       -- Data Bus
118
    DRAM_ADDR : out std_logic_vector(11 downto 0);       -- Address Bus    
119
    DRAM_LDQM,                                          -- Low-byte Data Mask 
120
    DRAM_UDQM,                                          -- High-byte Data Mask
121
    DRAM_WE_N,                                          -- Write Enable
122
    DRAM_CAS_N,                                         -- Column Address Strobe
123
    DRAM_RAS_N,                                         -- Row Address Strobe
124
    DRAM_CS_N,                                          -- Chip Select
125
    DRAM_BA_0,                                          -- Bank Address 0
126
    DRAM_BA_1,                                          -- Bank Address 0
127
    DRAM_CLK,                                           -- Clock
128
    DRAM_CKE : out std_logic;                           -- Clock Enable
129
 
130
    -- FLASH
131
    FL_DQ : inout std_logic_vector(7 downto 0);  -- Data bus
132
    FL_ADDR : out std_logic_vector(21 downto 0);    -- Address bus
133
    FL_WE_N : out std_logic;                                         -- Write Enable
134
    FL_RST_N : out std_logic;                                        -- Reset
135
    FL_OE_N : out std_logic;                                         -- Output Enable
136
    FL_CE_N : out std_logic;                        -- Chip Enable
137
 
138
    -- SRAM
139
    SRAM_DQ : inout std_logic_vector(15 downto 0);       -- Data bus 16 Bits
140
    SRAM_ADDR : out std_logic_vector(17 downto 0);       -- Address bus 18 Bits
141
    SRAM_UB_N,                                          -- High-byte Data Mask 
142
    SRAM_LB_N,                                          -- Low-byte Data Mask 
143
    SRAM_WE_N,                                          -- Write Enable
144
    SRAM_CE_N,                                          -- Chip Enable
145
    SRAM_OE_N : out std_logic;                          -- Output Enable
146
 
147
    -- SD card interface
148
    SD_DAT : in std_logic;      -- SD Card Data      SD pin 7 "DAT 0/DataOut"
149
    SD_DAT3 : out std_logic;    -- SD Card Data 3    SD pin 1 "DAT 3/nCS"
150
    SD_CMD : out std_logic;     -- SD Card Command   SD pin 2 "CMD/DataIn"
151
    SD_CLK : out std_logic;     -- SD Card Clock     SD pin 5 "CLK"
152
 
153
    -- USB JTAG link
154
    TDI,                        -- CPLD -> FPGA (data in)
155
    TCK,                        -- CPLD -> FPGA (clk)
156
    TCS : in std_logic;         -- CPLD -> FPGA (CS)
157
    TDO : out std_logic;        -- FPGA -> CPLD (data out)
158
 
159
    -- I2C bus
160
    I2C_SDAT : inout std_logic; -- I2C Data
161
    I2C_SCLK : out std_logic;   -- I2C Clock
162
 
163
    -- PS/2 port
164
    PS2_DAT,                                                                    -- Data
165
    PS2_CLK : inout std_logic;                                                  -- Clock
166
 
167
    -- VGA output
168
    VGA_HS,                                             -- H_SYNC
169
    VGA_VS                      : out std_logic;                    -- SYNC
170
    VGA_R,                                              -- Red[3:0]
171
    VGA_G,                                              -- Green[3:0]
172
    VGA_B                       : out std_logic_vector(3 downto 0); -- Blue[3:0]
173
 
174
    -- Audio CODEC
175
    AUD_ADCLRCK         : inout std_logic;                      -- ADC LR Clock
176
    AUD_ADCDAT          : in std_logic;                     -- ADC Data
177
    AUD_DACLRCK         : inout std_logic;                  -- DAC LR Clock
178
    AUD_DACDAT          : out std_logic;                    -- DAC Data
179
    AUD_BCLK            : inout std_logic;                  -- Bit-Stream Clock
180
    AUD_XCK             : out std_logic;                        -- Chip Clock
181
 
182
    -- General-purpose I/O
183
    GPIO_0,                                                     -- GPIO Connection 0
184
    GPIO_1 : inout std_logic_vector(35 downto 0)                 -- GPIO Connection 1    
185
);
186
end TOP_DE1;
187
 
188
architecture rtl of TOP_DE1 is
189
 
190
        component T80se
191
        generic(
192
                Mode            : integer := 0;  -- 0 => Z80, 1 => Fast Z80, 2 => 8080, 3 => GB
193
                T2Write         : integer := 1; -- 0 => WR_n active in T3, /=0 => WR_n active in T2
194
                IOWait          : integer := 1  -- 0 => Single cycle I/O, 1 => Std I/O cycle
195
        );
196
        port(
197
                RESET_n         : in std_logic;
198
                CLK_n           : in std_logic;
199
                CLKEN           : in std_logic;
200
                WAIT_n          : in std_logic;
201
                INT_n           : in std_logic;
202
                NMI_n           : in std_logic;
203
                BUSRQ_n         : in std_logic;
204
                M1_n            : out std_logic;
205
                MREQ_n          : out std_logic;
206
                IORQ_n          : out std_logic;
207
                RD_n            : out std_logic;
208
                WR_n            : out std_logic;
209
                RFSH_n          : out std_logic;
210
                HALT_n          : out std_logic;
211
                BUSAK_n         : out std_logic;
212
                A                       : out std_logic_vector(15 downto 0);
213
                DI                      : in std_logic_vector(7 downto 0);
214
                DO                      : out std_logic_vector(7 downto 0)
215
        );
216
        end component;
217
 
218
 
219
 
220
        component Clock_357Mhz
221
        PORT (
222
                clock_50Mhz             : IN    STD_LOGIC;
223
                clock_357Mhz    : OUT   STD_LOGIC);
224
        end component;
225
 
226
        component clk_div
227
        PORT
228
        (
229
                clock_25Mhz             : IN    STD_LOGIC;
230
                clock_1MHz              : OUT   STD_LOGIC;
231
                clock_100KHz    : OUT   STD_LOGIC;
232
                clock_10KHz             : OUT   STD_LOGIC;
233
                clock_1KHz              : OUT   STD_LOGIC;
234
                clock_100Hz             : OUT   STD_LOGIC;
235
                clock_10Hz              : OUT   STD_LOGIC;
236
                clock_1Hz               : OUT   STD_LOGIC;
237
                clock_10sec             : OUT   STD_LOGIC;
238
                clock_1min              : OUT   STD_LOGIC;
239
                clock_1hr               : OUT   STD_LOGIC);
240
        end component;
241
 
242
        component decoder_7seg
243
        port (
244
                NUMBER                  : in std_logic_vector(3 downto 0);
245
                HEX_DISP                : out std_logic_vector(6 downto 0));
246
        end component;
247
 
248
 
249
 
250
        COMPONENT miniUART
251
        PORT (
252
                SysClk   : in  Std_Logic;  -- System Clock
253
                Reset    : in  Std_Logic;  -- Reset input
254
                CS_N     : in  Std_Logic;
255
                RD_N     : in  Std_Logic;
256
                WR_N     : in  Std_Logic;
257
                RxD      : in  Std_Logic;
258
                TxD      : out Std_Logic;
259
                IntRx_N  : out Std_Logic;  -- Receive interrupt
260
                IntTx_N  : out Std_Logic;  -- Transmit interrupt
261
                Addr     : in  Std_Logic_Vector(1 downto 0); -- 
262
                DataIn   : in  Std_Logic_Vector(7 downto 0); -- 
263
                DataOut  : out Std_Logic_Vector(7 downto 0)); --     
264
        END COMPONENT;
265
 
266
 
267
        signal INT_n    : std_logic;
268
        signal M1_n             : std_logic;
269
        signal MREQ_n   : std_logic;
270
        signal IORQ_n   : std_logic;
271
        signal RD_n             : std_logic;
272
        signal WR_n             : std_logic;
273
        signal MWr_n    : std_logic;
274
        signal Rst_n_s  : std_logic;
275
 
276
        signal Clk_Z80          : std_logic;
277
        signal Clk_357Mhz       : std_logic;
278
 
279
        signal DI_CPU   : std_logic_vector(7 downto 0);
280
        signal DO_CPU   : std_logic_vector(7 downto 0);
281
        signal A                : std_logic_vector(15 downto 0);
282
        signal One              : std_logic;
283
        signal AA               : std_logic_vector(21 downto 0);
284
 
285
        signal D_ROM    : std_logic_vector(7 downto 0);
286
 
287
        signal clk25mhz         : std_logic;
288
        signal clk1hz           : std_logic;
289
        signal clk10hz          : std_logic;
290
        signal clk100hz         : std_logic;
291
        signal clk10sec         : std_logic;
292
        --signal clk1min                : std_logic;
293
        --signal clk1hr         : std_logic;
294
 
295
        signal HEX_DISP0        : std_logic_vector(6 downto 0);
296
        signal HEX_DISP1        : std_logic_vector(6 downto 0);
297
        signal HEX_DISP2        : std_logic_vector(6 downto 0);
298
        signal HEX_DISP3        : std_logic_vector(6 downto 0);
299
 
300
        signal NUMBER0          : std_logic_vector(3 downto 0);
301
        signal NUMBER1          : std_logic_vector(3 downto 0);
302
        signal NUMBER2          : std_logic_vector(3 downto 0);
303
        signal NUMBER3          : std_logic_vector(3 downto 0);
304
 
305
 
306
 
307
        signal uart0_CS                 : std_Logic;
308
        signal uart0_RD                 : std_Logic;
309
        signal uart0_WR                 : std_Logic;
310
        signal uart0_RxInt              : std_Logic;
311
        signal uart0_TxInt              : std_Logic;
312
        signal uart0_Addr       : std_Logic_Vector(1 downto 0);
313
        signal uart0_DataIn     : std_Logic_Vector(7 downto 0);
314
        signal uart0_DataOut    : std_logic_Vector(7 downto 0);
315
        signal UartIntVector    : std_logic_Vector(7 downto 0);
316
 
317
 
318
 
319
        signal IntVector                : std_logic_Vector(7 downto 0);
320
 
321
        signal LEDRED           : std_logic_Vector(7 downto 0);
322
 
323
 
324
begin
325
 
326
 
327
 
328
        Rst_n_s <= not SW(9);                   -- Switch 9 toggles Reset on z80
329
 
330
 
331
        HEX0 <= HEX_DISP0;                              -- Move Signal to Output Pins
332
        HEX1 <= HEX_DISP1;                              -- Move Signal to Output Pins
333
        HEX2 <= HEX_DISP2;                              -- Move Signal to Output Pins   
334
        HEX3 <= HEX_DISP3;                              -- Move Signal to Output Pins
335
 
336
        -- SRAM control signals
337
        SRAM_ADDR(15 downto 0) <= A - x"C000" when (A >= x"C000" and MREQ_n = '0');
338
        SRAM_DQ(7 downto 0) <= DO_CPU when (Wr_n = '0' and MREQ_n = '0' and A >= x"C000") else (others => 'Z');
339
        SRAM_WE_N <= Wr_n or MREQ_n when A >= x"C000";
340
        SRAM_OE_N <= Rd_n or MREQ_n when A >= x"C000";  --Rd_n;
341
 
342
        -- ???? Why can't this pin be connected to MREQ_n CPU will not run unless its is connected to zero
343
        SRAM_CE_N <= '0';
344
        --------------------------------------------------------------------------------------------------
345
 
346
        --1FFFH is used for unlocking ram in future.  Auto lock after one read or write.
347
 
348
        -- FLASH control signals        
349
 
350
        --FL_ADDR(15 downto 0) <= A(15 downto 0) when (Clk_Z80 = '1' and A < x"A000");
351
        FL_ADDR(15 downto 0) <= A(15 downto 0) when (A < x"A000" and MREQ_n = '0');
352
    --D_ROM(7 downto 0) <=  FL_DQ when (Clk_Z80 = '1' and A < x"A000");
353
        D_ROM(7 downto 0) <=  FL_DQ when (A < x"A000" and MREQ_n = '0');
354
 
355
    -- ????? Unblock this and CPU will not run
356
    --FL_DQ <= DO_CPU when (Wr_n = '0' and MREQ_n = '0' and A < x"A000") else (others => 'Z');
357
    -----------------------------------------------------------
358
 
359
    FL_DQ       <= (others => 'Z');
360
 
361
    FL_WE_N <= '1';              --'1';                 -- Write Enable
362
 
363
    FL_OE_N <= Rd_n;    -- Output Enable
364
 
365
    FL_CE_N <= MREQ_n when A < x"A000"; -- Chip Enable
366
 
367
 
368
 
369
 
370
    --Buffer Flash Data Lines
371
        --D_ROM(0) <= '1' when FL_DQ(0) = '1' else '0';
372
        --D_ROM(1) <= '1' when FL_DQ(1) = '1' else '0';
373
        --D_ROM(2) <= '1' when FL_DQ(2) = '1' else '0';
374
        --D_ROM(3) <= '1' when FL_DQ(3) = '1' else '0';
375
        --D_ROM(4) <= '1' when FL_DQ(4) = '1' else '0';
376
        --D_ROM(5) <= '1' when FL_DQ(5) = '1' else '0';
377
        --D_ROM(6) <= '1' when FL_DQ(6) = '1' else '0';
378
        --D_ROM(7) <= '1' when FL_DQ(7) = '1' else '0'; 
379
 
380
 
381
 
382
 
383
 
384
        -- UART control signals
385
        uart0_CS <= IORQ_n when (A(7 downto 0) = x"24" and IORQ_n = '0');
386
        uart0_RD <= Rd_n when (A(7 downto 0) = x"24" and IORQ_n = '0');
387
        uart0_WR <= Wr_n when (A(7 downto 0) = x"24" and IORQ_n = '0');
388
        uart0_Addr <= b"00";
389
    ----------------------------------------------
390
    ----------------------------------------------
391
        --Z80 Interrupt Vectors
392
        --               IBMVECT
393
        --0040 AA1C               DW        COMMBOUT    ;CHAN-B TRANSMIT BUFFER EMPTY
394
        --0042 101B               DW        COMBCLI     ;BSTATUS
395
        --0044 F21C               DW        COMMBIN     ;BRECEIVE
396
        --0046 FF1A               DW        COMBCLII    ;BEXTINT
397
        --0048 281C               DW        COMMAOUT    ;ATRBMTY
398
        --004A 691C               DW        COMACLI     ;WAS CRTEXINT   ;ASTATUS
399
        --004C 2F1B               DW        COMMAIN     ;WAS CRTINP     ;ARECEIVE
400
        --004E 971C               DW        COMACLII    ;WAS CRTEXIN?   ;AEXTINT        
401
        IntVector(7 downto 0) <= x"4C"  when (IORQ_n = '0' and MREQ_n = '1' and M1_n = '0' and uart0_RxInt = '1');
402
    ----------------------------------------------------------  
403
 
404
 
405
 
406
 
407
 
408
        -- Depending on bus signals DI_CPU gets loaded with one of these values.  
409
        -- Note: bus signals change while z80 is executing different instructions.
410
        -- Input to Z80
411
        DI_CPU <=
412
                        SRAM_DQ(7 downto 0) when (Rd_n = '0' and MREQ_n = '0' and IORQ_n = '1' and A >= x"C000") else
413
 
414
                        --Input ROM Code
415
                        D_ROM when (Rd_n = '0' and MREQ_n = '0' and IORQ_n = '1' and A < x"A000") else
416
 
417
                        uart0_DataIn(7 downto 0) when (IORQ_n = '0' and MREQ_n = '1' and Rd_n = '0' and A(7 downto 0) = x"24") else
418
 
419
                        IntVector(7 downto 0) when (IORQ_n = '0' and MREQ_n = '1' and M1_n = '0' and uart0_RxInt = '1') else
420
 
421
                        "ZZZZZZZZ";
422
 
423
        -- Process to latch leds and hex displays
424
        pinout_process: process(Clk_Z80)
425
        variable NUMBER0_sig    : std_logic_vector(3 downto 0);
426
        variable NUMBER1_sig    : std_logic_vector(3 downto 0);
427
        variable NUMBER2_sig    : std_logic_vector(3 downto 0);
428
        variable NUMBER3_sig    : std_logic_vector(3 downto 0);
429
        variable LEDG_sig               : std_logic_vector(7 downto 0);
430
        variable LEDR_sig               : std_logic_vector(9 downto 0);
431
        variable GPIO_0_buf_out: std_logic_vector(35 downto 0);
432
        variable uart0_buf_DataOut: std_logic_vector(7 downto 0);
433
        --variable GPIO_1_buf_out: std_logic_vector(35 downto 0);
434
        begin
435
        if Clk_Z80'event and Clk_Z80 = '1' then
436
                  if IORQ_n = '0' and MREQ_n = '1' and Wr_n = '0' then
437
                        -- LEDG
438
                        if A(7 downto 0) = x"01" then
439
                        -- LEDR
440
                        elsif A(7 downto 0) = x"02" then
441
                                LEDR_sig(7 downto 0) := DO_CPU;
442
                        -- HEX1 and HEX0
443
                        elsif A(7 downto 0) = x"10" then
444
                                NUMBER0_sig := DO_CPU(3 downto 0);
445
                                NUMBER1_sig := DO_CPU(7 downto 4);
446
                        -- HEX3 and HEX2
447
                        elsif A(7 downto 0) = x"11" then
448
                                NUMBER2_sig := DO_CPU(3 downto 0);
449
                                NUMBER3_sig := DO_CPU(7 downto 4);
450
                        elsif A(7 downto 0) = x"24" then
451
                                uart0_buf_DataOut := DO_CPU;            --load data to uart output buffer
452
 
453
                        end if;
454
                  end if;
455
                end if;
456
                -- Latches the signals
457
                NUMBER0 <= NUMBER0_sig;
458
                NUMBER1 <= NUMBER1_sig;
459
                NUMBER2 <= NUMBER2_sig;
460
                NUMBER3 <= NUMBER3_sig;
461
 
462
 
463
                -- ???? Unblock this and CPU will not run
464
                -- NOTE it will work if you block uart0_DataOut below
465
                --LEDRED(7 downto 0) <= LEDR_sig(7 downto 0);
466
                ---------------------------------------------
467
 
468
 
469
                uart0_DataOut <= uart0_buf_DataOut;
470
        end process;
471
 
472
        One <= '1';
473
        z80_inst: T80se
474
                port map (
475
                        M1_n => M1_n,
476
                        MREQ_n => MREQ_n,
477
                        IORQ_n => IORQ_n,
478
                        RD_n => Rd_n,
479
                        WR_n => Wr_n,
480
                        RFSH_n => open,
481
                        HALT_n => open,
482
                        WAIT_n => One,
483
                        INT_n => INT_n,
484
                        NMI_n => clk1hz,
485
                        RESET_n => Rst_n_s,
486
                        BUSRQ_n => One,
487
                        BUSAK_n => open,
488
                        CLK_n => Clk_Z80,
489
                        CLKEN => One,
490
                        A => A,
491
                        DI => DI_CPU,
492
                        DO => DO_CPU
493
                );
494
 
495
 
496
        clkdiv_inst: clk_div
497
        port map (
498
                clock_25Mhz                             => CLOCK_27,
499
                clock_1MHz                              => open,
500
                clock_100KHz                    => open,
501
                clock_10KHz                             => open,
502
                clock_1KHz                              => open,
503
                clock_100Hz                             => clk100hz,
504
                clock_10Hz                              => clk10hz,
505
                clock_1Hz                               => clk1hz,
506
                clock_10sec                             => clk10sec,
507
                clock_1min                              => open,
508
                clock_1hr                               => open
509
        );
510
 
511
        clock_z80_inst : Clock_357Mhz
512
                port map (
513
                        clock_50Mhz             => CLOCK_50,
514
                        clock_357Mhz    => Clk_Z80
515
        );
516
 
517
        DISPHEX0 : decoder_7seg PORT MAP (
518
                NUMBER                  =>      NUMBER0,
519
                HEX_DISP                =>      HEX_DISP0
520
        );
521
 
522
        DISPHEX1 : decoder_7seg PORT MAP (
523
                NUMBER                  =>      NUMBER1,
524
                HEX_DISP                =>      HEX_DISP1
525
        );
526
 
527
        DISPHEX2 : decoder_7seg PORT MAP (
528
                NUMBER                  =>      NUMBER2,
529
                HEX_DISP                =>      HEX_DISP2
530
        );
531
 
532
        DISPHEX3 : decoder_7seg PORT MAP (
533
                NUMBER                  =>      NUMBER3,
534
                HEX_DISP                =>      HEX_DISP3
535
        );
536
 
537
 
538
        U1 : miniUART PORT MAP (
539
                SysClk   => CLOCK_50,           --: in  Std_Logic;  -- System Clock
540
                Reset    => Key(0),              --: in  Std_Logic;  -- Reset input
541
                CS_N     => uart0_cs,           --: in  Std_Logic;
542
                RD_N     => uart0_Rd,           --: in  Std_Logic;
543
                WR_N     => uart0_Wr,           --: in  Std_Logic;
544
                RxD      => UART_RXD,           --: in  Std_Logic;
545
                TxD      => UART_TXD,           --: out Std_Logic;
546
                IntRx_N  => uart0_RxInt,                --: out Std_Logic;  -- Received Byte
547
                IntTx_N  => uart0_TxInt,                --: out Std_Logic;  -- Transmit Buffer Empty
548
                Addr     => uart0_Addr,         --: in  Std_Logic_Vector(1 downto 0); -- 
549
                DataIn   => uart0_DataOut,      --: in  Std_Logic_Vector(7 downto 0); -- 
550
                DataOut  => uart0_DataIn        --: out Std_Logic_Vector(7 downto 0)); --                               
551
        );
552
 
553
 
554
 
555
 
556
 
557
 
558
        LEDR(0) <= '1' when LEDRED(0) = '1' else '0';
559
        LEDR(1) <= '1' when LEDRED(1) = '1' else '0';
560
        LEDR(2) <= '1' when LEDRED(2) = '1' else '0';
561
        LEDR(3) <= '1' when LEDRED(3) = '1' else '0';
562
        LEDR(4) <= '1' when LEDRED(4) = '1' else '0';
563
        LEDR(5) <= '1' when LEDRED(5) = '1' else '0';
564
        LEDR(6) <= '1' when LEDRED(6) = '1' else '0';
565
        LEDR(7) <= '1' when LEDRED(7) = '1' else '0';
566
 
567
 
568
 
569
        INT_n <= '0' when uart0_RxInt ='1' else '1';
570
 
571
 
572
    -- Block any of these and CPU will not run -- ?????
573
        LEDG(0) <= uart0_RxInt;
574
        LEDG(1) <= uart0_TxInt;
575
        LEDG(5) <= INT_n;
576
        ------------------------------------------------------
577
 
578
        LEDG(6) <= clk10sec;
579
        LEDG(7) <= clk1hz;
580
 
581
        SRAM_DQ(15 downto 8) <= (others => 'Z');
582
        SRAM_ADDR(17 downto 16) <= "00";
583
        SRAM_UB_N <= '1';
584
        SRAM_LB_N <= '0';
585
        SRAM_CE_N <= '0';
586
        --
587
        UART_TXD <= 'Z';
588
        DRAM_ADDR <= (others => '0');
589
        DRAM_LDQM <= '0';
590
        DRAM_UDQM <= '0';
591
        DRAM_WE_N <= '1';
592
        DRAM_CAS_N <= '1';
593
        DRAM_RAS_N <= '1';
594
        DRAM_CS_N <= '1';
595
        DRAM_BA_0 <= '0';
596
        DRAM_BA_1 <= '0';
597
        DRAM_CLK <= '0';
598
        DRAM_CKE <= '0';
599
 
600
    FL_ADDR(21 downto 16) <= b"000000";
601
    FL_RST_N <= '1';            -- Reset
602
 
603
        TDO <= '0';
604
        I2C_SCLK <= '0';
605
        AUD_DACDAT <= '0';
606
        AUD_XCK <= '0';
607
        -- Set all bidirectional ports to tri-state
608
        DRAM_DQ     <= (others => 'Z');
609
 
610
        I2C_SDAT    <= 'Z';
611
        AUD_ADCLRCK <= 'Z';
612
        AUD_DACLRCK <= 'Z';
613
        AUD_BCLK    <= 'Z';
614
        GPIO_0 <= (others => 'Z');
615
        GPIO_1 <= (others => 'Z');
616
end;

powered by: WebSVN 2.1.0

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