-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal for a generic state machine #143
Comments
I had a similar idea today. The overall concept is the same, I think. It depends on how you propose a chain being set up. My idea was to implement an instruction as a sequence of functions. Each function is responsible for initiating a microprogram. When a microprogram ends, the next function in the sequence is called. As an example, perhaps
|
Sounds sensible. Should there be an implicit or explicit "end_of_instruction" step too, where the ucode can hook on exceptions/interrupts? |
Maybe a terminating |
Yes, I think I'd prefer an explicit |
Agreed. I edited the example. Possibly, |
I think I'd rather see something like separate sequences.
|
Things to consider regarding this and Bus/Address error.
With the EA sequence In case the In case of an Address error, where would things be aborted? Is the address detected before |
I have something that's almost working now. I don't think there will be any problem aborting an instruction midway. Just I don't know exactly how address error works. I would guess that the CPU detects the bad address at the start of the bus cycle, or |
For that matter, do you have a handle on externally versus internally generated bus errors? |
How can a bus error be internally generated? Without a bus access, there shouldn't be a possibility for a bus error. |
I read something in the 68000 User's Manual, but now that I read it again, I see it can be interpreted another way:
|
The next sentence there hints at it being identical in timing as well.
I.e. the bus cycle has started (just like with BERR) and aborts (just like with BERR). |
Well, it says "similar" to a bus error. It doesn't say it's done identically. But of course, it's slightly easier to implement them identically. |
I was also thinking of the other exceptions here. A If (at the start of an instruction), the trace bit is set, it should also append the trace exception after its normal execution. This will then work well with The trace state cannot reliably be checked after the instruction has finished, because according to the User's Manual, the state before the instruction is what determines the trace execution.
|
My use of "identical" was because of the phrase "bus cycle is aborted". They're of course not really identical, since a bus error is triggered externally, and there could be undeterministic delays from the bus request to the BERR, which will always be deterministic in an address error. |
I propose that
ucode
takes on the job of running everything around the instructions, and exceptions.The state machine has one state chain for each instruction being executed. A state chain is a sequence
of microcode instructions (
uop
) being executed one after the other. Eachuop
taking 2 8MHz cycles,and being run on even 8MHz cycles.
EA is just one or more sections of such a chain, and so are exceptions.
All of this assumes the full prefetch with IRC/IR/IRD is in place.
So the main role for an instruction is to setup the chain based on the instruction opcode (steps below may be optional):
uop
:s that's needed before any EAThe instruction is now only called to setup, after that,
ucode
takes over and steps through the chain.If anything would happen that would change the normal execution, like for example a bus error occurs within
the EA steps, a bus error chain replaces the rest of the instruction chain, and ucode keeps on executing
just like before.
For
TRAP
this would essentially be the same thing, except the instruction would just insert the exceptionchain for the
TRAP
exception into the chain straight away.Other exceptions could be caught when
ucode
parses the end step, and if there is an exception/interruptpending, append the exception chain, and keep on running a bit longer.
Every
uop
is a callback into a function dealing with it. For steps 2 and 4 above, those are callbacks prettymuch the way they are in the EA code now. For 1, 3, 5 and 6, they would be provided by the instruction code.
The text was updated successfully, but these errors were encountered: