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

Subversion Repositories lattice6502

[/] [lattice6502/] [ispLeaver/] [Processor.vhd] - Diff between revs 2 and 6

Show entire file | Details | Blame | View Log

Rev 2 Rev 6
Line 1... Line 1...
------------------------------------------------------------------
------------------------------------------------------------------
--      6502 Top module.
--      6502 Top module.
--
--
--      Copyright Ian Chapman October 28 2010
--      Copyright Ian Chapman October 28 2010
--
--      email author@kool.kor
 
--      author  EQU     ichapman
 
--      kool    EQU     videotron
 
--      kor     EQU     ca
 
--      ******************************************************
 
--      Dec 12 2010
 
--      RAM increased to 2k 0 to $7ff for bigger test code
 
--      sta irq and sta nmi trigger interrupts
 
--      ******************************************************
--      This file is part of the Lattice 6502 project
--      This file is part of the Lattice 6502 project
--      It is used to compile with ispLeaver not Linux ghdl.
--      It is used to compile with ispLeaver not Linux ghdl.
--      It is the address mapping and connecting the other modules.
--      It is the address mapping and connecting the other modules.
--      It is replaced by Processor.vhd when running ispLeaver.
--      It is replaced by Processor.vhd when running ispLeaver.
--
--
 
 
--      To do
--      To do
--              This will be work in process or replaced whatever
--              This will be work in process or replaced whatever
--              project file is needed to control other modules.
--              project file is needed to control other modules.
--
--
--      *************************************************************
--      *************************************************************
Line 29... Line 38...
--      You should have received a copy of the GNU General Public License
--      You should have received a copy of the GNU General Public License
--      along with this program.  If not, see <http://www.gnu.org/licenses/>
--      along with this program.  If not, see <http://www.gnu.org/licenses/>
--
--
--      Processor.vhd
--      Processor.vhd
------------------------------------------------------------------
------------------------------------------------------------------
 
--      Revision history
 
--      Nov 411, 2010
 
--      To facilitate testing of NMI and IRQ.
 
--      changed from I/O pins to signals
 
--      IRQ and NMI address decoded so as to initiated the inerupt from
 
------------------------------------------------------------------
library IEEE;                   --Use standard IEEE libs as recommended by Tristan. 
library IEEE;                   --Use standard IEEE libs as recommended by Tristan. 
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.numeric_std.all;
use IEEE.numeric_std.all;
 
 
entity Processor is
entity Processor is
Line 47... Line 62...
--      u1101 : out std_logic;  
--      u1101 : out std_logic;  
--      u801 : out std_logic;
--      u801 : out std_logic;
--      u701 : out std_logic;
--      u701 : out std_logic;
        u601 : out std_logic;
        u601 : out std_logic;
        rst_pin : in std_logic;
        rst_pin : in std_logic;
        irq_pin : in std_logic;
--      irq_pin : in std_logic; --disabled to test interrupts on fpga
        nmi_pin : in std_logic;
--      nmi_pin : in std_logic;
        RX_pin  : in std_logic;
        RX_pin  : in std_logic;
--      PG_pin  : in std_logic;
--      PG_pin  : in std_logic;
        TX_pin  : out std_logic;
        TX_pin  : out std_logic;
        Pwr_on_pin : out std_logic
        Pwr_on_pin : out std_logic
    );
    );
Line 103... Line 118...
port (
port (
        Clock: in  std_logic;
        Clock: in  std_logic;
        ClockEn: in  std_logic;
        ClockEn: in  std_logic;
        Reset: in  std_logic;
        Reset: in  std_logic;
        WE: in  std_logic;
        WE: in  std_logic;
        Address: in  std_logic_vector(9 downto 0);
        Address: in  std_logic_vector(10 downto 0);
        Data: in  std_logic_vector(7 downto 0);
        Data: in  std_logic_vector(7 downto 0);
        Q: out  std_logic_vector(7 downto 0));
        Q: out  std_logic_vector(7 downto 0));
end component;
end component;
 
 
--component ghdl_rom
--component ghdl_rom
Line 141... Line 156...
 
 
signal clk : std_logic;
signal clk : std_logic;
--signal clk_pin : std_logic;
--signal clk_pin : std_logic;
signal counter : unsigned(3 downto 0);
signal counter : unsigned(3 downto 0);
signal ram_write : std_logic;
signal ram_write : std_logic;
 
