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

Subversion Repositories z80control

[/] [z80control/] [trunk/] [DE1/] [rtl/] [VHDL/] [top_de1.vhd.bak] - 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 and displays on hex display
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
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.
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
-------------------------------------------------------------------------------------------------
82
 
83
library IEEE;
84
use IEEE.std_logic_1164.all;
85
use IEEE.std_logic_arith.all;
86
use IEEE.std_logic_unsigned.all;
87
 
88
entity  TOP_DE1 is
89
        port(
90
 
91
    -- Clocks
92
    CLOCK_27,                                           -- 27 MHz
93
    CLOCK_50,                                           -- 50 MHz
94
    EXT_CLOCK : in std_logic;                           -- External Clock
95
 
96
    -- Buttons and switches
97
    KEY : in std_logic_vector(3 downto 0);              -- Push buttons
98
    SW : in std_logic_vector(9 downto 0);               -- Switches
99
 
100
    -- LED displays
101
    HEX0, HEX1, HEX2, HEX3                              -- 7-segment displays
102
                        : out std_logic_vector(6 downto 0);
103
    LEDG : out std_logic_vector(7 downto 0);            -- Green LEDs
104
    LEDR : out std_logic_vector(9 downto 0);            -- Red LEDs
105
 
106
    -- RS-232 interface
107
    UART_TXD : out std_logic;                           -- UART transmitter
108
    UART_RXD : in std_logic;                            -- UART receiver
109
 
110
    -- IRDA interface
111
 
112
    -- IRDA_TXD : out std_logic;                    -- IRDA Transmitter
113
    IRDA_RXD : in std_logic;                            -- IRDA Receiver
114
 
115
    -- SDRAM
116
    DRAM_DQ : inout std_logic_vector(15 downto 0);      -- Data Bus
117
    DRAM_ADDR : out std_logic_vector(11 downto 0);      -- Address Bus
118
    DRAM_LDQM,                                          -- Low-byte Data Mask
119
    DRAM_UDQM,                                          -- High-byte Data Mask
120
    DRAM_WE_N,                                          -- Write Enable
121
    DRAM_CAS_N,                                         -- Column Address Strobe
122
    DRAM_RAS_N,                                         -- Row Address Strobe
123
    DRAM_CS_N,                                          -- Chip Select
124
    DRAM_BA_0,                                          -- Bank Address 0
125
    DRAM_BA_1,                                          -- Bank Address 0
126
    DRAM_CLK,                                           -- Clock
127
    DRAM_CKE : out std_logic;                           -- Clock Enable
128
 
129
    -- FLASH
130
    FL_DQ : inout std_logic_vector(7 downto 0);         -- Data bus
131
    FL_ADDR : out std_logic_vector(21 downto 0);    -- Address bus
132
    FL_WE_N : out std_logic;                                         -- Write Enable
133
    FL_RST_N : out std_logic;                                        -- Reset
134
    FL_OE_N : out std_logic;                                         -- Output Enable
135
    FL_CE_N : out std_logic;                        -- Chip Enable
136
 
137
    -- SRAM
138
    SRAM_DQ : inout std_logic_vector(15 downto 0);      -- Data bus 16 Bits
139
    SRAM_ADDR : out std_logic_vector(17 downto 0);      -- Address bus 18 Bits
140
    SRAM_UB_N,                                          -- High-byte Data Mask
141
    SRAM_LB_N,                                          -- Low-byte Data Mask
142
    SRAM_WE_N,                                          -- Write Enable
143
    SRAM_CE_N,                                          -- Chip Enable
144
    SRAM_OE_N : out std_logic;                          -- Output Enable
145
 
146
    -- SD card interface
147
    SD_DAT : in std_logic;      -- SD Card Data      SD pin 7 "DAT 0/DataOut"
148
    SD_DAT3 : out std_logic;    -- SD Card Data 3    SD pin 1 "DAT 3/nCS"
149
    SD_CMD : out std_logic;     -- SD Card Command   SD pin 2 "CMD/DataIn"
150
    SD_CLK : out std_logic;     -- SD Card Clock     SD pin 5 "CLK"
151
 
152
    -- USB JTAG link
153
    TDI,                        -- CPLD -> FPGA (data in)
154
    TCK,                        -- CPLD -> FPGA (clk)
155
    TCS : in std_logic;         -- CPLD -> FPGA (CS)
156
    TDO : out std_logic;        -- FPGA -> CPLD (data out)
157
 
158
    -- I2C bus
159
    I2C_SDAT : inout std_logic; -- I2C Data
160
    I2C_SCLK : out std_logic;   -- I2C Clock
161
 
162
    -- PS/2 port
163
    PS2_DAT,                                                                    -- Data
164
    PS2_CLK : inout std_logic;                                                  -- Clock
165
 
166
    -- VGA output
167
    VGA_HS,                                             -- H_SYNC
168
    VGA_VS                      : out std_logic;                    -- SYNC
169
    VGA_R,                                              -- Red[3:0]
170
    VGA_G,                                              -- Green[3:0]
171
    VGA_B                       : out std_logic_vector(3 downto 0); -- Blue[3:0]
172
 
173
    -- Audio CODEC
174
    AUD_ADCLRCK         : inout std_logic;                      -- ADC LR Clock
175
    AUD_ADCDAT          : in std_logic;                     -- ADC Data
176
    AUD_DACLRCK         : inout std_logic;                  -- DAC LR Clock
177
    AUD_DACDAT          : out std_logic;                    -- DAC Data
178
    AUD_BCLK            : inout std_logic;                  -- Bit-Stream Clock
179
    AUD_XCK             : out std_logic;                        -- Chip Clock
180
 
181
    -- General-purpose I/O
182
    GPIO_0,                                                     -- GPIO Connection 0
183
    GPIO_1 : inout std_logic_vector(35 downto 0)                -- GPIO Connection 1
184
);
185
end TOP_DE1;
186
 
