converted core to use req and grant signals to access data bus
Stefan Schuermans

Stefan Schuermans commited on 2012-03-01 21:23:47
Showing 1 changed files, with 13 additions and 12 deletions.

... ...
@@ -9,13 +9,13 @@ ENTITY e_mips_core IS
9 9
         clk:            IN  std_logic;
10 10
         o_instr_addr:   OUT std_logic_vector(31 DOWNTO 0);
11 11
         i_instr_data:   IN  std_logic_vector(31 DOWNTO 0);
12
+        o_data_req:     OUT std_logic;
13
+        i_data_grant:   IN  std_logic;
12 14
         o_data_addr:    OUT std_logic_vector(31 DOWNTO 0);
13 15
         i_data_rd_data: IN  std_logic_vector(31 DOWNTO 0);
14 16
         o_data_rd_en:   OUT std_logic_vector( 3 DOWNTO 0);
15
-        i_data_rd_ack:  IN  std_logic;
16 17
         o_data_wr_data: OUT std_logic_vector(31 DOWNTO 0);
17
-        o_data_wr_en:   OUT std_logic_vector( 3 DOWNTO 0);
18
-        i_data_wr_ack:  IN  std_logic
18
+        o_data_wr_en:   OUT std_logic_vector( 3 DOWNTO 0)
19 19
     );
20 20
 END ENTITY e_mips_core;
21 21
 
... ...
@@ -421,6 +421,10 @@ BEGIN
421 421
         END IF;
422 422
     END PROCESS p_next_pc;
423 423
 
424
+    o_data_req <= '1' WHEN (r_data_rd = data_rd_idle AND r_op = op_l)
425
+                           OR r_op = op_s
426
+                      ELSE '0';
427
+
424 428
     p_data_addr: PROCESS(r_op, s_val_s, r_imm_16)
425 429
         VARIABLE v_ofs: unsigned(31 DOWNTO 0);
426 430
         VARIABLE v_addr: unsigned(31 DOWNTO 0);
... ...
@@ -439,7 +443,7 @@ BEGIN
439 443
     p_data_rd_en: PROCESS(r_data_rd, r_op, r_ldst, s_data_addr)
440 444
     BEGIN
441 445
         o_data_rd_en <= "0000";
442
-        IF r_op = op_l THEN
446
+        IF r_data_rd = data_rd_idle AND r_op = op_l THEN
443 447
             CASE r_ldst IS
444 448
                 WHEN ldst_b | ldst_bu =>
445 449
                     CASE s_data_addr(1 DOWNTO 0) IS
... ...
@@ -479,7 +483,7 @@ BEGIN
479 483
     END PROCESS p_data_rd_en;
480 484
 
481 485
     p_data_rd: PROCESS(r_data_rd, r_op, r_ldst, s_data_addr, r_reg_t,
482
-                       i_data_rd_data, i_data_rd_ack, s_val_t)
486
+                       i_data_rd_data, i_data_grant, s_val_t)
483 487
         VARIABLE v_read: boolean;
484 488
         VARIABLE v_b:    std_logic_vector( 7 DOWNTO 0);
485 489
         VARIABLE v_h:    std_logic_vector(15 DOWNTO 0);
... ...
@@ -492,15 +496,12 @@ BEGIN
492 496
             WHEN data_rd_idle =>
493 497
                 IF r_op = op_l THEN
494 498
                     s_stall_data_rd <= '1';
499
+                    IF i_data_grant = '1' THEN
495 500
                         n_data_rd <= data_rd_read;
496 501
                     END IF;
502
+                END IF;
497 503
             WHEN data_rd_read =>
498
-                IF i_data_rd_ack = '0' THEN
499
-                    s_stall_data_rd <= '1';
500
-                    n_data_rd       <= data_rd_read;
501
-                ELSE
502 504
                 v_read := true;
503
-                END IF;
504 505
             WHEN OTHERS => NULL;
505 506
         END CASE;
506 507
         s_reg_wr_data_no   <= (OTHERS => '0');
... ...
@@ -568,7 +569,7 @@ BEGIN
568 569
         END IF;
569 570
     END PROCESS p_sync_data_rd;
570 571
 
571
-    p_data_wr: PROCESS(r_op, r_ldst, s_data_addr, s_val_t, i_data_wr_ack)
572
+    p_data_wr: PROCESS(r_op, r_ldst, s_data_addr, s_val_t, i_data_grant)
572 573
     BEGIN
573 574
         o_data_wr_data  <= (OTHERS => '0');
574 575
         o_data_wr_en    <= "0000";
... ...
@@ -638,7 +639,7 @@ BEGIN
638 639
                     END CASE;
639 640
                 WHEN OTHERS => NULL;
640 641
             END CASE;
641
-            IF i_data_wr_ack = '0' THEN
642
+            IF i_data_grant = '0' THEN
642 643
                 s_stall_data_wr <= '1';
643 644
             END IF;
644 645
         END IF;
645 646