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

Subversion Repositories t80

[/] [t80/] [trunk/] [rtl/] [vhdl/] [T80a.vhd] - Diff between revs 35 and 42

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 35 Rev 42
Line 1... Line 1...
--
--
-- Z80 compatible microprocessor core, asynchronous top level
-- Z80 compatible microprocessor core, asynchronous top level
--
--
-- Version : 0242
-- Version : 0247
--
--
-- Copyright (c) 2001-2002 Daniel Wallner (jesus@opencores.org)
-- Copyright (c) 2001-2002 Daniel Wallner (jesus@opencores.org)
--
--
-- All rights reserved
-- All rights reserved
--
--
Line 54... Line 54...
--
--
--      0240 : Updated for T80 interface change
--      0240 : Updated for T80 interface change
--
--
--      0242 : Updated for T80 interface change
--      0242 : Updated for T80 interface change
--
--
 
--      0247 : Fixed bus req/ack cycle
 
--
 
 
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 96... Line 98...
        signal Write            : std_logic;
        signal Write            : std_logic;
        signal MREQ                     : std_logic;
        signal MREQ                     : std_logic;
        signal MReq_Inhibit     : std_logic;
        signal MReq_Inhibit     : std_logic;
        signal Req_Inhibit      : std_logic;
        signal Req_Inhibit      : std_logic;
        signal RD                       : std_logic;
        signal RD                       : std_logic;
        signal WR_i                     : std_logic;
        signal MREQ_n_i         : std_logic;
 
        signal IORQ_n_i         : std_logic;
 
        signal RD_n_i           : std_logic;
 
        signal WR_n_i           : std_logic;
 
        signal RFSH_n_i         : std_logic;
 
        signal BUSAK_n_i        : std_logic;
 
        signal A_i                      : std_logic_vector(15 downto 0);
        signal DO                       : std_logic_vector(7 downto 0);
        signal DO                       : std_logic_vector(7 downto 0);
        signal DI_Reg           : std_logic_vector (7 downto 0); -- Input synchroniser
        signal DI_Reg           : std_logic_vector (7 downto 0); -- Input synchroniser
        signal Wait_s           : std_logic;
        signal Wait_s           : std_logic;
        signal MCycle           : std_logic_vector(2 downto 0);
        signal MCycle           : std_logic_vector(2 downto 0);
        signal TState           : std_logic_vector(2 downto 0);
        signal TState           : std_logic_vector(2 downto 0);
 
 
begin
begin
 
 
        CEN <= '1';
        CEN <= '1';
 
 
 
        BUSAK_n <= BUSAK_n_i;
 
        MREQ_n_i <= not MREQ or (Req_Inhibit and MReq_Inhibit);
 
        RD_n_i <= not RD or Req_Inhibit;
 
 
 
        MREQ_n <= MREQ_n_i when BUSAK_n_i = '1' else 'Z';
 
        IORQ_n <= IORQ_n_i when BUSAK_n_i = '1' else 'Z';
 
        RD_n <= RD_n_i when BUSAK_n_i = '1' else 'Z';
 
        WR_n <= WR_n_i when BUSAK_n_i = '1' else 'Z';
 
        RFSH_n <= RFSH_n_i when BUSAK_n_i = '1' else 'Z';
 
        A <= A_i when BUSAK_n_i = '1' else (others => 'Z');
 
        D <= DO when Write = '1' and BUSAK_n_i = '1' else (others => 'Z');
 
 
        process (RESET_n, CLK_n)
        process (RESET_n, CLK_n)
        begin
        begin
                if RESET_n = '0' then
                if RESET_n = '0' then
                        Reset_s <= '0';
                        Reset_s <= '0';
                elsif CLK_n'event and CLK_n = '1' then
                elsif CLK_n'event and CLK_n = '1' then
