From: Markus Hofstätter Date: Wed, 1 Dec 2010 15:14:16 +0000 (+0100) Subject: added: alu jumps X-Git-Tag: bootrom_v1~103 X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=calu.git;a=commitdiff_plain;h=37835209871e507ea3956c9fd616a6546b39d991 added: alu jumps --- diff --git a/cpu/src/alu.vhd b/cpu/src/alu.vhd index b68e7c0..82656ab 100755 --- a/cpu/src/alu.vhd +++ b/cpu/src/alu.vhd @@ -17,7 +17,8 @@ entity alu is op_group : in op_info_t; left_operand : in gp_register_t; right_operand : in gp_register_t; - displacement : in gp_register_t; + displacement : in gp_register_t; + prog_cnt : in instr_addr_t; op_detail : in op_opt_t; alu_state : in alu_result_rec; alu_result : out alu_result_rec; diff --git a/cpu/src/alu_b.vhd b/cpu/src/alu_b.vhd index 3405365..8399d60 100755 --- a/cpu/src/alu_b.vhd +++ b/cpu/src/alu_b.vhd @@ -46,21 +46,24 @@ calc: process(left_operand, right_operand,displacement, cond, op_group, op_detai variable res_prod : std_logic; variable cond_met : std_logic; variable mem_en : std_logic; - variable mem_op : std_logic; + variable mem_op : std_logic; + variable alu_jmp : std_logic; begin result_v := alu_state; - result_v.result := add_result.result; res_prod := '1'; mem_en := '0'; - mem_op := '0'; - addr <= add_result.result; + mem_op := '0'; + alu_jump := '0'; + left <= left_operand; right <= right_operand; addr <= add_result.result; data <= right_operand; - + + result_v.result := add_result.result; + case cond is when COND_NZERO => cond_met := not(alu_state.status.zero); @@ -96,7 +99,9 @@ begin cond_met := '0'; when others => null; end case; - + + cond_met := cond_met and (alu_state.alu_jmp xnor alu_state.brpr); + case op_group is when ADDSUB_OP => result_v := add_result; @@ -119,7 +124,13 @@ begin if op_detail(ST_OPT) = '1' then right <= displacement; mem_en := '1'; - end if; + end if; + when JMP_OP => + if op_detail(JMP_REG_OPT) = '0' then + left <= prog_cnt; + end if; + result_v.alu_jmp := '1'; + when JMP_ST_OP => null; end case; @@ -137,6 +148,7 @@ begin result_v.reg_op := not(op_detail(NO_DST_OPT)) and res_prod and cond_met; result_v.mem_en := mem_en and cond_met; result_v.mem_op := mem_op and cond_met; + result_v.alu_jmp := alu_jmp and cond_met; alu_result <= result_v; diff --git a/cpu/src/alu_pkg.vhd b/cpu/src/alu_pkg.vhd index 16c1099..f1c99dc 100755 --- a/cpu/src/alu_pkg.vhd +++ b/cpu/src/alu_pkg.vhd @@ -85,6 +85,7 @@ package alu_pkg is left_operand : in gp_register_t; right_operand : in gp_register_t; displacement : in gp_register_t; + prog_cnt : in instr_addr_t; op_detail : in op_opt_t; alu_state : in alu_result_rec; alu_result : out alu_result_rec; diff --git a/cpu/src/common_pkg.vhd b/cpu/src/common_pkg.vhd index dd6350c..03e61cd 100755 --- a/cpu/src/common_pkg.vhd +++ b/cpu/src/common_pkg.vhd @@ -52,14 +52,15 @@ package common_pkg is constant ARITH_OPT : integer := 1; constant CARRY_OPT : integer := 2; - constant ST_OPT : integer := 2; constant RIGHT_OPT : integer := 3; + constant JMP_REG_OPT : integer := 3; + constant ST_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); + type op_info_t is (ADDSUB_OP,AND_OP,OR_OP, XOR_OP,SHIFT_OP, LDST_OP, JMP_OP, JMP_ST_OP); subtype op_opt_t is std_logic_vector(NUM_OP_OPT_WIDTH-1 downto 0); @@ -106,6 +107,7 @@ package common_pkg is brpr : std_logic; displacement : gp_register_t; + prog_cnt : instr_addr_t; src1 : gp_register_t; src2 : gp_register_t;