[rtl/cpu] fixed bug in WFI instruction

This commit is contained in:
stnolting 2020-10-20 21:20:12 +02:00
parent 2669e3c02d
commit 65ef1027e2
2 changed files with 9 additions and 8 deletions

View file

@ -800,13 +800,14 @@ begin
when TRAP => -- Start trap environment (also used as cpu sleep state)
-- ------------------------------------------------------------
fetch_engine.reset <= '1';
execute_engine.if_rst_nxt <= '1'; -- this is a non-linear PC modification
if (trap_ctrl.env_start = '1') then -- check here again if we came directly from DISPATCH
trap_ctrl.env_start_ack <= '1';
execute_engine.pc_nxt <= csr.mtvec;
execute_engine.sleep_nxt <= '0'; -- waky waky
execute_engine.state_nxt <= SYS_WAIT;
-- stay here for sleep
if (trap_ctrl.env_start = '1') then -- trap triggered?
fetch_engine.reset <= '1';
execute_engine.if_rst_nxt <= '1'; -- this is a non-linear PC modification
trap_ctrl.env_start_ack <= '1';
execute_engine.pc_nxt <= csr.mtvec;
execute_engine.sleep_nxt <= '0'; -- waky waky
execute_engine.state_nxt <= SYS_WAIT;
end if;
when EXECUTE => -- Decode and execute instruction

View file

@ -41,7 +41,7 @@ package neorv32_package is
-- Architecture Constants -----------------------------------------------------------------
-- -------------------------------------------------------------------------------------------
constant data_width_c : natural := 32; -- data width - do not change!
constant hw_version_c : std_ulogic_vector(31 downto 0) := x"01040508"; -- no touchy!
constant hw_version_c : std_ulogic_vector(31 downto 0) := x"01040509"; -- no touchy!
constant pmp_max_r_c : natural := 8; -- max PMP regions - FIXED!
constant archid_c : natural := 19; -- official NEORV32 architecture ID - hands off!