From 1868d87ee0273a7812b9969e12a4d18887942e09 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Markus=20Hofst=C3=A4tter?= Date: Sun, 14 Nov 2010 11:02:57 +0100 Subject: [PATCH] Added interface types --- cpu/src/alu_pkg.vhd | 2 +- cpu/src/common_pkg.vhd | 41 +++++++++++++++++++++++++++++++++++++++++ cpu/src/exec_op.vhd | 25 +++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 1 deletion(-) create mode 100755 cpu/src/exec_op.vhd diff --git a/cpu/src/alu_pkg.vhd b/cpu/src/alu_pkg.vhd index a125674..9ab2384 100755 --- a/cpu/src/alu_pkg.vhd +++ b/cpu/src/alu_pkg.vhd @@ -42,7 +42,7 @@ package alu_pkg is constant SHIFT_WIDTH : integer := log2c(gp_register_t'length); function add_oflo(l_neg, r_neg, res_neg : std_logic) return std_logic; - function addsub_op(left_operand, right_operand : gp_register_t; sub : std_logic; alu_result : alu_result_rec) return alu_result_rec; + function addsub_op(left_operand, right_operand : gp_register_t; sub, addc : std_logic; alu_result : alu_result_rec) return alu_result_rec; function and_op(left_operand, right_operand : gp_register_t; alu_result : alu_result_rec) return alu_result_rec; function or_op(left_operand, right_operand : gp_register_t; alu_result : alu_result_rec) return alu_result_rec; diff --git a/cpu/src/common_pkg.vhd b/cpu/src/common_pkg.vhd index 59ff7a7..46434bc 100644 --- a/cpu/src/common_pkg.vhd +++ b/cpu/src/common_pkg.vhd @@ -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 index 0000000..b3ef75b --- /dev/null +++ b/cpu/src/exec_op.vhd @@ -0,0 +1,25 @@ +library IEEE; +use IEEE.std_logic_1164.all; +use IEEE.numeric_std.all; + +entity exec_op is + + generic ( + -- active reset value + RESET_VALUE : std_logic; + -- active logic value + LOGIC_ACT : std_logic + + ); + port( + --System inputs + clk : in std_logic; + reset : in std_logic; + -- + + + alu_state : in alu_result_rec; + alu_state_out : out alu_result_rec + ); + +end execute_stage; -- 2.25.1