writeback: Eliminate unintentional inferred latch
authorPaul Mackerras <paulus@ozlabs.org>
Tue, 9 Aug 2022 09:48:30 +0000 (19:48 +1000)
committerPaul Mackerras <paulus@ozlabs.org>
Tue, 9 Aug 2022 09:48:30 +0000 (19:48 +1000)
By not assigning to interrupt_out.srr1 in some circumstances, the
writeback_1 process creates an inferred latch, which is not
desirable.  Eliminate it by restructuring the code so
interrupt_out.srr1 is always set, to zeroes if nothing else.

Fixes: bc4d02cb0dcc ("Start removing SPRs from register file", 2022-07-12)
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
writeback.vhdl

index 2f6af2cc12ba2728ca498a5a9a742d3dbc05f612..7fef5c386e330bc785fafad0eeefc0d9037b87d1 100644 (file)
@@ -92,21 +92,20 @@ begin
         intr := e_in.interrupt or l_in.interrupt or fp_in.interrupt;
         interrupt_out.intr <= intr;
 
-        if intr = '1' then
-            srr1 := (others => '0');
-            if e_in.interrupt = '1' then
-                vec := e_in.intr_vec;
-                srr1 := e_in.srr1;
-            elsif l_in.interrupt = '1' then
-                vec := l_in.intr_vec;
-                srr1 := l_in.srr1;
-            elsif fp_in.interrupt = '1' then
-                vec := fp_in.intr_vec;
-                srr1 := fp_in.srr1;
-            end if;
-            interrupt_out.srr1 <= srr1;
+        srr1 := (others => '0');
+        if e_in.interrupt = '1' then
+            vec := e_in.intr_vec;
+            srr1 := e_in.srr1;
+        elsif l_in.interrupt = '1' then
+            vec := l_in.intr_vec;
+            srr1 := l_in.srr1;
+        elsif fp_in.interrupt = '1' then
+            vec := fp_in.intr_vec;
+            srr1 := fp_in.srr1;
+        end if;
+        interrupt_out.srr1 <= srr1;
 
-        else
+        if intr = '0' then
             if e_in.write_enable = '1' then
                 w_out.write_reg <= e_in.write_reg;
                 w_out.write_data <= e_in.write_data;