2 use IEEE.std_logic_1164.all;
3 use IEEE.numeric_std.all;
6 use work.common_pkg.all;
8 architecture behav of fetch_stage is
10 signal instr_w_addr : instruction_addr_t;
11 signal instr_r_addr : instruction_addr_t;
12 signal instr_r_addr_nxt : instruction_addr_t;
13 signal instr_we : std_logic;
14 signal instr_wr_data : instruction_word_t;
15 signal instr_rd_data : instruction_word_t;
19 instruction_ram : r_w_ram
21 PHYS_INSTR_ADDR_WIDTH,
27 instr_w_addr(PHYS_INSTR_ADDR_WIDTH-1 downto 0),
28 instr_r_addr_nxt(PHYS_INSTR_ADDR_WIDTH-1 downto 0),
34 syn: process(sys_clk, reset)
38 if (reset = RESET_VALUE) then
39 instr_r_addr <= (others => '0');
40 elsif rising_edge(sys_clk) then
41 instr_r_addr <= instr_r_addr_nxt;
47 asyn: process(instr_r_addr, jump_result, prediction_result, branch_prediction_bit, alu_jump_bit)
51 instruction <= instr_rd_data;
52 instr_r_addr_nxt <= std_logic_vector(unsigned(instr_r_addr) + 1);
54 if (alu_jump_bit = LOGIC_ACT) then
55 instr_r_addr_nxt <= jump_result;
56 elsif (branch_prediction_bit = LOGIC_ACT) then
57 instr_r_addr_nxt <= prediction_result;