187
architecture rtl of TOP_DE1 is
188
 
189
        component T80se
190
        generic(
191
                Mode            : integer := 0; -- 0 => Z80, 1 => Fast Z80, 2 => 8080, 3 => GB
192
                T2Write         : integer := 1; -- 0 => WR_n active in T3, /=0 => WR_n active in T2
193
                IOWait          : integer := 1  -- 0 => Single cycle I/O, 1 => Std I/O cycle
194
        );
195
        port(
196
                RESET_n         : in std_logic;
197
                CLK_n           : in std_logic;
198
                CLKEN           : in std_logic;
199
                WAIT_n          : in std_logic;
200
                INT_n           : in std_logic;
201
                NMI_n           : in std_logic;
202
                BUSRQ_n         : in std_logic;
203
                M1_n            : out std_logic;
204
                MREQ_n          : out std_logic;
205
                IORQ_n          : out std_logic;
206
                RD_n            : out std_logic;
207
                WR_n            : out std_logic;
208
                RFSH_n          : out std_logic;
209
                HALT_n          : out std_logic;
210
                BUSAK_n         : out std_logic;
211
                A                       : out std_logic_vector(15 downto 0);
212
                DI                      : in std_logic_vector(7 downto 0);
213
                DO                      : out std_logic_vector(7 downto 0)
214
        );
215
        end component;
216
 
217
 
218
 
219
        component Clock_357Mhz
220
        PORT (
221
                clock_50Mhz             : IN    STD_LOGIC;
222
                clock_357Mhz    : OUT   STD_LOGIC);
223
        end component;
224
 
225
        component clk_div
226
        PORT
227
        (
228
                clock_25Mhz             : IN    STD_LOGIC;
229
                clock_1MHz              : OUT   STD_LOGIC;
230
                clock_100KHz    : OUT   STD_LOGIC;
231
                clock_10KHz             : OUT   STD_LOGIC;
232
                clock_1KHz              : OUT   STD_LOGIC;
233
                clock_100Hz             : OUT   STD_LOGIC;
234
                clock_10Hz              : OUT   STD_LOGIC;
235
                clock_1Hz               : OUT   STD_LOGIC;
236
                clock_10sec             : OUT   STD_LOGIC;
237
                clock_1min              : OUT   STD_LOGIC;
238
                clock_1hr               : OUT   STD_LOGIC);
