A bit easier than an RTI detector might be a time-delay fuse. I'm sure I've read of a machine which does this: there's a register to poke at which has a delayed effect, enough time to do something particular after you poked it. For example, if only supervisor mode can poke I/O hardware, then the supervisor can light the fuse then do the RTI. The delay is figured to be just the right amount to have the RTI execute in supervisor mode, but (for example) get its data from the user-mode stack.
Another approach might be to place the special RTI for returning from supervisor mode at a particular address, and detect that address instead of detecting the RTI opcode. Not sure, but there might be advantages.
Discrete mmu?
Re: Discrete mmu?
BigEd wrote:
Another approach might be to place the special RTI for returning from supervisor mode at a particular address, and detect that address instead of detecting the RTI opcode. Not sure, but there might be advantages.
Another point to consider: an address test will involve more than just 8 bits (which argues in favor of using the opcode-test option instead).
BigEd wrote:
[...] a time-delay fuse. I'm sure I've read of a machine which does this: there's a register to poke at which has a delayed effect, enough time to do something particular after you poked it.
Last edited by Dr Jefyll on Fri Jun 17, 2016 7:56 pm, edited 1 time in total.
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
https://laughtonelectronics.com/Arcana/ ... mmary.html
Re: Discrete mmu?
Ah, thanks, it might well have been your idea I was thinking of. Although, I think maybe one of the minicomputers did it... yes, at least the PDP-8 has a couple of non-obvious delays:
"ION is used to turn on interrupts. The effect of this instruction is delayed one instruction so that, for example, an ION instruction immediately before a return instruction will not take effect until the return instruction is executed."
"CIF Delay is set whenever there is an instruction executed that could change the Instruction Field. These include CIF and RMF I believe. If you are including extended memory then you need to take this into account as well. The CIF Delay is cleared after any JMP or JMS instruction"
"ION is used to turn on interrupts. The effect of this instruction is delayed one instruction so that, for example, an ION instruction immediately before a return instruction will not take effect until the return instruction is executed."
"CIF Delay is set whenever there is an instruction executed that could change the Instruction Field. These include CIF and RMF I believe. If you are including extended memory then you need to take this into account as well. The CIF Delay is cleared after any JMP or JMS instruction"
Re: Discrete mmu?
In our case the late availability of the instruction read is not a problem. You only need to know that the instruction just read was a RTI. We need to switch to user space only during the next PHI2 low phase, approx. as fast as the CPU emits the address to read from the stack. We don't have to be faster than the CPU. A delay is a good idea and was also my first idea (see my other thread using 74LS610), make an address the trigger to switch to user space after n PHI2 cycles.
- BigDumbDinosaur
- Posts: 9428
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: Discrete mmu?
cbscpe wrote:
I fully agree, but still as I said I want to combine it with a flag as not necessary all RTI return to the user (nested interrupts or the NMI occurs during processing of a system call).
As for NMIs, they are best reserved for one high priority event that cannot be ignored under any circumstances. Using NMIs for routine processing can give rise to hard-to-diagnose deadlock problems (which I discuss in my 65C816 interrupt article). Many systems don't even pay attention to NMIs.
Quote:
You may ask why only 3 User Pages of un-equal size. The answer is I want to use only one Macro Cell per physical memory address line in the ATF1504AS to select the physical address and I have only 5 Product Terms per Macro Cell. This saves resources and minimizes propagation delay.
Code: Select all
property atmel {cascade_logic=on};
property atmel {logic_doubling=on}; /* if off, Pterms can't be "borrowed" from other MCs */
property atmel {output_fast=off}; /* set output slew rate to slow, might help with noise issues */
property atmel {pin_keep=off}; /* see data sheet for explanation */
property atmel {preassign=keep}; /* prevents fitter from changing your fixed pin assignments */
property atmel {security=off}; /* security fuse is not blown */
property atmel {xor_synthesis=on};x86? We ain't got no x86. We don't NEED no stinking x86!
- BigDumbDinosaur
- Posts: 9428
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: Discrete mmu?
cbscpe wrote:
In our case the late availability of the instruction read is not a problem. You only need to know that the instruction just read was a RTI. We need to switch to user space only during the next PHI2 low phase, approx. as fast as the CPU emits the address to read from the stack. We don't have to be faster than the CPU. A delay is a good idea and was also my first idea (see my other thread using 74LS610), make an address the trigger to switch to user space after n PHI2 cycles.
x86? We ain't got no x86. We don't NEED no stinking x86!
Re: Discrete mmu?
Nested interrupts do not need hardware support. As in most OS there is something called "stackdepth" a memory location that is incremented by the kernel for each interrupt level entered and decremented before exiting the level. So the OS knows when to go back to user mode (have a look at the sources of RSX-11S from digital, there it is also used to switch between kernal and user stack).
NMI is required as I want to avoid a user task to hog the CPU when it disables interrupts. I thought about using the NMI for the timer interrupt.
As I said the processing time for the RTI is of no importance at all. First the CPLD, or whatever logic we use, will see the RTI more or less at the same time as the CPU. Latest at the falling edge of PHI2 the CPU and the logic know that a RTI has been fetched. So our logic can switch to user mode on the falling edge of PHI2, even a slow CPLD would have activated user mode early enough for the CPU to continue with the right address space in the next cycle. Even more, the 2 cycles following the fetch of the RTI opcode are internal operations cycles.
As for dealing with Atmel CPLDs. The fitter is a piece of opaque software, you never know what it does. I have been surprised many times how bad this software is written and documented. I have designs that will not fit when the CPDL assigns the Pins and only will do it's job when you "help" him. Then I have designs that do strange things with the OE PT for bidirectional pins (they set int ON, which definitively does not work). And using the ATMEL PROPERTIES is another source of surprises. Even when you think you help the fitter by activating logic-doubling it is in some cases the wrong decision. And the documentation is virtually non-existing. I would really like to have more documentation, but even Atmel seems not to have more
. If you by any chance have some more information than available on the internet would be great.
NMI is required as I want to avoid a user task to hog the CPU when it disables interrupts. I thought about using the NMI for the timer interrupt.
As I said the processing time for the RTI is of no importance at all. First the CPLD, or whatever logic we use, will see the RTI more or less at the same time as the CPU. Latest at the falling edge of PHI2 the CPU and the logic know that a RTI has been fetched. So our logic can switch to user mode on the falling edge of PHI2, even a slow CPLD would have activated user mode early enough for the CPU to continue with the right address space in the next cycle. Even more, the 2 cycles following the fetch of the RTI opcode are internal operations cycles.
As for dealing with Atmel CPLDs. The fitter is a piece of opaque software, you never know what it does. I have been surprised many times how bad this software is written and documented. I have designs that will not fit when the CPDL assigns the Pins and only will do it's job when you "help" him. Then I have designs that do strange things with the OE PT for bidirectional pins (they set int ON, which definitively does not work). And using the ATMEL PROPERTIES is another source of surprises. Even when you think you help the fitter by activating logic-doubling it is in some cases the wrong decision. And the documentation is virtually non-existing. I would really like to have more documentation, but even Atmel seems not to have more