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

Subversion Repositories t80

[/] [t80/] [trunk/] [rtl/] [vhdl/] [T8080se.vhd] - Blame information for rev 22

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

Line No. Rev Author Line
1 22 jesus
--
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 : 0237
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
 
51
library IEEE;
52
use IEEE.std_logic_1164.all;
53
use IEEE.numeric_std.all;
54
use work.T80_Pack.all;
55
 
56
entity T8080se is
57
        generic(
58
                Mode : integer := 2;    -- 0 => Z80, 1 => Fast Z80, 2 => 8080, 3 => GB
59
                T2Write : integer := 0   -- 0 => WR_n active in T3, /=0 => WR_n active in T2
60
        );
61
        port(
62
                RESET_n         : in std_logic;
63
                CLK                     : in std_logic;
64
                CLKEN           : in std_logic;
65
                READY           : in std_logic;
66
                HOLD            : in std_logic;
67
                INT                     : in std_logic;
68
                INTE            : out std_logic;
69
                DBIN            : out std_logic;
70
                SYNC            : out std_logic;
71
                VAIT            : out std_logic;
72
                HLDA            : out std_logic;
73
                WR_n            : out std_logic;
74
                A                       : out std_logic_vector(15 downto 0);
75
                DI                      : in std_logic_vector(7 downto 0);
76
                DO                      : out std_logic_vector(7 downto 0)
77
        );
78
end T8080se;
79
 
80
architecture rtl of T8080se is
81
 
82
        signal False_M1         : std_logic;
83
        signal IntCycle_n       : std_logic;
84
        signal Write            : std_logic;
85
        signal IORQ                     : std_logic;
86
        signal INT_n            : std_logic;
87
        signal HALT_n           : std_logic;
88
        signal BUSRQ_n          : std_logic;
89
        signal BUSAK_n          : std_logic;
90
        signal DO_i                     : std_logic_vector(7 downto 0);
91
        signal DI_Reg           : std_logic_vector(7 downto 0);
92
        signal MCycle           : std_logic_vector(2 downto 0);
93
        signal TState           : std_logic_vector(2 downto 0);
94
        signal One                      : std_logic;
95
 
96
begin
97
 
98
        INT_n <= not INT;
99
        BUSRQ_n <= HOLD;
100
        HLDA <= not BUSAK_n;
101
        SYNC <= '1' when TState = "001" else '0';
102
        VAIT <= '1' when TState = "010" else '0';
103
        One <= '1';
104
 
105
        DO(0) <= not IntCycle_n when TState = "001" else DO_i(0); -- INTA
106
        DO(1) <= Write when TState = "001" else DO_i(1);        -- WO_n
107
        DO(2) <= DO_i(2);       -- STACK not supported !!!!!!!!!!
108
        DO(3) <= not HALT_n when TState = "001" else DO_i(3);   -- HLTA
109
        DO(4) <= IORQ and Write when TState = "001" else DO_i(4);       -- OUT
110
        DO(5) <= DO_i(5) when TState /= "001" else '1' when MCycle = "001" else '0';     -- M1
111
        DO(6) <= IORQ and not Write when TState = "001" else DO_i(6);   -- INP
112
        DO(7) <= not IORQ and not Write and IntCycle_n when TState = "001" else DO_i(7);        -- MEMR
113
 
114
        u0 : T80
115
                generic map(
116
                        Mode => Mode)
117
                port map(
118
                        CEN => CLKEN,
119
                        M1_n => open,
120
                        IORQ => IORQ,
121
                        Write => Write,
122
                        RFSH_n => open,
123
                        HALT_n => HALT_n,
124
                        WAIT_n => READY,
125
                        INT_n => INT_n,
126
                        NMI_n => One,
127
                        RESET_n => RESET_n,
128
                        BUSRQ_n => One,
129
                        BUSAK_n => BUSAK_n,
130
                        CLK_n => CLK,
131
                        A => A,
132
                        DInst => DI,
133
                        DI => DI_Reg,
134
                        DO => DO_i,
135
                        MC => MCycle,
136
                        TS => TState,
137
                        False_M1 => False_M1,
138
                        IntCycle_n => IntCycle_n,
139
                        IntE => INTE);
140
 
141
        process (RESET_n, CLK)
142
        begin
143
                if RESET_n = '0' then
144
                        DBIN <= '0';
145
                        WR_n <= '1';
146
                        DI_Reg <= "00000000";
147
                elsif CLK'event and CLK = '1' then
148
                        if CLKEN = '1' then
149
                                DBIN <= '0';
150
                                WR_n <= '1';
151
                                if MCycle = "001" and False_M1 = '0' then
152
                                        if TState = "001" or (TState = "010" and READY = '0') then
153
                                                DBIN <= IntCycle_n;
154
                                        end if;
155
                                else
156
                                        if (TState = "001" or (TState = "010" and READY = '0')) and Write = '0' then
157
                                                DBIN <= '1';
158
                                        end if;
159
                                        if T2Write = 0 then
160
                                                if TState = "010" and Write = '1' then
161
                                                        WR_n <= '0';
162
                                                end if;
163
                                        else
164
                                                if (TState = "001" or (TState = "010" and READY = '0')) and Write = '1' then
165
                                                        WR_n <= '0';
166
                                                end if;
167
                                        end if;
168
                                end if;
169
                                if TState = "010" and READY = '1' then
170
                                        DI_Reg <= DI;
171
                                end if;
172
                        end if;
173
                end if;
174
        end process;
175
 
176
end;

powered by: WebSVN 2.1.0

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