Line 819... |
Line 819... |
ALU_Ctrl.Reg <= SubOp(2 downto 1) & '0';
|
ALU_Ctrl.Reg <= SubOp(2 downto 1) & '0';
|
end if;
|
end if;
|
|
|
when LDX_C2 =>
|
when LDX_C2 =>
|
CPU_Next_State <= LDX_C3;
|
CPU_Next_State <= LDX_C3;
|
|
if( Enable_Auto_Increment and SubOp(0) = '1' )then
|
|
ALU_Ctrl.Oper <= ALU_UPP2;
|
|
ALU_Ctrl.Reg <= SubOp(2 downto 1) & '1';
|
|
end if;
|
PC_Ctrl.Offset <= PC_NEXT;
|
PC_Ctrl.Offset <= PC_NEXT;
|
|
|
when LDX_C3 =>
|
when LDX_C3 =>
|
CPU_Next_State <= LDX_C4;
|
CPU_Next_State <= LDX_C4;
|
Cache_Ctrl <= CACHE_OPER1;
|
Cache_Ctrl <= CACHE_OPER1;
|
Line 1319... |
Line 1323... |
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
|
|
-- The ALU code is responsible for (and should be the only code altering)
|
-- The ALU code is responsible for (and should be the only code altering)
|
-- the register file. Most of the "instructions" directly map to opcodes
|
-- the register file. Most of the "instructions" directly map to opcodes
|
-- but a few are for internal use only, such as operations involving the
|
-- but a few are for internal use only, such as operations involving the
|
-- stack pointer of interrupt mask.
|
-- stack pointer or interrupt mask.
|
|
|
Index := conv_integer(ALU_Ctrl.Reg);
|
Index := conv_integer(ALU_Ctrl.Reg);
|
Sum := (others => '0');
|
Sum := (others => '0');
|
Temp := (others => '0');
|
Temp := (others => '0');
|
|
|
Line 1341... |
Line 1345... |
("0" & Regfile(Index));
|
("0" & Regfile(Index));
|
Flags(PSR_C) <= Sum(8);
|
Flags(PSR_C) <= Sum(8);
|
Regfile(Index) <= Sum(7 downto 0);
|
Regfile(Index) <= Sum(7 downto 0);
|
|
|
when ALU_UPP2 => -- Rn = Rn + C
|
when ALU_UPP2 => -- Rn = Rn + C
|
Sum := ("0" & x"00") +
|
Sum := (x"00" & Flags(PSR_C)) +
|
("0" & Regfile(Index)) +
|
("0" & Regfile(Index));
|
Flags(PSR_C);
|
|
Flags(PSR_C) <= Sum(8);
|
Flags(PSR_C) <= Sum(8);
|
Regfile(Index) <= Sum(7 downto 0);
|
Regfile(Index) <= Sum(7 downto 0);
|
|
|
when ALU_ADC => -- R0 = R0 + Rn + C : Flags N,C,Z
|
when ALU_ADC => -- R0 = R0 + Rn + C : Flags N,C,Z
|
Sum := ("0" & Regfile(0)) +
|
Sum := ("0" & Regfile(0)) +
|