--System inputs
clk : in std_logic;
reset : in std_logic;
-
+
--Data inputs
jump_result : in instruction_addr_t;
prediction_result : in instruction_addr_t;
alu_jump_bit : in std_logic;
--Data outputs
- instruction : out instruction_word_t
-
+ instruction : out instruction_word_t;
+ prog_cnt : out instruction_addr_t
);
end component fetch_stage;
--Data inputs
instruction : in instruction_word_t;
+ prog_cnt : in instruction_addr_t;
reg_w_addr : in std_logic_vector(REG_ADDR_WIDTH-1 downto 0);
reg_wr_data : in gp_register_t;
reg_we : in std_logic;
-- reg2_rd_data : out gp_register_t;
branch_prediction_res : out instruction_word_t;
branch_prediction_bit : out std_logic;
+
to_next_stage : out dec_op
);
end component decode_stage;
--Data inputs
instruction : in instruction_word_t;
+ prog_cnt : in instruction_addr_t;
reg_w_addr : in std_logic_vector(REG_ADDR_WIDTH-1 downto 0);
reg_wr_data : in gp_register_t;
reg_we : in std_logic;
dec_op_inst.saddr2 <= (others => '0');
dec_op_inst.daddr <= (others => '0');
dec_op_inst.displacement <= (others => '0');
+ dec_op_inst.prog_cnt <= (others => '0');
elsif rising_edge(clk) then
rtw_rec <= rtw_rec_nxt;
dec_op_inst_nxt.daddr <= instr_spl.reg_dest_addr; --(others => '0');
dec_op_inst_nxt.op_group <= instr_spl.op_group;
dec_op_inst_nxt.displacement <= instr_spl.displacement;
+ dec_op_inst_nxt.prog_cnt <= prog_cnt;
end process;
instr_s.bp := instruction(1);
instr_s.jmptype := instruction(3 downto 2);
instr_s.signext := instruction(0);
+ instr_s.op_detail(NO_PSW_OPT) := '1';
+
+
+ if (instr_s.opcode = "10110") then
+ instr_s.op_detail(IMM_OPT) := '1';
+ else
+ instr_s.immediate(31 downto 0) := (others => '0');
+ instr_s.op_detail(JMP_REG_OPT) := '1';
+ instr_s.op_detail(IMM_OPT) := '1';
+ end if;
+
+ if (instr_s.signext = '1' and instr_s.immediate(15) = '1') then
+ instr_s.immediate(31 downto 16) := (others => '1');
+ end if;
+
+ if (instr_s.jmptype = "00") then
+-- instr_s.op_detail(SUB_OPT) := not instr_s.opcode(0);
+ instr_s.op_group := JMP_OP;
+ end if;
end if;
-- when "10111" => --brreg
alu_jump_bit : in std_logic;
--Data outputs
- instruction : out instruction_word_t
+ instruction : out instruction_word_t;
+ prog_cnt : out instruction_addr_t
);
end fetch_stage;
end process;
+prog_cnt <= std_logic_vector(unsigned(instr_r_addr_nxt(PHYS_INSTR_ADDR_WIDTH-1 downto 0)) + 1;
+
end behav;
signal branch_prediction_bit_pin : std_logic;
signal alu_jump_bit_pin : std_logic;
signal instruction_pin : instruction_word_t;
+ signal prog_cnt : instruction_addr_t;
signal reg_w_addr_pin : std_logic_vector(REG_ADDR_WIDTH-1 downto 0);
signal reg_wr_data_pin : gp_register_t;
alu_jump_bit => alu_jump_bit_pin, --: in std_logic;
--Data outputs
- instruction => instruction_pin --: out instruction_word_t
- );
+ instruction => instruction_pin, --: out instruction_word_t
+ prog_cnt => prog_cnt
+ );
decode_st : decode_stage
generic map (
--Data inputs
instruction => instruction_pin, --: in instruction_word_t;
+ prog_cnt => prog_cnt,
reg_w_addr => reg_w_addr_pin, --: in std_logic_vector(REG_ADDR_WIDTH-1 downto 0);
reg_wr_data => reg_wr_data_pin, --: in gp_register_t;
reg_we => reg_we_pin, --: in std_logic;