Added interface types
authorMarkus Hofstätter <markus.hofstaetter@gmx.net>
Sun, 14 Nov 2010 10:02:57 +0000 (11:02 +0100)
committerMarkus Hofstätter <markus.hofstaetter@gmx.net>
Sun, 14 Nov 2010 10:02:57 +0000 (11:02 +0100)
cpu/src/alu_pkg.vhd
cpu/src/common_pkg.vhd
cpu/src/exec_op.vhd [new file with mode: 0755]

index a125674232e8713096de62472ab656a1d0912944..9ab238450639badc6906b0dbfa41fa6d984a09f6 100755 (executable)
@@ -42,7 +42,7 @@ package alu_pkg is
        constant SHIFT_WIDTH : integer := log2c(gp_register_t'length);\r
        \r
        function add_oflo(l_neg, r_neg, res_neg : std_logic) return std_logic;\r
-       function addsub_op(left_operand, right_operand : gp_register_t; sub : std_logic; alu_result : alu_result_rec) return alu_result_rec;\r
+       function addsub_op(left_operand, right_operand : gp_register_t; sub, addc : std_logic; alu_result : alu_result_rec) return alu_result_rec;\r
        \r
        function and_op(left_operand, right_operand : gp_register_t; alu_result : alu_result_rec) return alu_result_rec;\r
        function or_op(left_operand, right_operand : gp_register_t; alu_result : alu_result_rec) return alu_result_rec;\r
index 59ff7a7e9566866c7ee85753a3fcf15b76060aac..46434bcf991648fa24da65974733342c8507c1b1 100644 (file)
@@ -19,6 +19,9 @@ package common_pkg is
        constant REG_ADDR_WIDTH         : INTEGER := 4;
        constant DATA_ADDR_WIDTH        : INTEGER := 32;
        constant PHYS_DATA_ADDR_WIDTH   : INTEGER := 32;
+       
+       constant NUM_OP_OPT_WIDTH       : INTEGER := 5;
+       constant COND_WIDTH : INTEGER := 4;
 
        subtype byte_t is std_logic_vector(BYTE_WIDTH-1 downto 0);
        subtype hword_t is std_logic_vector(HWORD_WIDTH-1 downto 0);
@@ -33,6 +36,44 @@ package common_pkg is
        subtype data_ram_addr_t is std_logic_vector(DATA_ADDR_WIDTH-1 downto 0);
 
        subtype opcode_t is std_logic_vector(OPCODE_WIDTH-1 downto 0);
+       subtype condition_t is std_logic_vector(COND_WIDTH-1 downto 0);
+       
+       --Opcode consits of decoded group information type and option bits
+       --currently not complete, might need option increase too.
+       --IMMEDIATE always in right_operand (src2)
+       
+       constant IMM_OPT : integer := 0;
+       
+       constant SUB_OPT : integer := 1;
+       constant LOG_SHIFT : integer := 1;
+       
+       constant CARRY_OPT : integer := 2;
+       
+       constant LEFT_SHIFT : integer := 3;
+       
+       constant PSW_DISABLE : integer := 4;
+       
+       
+       
+       
+       type op_info_t is (ADDSUB_OP,AND_OP,OR_OP, XOR_OP,SHIFT_OP);
+       subtype op_opt_rec is std_logic_vector(NUM_OP_OPT_WIDTH-1 downto 0);
+       
+       type dec_op is
+               condition : condition_t;
+               op_group : op_info_t;
+               op_detail : op_opt_rec;
+               brpr : std_logic;
+               
+               src1 : gp_register_t;
+               src2 : gp_register_t;
+               
+               saddr1 : gp_addr_t;
+               saddr2 : gp_addr_t;
+               
+               daddr   : gp_addr_t
+               
+       end record dec_op;
        
        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;
diff --git a/cpu/src/exec_op.vhd b/cpu/src/exec_op.vhd
new file mode 100755 (executable)
index 0000000..b3ef75b
--- /dev/null
@@ -0,0 +1,25 @@
+library IEEE;\r
+use IEEE.std_logic_1164.all;\r
+use IEEE.numeric_std.all;\r
+\r
+entity exec_op is\r
+\r
+       generic (\r
+                       -- active reset value\r
+                       RESET_VALUE : std_logic;\r
+                       -- active logic value\r
+                       LOGIC_ACT : std_logic\r
+                       \r
+                       );\r
+       port(\r
+               --System inputs\r
+                       clk : in std_logic;\r
+                       reset : in std_logic;\r
+               --\r
+                       \r
+                       \r
+                       alu_state : in alu_result_rec;\r
+                       alu_state_out : out alu_result_rec\r
+               );\r
+               \r
+end execute_stage;\r