stack op
[calu.git] / cpu / src / common_pkg.vhd
index 23791653dacc5a17bebf2f18faf9ae34a4bdfcd3..ca312f0b3040165deca10896e5101648c898dc54 100755 (executable)
@@ -18,7 +18,8 @@ package common_pkg is
        subtype word_t  is std_logic_vector(WORD_WIDTH-1 downto 0);
 
        subtype gp_register_t is word_t;
-
+       
+       subtype byte_en_t is std_logic_vector((gp_register_t'length/byte_t'length-1) downto 0); 
        
        constant REG_ZERO : gp_register_t := (others => '0');
 
@@ -30,6 +31,7 @@ package common_pkg is
        
        constant NUM_OP_OPT_WIDTH       : INTEGER := 6;
        constant COND_WIDTH : INTEGER := 4;
+       constant DATA_END_ADDR          : integer := ((2**DATA_ADDR_WIDTH)-1);
 
        
        subtype instruction_word_t is std_logic_vector(WORD_WIDTH-1 downto 0);
@@ -51,17 +53,21 @@ package common_pkg is
        
        constant SUB_OPT : integer := 1;
        constant ARITH_OPT : integer := 1;
+       constant HWORD_OPT : integer := 1;
+       constant PUSH_OPT : integer := 1;
        
        constant CARRY_OPT : integer := 2;
+       constant BYTE_OPT : integer := 2;
 
        constant RIGHT_OPT : integer := 3;
        constant JMP_REG_OPT : integer := 3;
-       constant ST_OPT  : integer := 3;
+       constant ST_OPT  : integer := 3; -- store opt
+       constant RET_OPT : integer := 3;
        
        constant NO_PSW_OPT : integer := 4;--no sharing
        constant NO_DST_OPT : integer := 5; --no sharing
        
-       type op_info_t is (ADDSUB_OP,AND_OP,OR_OP, XOR_OP,SHIFT_OP, LDST_OP, JMP_OP, JMP_ST_OP);
+       type op_info_t is (ADDSUB_OP,AND_OP,OR_OP, XOR_OP,SHIFT_OP, LDST_OP, JMP_OP, JMP_ST_OP, STACK_OP);
        subtype op_opt_t is std_logic_vector(NUM_OP_OPT_WIDTH-1 downto 0);
        
        
@@ -89,6 +95,7 @@ package common_pkg is
        end record;
 
 
+       
        type read_through_write_rec is record
 
                rtw_reg : gp_register_t;
@@ -131,8 +138,23 @@ package common_pkg is
                dmem_write_en : std_logic;      --ureg
                hword : std_logic;              --ureg
                byte_s : std_logic;
+               byte_en : byte_en_t;
+               data : gp_register_t;
        end record;
        
+       type exec2wb_rec is record
+                       result : gp_register_t; --reg  (alu result or jumpaddr)
+                       result_addr : gp_addr_t;        --reg
+                       address : word_t;               --ureg 
+                       ram_data : word_t;              --ureg
+                       alu_jmp : std_logic;            --reg
+                       br_pred : std_logic;            --reg
+                       write_en : std_logic;   --reg  (register file) bei jump 1 wenn addr in result
+                       dmem_en : std_logic;            --ureg (jump addr in mem or in address)
+                       dmem_write_en : std_logic;      --ureg
+                       hword : std_logic;              --ureg
+                       byte_s : std_logic;             --ureg  
+       end record;
        
        function inc(value : in std_logic_vector; constant by : in integer := 1) return std_logic_vector;
        function log2c(constant value : in integer range 0 to integer'high) return integer;