2 -- T80(b) core. In an effort to merge and maintain bug fixes ....
5 -- Ver 300 started tidyup
7 -- Latest version from www.fpgaarcade.com (original www.opencores.org)
10 -- ** CUSTOM 2 CLOCK MEMORY ACCESS FOR PACMAN, MIKEJ **
12 -- Z80 compatible microprocessor core, synchronous top level with clock enable
13 -- Different timing than the original z80
14 -- Inputs needs to be synchronous and outputs may glitch
18 -- Copyright (c) 2001-2002 Daniel Wallner (jesus@opencores.org)
20 -- All rights reserved
22 -- Redistribution and use in source and synthezised forms, with or without
23 -- modification, are permitted provided that the following conditions are met:
25 -- Redistributions of source code must retain the above copyright notice,
26 -- this list of conditions and the following disclaimer.
28 -- Redistributions in synthesized form must reproduce the above copyright
29 -- notice, this list of conditions and the following disclaimer in the
30 -- documentation and/or other materials provided with the distribution.
32 -- Neither the name of the author nor the names of other contributors may
33 -- be used to endorse or promote products derived from this software without
34 -- specific prior written permission.
36 -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
37 -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
38 -- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
39 -- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
40 -- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
41 -- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
42 -- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
43 -- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
44 -- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
45 -- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
46 -- POSSIBILITY OF SUCH DAMAGE.
48 -- Please report bugs to the author, but before you do so, please
49 -- make sure that this is not a derivative work and that
50 -- you have the latest version of this file.
52 -- The latest version of this file can be found at:
53 -- http://www.opencores.org/cvsweb.shtml/t80/
59 -- 0235 : First release
61 -- 0236 : Added T2Write generic
63 -- 0237 : Fixed T2Write with wait state
65 -- 0238 : Updated for T80 interface change
67 -- 0242 : Updated for T80 interface change
71 use IEEE.std_logic_1164.all;
72 use IEEE.numeric_std.all;
73 use work.T80_Pack.all;
77 RESET_n : in std_logic;
80 WAIT_n : in std_logic;
83 BUSRQ_n : in std_logic;
85 MREQ_n : out std_logic;
86 IORQ_n : out std_logic;
89 RFSH_n : out std_logic;
90 HALT_n : out std_logic;
91 BUSAK_n : out std_logic;
92 A : out std_logic_vector(15 downto 0);
93 DI : in std_logic_vector(7 downto 0);
94 DO : out std_logic_vector(7 downto 0)
98 architecture rtl of T80sed is
100 signal IntCycle_n : std_logic;
101 signal NoRead : std_logic;
102 signal Write : std_logic;
103 signal IORQ : std_logic;
104 signal DI_Reg : std_logic_vector(7 downto 0);
105 signal MCycle : std_logic_vector(2 downto 0);
106 signal TState : std_logic_vector(2 downto 0);
135 IntCycle_n => IntCycle_n);
137 process (RESET_n, CLK_n)
139 if RESET_n = '0' then
144 DI_Reg <= "00000000";
145 elsif CLK_n'event and CLK_n = '1' then
151 if MCycle = "001" then
152 if TState = "001" or (TState = "010" and Wait_n = '0') then
153 RD_n <= not IntCycle_n;
154 MREQ_n <= not IntCycle_n;
155 IORQ_n <= IntCycle_n;
157 if TState = "011" then
161 if (TState = "001" or TState = "010") and NoRead = '0' and Write = '0' then
166 if ((TState = "001") or (TState = "010")) and Write = '1' then
172 if TState = "010" and Wait_n = '1' then