core: Implement a simple branch predictor
[microwatt.git] / fetch1.vhdl
index 93a229347d82c80489aaaa409f5667ba3abd4c80..0d9c6f73f3133f07255bfc24795fba1ce8b356ed 100644 (file)
@@ -23,6 +23,9 @@ entity fetch1 is
        -- redirect from execution unit
        e_in          : in Execute1ToFetch1Type;
 
+        -- redirect from decode1
+        d_in          : in Decode1ToFetch1Type;
+
        -- Request to icache
        i_out         : out Fetch1ToIcacheType;
 
@@ -49,7 +52,7 @@ begin
                report "fetch1 rst:" & std_ulogic'image(rst) &
                     " IR:" & std_ulogic'image(e_in.virt_mode) &
                     " P:" & std_ulogic'image(e_in.priv_mode) &
-                   " R:" & std_ulogic'image(e_in.redirect) &
+                   " R:" & std_ulogic'image(e_in.redirect) & std_ulogic'image(d_in.redirect) &
                    " S:" & std_ulogic'image(stall_in) &
                    " T:" & std_ulogic'image(stop_in) &
                    " nia:" & to_hstring(r_next.nia) &
@@ -83,6 +86,8 @@ begin
            v.nia := e_in.redirect_nia;
             v.virt_mode := e_in.virt_mode;
             v.priv_mode := e_in.priv_mode;
+        elsif d_in.redirect = '1' then
+            v.nia := d_in.redirect_nia;
        elsif stall_in = '0' then
 
            -- For debug stop/step to work properly we need a little bit of