ctrl_tmp.dec <= std_ulogic_vector(unsigned(ctrl.dec) - 1);
irq_valid := '0';
- if ctrl.msr(MSR_EE) = '1' and ctrl.dec(63) = '1' then
- report "IRQ valid";
- irq_valid := '1';
- if ctrl.msr(63 - 48) = '1' then
++ if ctrl.msr(MSR_EE) = '1' then
+ if ctrl.dec(63) = '1' then
+ ctrl_tmp.irq_nia <= std_logic_vector(to_unsigned(16#900#, 64));
+ report "IRQ valid: DEC";
+ irq_valid := '1';
+ elsif i_in.irq = '1' then
+ ctrl_tmp.irq_nia <= std_logic_vector(to_unsigned(16#500#, 64));
+ report "IRQ valid: External";
+ irq_valid := '1';
+ end if;
end if;
terminate_out <= '0';
-- 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.srr1 <= msr_copy(ctrl.msr);
- elsif e_in.valid = '1' then
+ elsif e_in.valid = '1' and ctrl.msr(MSR_PR) = '1' and
+ instr_is_privileged(e_in.insn_type, e_in.insn) then
+ -- generate a program interrupt
+ exception := '1';
+ ctrl_tmp.irq_nia <= std_logic_vector(to_unsigned(16#700#, 64));
+ ctrl_tmp.srr1 <= msr_copy(ctrl.msr);
+ -- set bit 45 to indicate privileged instruction type interrupt
+ ctrl_tmp.srr1(63 - 45) <= '1';
+ report "privileged instruction";
+
+ elsif e_in.valid = '1' and e_in.unit = ALU then
+ report "execute nia " & to_hstring(e_in.nia);
+
v.e.valid := '1';
v.e.write_reg := e_in.write_reg;
v.slow_op_dest := gspr_to_gpr(e_in.write_reg);