signal irq_pin, nmi_pin : std_logic;
 
 
--      I/O ports
--      I/O ports
constant        led_port    : unsigned (15 downto 0) := x"4007";
--constant      led_port        : unsigned (15 downto 0) := x"4007";
 
constant        irq             : unsigned (15 downto 0) := X"4002";
 
constant        nmi             : unsigned (15 downto 0) := x"4003";
constant        rs232_dat   : unsigned (15 downto 0) := x"4000"; --input and output
constant        rs232_dat   : unsigned (15 downto 0) := x"4000"; --input and output
constant        uart_stat   : unsigned (15 downto 0) := x"4001"; --RX and TX state found here
constant        uart_stat   : unsigned (15 downto 0) := x"4001"; --RX and TX state found here
constant        uart: unsigned (15 downto 0) := x"4000"; --starts the uart transmitting
constant        uart: unsigned (15 downto 0) := x"4000"; --starts the uart transmitting
 
 
begin
begin
Line 204... Line 222...
 
 
R4 : Lattice_ram port map(
R4 : Lattice_ram port map(
        Reset => rst_bar,
        Reset => rst_bar,
        Clock => clk_pin,
        Clock => clk_pin,
        WE => ram_write,
        WE => ram_write,
        address(9 downto 0) => std_logic_vector(Address(9 downto 0)),
        address(10 downto 0) => std_logic_vector(Address(10 downto 0)),
        Data => std_logic_vector(data_wr),
        Data => std_logic_vector(data_wr),
        unsigned(Q) => ram_dat, ClockEn => one);
        unsigned(Q) => ram_dat, ClockEn => one);
 
 
--      address(9 downto 0) => (Address(9 downto 0)), 
--      address(9 downto 0) => (Address(9 downto 0)), 
--      Data => (data_wr),
--      Data => (data_wr),
--      (Q) => ram_dat, ClockEn => one);
--      (Q) => ram_dat, ClockEn => one);
 
 
one <= '1';
one <= '1';
rst_bar <= not rst_pin;
rst_bar <= not rst_pin;
one <= '1';
one <= '1';
 
--ram_write <= proc_write and not address(15) and not address(14) and not address(13) and not address(12) and not address(11) and not address(10);
 
--ram_write <= proc_write and not address(15) and not address(14);
 
--irq_pin <= '1';       --only used to test interrupts on fpga
 
--nmi_pin <= '1';
--u601 <= cycle_mark;
--u601 <= cycle_mark;
 
 
 
 
 
 
mux_add : process(rst_pin, clk_pin)
mux_add : process(rst_pin, clk_pin)
Line 271... Line 293...
        csw_usart <= '1';
        csw_usart <= '1';
else
else
        csw_usart <= '0';
        csw_usart <= '0';
end if;
end if;
end process;
end process;
 
--      Only uded to test interrupts in the fpga
 
--      These two processe let the SW fire NMI and IRG
 
--      with a sta instruction.
 
irq : process (rst_pin, proc_write, address, data_wr(0), clk_pin)
 
begin
 
if rst_pin = '0' then
 
        irq_pin <= '1';
 
        elsif rising_edge(clk_pin) then
 
                if address = irq and proc_write = '1' then
 
                        irq_pin <= data_wr(0);   --set and hold bit 0
 
                end if;
 
end if;
 
end process;
 
 
 
nmi : process (rst_pin, proc_write, address, data_wr(0), clk_pin)
 
 
relay : process (rst_pin, proc_write, address, data_wr(7), clk_pin)
 
begin
begin
if rst_pin = '0' then
if rst_pin = '0' then
        Pwr_on_pin <= '0';
        nmi_pin <= '1';
        elsif rising_edge(clk_pin) and address = led_port  and proc_write = '1' then
        elsif rising_edge(clk_pin) then
        Pwr_on_pin <= data_wr(7);
                if address = nmi and proc_write = '1' then
 
                        nmi_pin <= data_wr(0);   --set and hold bit 0
 
                end if;
end if;
end if;
end process;
end process;
 
 
 
--relay : process (rst_pin, proc_write, address, data_wr(7), clk_pin)
 
--begin
 
--if rst_pin = '0' then
 
--      Pwr_on_pin <= '0';
 
--      elsif rising_edge(clk_pin) and address = led_port  and proc_write = '1' then
 
--      Pwr_on_pin <= data_wr(7);
 
--end if;
 
--end process;
 
 
 
 
end structure;
end structure;
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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