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 244 and 245

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

Rev 244 Rev 245
Line 222... Line 222...
--                           from being set outside of an ISR. The
--                           from being set outside of an ISR. The
--                           Default_Int_Flag setting allows the I bit to
--                           Default_Int_Flag setting allows the I bit to
--                           start set so that initialization code can run,
--                           start set so that initialization code can run,
--                           but not be hijacked later to corrupt any memory
--                           but not be hijacked later to corrupt any memory
--                           write protection later.
--                           write protection later.
 
-- Seth Henry      05/21/20 Supervisor_Mode now protects the interrupt mask
 
--                           and stack pointer as well.
 
 
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 315... Line 317...
  signal DP_Ctrl             : DATA_CTRL_TYPE;
  signal DP_Ctrl             : DATA_CTRL_TYPE;
 
 
  signal INT_Ctrl            : INT_CTRL_TYPE;
  signal INT_Ctrl            : INT_CTRL_TYPE;
  signal Ack_D, Ack_Q, Ack_Q1: std_logic   := '0';
  signal Ack_D, Ack_Q, Ack_Q1: std_logic   := '0';
  signal Int_Req, Int_Ack    : std_logic   := '0';
  signal Int_Req, Int_Ack    : std_logic   := '0';
 
  signal Set_Mask            : std_logic   := '0';
  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';
Line 987... Line 990...
 
 
      Int_Req                <= '0';
      Int_Req                <= '0';
      Pending                <= x"00";
      Pending                <= x"00";
      Wait_for_FSM           <= '0';
      Wait_for_FSM           <= '0';
      Wait_for_ISR           <= '0';
      Wait_for_ISR           <= '0';
 
      Set_Mask               <= '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 1100... Line 1104...
 
 
        when SP_CLR =>
        when SP_CLR =>
          Stack_Ptr          <= Stack_Start_Addr;
          Stack_Ptr          <= Stack_Start_Addr;
 
 
        when SP_SET =>
        when SP_SET =>
 
          if( Supervisor_Mode )then
 
            if( Flags(PSR_I) = '1' )then
          Stack_Ptr          <= Regfile(1) & Regfile(0);
          Stack_Ptr          <= Regfile(1) & Regfile(0);
 
            end if;
 
          else
 
            Stack_Ptr        <= Regfile(1) & Regfile(0);
 
          end if;
 
 
        when SP_POP  =>
        when SP_POP  =>
          Stack_Ptr          <= Stack_Ptr + 1;
          Stack_Ptr          <= Stack_Ptr + 1;
 
 
        when SP_PUSH =>
        when SP_PUSH =>
Line 1116... Line 1126...
      end case;
      end case;
 
 
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-- Interrupt Controller
-- Interrupt Controller
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
 
 
 
      -- If Supervisor_Mode is set, restrict the SMSK instruction such that it
 
      --  requires the I bit to be set.
 
      if( Supervisor_Mode )then
 
        Set_Mask             <= INT_Ctrl.Mask_Set and Flags(PSR_I);
 
      else
 
        Set_Mask             <= INT_Ctrl.Mask_Set;
 
      end if;
 
 
      -- The interrupt control mask is always sourced out of R0
      -- The interrupt control mask is always sourced out of R0
      if( INT_Ctrl.Mask_Set = '1' )then
      if( Set_Mask = '1' )then
        if( Enable_NMI )then
        if( Enable_NMI )then
          Int_Mask           <= Regfile(conv_integer(ACCUM))(7 downto 1) & '1';
          Int_Mask           <= Regfile(conv_integer(ACCUM))(7 downto 1) & '1';
        else
        else
          Int_Mask           <= Regfile(conv_integer(ACCUM));
          Int_Mask           <= Regfile(conv_integer(ACCUM));
        end if;
        end if;

powered by: WebSVN 2.1.0

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