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

Subversion Repositories cpu65c02_true_cycle

[/] [cpu65c02_true_cycle/] [trunk/] [released/] [rtl/] [v2_00/] [vhdl/] [fsm_intnmi.vhd] - Rev 24

Compare with Previous | Blame | View Log

LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.std_logic_arith.all;
 
entity fsm_intnmi is
   port( 
      clk_clk_i   : in     std_logic;
      nmi_n_i     : in     std_logic;
      rst_nmi_i   : in     std_logic;
      rst_rst_n_i : in     std_logic;
      nmi_o       : out    std_logic
   );
 
-- Declarations
 
end fsm_intnmi ;
-- (C) 2008 - 2021 Jens Gutschmidt
-- (email: opencores@vivare-services.com)
-- 
-- Versions:
-- Revision 1.8  2018/09/01 18:07:00  jens
-- - NMI = '0' need at least 1 cycles for correct
--   operation now (2 cycles in the past)
-- 
-- Revision 1.7  2013/07/21 11:11:00  jens
-- - Changing the title block and internal revision history
-- 
-- Revision 1.6  2009/01/04 10:20:47  eda
-- Changes for cosmetic issues only
-- 
-- Revision 1.5  2009/01/04 09:23:10  eda
-- - Delete unused nets and blocks (same as R6502_TC)
-- - Rename blocks
-- 
-- Revision 1.4  2009/01/03 16:53:02  eda
-- - Unused nets and blocks deleted
-- - Renamed blocks
-- 
-- Revision 1.3  2009/01/03 16:42:02  eda
-- - Unused nets and blocks deleted
-- - Renamed blocks
-- 
-- Revision 1.2  2008/12/31 19:31:24  eda
-- Production Release
--  
-- 
--
-- r65c02_tc.fsm_intnmi.fsm
--
-- Date:    06.01.2021
-- Time:    22:57:33
-- By:        VIVARE GmbH, Switzerland
--
-- COPYRIGHT (C) 2008 - 2021 by Jens Gutschmidt
-- 
-- This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
-- 
-- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-- 
-- You should have received a copy of the GNU General Public License along with this program.  If not, see <http://www.gnu.org/licenses/>.
-- 
-- 
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.std_logic_arith.all;
 
architecture fsm of fsm_intnmi is
 
   type state_type is (
      idle,
      idle1,
      IMP
   );
 
   -- State vector declaration
   attribute state_vector : string;
   attribute state_vector of fsm : architecture is "current_state";
 
   -- Declare current and next state signals
   signal current_state : state_type;
   signal next_state : state_type;
 
   -- Declare any pre-registered internal signals
   signal nmi_o_cld : std_logic ;
 
begin
 
   -----------------------------------------------------------------
   clocked_proc : process ( 
      clk_clk_i,
      rst_rst_n_i
   )
   -----------------------------------------------------------------
   begin
      if (rst_rst_n_i = '0') then
         current_state <= idle;
         -- Default Reset Values
         nmi_o_cld <= '0';
      elsif (clk_clk_i'event and clk_clk_i = '1') then
         current_state <= next_state;
         -- Default Assignment To Internals
         nmi_o_cld <= '0';
 
         -- Combined Actions
         case current_state is
            when idle1 => 
               if (nmi_n_i = '0') then 
                  nmi_o_cld <= '1';
               end if;
            when IMP => 
               nmi_o_cld <= '1';
               if (rst_nmi_i = '1') then 
                  nmi_o_cld <= '0';
               end if;
            when others =>
               null;
         end case;
      end if;
   end process clocked_proc;
 
   -----------------------------------------------------------------
   nextstate_proc : process ( 
      current_state,
      nmi_n_i,
      rst_nmi_i
   )
   -----------------------------------------------------------------
   begin
      case current_state is
         when idle => 
            if (nmi_n_i = '1') then 
               next_state <= idle1;
            else
               next_state <= idle;
            end if;
         when idle1 => 
            if (nmi_n_i = '0') then 
               next_state <= IMP;
            else
               next_state <= idle1;
            end if;
         when IMP => 
            if (rst_nmi_i = '1') then 
               next_state <= idle;
            else
               next_state <= IMP;
            end if;
         when others =>
            next_state <= idle;
      end case;
   end process nextstate_proc;
 
   -- Concurrent Statements
   -- Clocked output assignments
   nmi_o <= nmi_o_cld;
end fsm;
 

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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