implemented "register 0 is always 0" in a faster way
Stefan Schuermans

Stefan Schuermans commited on 2012-01-26 21:17:30
Showing 1 changed files, with 16 additions and 2 deletions.

... ...
@@ -32,16 +32,30 @@ ARCHITECTURE a_mips_regs OF e_mips_regs IS
32 32
 
33 33
 BEGIN
34 34
 
35
+    p_read_a: PROCESS(i_rd_a_no)
36
+    BEGIN
37
+        IF i_rd_a_no = "00000" THEN
38
+            o_rd_a_data <= X"00000000";
39
+        ELSE
35 40
             o_rd_a_data <= r_regs(no2idx(i_rd_a_no));
41
+        END IF;
42
+    END PROCESS p_read_a;
36 43
 
44
+    p_read_b: PROCESS(i_rd_a_no)
45
+    BEGIN
46
+        IF i_rd_b_no = "00000" THEN
47
+            o_rd_b_data <= X"00000000";
48
+        ELSE
37 49
             o_rd_b_data <= r_regs(no2idx(i_rd_b_no));
50
+        END IF;
51
+    END PROCESS p_read_b;
38 52
 
39 53
     p_write: PROCESS(rst, clk)
40 54
     BEGIN
41 55
         IF rst = '1' THEN
42
-            r_regs <= (OTHERS => X"00000000");
56
+            -- r_regs <= (OTHERS => X"00000000");
43 57
         ELSIF rising_edge(clk) THEN
44
-            IF i_wr_en = '1' AND i_wr_no /= "00000" THEN
58
+            IF i_wr_en = '1' THEN
45 59
                 r_regs(no2idx(i_wr_no)) <= i_wr_data;
46 60
             END IF;
47 61
         END IF;
48 62