239
        end component;
240
 
241
        component decoder_7seg
242
        port (
243
                NUMBER                  : in std_logic_vector(3 downto 0);
244
                HEX_DISP                : out std_logic_vector(6 downto 0));
245
        end component;
246
 
247
 
248
 
249
        COMPONENT miniUART
250
        PORT (
251
                SysClk   : in  Std_Logic;  -- System Clock
252
                Reset    : in  Std_Logic;  -- Reset input
253
                CS_N     : in  Std_Logic;
254
                RD_N     : in  Std_Logic;
255
                WR_N     : in  Std_Logic;
256
                RxD      : in  Std_Logic;
257
                TxD      : out Std_Logic;
258
                IntRx_N  : out Std_Logic;  -- Receive interrupt
259
                IntTx_N  : out Std_Logic;  -- Transmit interrupt
260
                Addr     : in  Std_Logic_Vector(1 downto 0); --
261
                DataIn   : in  Std_Logic_Vector(7 downto 0); --
262
                DataOut  : out Std_Logic_Vector(7 downto 0)); --
263
        END COMPONENT;
264
 
265
 
266
        signal INT_n    : std_logic;
267
        signal M1_n             : std_logic;
268
        signal MREQ_n   : std_logic;
269
        signal IORQ_n   : std_logic;
270
        signal RD_n             : std_logic;
271
        signal WR_n             : std_logic;
272
        signal MWr_n    : std_logic;
273
        signal Rst_n_s  : std_logic;
274
 
275
        signal Clk_Z80          : std_logic;
276
        signal Clk_357Mhz       : std_logic;
277
 
278
        signal DI_CPU   : std_logic_vector(7 downto 0);
279
        signal DO_CPU   : std_logic_vector(7 downto 0);
280
        signal A                : std_logic_vector(15 downto 0);
281
        signal One              : std_logic;
282
        signal AA               : std_logic_vector(21 downto 0);
283
 
284
        signal D_ROM    : std_logic_vector(7 downto 0);
285
 
286
        signal clk25mhz         : std_logic;
287
        signal clk1hz           : std_logic;
288
        signal clk10hz          : std_logic;
289
        signal clk100hz         : std_logic;
290
        signal clk10sec         : std_logic;
291
        --signal clk1min                : std_logic;
292
        --signal clk1hr         : std_logic;
293
 
294
        signal HEX_DISP0        : std_logic_vector(6 downto 0);
295
        signal HEX_DISP1        : std_logic_vector(6 downto 0);
296
        signal HEX_DISP2        : std_logic_vector(6 downto 0);
297
        signal HEX_DISP3        : std_logic_vector(6 downto 0);
298
 
299
        signal NUMBER0          : std_logic_vector(3 downto 0);
300
        signal NUMBER1          : std_logic_vector(3 downto 0);
301
        signal NUMBER2          : std_logic_vector(3 downto 0);
302
        signal NUMBER3          : std_logic_vector(3 downto 0);
303
 
304
        --signal GPIO_0_buf_in  : std_logic_vector(35 downto 0);
305
        --signal GPIO_1_buf_in  : std_logic_vector(35 downto 0);
306
 
307
 
308
 
309
 
310
 
311
 
312
        --signal Z80SOC_VERSION : std_logic_vector(2 downto 0);   -- "000" = DE1, "001" = S3E
313
        --signal Z80SOC_STACK           : std_logic_vector(15 downto 0);  -- Should be set to top of (RAM Memory - 1)
314
 
315
 
316
 
317
        signal uart0_CS                 : std_Logic;
318
        signal uart0_RD                 : std_Logic;
319
        signal uart0_WR                 : std_Logic;
320
        signal uart0_RxInt              : std_Logic;
321
        signal uart0_TxInt              : std_Logic;
322
        signal uart0_Addr       : std_Logic_Vector(1 downto 0);
