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>
jtag-port
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 := next_nia;
v.e.exc_write_data := std_logic_vector(unsigned(e_in.nia) + 4); end if;
end if; ctrl_tmp.irq_state <= WRITE_SRR1;
ctrl_tmp.irq_state <= WRITE_SRR1; v.e.valid := '1';
stall_out <= '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,52 +55,54 @@ 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
w_out.write_reg <= e_in.write_reg; if e_in.write_enable = '1' then
w_out.write_data <= e_in.write_data; w_out.write_reg <= e_in.write_reg;
w_out.write_enable <= '1'; w_out.write_data <= e_in.write_data;
end if; w_out.write_enable <= '1';

end if;
if e_in.write_cr_enable = '1' then
c_out.write_cr_enable <= '1'; if e_in.write_cr_enable = '1' then
c_out.write_cr_mask <= e_in.write_cr_mask; c_out.write_cr_enable <= '1';
c_out.write_cr_data <= e_in.write_cr_data; c_out.write_cr_mask <= e_in.write_cr_mask;
end if; c_out.write_cr_data <= e_in.write_cr_data;

end if;
if e_in.write_xerc_enable = '1' then
c_out.write_xerc_enable <= '1'; if e_in.write_xerc_enable = '1' then
c_out.write_xerc_data <= e_in.xerc; c_out.write_xerc_enable <= '1';
end if; c_out.write_xerc_data <= e_in.xerc;

end if;
if l_in.write_enable = '1' then
w_out.write_reg <= gpr_to_gspr(l_in.write_reg); if l_in.write_enable = '1' then
w_out.write_data <= l_in.write_data; w_out.write_reg <= gpr_to_gspr(l_in.write_reg);
w_out.write_enable <= '1'; w_out.write_data <= l_in.write_data;
end if; w_out.write_enable <= '1';

end if;
if l_in.rc = '1' then
-- st*cx. instructions if l_in.rc = '1' then
scf(3) := '0'; -- st*cx. instructions
scf(2) := '0'; scf(3) := '0';
scf(1) := l_in.store_done; scf(2) := '0';
scf(0) := l_in.xerc.so; scf(1) := l_in.store_done;
c_out.write_cr_enable <= '1'; scf(0) := l_in.xerc.so;
c_out.write_cr_mask <= num_to_fxm(0); c_out.write_cr_enable <= '1';
c_out.write_cr_data(31 downto 28) <= scf; c_out.write_cr_mask <= num_to_fxm(0);
end if; c_out.write_cr_data(31 downto 28) <= scf;

end if;
-- Perform CR0 update for RC forms
-- Note that loads never have a form with an RC bit, therefore this can test e_in.write_data -- Perform CR0 update for RC forms
if e_in.rc = '1' and e_in.write_enable = '1' then -- Note that loads never have a form with an RC bit, therefore this can test e_in.write_data
sign := e_in.write_data(63); if e_in.rc = '1' and e_in.write_enable = '1' then
zero := not (or e_in.write_data); sign := e_in.write_data(63);
c_out.write_cr_enable <= '1'; zero := not (or e_in.write_data);
c_out.write_cr_mask <= num_to_fxm(0); c_out.write_cr_enable <= '1';
cf(3) := sign; c_out.write_cr_mask <= num_to_fxm(0);
cf(2) := not sign and not zero; cf(3) := sign;
cf(1) := zero; cf(2) := not sign and not zero;
cf(0) := e_in.xerc.so; cf(1) := zero;
c_out.write_cr_data(31 downto 28) <= cf; cf(0) := e_in.xerc.so;
c_out.write_cr_data(31 downto 28) <= cf;
end if;
end if; end if;
end process; end process;
end; end;

Loading…
Cancel
Save