In my original sketch for the Megaprocessor I was guessing that
there would be a frame for controlling the processor. I had a
dream of big levers, dials, knife switches etc., and one or two of
those big sparky things. I called this frame Igor after the
professors loyal assistant. And there would also be a frame for
some peripherals such as I/O, timers and interrupts.
When it later came to actually designing them my ideas changed
somewhat...
Firstly whilst the design of the peripherals is much much simpler
than that of the processor it turns out that its size, if built in
discrete transistors, is not proportionately smaller. It could
well take two or three frames rather than just one. And I was
running out of space. So I decided that I couldn't/wouldn't build
them from discrete components but use some more sensible
technology. And if you use an FPGA then it takes no space at all.
Secondly my vision for Igor faded away. It turned out there really
wasn't very much for him to do. One lever (for clock speed) and
just one big switch for reset. I think I originally thought there
would be a lot of status information coming out of the processor
which would need to be displayed. But there wasn't.
I had also decided by about this time that as well as the 256B of
RAM I'd build from discrete components it would also be nice to
have a larger chunk so I could run some more interesting
programs. And if I had this it would also make life a lot nicer if
I could download programs into it from the outside world.
The Igor board was born to mop up all of these functions :
- clock speed control and generation
- reset
- peripherals : I/O, counter, timer, interrupts, UART
- 32K RAM: dual ported between the Megaprocessor and something
that could be talked to over a serial interface
This was built around an FPGA development board from Lattice. The
chips around the edge of the board provide voltage level
translation (the FPGA is a 3V device, whilst the Megaprocessor is
5V). IC8 is a PIC processor which I use to provide a bit of
intelligence (e.g. working out dividers and decimal display values
for the clock) and a UART. It talks to the FPGA over SPI.
I was originally intending to have just the one built and have it
do everything. However when it came to designing the frame and
working out how to draw what was happening a single board with
"magic happens here" didn't seem very satisfactory. Also as the
minimum order for PCBs is 3 I had three of the boards (actually 4,
they sent me a bonus one) to hand so I decided to split out the
functions to : control, RAM, peripherals.
When starting to write the code for the Igor which would look
after just the clock and reset I had a further idea. If the board
was not acting as a peripheral for the processor then it could
monitor it instead. In particular it could sniff the address bus
and halt the clock when it saw a specified value. i.e. it gave me
breakpoints. It meant I had to change the direction of some of the
interfaces so that they all pointed in. You can see one of the
little blue wires changing control signals on IC1 at top left.
As a further development I wrote a VHDL version of the
Megaprocessor which could run in the FPGA.
I put one instance running in the control Igor. This was fed the
data sniffed from processor read data bus and given the same
control signals as the megaprocessor itself. It should therefore
behave in exactly the same way generating the same address and
write data requests. Checking these meant that I had two different
versions of the Megaprocessor that should run in lockstep with
each other and so gives me a powerful test and debug tool. If ever
the two versions diverge the clock is instantly stopped and I can
examine the processor(s) frozen at the point of error.
During integration I was able to take advantage of that bonus
fourth Igor. By completely reversing the direction of all the
interfaces (that was a bit ugly) and running just the VHDL version
of the Megaprocessor in the FPGA it emulate a Megaprocessor and
use that for testing the control frame.
Igor's been an invaluable assistant.
Would still have liked one of those spark ladders though.
Something like this
one.