323
        signal uart0_DataIn     : std_Logic_Vector(7 downto 0);
324
        signal uart0_DataOut    : std_logic_Vector(7 downto 0);
325
        signal UartIntVector    : std_logic_Vector(7 downto 0);
326
 
327
 
328
        --signal FlashReady             : std_logic;
329
        --signal iDataFlash             : std_logic_Vector(7 downto 0);
330
        --signal iCMDFlash              : std_logic_Vector(2 downto 0);
331
 
332
        --signal FlashAddr      : std_logic_Vector(21 downto 0);
333
 
334
        --signal LedBlink                       : std_logic;
335
 
336
        --signal SingleShot             : std_logic;
337
 
338
        signal IntVector                : std_logic_Vector(7 downto 0);
339
 
340
 
341
 
342
        --signal Z80_RAM_ADR    : Std_Logic_Vector(15 downto 0);
343
        --signal Z80_RAM_CE     : Std_Logic;
344
        --signal Z80_RAM_OE     : Std_Logic;
345
        --signal Z80_RAM_WE             : Std_Logic;
346
 
347
 
348
        --signal Z80_EE_ADR     : Std_Logic_Vector(21 downto 0);
349
        --signal Z80_EE_0E      : Std_Logic;
350
        --signal Z80_EE_WE      : Std_Logic;
351
        --signal Z80_EE_CE      : Std_Logic;
352
 
353
        --signal PFA_IOE            : Std_Logic;
354
        --signal PFA_MEX            : Std_Logic;
355
 
356
        signal LEDRED           : std_logic_Vector(7 downto 0);
357
 
358
 
359
begin
360
 
361
 
362
 
363
        Rst_n_s <= not SW(9);                   -- Switch 9 toggles Reset on z80
364
 
365
 
366
        HEX0 <= HEX_DISP0;                              -- Move Signal to Output Pins
367
        HEX1 <= HEX_DISP1;                              -- Move Signal to Output Pins
368
        HEX2 <= HEX_DISP2;                              -- Move Signal to Output Pins
369
        HEX3 <= HEX_DISP3;                              -- Move Signal to Output Pins
370
 
371
        -- SRAM control signals
372
        SRAM_ADDR(15 downto 0) <= A - x"C000" when (A >= x"C000" and MREQ_n = '0');
373
        SRAM_DQ(7 downto 0) <= DO_CPU when (Wr_n = '0' and MREQ_n = '0' and A >= x"C000") else (others => 'Z');
374
        SRAM_WE_N <= Wr_n or MREQ_n when A >= x"C000";
375
        SRAM_OE_N <= Rd_n or MREQ_n when A >= x"C000";  --Rd_n;
376
 
377
        -- ???? Why can't this pin be connected to MREQ_n CPU will not run unless its is connected to zero
378
        SRAM_CE_N <= '0';
379
        --------------------------------------------------------------------------------------------------
380
 
381
        --1FFFH is used for unlocking ram in future.  Auto lock after one read or write.
382
 
383
        -- FLASH control signals
384
 
385
        --FL_ADDR(15 downto 0) <= A(15 downto 0) when (Clk_Z80 = '1' and A < x"A000");
386
        FL_ADDR(15 downto 0) <= A(15 downto 0) when (A < x"A000" and MREQ_n = '0');
387
    --D_ROM(7 downto 0) <=  FL_DQ when (Clk_Z80 = '1' and A < x"A000");
388
        D_ROM(7 downto 0) <=  FL_DQ when (A < x"A000" and MREQ_n = '0');
389
 
390
    -- ????? Unblock this and CPU will not run
391
    --FL_DQ <= DO_CPU when (Wr_n = '0' and MREQ_n = '0' and A < x"A000") else (others => 'Z');
392
    -----------------------------------------------------------
393
 
394
    FL_DQ       <= (others => 'Z');
395
 
396
    FL_WE_N <= Wr_n;              --'1';                -- Write Enable
397
 
398
    FL_OE_N <= Rd_n;    -- Output Enable
399
 
400
    FL_CE_N <= MREQ_n when A < x"A000"; -- Chip Enable
