BigDumbDinosaur wrote:
cbscpe wrote:
I have decided to use a 74LS610 as the MMU.
Do you have a source for for the '610?
Yes I already have some and also some 74LS612.
BigDumbDinosaur wrote:
Also, I assume you are aware that it is a TTL device and as is typical of most such silicon, has weak fanout and may not be able to reliably drive CMOS inputs. Also, it's relatively slow...
Yes I know, but some pull-ups on the respective signals will help. The MMU takes about 70ns. I plan to have everything to settle in the PHI2 low phase, with a 14MHz W65C02 and a fast CPLD everything should be settled within approx 120ns. The initial plan was to run the system with either 4MHz or 3,6864 MHz. High-speed is not the design goal.
BigDumbDinosaur wrote:
I seem to recall that the state of the '610 is undefined at power-on. How will you get it into the above state?
There is the MM input. When set high the address inputs (MA0 to MA3) are passed through to the address pins MO8 to MO11 and address output pins MO0 to MO7 are low. I plan to have a MMU control register that has a defined state after reset and will set MM high to have a "neutral" mapping.
BigDumbDinosaur wrote:
cbscpe wrote:
$E200..$E2FF UART (one of the famous Siemens UART with FIFO and multiple channels that BDD always praises)
Actually, the UARTs I use are made by NXP. Possible candidates for your system would be the 26C92, 28L92 (the device in current use in POC V1.1) or the 28C94.
yes of course it's NXP don't ask me I always confuse them with Siemens but in fact they have been formerly Philips. My bad.
BigDumbDinosaur wrote:
The WDC 65C02 also briefly asserts VPB during reset, so that might be the means by which you could put the '610 into a known state following a hard reset.
In my design VPB will always set the Status Bit that controls MM to the high-state. So whenever the W65C02 reads a vector it is from the "kernel" mapping, that is when the MMU is disabled.
BigDumbDinosaur wrote:
Since you are planning on have a user stack and a kernel stack, why not just push the registers to the user stack when an interrupt hits, instead of writing them into RAM? Context changes would take a bit less code, would be faster and best of all, a common interrupt return (CRTI) could be used to switch context back to user mode upon completion of interrupt service, regardless of interrupt type.
Also, note that the 65C02 automatically reverts to binary mode when any interrupt is serviced, so the CLD instruction wouldn't be required.
This code executes after the vector has been read, MMU is then disabled and therefore the "user" address space is not accessible. STA zp / LDA zp require the same amount of cycles as a PHA / PLA pair. So no need to access a stack at that moment. Always keep in mind "kernel" mode always starts with MMU disabled, that is the 6502 address space is mapped one-to-one to the first 64kbyte phyiscal addresses. If the "kernel" needs to access user memory it will first have to set the MMU registers to map it's own requirements, e.g. it's own code and/or some user RAM and then activate the MMU again. In "kernel" mode the MMU can be enabled/disabled as required most other designs only disable it after a reset and when accessing the MMU it will be activated forever. Also because I need to switch into "user" mode I need to have some combined action which goes from disabled MMU to active MMU and at the same time performs an action in "user"mode. So I let the CPU fetch the RTI instruction from "kernel" and then activate the MMU, the rest of the RTI will be executed in "user" memory, that is it will pull PCL, PCH and P from the user stack and start execution from the loaded PC with the loaded status bits.
BigDumbDinosaur wrote:
If it were me, I'd start right off with the 65C816. Also, I would not consider emulation mode at all, except maybe for initial experimentation as you sort out circuit bugs. Switching from native to emulation mode, especially during interrupt servicing, is fraught with peril, not the least of which is the 16 bit stack pointer suddenly becomes 8 bits and is hard wired to page 1 RAM. Is that really what you want?
Something to consider is that everything that the 74LS610 can do may be synthesized in a small CPLD (e.g., an ATF1504AS). Also, any CPLD you might use will be a CMOS device with much better fanout and much higher operating speed than the '610.
Just some curmudgeonly opinions...
My design does not have severe stack limitations. Each User has it's own memory. Memory Page 0 is different for "kernel" and every "user" address space. In fact there is no "shared" address, although you can setup the MMU to share some memory of course. Only "kernel" address $0xxx is actually $00xxx. And we all know 256bytes of stack for a single task is far enough. Also when the system jumps to "user" mode the "kernel" stack is always "clean"
To synthesize a 74LS610 you need a rather large CPLD, don't forget we need at least sixteen 8-bit registers, with WP and NX bits we need another 2 bits per memory page. So in total we need 160bits of storage and even a ATF1508 has only 128 flip-flops.