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

Subversion Repositories z80soc

[/] [z80soc/] [branches/] [RonivonCosta/] [DE1/] [rtl/] [VHDL/] [t80/] [T8080se.vhd] - Blame information for rev 11

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 11 rrred
--
2
-- 8080 compatible microprocessor core, synchronous top level with clock enable
3
-- Different timing than the original 8080
4
-- Inputs needs to be synchronous and outputs may glitch
5
--
6
-- Version : 0242
7
--
8
-- Copyright (c) 2002 Daniel Wallner (jesus@opencores.org)
9
--
10
-- All rights reserved
11
--
12
-- Redistribution and use in source and synthezised forms, with or without
13
-- modification, are permitted provided that the following conditions are met:
14
--
15
-- Redistributions of source code must retain the above copyright notice,
16
-- this list of conditions and the following disclaimer.
17
--
18
-- Redistributions in synthesized form must reproduce the above copyright
19
-- notice, this list of conditions and the following disclaimer in the
20
-- documentation and/or other materials provided with the distribution.
21
--
22
-- Neither the name of the author nor the names of other contributors may
23
-- be used to endorse or promote products derived from this software without
24
-- specific prior written permission.
25
--
26
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
28
-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29
-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
30
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36
-- POSSIBILITY OF SUCH DAMAGE.
37
--
38
-- Please report bugs to the author, but before you do so, please
39
-- make sure that this is not a derivative work and that
40
-- you have the latest version of this file.
41
--
42
-- The latest version of this file can be found at:
43
--      http://www.opencores.org/cvsweb.shtml/t80/
44
--
45
-- Limitations :
46
--      STACK status output not supported
47
--
48
-- File history :
49
--
50
--      0237 : First version
51
--
52
--      0238 : Updated for T80 interface change
53
--
54
--      0240 : Updated for T80 interface change
55
--
56
--      0242 : Updated for T80 interface change
57
--
58
 
59
library IEEE;
60
use IEEE.std_logic_1164.all;
61
use IEEE.numeric_std.all;
62
use work.T80_Pack.all;
63
 
64
entity T8080se is
65
        generic(
66
                Mode : integer := 2;    -- 0 => Z80, 1 => Fast Z80, 2 => 8080, 3 => GB
67
                T2Write : integer := 0   -- 0 => WR_n active in T3, /=0 => WR_n active in T2
68
        );
69
        port(
70
                RESET_n         : in std_logic;
71
                CLK                     : in std_logic;
72
                CLKEN           : in std_logic;
73
                READY           : in std_logic;
74
                HOLD            : in std_logic;
75
                INT                     : in std_logic;
76
                INTE            : out std_logic;
77
                DBIN            : out std_logic;
78
                SYNC            : out std_logic;
79
                VAIT            : out std_logic;
80
                HLDA            : out std_logic;
81
                WR_n            : out std_logic;
82
                A                       : out std_logic_vector(15 downto 0);
83
                DI                      : in std_logic_vector(7 downto 0);
84
                DO                      : out std_logic_vector(7 downto 0)
85
        );
86
end T8080se;
87
 
88
architecture rtl of T8080se is
89
 
90
        signal IntCycle_n       : std_logic;
91
        signal NoRead           : std_logic;
92
        signal Write            : std_logic;
93
        signal IORQ                     : std_logic;
94
        signal INT_n            : std_logic;
95
        signal HALT_n           : std_logic;
96
        signal BUSRQ_n          : std_logic;
97
        signal BUSAK_n          : std_logic;
98
        signal DO_i                     : std_logic_vector(7 downto 0);
99
        signal DI_Reg           : std_logic_vector(7 downto 0);
100
        signal MCycle           : std_logic_vector(2 downto 0);
101
        signal TState           : std_logic_vector(2 downto 0);
102
        signal One                      : std_logic;
103
 
104
begin
105
 
106
        INT_n <= not INT;
107
        BUSRQ_n <= HOLD;
108
        HLDA <= not BUSAK_n;
109
        SYNC <= '1' when TState = "001" else '0';
110
        VAIT <= '1' when TState = "010" else '0';
111
        One <= '1';
112
 
113
        DO(0) <= not IntCycle_n when TState = "001" else DO_i(0); -- INTA
114
        DO(1) <= Write when TState = "001" else DO_i(1);        -- WO_n
115
        DO(2) <= DO_i(2);       -- STACK not supported !!!!!!!!!!
116
        DO(3) <= not HALT_n when TState = "001" else DO_i(3);   -- HLTA
117
        DO(4) <= IORQ and Write when TState = "001" else DO_i(4);       -- OUT
118
        DO(5) <= DO_i(5) when TState /= "001" else '1' when MCycle = "001" else '0';     -- M1
119
        DO(6) <= IORQ and not Write when TState = "001" else DO_i(6);   -- INP
120
        DO(7) <= not IORQ and not Write and IntCycle_n when TState = "001" else DO_i(7);        -- MEMR
121
 
122
        u0 : T80
123
                generic map(
124
                        Mode => Mode,
125
                        IOWait => 0)
126
                port map(
127
                        CEN => CLKEN,
128
                        M1_n => open,
129
                        IORQ => IORQ,
130
                        NoRead => NoRead,
131
                        Write => Write,
132
                        RFSH_n => open,
133
                        HALT_n => HALT_n,
134
                        WAIT_n => READY,
135
                        INT_n => INT_n,
136
                        NMI_n => One,
137
                        RESET_n => RESET_n,
138
                        BUSRQ_n => One,
139
                        BUSAK_n => BUSAK_n,
140
                        CLK_n => CLK,
141
                        A => A,
142
                        DInst => DI,
143
                        DI => DI_Reg,
144
                        DO => DO_i,
145
                        MC => MCycle,
146
                        TS => TState,
147
                        IntCycle_n => IntCycle_n,
148
                        IntE => INTE);
149
 
150
        process (RESET_n, CLK)
151
        begin
152
                if RESET_n = '0' then
153
                        DBIN <= '0';
154
                        WR_n <= '1';
155
                        DI_Reg <= "00000000";
156
                elsif CLK'event and CLK = '1' then
157
                        if CLKEN = '1' then
158
                                DBIN <= '0';
159
                                WR_n <= '1';
160
                                if MCycle = "001" then
161
                                        if TState = "001" or (TState = "010" and READY = '0') then
162
                                                DBIN <= IntCycle_n;
163
                                        end if;
164
                                else
165
                                        if (TState = "001" or (TState = "010" and READY = '0')) and NoRead = '0' and Write = '0' then
166
                                                DBIN <= '1';
167
                                        end if;
168
                                        if T2Write = 0 then
169
                                                if TState = "010" and Write = '1' then
170
                                                        WR_n <= '0';
171
                                                end if;
172
                                        else
173
                                                if (TState = "001" or (TState = "010" and READY = '0')) and Write = '1' then
174
                                                        WR_n <= '0';
175
                                                end if;
176
                                        end if;
177
                                end if;
178
                                if TState = "010" and READY = '1' then
179
                                        DI_Reg <= DI;
180
                                end if;
181
                        end if;
182
                end if;
183
        end process;
184
 
185
end;

powered by: WebSVN 2.1.0

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