implementation of LWL, LWR
Stefan Schuermans

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

... ...
@@ -337,9 +337,10 @@ BEGIN
337 337
 
338 338
     o_data_addr <= s_data_addr(31 DOWNTO 2) & "00";
339 339
 
340
-    p_data_rd: PROCESS(r_data_rd, r_op, r_ldst, s_data_addr, r_reg_t, i_data_rd_data)
340
+    p_data_rd: PROCESS(r_data_rd, r_op, r_ldst, s_data_addr, r_reg_t, i_data_rd_data, s_val_t)
341 341
         VARIABLE v_b: std_logic_vector( 7 DOWNTO 0);
342 342
         VARIABLE v_h: std_logic_vector(15 DOWNTO 0);
343
+        VARIABLE v_w: std_logic_vector(31 DOWNTO 0);
343 344
     BEGIN
344 345
         s_stall_data_rd    <= '0';
345 346
         n_data_rd          <= data_rd_idle;
... ...
@@ -378,6 +379,26 @@ BEGIN
378 379
                         END IF;
379 380
                     WHEN ldst_w =>
380 381
                         s_reg_wr_data_data <= i_data_rd_data;
382
+                    WHEN ldst_wl =>
383
+                        v_w := s_val_t;
384
+                        CASE s_data_addr(1 DOWNTO 0) IS
385
+                            WHEN "00" => v_w(31 DOWNTO 24) := i_data_rd_data( 7 DOWNTO 0);
386
+                            WHEN "01" => v_w(31 DOWNTO 16) := i_data_rd_data(15 DOWNTO 0);
387
+                            WHEN "10" => v_w(31 DOWNTO  8) := i_data_rd_data(23 DOWNTO 0);
388
+                            WHEN "11" => v_w(31 DOWNTO  0) := i_data_rd_data(31 DOWNTO 0);
389
+                            WHEN OTHERS => NULL;
390
+                        END CASE;
391
+                        s_reg_wr_data_data <= v_w;
392
+                    WHEN ldst_wr =>
393
+                        v_w := s_val_t;
394
+                        CASE s_data_addr(1 DOWNTO 0) IS
395
+                            WHEN "00" => v_w(31 DOWNTO  0) := i_data_rd_data(31 DOWNTO  0);
396
+                            WHEN "01" => v_w(23 DOWNTO  0) := i_data_rd_data(31 DOWNTO  8);
397
+                            WHEN "10" => v_w(15 DOWNTO  0) := i_data_rd_data(31 DOWNTO 16);
398
+                            WHEN "11" => v_w( 7 DOWNTO  0) := i_data_rd_data(31 DOWNTO 24);
399
+                            WHEN OTHERS => NULL;
400
+                        END CASE;
401
+                        s_reg_wr_data_data <= v_w;
381 402
                     WHEN OTHERS => NULL;
382 403
                 END CASE;
383 404
                 s_reg_wr_data_no <= r_reg_t;
384 405