OSDN Git Service

branch backward bug fix
authorastoria-d <astoria-d@mail.goo.ne.jp>
Tue, 18 Jun 2013 09:33:28 +0000 (18:33 +0900)
committerastoria-d <astoria-d@mail.goo.ne.jp>
Tue, 18 Jun 2013 09:33:28 +0000 (18:33 +0900)
simulation/cpu/alu.vhd
simulation/cpu/decoder.vhd

index ac5e6bf..6aff807 100644 (file)
@@ -237,8 +237,13 @@ end  procedure;
 
     elsif (rel_calc_n = '0') then
         if (pg_next_n = '1') then
-            sel <= ALU_INC;
-            c_in <= '0';
+            if (int_d_bus(7) = '1') then
+                ---backward relative branch
+                sel <= ALU_DEC;
+            else
+                ---forward relative branch
+                sel <= ALU_INC;
+            end if;
             ---d1 is pch.`
             d1 <= bah;
             ---rel val is on the d_bus.
index bbb0c00..ce1658c 100644 (file)
@@ -425,13 +425,13 @@ begin
         next_cycle <= T3;
     elsif exec_cycle = T3 then
 
-        dl_dh_oe_n <= '1';
         back_we(pcl_cmd, '1');
         if ea_carry = '1' then
             --page crossed. adh calc.
             back_oe(pcl_cmd, '0');
             back_oe(pch_cmd, '0');
             back_we(pch_cmd, '0');
+            dl_dh_oe_n <= '0';
 
             rel_calc_n <= '0';
             pg_next_n <= '1';