Line 80... |
Line 80... |
-- : preventing code from setting the I bit. When enabled, only
|
-- : preventing code from setting the I bit. When enabled, only
|
-- : interrupts can set the I bit, allowing for more robust memory
|
-- : interrupts can set the I bit, allowing for more robust memory
|
-- : protection by preventing errant code execution from
|
-- : protection by preventing errant code execution from
|
-- : inadvertently entering an interrupt state.
|
-- : inadvertently entering an interrupt state.
|
-- :
|
-- :
|
-- : Default_Int_Flag allows the initial state of the I bit to be
|
-- : This setting also sets I bit at startup so that any
|
-- : set at startup. If set, initialization code may be run in an
|
-- : initialization code may be run in an ISR context, initially
|
-- : ISR context, disabling memory protection initially. Init code
|
-- : bypassing memory protection. Init code should clear the I bit
|
-- : should clear the I bit when done;
|
-- : when done;
|
-- :
|
-- :
|
-- : Default_Interrupt_Mask sets the intial/reset value of the
|
-- : Default_Interrupt_Mask sets the intial/reset value of the
|
-- : interrupt mask. To remain true to the original core, which
|
-- : interrupt mask. To remain true to the original core, which
|
-- : had no interrupt mask, this should be set to x"FF". Otherwise
|
-- : had no interrupt mask, this should be set to x"FF". Otherwise
|
-- : it can be initialized to any value. Note that Enable_NMI
|
-- : it can be initialized to any value. Note that Enable_NMI
|
Line 224... |
Line 224... |
-- 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
|
-- Seth Henry 05/21/20 Supervisor_Mode now protects the interrupt mask
|
-- and stack pointer as well.
|
-- and stack pointer as well.
|
|
-- Seth Henry 05/24/20 Removed the Default_Int_Flag, as it is covered by
|
|
-- Supervisor_Mode. If Supervisor_Mode isn't set,
|
|
-- code can simply use STP to set the bit
|
|
|
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 247... |
Line 250... |
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
|
Sequential_Interrupts : boolean := false; -- Interruptable ISRs
|
RTI_Ignores_GP_Flags : boolean := false; -- RTI sets all flags
|
RTI_Ignores_GP_Flags : boolean := false; -- RTI sets all flags
|
Supervisor_Mode : boolean := false; -- I bit is restricted
|
Supervisor_Mode : boolean := false; -- I bit is restricted
|
Default_Int_Flag : boolean := false; -- Start with I bit set
|
|
Default_Interrupt_Mask : DATA_TYPE := x"FF"; -- Enable all Ints
|
Default_Interrupt_Mask : DATA_TYPE := x"FF"; -- Enable all Ints
|
Clock_Frequency : real -- Clock Frequency
|
Clock_Frequency : real -- Clock Frequency
|
);
|
);
|
port(
|
port(
|
Clock : in std_logic;
|
Clock : in std_logic;
|
Line 1002... |
Line 1004... |
|
|
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";
|
if( Default_Int_Flag )then
|
if( Supervisor_Mode )then
|
Flags(PSR_I) <= '1';
|
Flags(PSR_I) <= '1';
|
end if;
|
end if;
|
|
|
Open8_Bus.GP_Flags <= (others => '0');
|
Open8_Bus.GP_Flags <= (others => '0');
|
|
|