401
 
402
 
403
 
404
 
405
    --Buffer Flash Data Lines
406
        --D_ROM(0) <= '1' when FL_DQ(0) = '1' else '0';
407
        --D_ROM(1) <= '1' when FL_DQ(1) = '1' else '0';
408
        --D_ROM(2) <= '1' when FL_DQ(2) = '1' else '0';
409
        --D_ROM(3) <= '1' when FL_DQ(3) = '1' else '0';
410
        --D_ROM(4) <= '1' when FL_DQ(4) = '1' else '0';
411
        --D_ROM(5) <= '1' when FL_DQ(5) = '1' else '0';
412
        --D_ROM(6) <= '1' when FL_DQ(6) = '1' else '0';
413
        --D_ROM(7) <= '1' when FL_DQ(7) = '1' else '0';
414
 
415
 
416
 
417
 
418
 
419
        -- UART control signals
420
        uart0_CS <= IORQ_n when (A(7 downto 0) = x"24" and IORQ_n = '0');
421
        uart0_RD <= Rd_n when (A(7 downto 0) = x"24" and IORQ_n = '0');
422
        uart0_WR <= Wr_n when (A(7 downto 0) = x"24" and IORQ_n = '0');
423
        uart0_Addr <= b"00";
424
    ----------------------------------------------
425
    ----------------------------------------------
426
        --Z80 Interrupt Vectors
427
        --               IBMVECT
428
        --0040 AA1C               DW        COMMBOUT    ;CHAN-B TRANSMIT BUFFER EMPTY
429
        --0042 101B               DW        COMBCLI     ;BSTATUS
430
        --0044 F21C               DW        COMMBIN     ;BRECEIVE
431
        --0046 FF1A               DW        COMBCLII    ;BEXTINT
432
        --0048 281C               DW        COMMAOUT    ;ATRBMTY
433
        --004A 691C               DW        COMACLI     ;WAS CRTEXINT   ;ASTATUS
434
        --004C 2F1B               DW        COMMAIN     ;WAS CRTINP     ;ARECEIVE
435
        --004E 971C               DW        COMACLII    ;WAS CRTEXIN?   ;AEXTINT
436
        IntVector(7 downto 0) <= x"4C"  when (IORQ_n = '0' and MREQ_n = '1' and M1_n = '0' and uart0_RxInt = '1');
437
    ----------------------------------------------------------
438
 
439
 
440
 
441
 
442
 
443
        -- Depending on bus signals DI_CPU gets loaded with one of these values.
444
        -- Note: bus signals change while z80 is executing different instructions.
445
        -- Input to Z80
446
        DI_CPU <=
447
                        SRAM_DQ(7 downto 0) when (Rd_n = '0' and MREQ_n = '0' and IORQ_n = '1' and A >= x"C000") else
448
 
449
                        --Input ROM Code
450
                        D_ROM when (Rd_n = '0' and MREQ_n = '0' and IORQ_n = '1' and A < x"A000") else
451
 
452
                        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
453
 
454
                        IntVector(7 downto 0) when (IORQ_n = '0' and MREQ_n = '1' and M1_n = '0' and uart0_RxInt = '1') else
455
 
456
                        "ZZZZZZZZ";
457
 
458
        -- Process to latch leds and hex displays
459
        pinout_process: process(Clk_Z80)
460
        variable NUMBER0_sig    : std_logic_vector(3 downto 0);
461
        variable NUMBER1_sig    : std_logic_vector(3 downto 0);
462
        variable NUMBER2_sig    : std_logic_vector(3 downto 0);
463
        variable NUMBER3_sig    : std_logic_vector(3 downto 0);
464
        variable LEDG_sig               : std_logic_vector(7 downto 0);
465
        variable LEDR_sig               : std_logic_vector(9 downto 0);
466
        variable GPIO_0_buf_out: std_logic_vector(35 downto 0);
467
        variable uart0_buf_DataOut: std_logic_vector(7 downto 0);
468
        --variable GPIO_1_buf_out: std_logic_vector(35 downto 0);
