execute1: Simplify the interrupt logic a little

This makes some simplifications to the interrupt logic which will
help with later commits.

- When irq_valid is set, don't set exception to 1 until we have a
  valid instruction.  That means we can remove the if e_in.valid = '1'
  test from the exception = '1' block.

- Don't assert stall_out on the first cycle of delivering an
  interrupt.  If we do get another instruction in the next cycle,
  nothing will happen because we have ctrl.irq_state set and we
  will just continue writing the interrupt registers.

- Make sure we deliver as many completions as we got instructions,
  otherwise the outstanding instruction count in control.vhdl gets
  out of sync.

- In writeback, make sure all of the other write enables are ignored
  when e_in.exc_write_enable is set.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
pull/158/head
Paul Mackerras 5 years ago
parent fe077a116a
commit d77033aa92

@ -399,13 +399,15 @@ begin
ctrl_tmp.msr(63 - 48) <= '0'; -- clear EE ctrl_tmp.msr(63 - 48) <= '0'; -- clear EE
f_out.redirect <= '1'; f_out.redirect <= '1';
f_out.redirect_nia <= ctrl.irq_nia; f_out.redirect_nia <= ctrl.irq_nia;
v.e.valid := '1'; v.e.valid := e_in.valid;
report "Writing SRR1: " & to_hstring(ctrl.srr1); report "Writing SRR1: " & to_hstring(ctrl.srr1);


elsif irq_valid = '1' then elsif irq_valid = '1' then
-- we need two cycles to write srr0 and 1 -- we need two cycles to write srr0 and 1
-- will need more when we have to write DSISR, DAR and HIER -- will need more when we have to write DSISR, DAR and HIER
exception := '1'; -- Don't deliver the interrupt until we have a valid instruction
-- coming in, so we have a valid NIA to put in SRR0.
exception := e_in.valid;
ctrl_tmp.irq_nia <= std_logic_vector(to_unsigned(16#900#, 64)); ctrl_tmp.irq_nia <= std_logic_vector(to_unsigned(16#900#, 64));
ctrl_tmp.srr1 <= msr_copy(ctrl.msr); ctrl_tmp.srr1 <= msr_copy(ctrl.msr);


@ -821,16 +823,12 @@ begin
end if; end if;


if exception = '1' then if exception = '1' then
if e_in.valid = '1' then
v.e.exc_write_enable := '1'; v.e.exc_write_enable := '1';
if exception_nextpc = '1' then if exception_nextpc = '1' then
v.e.exc_write_data := std_logic_vector(unsigned(e_in.nia) + 4); v.e.exc_write_data := next_nia;
end if; end if;
ctrl_tmp.irq_state <= WRITE_SRR1; ctrl_tmp.irq_state <= WRITE_SRR1;
stall_out <= '1'; v.e.valid := '1';
v.e.valid := '0';
result_en := '0';
end if;
end if; end if;


v.e.write_data := result; v.e.write_data := result;

@ -55,7 +55,8 @@ begin
w_out.write_reg <= e_in.exc_write_reg; w_out.write_reg <= e_in.exc_write_reg;
w_out.write_data <= e_in.exc_write_data; w_out.write_data <= e_in.exc_write_data;
w_out.write_enable <= '1'; w_out.write_enable <= '1';
elsif e_in.write_enable = '1' then else
if e_in.write_enable = '1' then
w_out.write_reg <= e_in.write_reg; w_out.write_reg <= e_in.write_reg;
w_out.write_data <= e_in.write_data; w_out.write_data <= e_in.write_data;
w_out.write_enable <= '1'; w_out.write_enable <= '1';
@ -102,5 +103,6 @@ begin
cf(0) := e_in.xerc.so; cf(0) := e_in.xerc.so;
c_out.write_cr_data(31 downto 28) <= cf; c_out.write_cr_data(31 downto 28) <= cf;
end if; end if;
end if;
end process; end process;
end; end;

Loading…
Cancel
Save