Hi there,
I am trying to speed up my Micro-PET design from 50MHz base / 12.5MHz CPU clock to 70 MHz base / 17.5MHz CPU clock.
I have a stable read timing now, but the system does not correctly read and process the bank byte in time it seems. With bank clamped to zero, I see correct memory accesses (at least at the initial vector pull and subsequent memory fetches - but not with how I try to use the bank byte.
Currently I try to latch the bank byte, and then derive select signals from it. Latching is not really a good FPGA design, registers are preferred, but registering the bank byte directly at the rising edge of phi2 leads to
a) either all select lines are delayed until after phi2 rises or
b) when selecting the data input vs the latch output depending on phi2 itself, the changing data lines already effect the select lines causing glitches.
Note in this example, phi2 rises with the falling edge of qclk (which is 50/70MHz), so registering the value at the rising edge - half a qclk before phi2 rises - avoids the glitches
Code:
-----------------------------------------------------------------------
-- CPU address space analysis
--
-- note: simply latching D at rising phi2 does not work,
-- as in the logical part after the latch, the changing D already
-- bleeds through, before the result is switched back when bankl is in effect.
-- Therefore we sample D at half-qclk before the transition of phi2.
-- This may lead to speed limits in faster designs, but works here.
BankLatch: process(reset, D, phi2, qclk)
begin
if (reset ='1') then
bankl <= (others => '0');
elsif (rising_edge(qclk) and phi2='0') then
if (forceb0 = '1') then
bankl <= (others => '0');
else
bankl <= D;
end if;
end if;
end process;
bank <= bankl;
Now, this does not seem to be fast enough anymore. Any idea / best practice for this?
_________________
Author of the GeckOS multitasking operating system, the usb65 stack, designer of the Micro-PET and many more 6502 content:
http://6502.org/users/andre/