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

Subversion Repositories t80

[/] [t80/] [trunk/] [rtl/] [vhdl/] [T80se.vhd] - Blame information for rev 25

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

Line No. Rev Author Line
1 15 jesus
--
2
-- Z80 compatible microprocessor core, synchronous top level with clock enable
3
-- Different timing than the original z80
4
-- Inputs needs to be synchronous and outputs may glitch
5
--
6 25 jesus
-- Version : 0238
7 15 jesus
--
8
-- Copyright (c) 2001-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
--
47
-- File history :
48
--
49
--      0235 : First release
50
--
51 18 jesus
--      0236 : Added T2Write generic
52
--
53 23 jesus
--      0237 : Fixed T2Write with wait state
54
--
55 25 jesus
--      0238 : Updated for T80 interface change
56
--
57 15 jesus
 
58
library IEEE;
59
use IEEE.std_logic_1164.all;
60
use IEEE.numeric_std.all;
61
use work.T80_Pack.all;
62
 
63
entity T80se is
64
        generic(
65 18 jesus
                Mode : integer := 0;     -- 0 => Z80, 1 => Fast Z80, 2 => 8080, 3 => GB
66
                T2Write : integer := 0   -- 0 => WR_n active in T3, /=0 => WR_n active in T2
67 15 jesus
        );
68
        port(
69
                RESET_n         : in std_logic;
70
                CLK_n           : in std_logic;
71
                CLKEN           : in std_logic;
72
                WAIT_n          : in std_logic;
73
                INT_n           : in std_logic;
74
                NMI_n           : in std_logic;
75
                BUSRQ_n         : in std_logic;
76
                M1_n            : out std_logic;
77
                MREQ_n          : out std_logic;
78
                IORQ_n          : out std_logic;
79
                RD_n            : out std_logic;
80
                WR_n            : out std_logic;
81
                RFSH_n          : out std_logic;
82
                HALT_n          : out std_logic;
83
                BUSAK_n         : out std_logic;
84
                A                       : out std_logic_vector(15 downto 0);
85
                DI                      : in std_logic_vector(7 downto 0);
86
                DO                      : out std_logic_vector(7 downto 0)
87
        );
88
end T80se;
89
 
90
architecture rtl of T80se is
91
 
92
        signal False_M1         : std_logic;
93
        signal IntCycle_n       : std_logic;
94 25 jesus
        signal NoRead           : std_logic;
95 15 jesus
        signal Write            : std_logic;
96
        signal IORQ                     : std_logic;
97
        signal DI_Reg           : std_logic_vector(7 downto 0);
98
        signal MCycle           : std_logic_vector(2 downto 0);
99
        signal TState           : std_logic_vector(2 downto 0);
100
 
101
begin
102
 
103
        u0 : T80
104
                generic map(
105
                        Mode => Mode)
106
                port map(
107
                        CEN => CLKEN,
108
                        M1_n => M1_n,
109
                        IORQ => IORQ,
110 25 jesus
                        NoRead => NoRead,
111 15 jesus
                        Write => Write,
112
                        RFSH_n => RFSH_n,
113
                        HALT_n => HALT_n,
114
                        WAIT_n => Wait_n,
115
                        INT_n => INT_n,
116
                        NMI_n => NMI_n,
117
                        RESET_n => RESET_n,
118
                        BUSRQ_n => BUSRQ_n,
119
                        BUSAK_n => BUSAK_n,
120
                        CLK_n => CLK_n,
121
                        A => A,
122
                        DInst => DI,
123
                        DI => DI_Reg,
124
                        DO => DO,
125
                        MC => MCycle,
126
                        TS => TState,
127
                        False_M1 => False_M1,
128
                        IntCycle_n => IntCycle_n);
129
 
130
        process (RESET_n, CLK_n)
131
        begin
132
                if RESET_n = '0' then
133
                        RD_n <= '1';
134
                        WR_n <= '1';
135
                        IORQ_n <= '1';
136
                        MREQ_n <= '1';
137
                        DI_Reg <= "00000000";
138
                elsif CLK_n'event and CLK_n = '1' then
139
                        if CLKEN = '1' then
140
                                RD_n <= '1';
141
                                WR_n <= '1';
142
                                IORQ_n <= '1';
143
                                MREQ_n <= '1';
144
                                if MCycle = "001" and False_M1 = '0' then
145
                                        if TState = "001" or (TState = "010" and Wait_n = '0') then
146
                                                RD_n <= not IntCycle_n;
147
                                                MREQ_n <= not IntCycle_n;
148
                                                IORQ_n <= IntCycle_n;
149
                                        end if;
150
                                        if TState = "011" then
151
                                                MREQ_n <= '0';
152
                                        end if;
153
                                else
154 25 jesus
                                        if (TState = "001" or (TState = "010" and Wait_n = '0')) and NoRead = '0' and Write = '0' then
155 15 jesus
                                                RD_n <= '0';
156
                                                IORQ_n <= not IORQ;
157
                                                MREQ_n <= IORQ;
158
                                        end if;
159 18 jesus
                                        if T2Write = 0 then
160
                                                if TState = "010" and Write = '1' then
161
                                                        WR_n <= '0';
162
                                                        IORQ_n <= not IORQ;
163
                                                        MREQ_n <= IORQ;
164
                                                end if;
165
                                        else
166 24 jesus
                                                if (TState = "001" or (TState = "010" and Wait_n = '0')) and Write = '1' then
167 18 jesus
                                                        WR_n <= '0';
168
                                                        IORQ_n <= not IORQ;
169
                                                        MREQ_n <= IORQ;
170
                                                end if;
171 15 jesus
                                        end if;
172
                                end if;
173
                                if TState = "010" and Wait_n = '1' then
174
                                        DI_Reg <= DI;
175
                                end if;
176
                        end if;
177
                end if;
178
        end process;
179
 
180
end;

powered by: WebSVN 2.1.0

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