Well, I'm far too young to really be expected to get into that level of arcane
knowledge, but I'm working on a CPU emulator for a virtual ISA meant for use in a
video game under development. It's extremely simple (16 opcodes - 15 basic ones, and a
single "non-basic" one). It has 64k address space of 16-bit bytes (each address
refers to 16 bits, and a separate set of 16 bits - 0x12345678 is 0x2 locations long - I
believe that means that the byte is thus 16-bits long here)
Addressing for instruction operands is extremely orthogonal. To the point that the stack
manipulation functions PUSH and POP are operands and not their own instructions. To push
an integer 1 on the stack, you do so: SET PUSH, 1
https://segin-utils.googlecode.com/svn/trunk/dcpu16/ contains the WIP source code for my
emulator (and also serves as a "how not to write C code" guide, on purpose - I
wanted to see how many tricks I could employ to keep code size down and execution speed
high), as well as a copy of the CPU architecture spec. Those interested may want to browse
the subversion history for the source to see the different approaches I've tried. For
the lazy, use the web interface on the meta-project page:
http://code.google.com/p/segin-utils/ under Source -> Browse
But coding this emulator, thinking about how to structure the logic - yes, I know,
probably too high level, but still, fetch the instruction, decode it, decode it's
operands, fetch additional memory if operands are pointers or extend the instruction
length, execute the operation, store the instruction, etc., while overly simplified, give
me a fair idea what that billion-transistor slab of silicon in front of me (or in my
pocket!) is doing when it's doing it's thing.
I wrote a somewhat long memo detailing my thoughts on the architecture in general on the
forum for the game, under the section for discussing the virtual architecture itself.
Link:
http://www.0x10cforum.com/forum/m/4932880/viewthread/2750850. Keep in mind that I
might be talking out of my ass in huge swaths. Any and all commentary would be appreciated
(and may even be used to edit and modify that post - I wish to inform, but I'm certain
almost everyone on this list knows far more about real-world ISAs than I do; I was born 4
days before Windows 3.0 was released. Please forgive my mass ignorance.)
(Note: I filter the list's messages into a separate IMAP folder that I check far too
infrequently, so please CC me on replies, else it might be months, if ever, that I read
your reply/)
On Apr 10, 2012, at 3:14 PM, Tony Duell wrote:
It depends on wht you want to learn....
Smalelr PDP11s, including all Q-bus models, have a custom DEC processor
IC or chipset. In that respect they're rather like microcomputers, THe
older, larger machines may well have a processor built from SSI and MSI
chips. Whith those you can (and do) connect a logic analyser to the ALU
outputs, or look athe carry flag with a logic probe, or...
As a hardware hacker, I feel everyone should get at least one machine
(not necessarily a PDP11) with a CPU built like that and fully understnad
it. It takes away a lot of the clouds of 'magic' that seems to be
associated with the operation of a processor.
-tony