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

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [VHDL/] [o8_cpu.vhd] - Diff between revs 209 and 210

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

Rev 209 Rev 210
Line 192... Line 192...
-- Seth Henry      03/17/20 Added generic to control whether RTI full restores
-- Seth Henry      03/17/20 Added generic to control whether RTI full restores
--                           the flags, including the general purpose ones, or
--                           the flags, including the general purpose ones, or
--                           only the core ALU flags (Z, N, and C). Also
--                           only the core ALU flags (Z, N, and C). Also
--                           brought out copies of the GP flags for external
--                           brought out copies of the GP flags for external
--                           connection.
--                           connection.
 
-- Seth Henry      04/09/20 Added a compile time setting to block interrupts
 
--                           while the I bit is set to avoid reentering ISRs
 
--                           This may slightly affect timing, as this will
 
--                           potentially block higher priority interrupts
 
--                           until the lower priority ISR returns or clears
 
--                           the I bit.
 
--                          Also added the I bit to the exported flags for
 
--                           use in memory protection schemes.
 
 
library ieee;
library ieee;
  use ieee.std_logic_1164.all;
  use ieee.std_logic_1164.all;
  use ieee.std_logic_unsigned.all;
  use ieee.std_logic_unsigned.all;
  use ieee.std_logic_arith.all;
  use ieee.std_logic_arith.all;
Line 212... Line 220...
    Allow_Stack_Address_Move : boolean      := false;   -- Use Normal v8 RSP
    Allow_Stack_Address_Move : boolean      := false;   -- Use Normal v8 RSP
    Stack_Xfer_Flag          : integer      := PSR_GP4; -- GP4 modifies RSP
    Stack_Xfer_Flag          : integer      := PSR_GP4; -- GP4 modifies RSP
    Enable_Auto_Increment    : boolean      := false;   -- Modify indexed instr
    Enable_Auto_Increment    : boolean      := false;   -- Modify indexed instr
    BRK_Implements_WAI       : boolean      := false;   -- BRK -> Wait for Int
    BRK_Implements_WAI       : boolean      := false;   -- BRK -> Wait for Int
    Enable_NMI               : boolean      := true;    -- Force INTR0 enabled
    Enable_NMI               : boolean      := true;    -- Force INTR0 enabled
 
    Sequential_Interrupts    : boolean      := false;   -- Interruptable ISRs
    RTI_Ignores_GP_Flags     : boolean      := false;   -- RTI restores all flags
    RTI_Ignores_GP_Flags     : boolean      := false;   -- RTI restores all flags
    Default_Interrupt_Mask   : DATA_TYPE    := x"FF";   -- Enable all Ints
    Default_Interrupt_Mask   : DATA_TYPE    := x"FF";   -- Enable all Ints
    Reset_Level              : std_logic    := '0' );   -- Active reset level
    Reset_Level              : std_logic    := '0' );   -- Active reset level
  port(
  port(
    Clock                    : in  std_logic;
    Clock                    : in  std_logic;
Line 276... Line 285...
  signal Int_Mask            : DATA_TYPE   := x"00";
  signal Int_Mask            : DATA_TYPE   := x"00";
  signal ISR_Addr            : ADDRESS_TYPE := x"0000";
  signal ISR_Addr            : ADDRESS_TYPE := x"0000";
  signal i_Ints              : INTERRUPT_BUNDLE := x"00";
  signal i_Ints              : INTERRUPT_BUNDLE := x"00";
  signal Pending             : INTERRUPT_BUNDLE := x"00";
  signal Pending             : INTERRUPT_BUNDLE := x"00";
  signal Wait_for_FSM        : std_logic := '0';
  signal Wait_for_FSM        : std_logic := '0';
 
  signal Wait_for_ISR        : std_logic := '0';
 
 
begin
begin
 
 
 
 
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
Line 893... Line 903...
      Int_Ack                <= '0';
      Int_Ack                <= '0';
 
 
      Int_Req                <= '0';
      Int_Req                <= '0';
      Pending                <= x"00";
      Pending                <= x"00";
      Wait_for_FSM           <= '0';
      Wait_for_FSM           <= '0';
 
      Wait_for_ISR           <= '0';
      if( Enable_NMI )then
      if( Enable_NMI )then
        Int_Mask             <= Default_Interrupt_Mask(7 downto 1) & '1';
        Int_Mask             <= Default_Interrupt_Mask(7 downto 1) & '1';
      else
      else
        Int_Mask             <= Default_Interrupt_Mask;
        Int_Mask             <= Default_Interrupt_Mask;
      end if;
      end if;
Line 905... Line 916...
      for i in 0 to 7 loop
      for i in 0 to 7 loop
        Regfile(i)           <= x"00";
        Regfile(i)           <= x"00";
      end loop;
      end loop;
      Flags                  <= x"00";
      Flags                  <= x"00";
 
 
      GP_Flags               <= x"0";
      GP_Flags               <= (others => '0');
 
 
    elsif( rising_edge(Clock) )then
    elsif( rising_edge(Clock) )then
 
 
      CPU_Halt_Req           <= CPU_Halt;
      CPU_Halt_Req           <= CPU_Halt;
 
 
Line 1034... Line 1045...
      i_Ints                 := (Interrupts or INT_Ctrl.Soft_Ints) and
      i_Ints                 := (Interrupts or INT_Ctrl.Soft_Ints) and
                                Int_Mask;
                                Int_Mask;
 
 
      Pending                <= i_Ints or Pending;
      Pending                <= i_Ints or Pending;
 
 
      if( Wait_for_FSM = '0' )then
      if( Sequential_Interrupts )then
 
        Wait_for_ISR         <= Flags(PSR_I);
 
      else
 
        Wait_for_ISR         <= '0';
 
      end if;
 
 
 
      if( Wait_for_FSM = '0' and Wait_for_ISR = '0' )then
        if(    Pending(0) = '1' )then
        if(    Pending(0) = '1' )then
          ISR_Addr           <= INT_VECTOR_0;
          ISR_Addr           <= INT_VECTOR_0;
          Pending(0)         <= '0';
          Pending(0)         <= '0';
        elsif( Pending(1) = '1' )then
        elsif( Pending(1) = '1' )then
          ISR_Addr           <= INT_VECTOR_1;
          ISR_Addr           <= INT_VECTOR_1;
Line 1236... Line 1253...
 
 
        when others =>
        when others =>
          null;
          null;
      end case;
      end case;
 
 
      GP_Flags               <= Flags(7 downto 4);
      GP_Flags               <= Flags(7 downto 3);
 
 
    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.