Line 138... |
Line 138... |
|
|
signal rs1_forwarded, rs2_forwarded : std_logic_vector(31 downto 0);
|
signal rs1_forwarded, rs2_forwarded : std_logic_vector(31 downto 0);
|
|
|
signal branch : branch_type;
|
signal branch : branch_type;
|
signal branch_condition : std_logic;
|
signal branch_condition : std_logic;
|
|
signal do_jump : std_logic;
|
signal jump_target : std_logic_vector(31 downto 0);
|
signal jump_target : std_logic_vector(31 downto 0);
|
|
|
signal sr : csr_status_register;
|
signal sr : csr_status_register;
|
signal evec, evec_forwarded : std_logic_vector(31 downto 0);
|
signal evec, evec_forwarded : std_logic_vector(31 downto 0);
|
|
|
Line 187... |
Line 188... |
status => exception_context_forwarded.status,
|
status => exception_context_forwarded.status,
|
cause => exception_cause,
|
cause => exception_cause,
|
badvaddr => exception_vaddr
|
badvaddr => exception_vaddr
|
) when exception_taken = '1' else exception_context_forwarded;
|
) when exception_taken = '1' else exception_context_forwarded;
|
|
|
jump_out <= to_std_logic(branch = BRANCH_JUMP or branch = BRANCH_JUMP_INDIRECT)
|
do_jump <= to_std_logic(branch = BRANCH_JUMP or branch = BRANCH_JUMP_INDIRECT)
|
or (to_std_logic(branch = BRANCH_CONDITIONAL) and branch_condition)
|
or (to_std_logic(branch = BRANCH_CONDITIONAL) and branch_condition)
|
or to_std_logic(branch = BRANCH_SRET);
|
or to_std_logic(branch = BRANCH_SRET);
|
|
jump_out <= do_jump;
|
jump_target_out <= jump_target;
|
jump_target_out <= jump_target;
|
|
|
evec_out <= evec_forwarded;
|
evec_out <= evec_forwarded;
|
exception_taken <= decode_exception or to_std_logic(exception_cause /= CSR_CAUSE_NONE) or irq_asserted;
|
exception_taken <= decode_exception or to_std_logic(exception_cause /= CSR_CAUSE_NONE) or irq_asserted;
|
|
|
Line 309... |
Line 311... |
when others =>
|
when others =>
|
data_misaligned <= '0';
|
data_misaligned <= '0';
|
end case;
|
end case;
|
end process data_misalign_check;
|
end process data_misalign_check;
|
|
|
instr_misalign_check: instr_misaligned <= '1' when jump_target(1 downto 0) /= b"00" else '0';
|
instr_misalign_check: process(jump_target, branch, branch_condition)
|
|
begin
|
|
if jump_target(1 downto 0) /= b"00" and do_jump = '1' then
|
|
instr_misaligned <= '1';
|
|
else
|
|
instr_misaligned <= '0';
|
|
end if;
|
|
end process instr_misalign_check;
|
|
|
find_exception_cause: process(decode_exception, decode_exception_cause, mem_op,
|
find_exception_cause: process(decode_exception, decode_exception_cause, mem_op,
|
data_misaligned, instr_misaligned, irq_asserted, irq_asserted_num)
|
data_misaligned, instr_misaligned, irq_asserted, irq_asserted_num)
|
begin
|
begin
|
if irq_asserted = '1' then
|
if irq_asserted = '1' then
|