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

Subversion Repositories z80soc

[/] [z80soc/] [branches/] [RonivonCosta/] [DE1/] [rtl/] [VHDL/] [t80/] [T80se.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
-- 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
-- Version : 0242
7
--
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
--      0236 : Added T2Write generic
52
--
53
--      0237 : Fixed T2Write with wait state
54
--
55
--      0238 : Updated for T80 interface change
56
--
57
--      0240 : Updated for T80 interface change
58
--
59
--      0242 : Updated for T80 interface change
60
--
61
 
62
library IEEE;
63
use IEEE.std_logic_1164.all;
64
use IEEE.numeric_std.all;
65
use work.T80_Pack.all;
66
 
67
entity T80se is
68
        generic(
69
                Mode : integer := 0;     -- 0 => Z80, 1 => Fast Z80, 2 => 8080, 3 => GB
70
                T2Write : integer := 0;  -- 0 => WR_n active in T3, /=0 => WR_n active in T2
71
                IOWait : integer := 1   -- 0 => Single cycle I/O, 1 => Std I/O cycle
72
        );
73
        port(
74
                RESET_n         : in std_logic;
75
                CLK_n           : in std_logic;
76
                CLKEN           : in std_logic;
77
                WAIT_n          : in std_logic;
78
                INT_n           : in std_logic;
79
                NMI_n           : in std_logic;
80
                BUSRQ_n         : in std_logic;
81
                M1_n            : out std_logic;
82
                MREQ_n          : out std_logic;
83
                IORQ_n          : out std_logic;
84
                RD_n            : out std_logic;
85
                WR_n            : out std_logic;
86
                RFSH_n          : out std_logic;
87
                HALT_n          : out std_logic;
88
                BUSAK_n         : out std_logic;
89
                A                       : out std_logic_vector(15 downto 0);
90
                DI                      : in std_logic_vector(7 downto 0);
91
                DO                      : out std_logic_vector(7 downto 0)
92
        );
93
end T80se;
94
 
95
architecture rtl of T80se is
96
 
97
        signal IntCycle_n       : std_logic;
98
        signal NoRead           : std_logic;
99
        signal Write            : std_logic;
100
        signal IORQ                     : std_logic;
101
        signal DI_Reg           : std_logic_vector(7 downto 0);
102
        signal MCycle           : std_logic_vector(2 downto 0);
103
        signal TState           : std_logic_vector(2 downto 0);
104
 
105
begin
106
 
107
        u0 : T80
108
                generic map(
109
                        Mode => Mode,
110
                        IOWait => IOWait)
111
                port map(
112
                        CEN => CLKEN,
113
                        M1_n => M1_n,
114
                        IORQ => IORQ,
115
                        NoRead => NoRead,
116
                        Write => Write,
117
                        RFSH_n => RFSH_n,
118
                        HALT_n => HALT_n,
119
                        WAIT_n => Wait_n,
120
                        INT_n => INT_n,
121
                        NMI_n => NMI_n,
122
                        RESET_n => RESET_n,
123
                        BUSRQ_n => BUSRQ_n,
124
                        BUSAK_n => BUSAK_n,
125
                        CLK_n => CLK_n,
126
                        A => A,
127
                        DInst => DI,
128
                        DI => DI_Reg,
129
                        DO => DO,
130
                        MC => MCycle,
131
                        TS => TState,
132
                        IntCycle_n => IntCycle_n);
133
 
134
        process (RESET_n, CLK_n)
135
        begin
136
                if RESET_n = '0' then
137
                        RD_n <= '1';
138
                        WR_n <= '1';
139
                        IORQ_n <= '1';
140
                        MREQ_n <= '1';
141
                        DI_Reg <= "00000000";
142
                elsif CLK_n'event and CLK_n = '1' then
143
                        if CLKEN = '1' then
144
                                RD_n <= '1';
145
                                WR_n <= '1';
146
                                IORQ_n <= '1';
147
                                MREQ_n <= '1';
148
                                if MCycle = "001" then
149
                                        if TState = "001" or (TState = "010" and Wait_n = '0') then
150
                                                RD_n <= not IntCycle_n;
151
                                                MREQ_n <= not IntCycle_n;
152
                                                IORQ_n <= IntCycle_n;
153
                                        end if;
154
                                        if TState = "011" then
155
                                                MREQ_n <= '0';
156
                                        end if;
157
                                else
158
                                        if (TState = "001" or (TState = "010" and Wait_n = '0')) and NoRead = '0' and Write = '0' then
159
                                                RD_n <= '0';
160
                                                IORQ_n <= not IORQ;
161
                                                MREQ_n <= IORQ;
162
                                        end if;
163
                                        if T2Write = 0 then
164
                                                if TState = "010" and Write = '1' then
165
                                                        WR_n <= '0';
166
                                                        IORQ_n <= not IORQ;
167
                                                        MREQ_n <= IORQ;
168
                                                end if;
169
                                        else
170
                                                if (TState = "001" or (TState = "010" and Wait_n = '0')) and Write = '1' then
171
                                                        WR_n <= '0';
172
                                                        IORQ_n <= not IORQ;
173
                                                        MREQ_n <= IORQ;
174
                                                end if;
175
                                        end if;
176
                                end if;
177
                                if TState = "010" and Wait_n = '1' then
178
                                        DI_Reg <= DI;
179
                                end if;
180
                        end if;
181
                end if;
182
        end process;
183
 
184
end;

powered by: WebSVN 2.1.0

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