library ieee;
use ieee.std_logic_1164.all;

package mor1kx_pkg is
	-- mor1kx-defines (incomplete)
	constant OR1K_INSN_WIDTH : integer := 32;

	-- Top Level configs
	constant OPTION_OPERAND_WIDTH : integer := 32;

	constant OPTION_CPU0 : string := "CAPPUCCINO";

	constant FEATURE_DATACACHE          : string  := "NONE";
	constant OPTION_DCACHE_BLOCK_WIDTH  : integer := 5;
	constant OPTION_DCACHE_SET_WIDTH    : integer := 9;
	constant OPTION_DCACHE_WAYS         : integer := 2;
	constant OPTION_DCACHE_LIMIT_WIDTH  : integer := 32;
	constant OPTION_DCACHE_SNOOP        : string  := "NONE";
	constant FEATURE_DMMU               : string  := "NONE";
	constant FEATURE_DMMU_HW_TLB_RELOAD : string  := "NONE";
	constant OPTION_DMMU_SET_WIDTH      : integer := 6;
	constant OPTION_DMMU_WAYS           : integer := 1;
	constant FEATURE_INSTRUCTIONCACHE   : string  := "NONE";
	constant OPTION_ICACHE_BLOCK_WIDTH  : integer := 5;
	constant OPTION_ICACHE_SET_WIDTH    : integer := 9;
	constant OPTION_ICACHE_WAYS         : integer := 2;
	constant OPTION_ICACHE_LIMIT_WIDTH  : integer := 32;
	constant FEATURE_IMMU               : string  := "NONE";
	constant FEATURE_IMMU_HW_TLB_RELOAD : string  := "NONE";
	constant OPTION_IMMU_SET_WIDTH      : integer := 6;
	constant OPTION_IMMU_WAYS           : integer := 1;
	constant FEATURE_TIMER              : string  := "ENABLED";
	constant FEATURE_DEBUGUNIT          : string  := "NONE";
	constant FEATURE_PERFCOUNTERS       : string  := "NONE";
	constant FEATURE_MAC                : string  := "NONE";

	constant FEATURE_SYSCALL : string := "ENABLED";
	constant FEATURE_TRAP    : string := "ENABLED";
	constant FEATURE_RANGE   : string := "ENABLED";

	constant FEATURE_PIC          : string  := "ENABLED";
	constant OPTION_PIC_TRIGGER   : string  := "LEVEL";
	constant OPTION_PIC_NMI_WIDTH : integer := 0;

	constant FEATURE_DSX        : string := "ENABLED";
	constant FEATURE_OVERFLOW   : string := "ENABLED";
	constant FEATURE_CARRY_FLAG : string := "ENABLED";

	constant FEATURE_FASTCONTEXTS     : string  := "NONE";
	constant OPTION_RF_CLEAR_ON_INIT  : integer := 0;
	constant OPTION_RF_NUM_SHADOW_GPR : integer := 0;
	constant OPTION_RF_ADDR_WIDTH     : integer := 5;
	constant OPTION_RF_WORDS          : integer := 32;

	--constant OPTION_RESET_PC : ???? := { { (OPTION_OPERAND_WIDTH-13){1'b0}} ; ` OR1K_RESET_VECTOR ;8'd0};

	constant FEATURE_MULTIPLIER : string := "THREESTAGE";
	constant FEATURE_DIVIDER    : string := "SERIAL";

	constant FEATURE_ADDC   : string := "ENABLED";
	constant FEATURE_SRA    : string := "ENABLED";
	constant FEATURE_ROR    : string := "NONE";
	constant FEATURE_EXT    : string := "NONE";
	constant FEATURE_CMOV   : string := "ENABLED";
	constant FEATURE_FFL1   : string := "ENABLED";
	constant FEATURE_ATOMIC : string := "ENABLED";

	constant FEATURE_CUST1 : string := "NONE";
	constant FEATURE_CUST2 : string := "NONE";
	constant FEATURE_CUST3 : string := "NONE";
	constant FEATURE_CUST4 : string := "NONE";
	constant FEATURE_CUST5 : string := "NONE";
	constant FEATURE_CUST6 : string := "NONE";
	constant FEATURE_CUST7 : string := "NONE";
	constant FEATURE_CUST8 : string := "NONE";

	constant FEATURE_FPU : string := "NONE"; -- ENABLED|NONE: actual for cappuccino pipeline only

	constant OPTION_SHIFTER : string := "BARREL";

	constant FEATURE_STORE_BUFFER            : string  := "ENABLED";
	constant OPTION_STORE_BUFFER_DEPTH_WIDTH : integer := 8;

	constant FEATURE_MULTICORE : string := "NONE";

	constant FEATURE_TRACEPORT_EXEC : string := "NONE";

	constant BUS_IF_TYPE : string := "WISHBONE32";

	constant IBUS_WB_TYPE : string := "CLASSIC"; -- Default: B3_READ_BURSTING
	constant DBUS_WB_TYPE : string := "CLASSIC";

	type debug_interface_i is record
		addr  : std_logic_vector(15 downto 0);
		stb   : std_logic;
		dat   : std_logic_vector(OPTION_OPERAND_WIDTH - 1 downto 0);
		we    : std_logic;
		stall : std_logic;
	end record debug_interface_i;

	type debug_interface_o is record
		dat   : std_logic_vector(OPTION_OPERAND_WIDTH - 1 downto 0);
		ack   : std_logic;
		stall : std_logic;
	end record debug_interface_o;

end package mor1kx_pkg;

package body mor1kx_pkg is
end package body mor1kx_pkg;
