Line 1... |
Line 1... |
--
|
--
|
-- Z80 compatible microprocessor core
|
-- Z80 compatible microprocessor core
|
--
|
--
|
-- Version : 0214
|
-- Version : 0232
|
--
|
--
|
-- Copyright (c) 2001-2002 Daniel Wallner (dwallner@hem2.passagen.se)
|
-- Copyright (c) 2001-2002 Daniel Wallner (jesus@opencores.org)
|
--
|
--
|
-- All rights reserved
|
-- All rights reserved
|
--
|
--
|
-- Redistribution and use in source and synthezised forms, with or without
|
-- Redistribution and use in source and synthezised forms, with or without
|
-- modification, are permitted provided that the following conditions are met:
|
-- modification, are permitted provided that the following conditions are met:
|
Line 36... |
Line 36... |
-- Please report bugs to the author, but before you do so, please
|
-- Please report bugs to the author, but before you do so, please
|
-- make sure that this is not a derivative work and that
|
-- make sure that this is not a derivative work and that
|
-- you have the latest version of this file.
|
-- you have the latest version of this file.
|
--
|
--
|
-- The latest version of this file can be found at:
|
-- The latest version of this file can be found at:
|
-- http://hem.passagen.se/dwallner/vhdl.html
|
-- http://www.opencores.org/cvsweb.shtml/t80/
|
--
|
--
|
-- Limitations :
|
-- Limitations :
|
-- No extra I/O waitstate
|
-- No extra I/O waitstate
|
-- GB instruction set is incomplete
|
-- GB instruction set is incomplete
|
-- Not all instruction timing are correct
|
-- Not all instruction timing are correct
|
Line 53... |
Line 53... |
--
|
--
|
-- 0211 : Fixed Refresh addition and IM 1
|
-- 0211 : Fixed Refresh addition and IM 1
|
--
|
--
|
-- 0214 : Fixed mostly flags, only the block instructions now fail the zex regression test
|
-- 0214 : Fixed mostly flags, only the block instructions now fail the zex regression test
|
--
|
--
|
|
-- 0232 : Removed refresh address output for Mode > 1 and added DJNZ M1_n fix by Mike Johnson
|
|
|
library IEEE;
|
library IEEE;
|
use IEEE.std_logic_1164.all;
|
use IEEE.std_logic_1164.all;
|
use IEEE.numeric_std.all;
|
use IEEE.numeric_std.all;
|
use work.T80_Pack.all;
|
use work.T80_Pack.all;
|
Line 328... |
Line 329... |
|
|
if MCycle = "001" and TState(2) = '0' and XY_Fetch = '0' then
|
if MCycle = "001" and TState(2) = '0' and XY_Fetch = '0' then
|
-- MCycle = 1 and TState = 1, 2, or 3
|
-- MCycle = 1 and TState = 1, 2, or 3
|
|
|
if TState = 2 and Wait_n = '1' then
|
if TState = 2 and Wait_n = '1' then
|
|
if Mode < 2 then
|
A(7 downto 0) <= std_logic_vector(R);
|
A(7 downto 0) <= std_logic_vector(R);
|
A(15 downto 8) <= I;
|
A(15 downto 8) <= I;
|
R(6 downto 0) <= R(6 downto 0) + 1;
|
R(6 downto 0) <= R(6 downto 0) + 1;
|
|
end if;
|
|
|
if Jump = '0' and Call = '0' and NMICycle = '0' and IntCycle = '0' and not (Halt_FF = '1' or Halt = '1') then
|
if Jump = '0' and Call = '0' and NMICycle = '0' and IntCycle = '0' and not (Halt_FF = '1' or Halt = '1') then
|
PC <= PC + 1;
|
PC <= PC + 1;
|
end if;
|
end if;
|
|
|
Line 899... |
Line 902... |
process (RESET_n,CLK_n)
|
process (RESET_n,CLK_n)
|
begin
|
begin
|
if RESET_n = '0' then
|
if RESET_n = '0' then
|
M1_n <= '0';
|
M1_n <= '0';
|
elsif CLK_n'event and CLK_n = '1' then
|
elsif CLK_n'event and CLK_n = '1' then
|
if T_Res = '1' and MCycle = MCycles then
|
if T_Res = '1' and (MCycle = MCycles or (MCycle = "010" and I_DJNZ = '1' and B = "00000000")) then
|
M1_n <= '0';
|
M1_n <= '0';
|
end if;
|
end if;
|
if MCycle = "001" and TState = 2 and Wait_n = '1' then
|
if MCycle = "001" and TState = 2 and Wait_n = '1' then
|
M1_n <= '1';
|
M1_n <= '1';
|
end if;
|
end if;
|