diff --git a/AtomCpuMon.xise b/AtomCpuMon.xise
index 4ec1fa1..2ed973a 100644
--- a/AtomCpuMon.xise
+++ b/AtomCpuMon.xise
@@ -20,7 +20,7 @@
-
+
@@ -257,6 +257,10 @@
+
+
+
+
diff --git a/src/AlanD/R65Cx2.vhd b/src/AlanD/R65Cx2.vhd
index 19efd8f..eb85f0d 100644
--- a/src/AlanD/R65Cx2.vhd
+++ b/src/AlanD/R65Cx2.vhd
@@ -26,8 +26,9 @@ entity R65C02 is
addr : out unsigned(15 downto 0);
nwe : out std_logic;
sync : out std_logic;
- sync_irq : out std_logic
-
+ sync_irq : out std_logic;
+ -- 6502 registers (MSB) PC, SP, P, Y, X, A (LSB)
+ Regs : out std_logic_vector(63 downto 0)
);
end R65C02;
@@ -847,15 +848,16 @@ processAlu: process(clk, opcInfo, aluInput, aluCmpInput, A, T, irqActive, N, V,
end if;
when others => null;
end case;
-
- if rising_edge(clk) then
+
+-- DMB Remove Pipelining
+-- if rising_edge(clk) then
aluRmwOut <= rmwBits(7 downto 0);
aluRegisterOut <= ninebits(7 downto 0);
aluC <= varC;
aluZ <= varZ;
aluV <= varV;
aluN <= varN;
- end if;
+-- end if;
end process;
@@ -909,12 +911,13 @@ calcNextOpcode: process(clk, di, reset, processIrq)
nextOpcInfo <= opcodeInfoTable(to_integer(nextOpcode));
- process(clk)
- begin
- if rising_edge(clk) then
+-- DMB Remove Pipelining
+-- process(clk)
+-- begin
+-- if rising_edge(clk) then
nextOpcInfoReg <= nextOpcInfo;
- end if;
- end process;
+-- end if;
+-- end process;
-- Read bits and flags from opcodeInfoTable and store in opcInfo.
-- This info is used to control the execution of the opcode.
@@ -1511,6 +1514,13 @@ calcAddr: process(clk)
end process;
sync_irq <= irqActive;
+
+ Regs <= std_logic_vector(PC) &
+ "00000001" & std_logic_vector(S)&
+ N & V & R & B & D & I & Z & C &
+ std_logic_vector(Y) &
+ std_logic_vector(X) &
+ std_logic_vector(A);
end architecture;
diff --git a/src/AtomCpuMon.vhd b/src/AtomCpuMon.vhd
index 75df108..9adc017 100644
--- a/src/AtomCpuMon.vhd
+++ b/src/AtomCpuMon.vhd
@@ -23,6 +23,10 @@ use work.OhoPack.all ;
entity AtomCpuMon is
+ generic (
+ UseT65Core : boolean := false;
+ UseAlanDCore : boolean := true
+ );
port (
clock49 : in std_logic;
@@ -76,7 +80,10 @@ architecture behavioral of AtomCpuMon is
signal Addr_int : std_logic_vector(15 downto 0);
signal IRQ_n_sync : std_logic;
signal NMI_n_sync : std_logic;
-
+
+ signal cpu_addr_us: unsigned (15 downto 0);
+ signal cpu_dout_us: unsigned (7 downto 0);
+
signal Phi0_a : std_logic;
signal Phi0_b : std_logic;
signal Phi0_c : std_logic;
@@ -124,24 +131,45 @@ begin
DataIn => memory_din
);
- cpu_t65 : entity work.T65 port map (
- mode => "00",
- Abort_n => '1',
- SO_n => SO_n,
- Res_n => Res_n,
- Enable => Rdy_int,
- Clk => cpu_clk,
- Rdy => '1',
- IRQ_n => IRQ_n_sync,
- NMI_n => NMI_n_sync,
- R_W_n => R_W_n_int,
- Sync => Sync_int,
- A(23 downto 16) => open,
- A(15 downto 0) => Addr_int,
- DI => Din,
- DO => Dout,
- Regs => Regs
- );
+ GenT65Core: if UseT65Core generate
+ inst_t65: entity work.T65 port map (
+ mode => "00",
+ Abort_n => '1',
+ SO_n => SO_n,
+ Res_n => Res_n,
+ Enable => Rdy_int,
+ Clk => cpu_clk,
+ Rdy => '1',
+ IRQ_n => IRQ_n_sync,
+ NMI_n => NMI_n_sync,
+ R_W_n => R_W_n_int,
+ Sync => Sync_int,
+ A(23 downto 16) => open,
+ A(15 downto 0) => Addr_int,
+ DI => Din,
+ DO => Dout,
+ Regs => Regs
+ );
+ end generate;
+
+ GenAlanDCore: if UseAlanDCore generate
+ inst_r65c02: entity work.r65c02 port map (
+ reset => RES_n,
+ clk => cpu_clk,
+ enable => Rdy_int,
+ nmi_n => NMI_n_sync,
+ irq_n => IRQ_n_sync,
+ di => unsigned(Din),
+ do => cpu_dout_us,
+ addr => cpu_addr_us,
+ nwe => R_W_n_int,
+ sync => Sync_int,
+ sync_irq => open,
+ Regs => Regs
+ );
+ Dout <= std_logic_vector(cpu_dout_us);
+ Addr_int <= std_logic_vector(cpu_addr_us);
+ end generate;
sync_gen : process(cpu_clk, Res_n)
begin