469
        begin
470
        if Clk_Z80'event and Clk_Z80 = '1' then
471
                  if IORQ_n = '0' and MREQ_n = '1' and Wr_n = '0' then
472
                        -- LEDG
473
                        if A(7 downto 0) = x"01" then
474
                        -- LEDR
475
                        elsif A(7 downto 0) = x"02" then
476
                                LEDR_sig(7 downto 0) := DO_CPU;
477
                        -- HEX1 and HEX0
478
                        elsif A(7 downto 0) = x"10" then
479
                                NUMBER0_sig := DO_CPU(3 downto 0);
480
                                NUMBER1_sig := DO_CPU(7 downto 4);
481
                        -- HEX3 and HEX2
482
                        elsif A(7 downto 0) = x"11" then
483
                                NUMBER2_sig := DO_CPU(3 downto 0);
484
                                NUMBER3_sig := DO_CPU(7 downto 4);
485
                        elsif A(7 downto 0) = x"24" then
486
                                uart0_buf_DataOut := DO_CPU;            --load data to uart output buffer
487
 
488
                        end if;
489
                  end if;
490
                end if;
491
                -- Latches the signals
492
                NUMBER0 <= NUMBER0_sig;
493
                NUMBER1 <= NUMBER1_sig;
494
                NUMBER2 <= NUMBER2_sig;
495
                NUMBER3 <= NUMBER3_sig;
496
 
497
 
498
                -- ???? Unblock this and CPU will not run
499
                --LEDRED(7 downto 0) <= LEDR_sig(7 downto 0);
500
                ---------------------------------------------
501
 
502
 
503
                uart0_DataOut <= uart0_buf_DataOut;
504
        end process;
505
 
506
        One <= '1';
507
        z80_inst: T80se
508
                port map (
509
                        M1_n => M1_n,
510
                        MREQ_n => MREQ_n,
511
                        IORQ_n => IORQ_n,
512
                        RD_n => Rd_n,
513
                        WR_n => Wr_n,
514
                        RFSH_n => open,
515
                        HALT_n => open,
516
                        WAIT_n => One,
517
                        INT_n => INT_n,
518
                        NMI_n => clk1hz,
519
                        RESET_n => Rst_n_s,
520
                        BUSRQ_n => One,
521
                        BUSAK_n => open,
522
                        CLK_n => Clk_Z80,
523
                        CLKEN => One,
524
                        A => A,
525
                        DI => DI_CPU,
526
                        DO => DO_CPU
527
                );
528
 
529
 
530
        clkdiv_inst: clk_div
531
        port map (
532
                clock_25Mhz                             => CLOCK_27,
533
                clock_1MHz                              => open,
534
                clock_100KHz                    => open,
535
                clock_10KHz                             => open,
536
                clock_1KHz                              => open,
537
                clock_100Hz                             => clk100hz,
538
                clock_10Hz                              => clk10hz,
539
                clock_1Hz                               => clk1hz,
540
                clock_10sec                             => clk10sec,
541
                clock_1min                              => open,
542
                clock_1hr                               => open
543
        );
544
 
545
        clock_z80_inst : Clock_357Mhz
546
                port map (
547
                        clock_50Mhz             => CLOCK_50,
548
                        clock_357Mhz    => Clk_Z80
549
        );
550
 
551
        DISPHEX0 : decoder_7seg PORT MAP (
552
                NUMBER                  =>      NUMBER0,
553
                HEX_DISP                =>      HEX_DISP0
554
        );
555
 
556
        DISPHEX1 : decoder_7seg PORT MAP (
557
                NUMBER                  =>      NUMBER1,
558
                HEX_DISP                =>      HEX_DISP1
559
        );
560
 
561
        DISPHEX2 : decoder_7seg PORT MAP (
562
                NUMBER                  =>      NUMBER2,
563
                HEX_DISP                =>      HEX_DISP2
564
        );
565
 
566
        DISPHEX3 : decoder_7seg PORT MAP (
567
                NUMBER                  =>      NUMBER3,
568
                HEX_DISP                =>      HEX_DISP3
569
        );
