implemented ... and link -> MIPSel1 core complete
Stefan Schuermans

Stefan Schuermans commited on 2012-02-05 21:16:11
Showing 1 changed files, with 21 additions and 1 deletions.

... ...
@@ -76,6 +76,10 @@ ARCHITECTURE a_mips_core OF e_mips_core IS
76 76
     SIGNAL s_reg_wr_hi_lo_data: std_logic_vector(31 DOWNTO 0);
77 77
     SIGNAL s_reg_wr_hi_lo_en:   std_logic;
78 78
 
79
+    SIGNAL s_reg_wr_link_no:   std_logic_vector( 4 DOWNTO 0);
80
+    SIGNAL s_reg_wr_link_data: std_logic_vector(31 DOWNTO 0);
81
+    SIGNAL s_reg_wr_link_en:   std_logic;
82
+
79 83
     SIGNAL s_reg_wr_no:   std_logic_vector( 4 DOWNTO 0);
80 84
     SIGNAL s_reg_wr_data: std_logic_vector(31 DOWNTO 0);
81 85
     SIGNAL s_reg_wr_en:   std_logic;
... ...
@@ -361,7 +365,8 @@ BEGIN
361 365
     p_reg_wr: PROCESS(s_stall,
362 366
                       s_reg_wr_alu_no, s_reg_wr_alu_data, s_reg_wr_alu_en,
363 367
                       s_reg_wr_data_no, s_reg_wr_data_data, s_reg_wr_data_en,
364
-                      s_reg_wr_hi_lo_no, s_reg_wr_hi_lo_data, s_reg_wr_hi_lo_en)
368
+                      s_reg_wr_hi_lo_no, s_reg_wr_hi_lo_data, s_reg_wr_hi_lo_en,
369
+                      s_reg_wr_link_no, s_reg_wr_link_data, s_reg_wr_link_en)
365 370
     BEGIN
366 371
         s_reg_wr_no   <= (OTHERS => '0');
367 372
         s_reg_wr_data <= (OTHERS => '0');
... ...
@@ -379,6 +384,10 @@ BEGIN
379 384
                 s_reg_wr_no   <= s_reg_wr_hi_lo_no;
380 385
                 s_reg_wr_data <= s_reg_wr_hi_lo_data;
381 386
                 s_reg_wr_en   <= '1';
387
+            ELSIF s_reg_wr_link_en = '1' THEN
388
+                s_reg_wr_no   <= s_reg_wr_link_no;
389
+                s_reg_wr_data <= s_reg_wr_link_data;
390
+                s_reg_wr_en   <= '1';
382 391
             END IF;
383 392
         END IF;
384 393
     END PROCESS p_reg_wr;
... ...
@@ -617,4 +626,15 @@ BEGIN
617 626
     s_div_signed <= '1' WHEN r_op = op_div ELSE '0';
618 627
     s_div_start  <= '1' WHEN i_stall = '0' AND (r_op = op_div OR r_op = op_divu) ELSE '0';
619 628
 
629
+    p_link: PROCESS(r_pc, r_link)
630
+    BEGIN
631
+        s_reg_wr_link_no   <= std_logic_vector(to_unsigned(31, 5));
632
+        s_reg_wr_link_data <= std_logic_vector(signed(r_pc) + to_signed(4, 32));
633
+        IF r_link = link_link THEN
634
+            s_reg_wr_link_en <= '1';
635
+        ELSE
636
+            s_reg_wr_link_en <= '0';
637
+        END IF;
638
+    END PROCESS p_link;
639
+
620 640
 END ARCHITECTURE a_mips_core;
621 641