Line 126... Line 146...
                        CEN => CEN,
                        CEN => CEN,
                        M1_n => M1_n,
                        M1_n => M1_n,
                        IORQ => IORQ,
                        IORQ => IORQ,
                        NoRead => NoRead,
                        NoRead => NoRead,
                        Write => Write,
                        Write => Write,
                        RFSH_n => RFSH_n,
                        RFSH_n => RFSH_n_i,
                        HALT_n => HALT_n,
                        HALT_n => HALT_n,
                        WAIT_n => Wait_s,
                        WAIT_n => Wait_s,
                        INT_n => INT_n,
                        INT_n => INT_n,
                        NMI_n => NMI_n,
                        NMI_n => NMI_n,
                        RESET_n => Reset_s,
                        RESET_n => Reset_s,
                        BUSRQ_n => BUSRQ_n,
                        BUSRQ_n => BUSRQ_n,
                        BUSAK_n => BUSAK_n,
                        BUSAK_n => BUSAK_n_i,
                        CLK_n => CLK_n,
                        CLK_n => CLK_n,
                        A => A,
                        A => A_i,
                        DInst => D,
                        DInst => D,
                        DI => DI_Reg,
                        DI => DI_Reg,
                        DO => DO,
                        DO => DO,
                        MC => MCycle,
                        MC => MCycle,
                        TS => TState,
                        TS => TState,
                        IntCycle_n => IntCycle_n);
                        IntCycle_n => IntCycle_n);
 
 
        D <= DO when Write = '1' else (others => 'Z');
 
 
 
        process (CLK_n)
        process (CLK_n)
        begin
        begin
                if CLK_n'event and CLK_n = '0' then
                if CLK_n'event and CLK_n = '0' then
                        WR_n <= WR_i;
 
                        Wait_s <= WAIT_n;
                        Wait_s <= WAIT_n;
                        if TState = "011" then
                        if TState = "011" and BUSAK_n_i = '1' then
                                DI_Reg <= to_x01(D);
                                DI_Reg <= to_x01(D);
                        end if;
                        end if;
                end if;
                end if;
        end process;
        end process;
 
 
        MREQ_n <= not MREQ or (Req_Inhibit and MReq_Inhibit);
 
        RD_n <= not RD or Req_Inhibit;
 
 
 
        process (Reset_s,CLK_n)
        process (Reset_s,CLK_n)
        begin
        begin
                if Reset_s = '0' then
                if Reset_s = '0' then
                        WR_i <= '1';
                        WR_n_i <= '1';
                elsif CLK_n'event and CLK_n = '1' then
                elsif CLK_n'event and CLK_n = '1' then
                        WR_i <= '1';
                        WR_n_i <= '1';
                        if TState = "001" then  -- To short for IO writes !!!!!!!!!!!!!!!!!!!
                        if TState = "001" then  -- To short for IO writes !!!!!!!!!!!!!!!!!!!
                                WR_i <= not Write;
                                WR_n_i <= not Write;
                        end if;
                        end if;
                end if;
                end if;
        end process;
        end process;
 
 
        process (Reset_s,CLK_n)
        process (Reset_s,CLK_n)
Line 201... Line 215...
 
 
        process(Reset_s,CLK_n)
        process(Reset_s,CLK_n)
        begin
        begin
                if Reset_s = '0' then
                if Reset_s = '0' then
                        RD <= '0';
                        RD <= '0';
                        IORQ_n <= '1';
                        IORQ_n_i <= '1';
                        MREQ <= '0';
                        MREQ <= '0';
                elsif CLK_n'event and CLK_n = '0' then
                elsif CLK_n'event and CLK_n = '0' then
 
 
                        if MCycle = "001" then
                        if MCycle = "001" then
                                if TState = "001" then
                                if TState = "001" then
                                        RD <= IntCycle_n;
                                        RD <= IntCycle_n;
                                        MREQ <= IntCycle_n;
                                        MREQ <= IntCycle_n;
                                        IORQ_n <= IntCycle_n;
                                        IORQ_n_i <= IntCycle_n;
                                end if;
                                end if;
                                if TState = "011" then
                                if TState = "011" then
                                        RD <= '0';
                                        RD <= '0';
                                        IORQ_n <= '1';
                                        IORQ_n_i <= '1';
                                        MREQ <= '1';
                                        MREQ <= '1';
                                end if;
                                end if;
                                if TState = "100" then
                                if TState = "100" then
                                        MREQ <= '0';
                                        MREQ <= '0';
                                end if;
                                end if;
                        else
                        else
                                if TState = "001" and NoRead = '0' then
                                if TState = "001" and NoRead = '0' then
                                        RD <= not Write;
                                        RD <= not Write;
                                        IORQ_n <= not IORQ;
                                        IORQ_n_i <= not IORQ;
                                        MREQ <= not IORQ;
                                        MREQ <= not IORQ;
                                end if;
                                end if;
                                if TState = "011" then
                                if TState = "011" then
                                        RD <= '0';
                                        RD <= '0';
                                        IORQ_n <= '1';
                                        IORQ_n_i <= '1';
                                        MREQ <= '0';
                                        MREQ <= '0';
                                end if;
                                end if;
                        end if;
                        end if;
                end if;
                end if;
        end process;
        end process;

powered by: WebSVN 2.1.0

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