570
 
571
 
572
        U1 : miniUART PORT MAP (
573
                SysClk   => CLOCK_50,           --: in  Std_Logic;  -- System Clock
574
                Reset    => Key(0),             --: in  Std_Logic;  -- Reset input
575
                CS_N     => uart0_cs,           --: in  Std_Logic;
576
                RD_N     => uart0_Rd,           --: in  Std_Logic;
577
                WR_N     => uart0_Wr,           --: in  Std_Logic;
578
                RxD      => UART_RXD,           --: in  Std_Logic;
579
                TxD      => UART_TXD,           --: out Std_Logic;
580
                IntRx_N  => uart0_RxInt,                --: out Std_Logic;  -- Received Byte
581
                IntTx_N  => uart0_TxInt,                --: out Std_Logic;  -- Transmit Buffer Empty
582
                Addr     => uart0_Addr,         --: in  Std_Logic_Vector(1 downto 0); --
583
                DataIn   => uart0_DataOut,      --: in  Std_Logic_Vector(7 downto 0); --
584
                DataOut  => uart0_DataIn        --: out Std_Logic_Vector(7 downto 0)); --
585
        );
586
 
587
 
588
 
589
 
590
 
591
 
592
        LEDR(0) <= '1' when LEDRED(0) = '1' else '0';
593
        LEDR(1) <= '1' when LEDRED(1) = '1' else '0';
594
        LEDR(2) <= '1' when LEDRED(2) = '1' else '0';
595
        LEDR(3) <= '1' when LEDRED(3) = '1' else '0';
596
        LEDR(4) <= '1' when LEDRED(4) = '1' else '0';
597
        LEDR(5) <= '1' when LEDRED(5) = '1' else '0';
598
        LEDR(6) <= '1' when LEDRED(6) = '1' else '0';
599
        LEDR(7) <= '1' when LEDRED(7) = '1' else '0';
600
 
601
 
602
 
603
        INT_n <= '0' when uart0_RxInt ='1' else '1';
604
 
605
 
606
    -- Block any of these and CPU will not run -- ?????
607
        LEDG(0) <= uart0_RxInt;
608
        LEDG(1) <= uart0_TxInt;
609
        LEDG(5) <= INT_n;
610
        ------------------------------------------------------
611
 
612
        LEDG(6) <= clk10sec;
613
        LEDG(7) <= clk1hz;
614
 
615
        SRAM_DQ(15 downto 8) <= (others => 'Z');
616
        SRAM_ADDR(17 downto 16) <= "00";
617
        SRAM_UB_N <= '1';
618
        SRAM_LB_N <= '0';
619
        SRAM_CE_N <= '0';
620
        --
621
        UART_TXD <= 'Z';
622
        DRAM_ADDR <= (others => '0');
623
        DRAM_LDQM <= '0';
624
        DRAM_UDQM <= '0';
625
        DRAM_WE_N <= '1';
626
        DRAM_CAS_N <= '1';
627
        DRAM_RAS_N <= '1';
628
        DRAM_CS_N <= '1';
629
        DRAM_BA_0 <= '0';
630
        DRAM_BA_1 <= '0';
631
        DRAM_CLK <= '0';
632
        DRAM_CKE <= '0';
633
 
634
    FL_ADDR(21 downto 16) <= b"000000";
635
    FL_RST_N <= '1';            -- Reset
636
 
637
        TDO <= '0';
638
        I2C_SCLK <= '0';
639
        AUD_DACDAT <= '0';
640
        AUD_XCK <= '0';
641
        -- Set all bidirectional ports to tri-state
642
        DRAM_DQ     <= (others => 'Z');
643
 
644
        I2C_SDAT    <= 'Z';
645
        AUD_ADCLRCK <= 'Z';
646
        AUD_DACLRCK <= 'Z';
647
        AUD_BCLK    <= 'Z';
648
        GPIO_0 <= (others => 'Z');
649
        GPIO_1 <= (others => 'Z');
650
end;

powered by: WebSVN 2.1.0

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