Joel Mc Cormack - P-machine Architecture

P-machine Architecture

The CPU used the technique of keeping the top word of the stack in one of the AMD 2901 registers. This often resulted in one fewer microinstructions. For example, here are a few p-codes the way they ended up. tos is a register, and q is a register. "|" means parallel activities in a single cycle. (The stack doesn't quite operate this way...it decrements before data is written to it, and increments after data is read.)

Since next-address control and next microcode location were in each wide microword, there was no penalty for any-order execution of the microcode. A table of 256 labels, and the microcode compiler moved the first instruction at each of those labels to the first 256 locations of microcode memory. The only restriction this placed upon the microcode was that if the p-code required more than one microinstruction, then the first microinstruction couldn't have any flow control specified (as it would be filled in with a "goto ).

fetch % Fetch and save in an AMD register the next byte opcode from % the prefetch unit, and go to that location in the microcode. q := ubyte | goto ubyte SLDCI % Short load constant integer (push opcode byte) % Push top-of-stack AMD register onto real stack, load % the top-of-stack register with the fetched opcode that got us here dec(sp) | stack := tos | tos := q | goto fetch LDCI % Load constant integer (push opcode word) % A lot like SLDCI, except fetch 2-byte word and "push" on stack dec(sp) | stack := tos | tos := word | goto fetch SLDL1 % Short load local variable at offset 1 % mpd0 is a pointer to local data at offset 0. Write appropriate % data address into the byte-addressed memory-address-register mar := mpd0+2 % Push tos, load new tos from memory SLDX dec(sp) | stack := tos | tos := memword | goto fetch LDL % Load local variable at offset specified by "big" operand r0 := big mar := mpd0 + r0 | goto sldx INCR % Increment top-of-stack by big operand tos := tos + big | goto fetch ADI % Add two words on top of stack tos := tos + stack | inc(sp) | goto fetch EQUI % Top two words of stack equal? test tos - stack | inc(sp) tos := 0 | if ~zero goto fetch tos := 1 | goto fetch

This architecture should be compared to the original P-code machine specification as proposed by Niklaus Wirth.

Read more about this topic:  Joel Mc Cormack

Famous quotes containing the word architecture:

    The two elements the traveler first captures in the big city are extrahuman architecture and furious rhythm. Geometry and anguish. At first glance, the rhythm may be confused with gaiety, but when you look more closely at the mechanism of social life and the painful slavery of both men and machines, you see that it is nothing but a kind of typical, empty anguish that makes even crime and gangs forgivable means of escape.
    Federico García Lorca (1898–1936)