Line 27... |
Line 27... |
-- Author Date Change
|
-- Author Date Change
|
------------------ -------- ---------------------------------------------------
|
------------------ -------- ---------------------------------------------------
|
-- Seth Henry 07/22/06 Design Start
|
-- Seth Henry 07/22/06 Design Start
|
-- Seth Henry 02/03/12 Updated generics to match current model
|
-- Seth Henry 02/03/12 Updated generics to match current model
|
-- Seth Henry 10/29/15 Migrated type/constant definitions to this file
|
-- Seth Henry 10/29/15 Migrated type/constant definitions to this file
|
|
-- Seth Henry 03/09/20 Created new ALU/SP opcodes for handling new RSP
|
|
|
library ieee;
|
library ieee;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_1164.all;
|
|
|
package Open8_pkg is
|
package Open8_pkg is
|
Line 60... |
Line 61... |
generic(
|
generic(
|
Program_Start_Addr : ADDRESS_TYPE := x"8000"; -- Initial PC location
|
Program_Start_Addr : ADDRESS_TYPE := x"8000"; -- Initial PC location
|
ISR_Start_Addr : ADDRESS_TYPE := x"FFF0"; -- Bottom of ISR vec's
|
ISR_Start_Addr : ADDRESS_TYPE := x"FFF0"; -- Bottom of ISR vec's
|
Stack_Start_Addr : ADDRESS_TYPE := x"03FF"; -- Top of Stack
|
Stack_Start_Addr : ADDRESS_TYPE := x"03FF"; -- Top of Stack
|
Allow_Stack_Address_Move : boolean := false; -- Use Normal v8 RSP
|
Allow_Stack_Address_Move : boolean := false; -- Use Normal v8 RSP
|
|
Stack_Xfer_Flag : integer := 4; -- If enabled, GP1 alters 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
|
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
|
Line 139... |
Line 141... |
-- Instruction fetch & Decode
|
-- Instruction fetch & Decode
|
PIPE_FILL_0, PIPE_FILL_1, PIPE_FILL_2, INSTR_DECODE,
|
PIPE_FILL_0, PIPE_FILL_1, PIPE_FILL_2, INSTR_DECODE,
|
-- Branching
|
-- Branching
|
BRN_C1, DBNZ_C1, JMP_C1, JMP_C2,
|
BRN_C1, DBNZ_C1, JMP_C1, JMP_C2,
|
-- Loads
|
-- Loads
|
LDA_C1, LDA_C2, LDA_C3, LDA_C4, LDI_C1, LDO_C1, LDX_C1, LDX_C2, LDX_C3,
|
LDA_C1, LDA_C2, LDA_C3, LDA_C4, LDI_C1, LDO_C1, LDX_C1, LDX_C2, LDX_C3, LDX_C4,
|
-- Stores
|
-- Stores
|
STA_C1, STA_C2, STA_C3, STO_C1, STO_C2, STX_C1, STX_C2,
|
STA_C1, STA_C2, STA_C3, STO_C1, STO_C2, STX_C1, STX_C2,
|
-- 2-cycle math
|
-- 2-cycle math
|
MUL_C1, UPP_C1,
|
MUL_C1, UPP_C1,
|
-- Stack
|
-- Stack
|
Line 163... |
Line 165... |
Oper : PC_MODES;
|
Oper : PC_MODES;
|
Offset : DATA_TYPE;
|
Offset : DATA_TYPE;
|
Addr : ADDRESS_TYPE;
|
Addr : ADDRESS_TYPE;
|
end record;
|
end record;
|
|
|
type SP_MODES is ( SP_IDLE, SP_RSET, SP_POP, SP_PUSH );
|
type SP_MODES is ( SP_IDLE, SP_CLR, SP_SET, SP_POP, SP_PUSH );
|
|
|
type SP_CTRL_TYPE is record
|
type SP_CTRL_TYPE is record
|
Oper : SP_MODES;
|
Oper : SP_MODES;
|
Addr : ADDRESS_TYPE;
|
|
end record;
|
end record;
|
|
|
type DP_MODES is ( DATA_BUS_IDLE, DATA_RD_MEM,
|
type DP_MODES is ( DATA_BUS_IDLE, DATA_RD_MEM,
|
DATA_WR_REG, DATA_WR_FLAG, DATA_WR_PC );
|
DATA_WR_REG, DATA_WR_FLAG, DATA_WR_PC );
|
|
|
Line 206... |
Line 207... |
constant ALU_CMP : OPCODE_TYPE := "01111"; -- x"0F"
|
constant ALU_CMP : OPCODE_TYPE := "01111"; -- x"0F"
|
constant ALU_POP : OPCODE_TYPE := "10001"; -- x"11"
|
constant ALU_POP : OPCODE_TYPE := "10001"; -- x"11"
|
constant ALU_MUL : OPCODE_TYPE := "10110"; -- x"16"
|
constant ALU_MUL : OPCODE_TYPE := "10110"; -- x"16"
|
constant ALU_UPP : OPCODE_TYPE := "11000"; -- x"18"
|
constant ALU_UPP : OPCODE_TYPE := "11000"; -- x"18"
|
constant ALU_LDI : OPCODE_TYPE := "11100"; -- x"1C"
|
constant ALU_LDI : OPCODE_TYPE := "11100"; -- x"1C"
|
constant ALU_LDX : OPCODE_TYPE := "11110"; -- x"1E"
|
|
|
|
constant ALU_IDLE : OPCODE_TYPE := "10000"; -- x"10"
|
constant ALU_IDLE : OPCODE_TYPE := "10000"; -- x"10"
|
constant ALU_UPP2 : OPCODE_TYPE := "10010"; -- x"12"
|
constant ALU_UPP2 : OPCODE_TYPE := "10010"; -- x"12"
|
constant ALU_RFLG : OPCODE_TYPE := "10011"; -- x"13"
|
constant ALU_RFLG : OPCODE_TYPE := "10011"; -- x"13"
|
|
constant ALU_TSX : OPCODE_TYPE := "10111"; -- x"17"
|
|
|
constant FL_ZERO : integer := 0;
|
constant FL_ZERO : integer := 0;
|
constant FL_CARRY : integer := 1;
|
constant FL_CARRY : integer := 1;
|
constant FL_NEG : integer := 2;
|
constant FL_NEG : integer := 2;
|
constant FL_INT_EN : integer := 3;
|
constant FL_INT_EN : integer := 3;
|