Spinsim 0.84

This version of spinsim supports most of the opcodes in the P2 instruction
set.  The list of opcodes that haven't been implemented are shown below.
Spinsim runs in the P1 mode by default.  It can be set to run in the P2 mode
with the -t parameter.

In the P2 mode, spinsim will load a P2 binary file into hub RAM, and start
cog 0 with the code located at $e00.  A simulated serial port is supported by
using the -b option.  The default baud rate is 115200, but other rates can be
used by specifying it with -b, such as -b9600.  The serial port uses pin 31
and 30, just like with P1.

Spinsim is built under Linux or cygwin by using the Makefile, and typing make.
There is also a buildit.bat batch file that is used to build spinsim with the
Watcom compiler for Windows.  The Windows executable, spinsim.exe is included
with this distribution.

The sample program, p2pfth run by going into the p2pfth directory and typing

..\spinsim084\spinsim -t -b p2pfth.binary

It takes about 10 seconds for p2pfth to compile it's boot Forth code and
print out a prompt.  On my PC the P2 simulator runs at an effective clock rate
of about 20 MHz.

Spinsim currently does not support the hub execution mode or interrupts.  Only
the core processor is supported, and none of the counters, video hardware or
cordic hardware is simulated.  These features will be added later.

Spinsim contains a simple debugger, which is enabled with the -d command-line
option.  The debugger prints the prompt "DEBUG>" to indicate that it is ready
to accept a command.  The "help" command will print the following:

Debug Commands
help           - Print command list
exit           - Exit spinsim
step           - Run one cycle
stepx          - Run next executed instruction
run            - Run continuously
verbose #      - Set verbosity level
reboot         - Reboot the Prop
setbr cog addr - Set breakpoint for cog to addr
state cog      - Dump cog state
peekc cog addr - Print out a cog memory location
peekh addr     - Print out a hub memory location

The "step" command will run one cycle, and the "stepx" command will run any
non-executing cycles until it encounters an instruction that is executed.
The previous command can be executed again by just pushing the enter key.
This is useful for stepping where the "step" command is typed once, and
the enter key can then be used to step again.

The "run" command will run until a breakpoint is encountered or ^] is typed.
^] is typed by holding down the control key and pressing the "]" key.
While running, spinsim will print out the results of each cycle as
controlled by the verbosity level, which is set by the "verbose" command.
The verbosity level can also be set with the command-line parameter "-v#".

The verbosity levels are as follows:

0 - Disable printing
1 - Print only the executed instructions
2 - Print only the executed instructions, and show the execution results
3 - Print executed and instruction not executed due to condition code
4 - Also print instructions invalidated in the pipeline due to jumps
5 - Also print instructions that include hub and hardware waits
6 - Also print instructions that include icache waits
7 - Also print instructions waiting for a pin state
8 - Print all cycles, including waitcnt waits

The verbosity level is entered as a hexadecimal number.  If the verbosity level
is entered as a single digit it will apply to all cogs.  If more than one digit
is entered each digit will be used for each cog, starting with cog 0 for the
right-most digit.  As an example, a value of 456 will cause 6 to be used for
cog 0, 5 for cog 1, and 4 for cog 2.  All other cogs will use 0.

Opcodes Not Implemented
-----------------------
altds   calld   clkset  cmpm    coginit djns    djs     fblock
getbw   getgx   getgy   getqx   getqy   getrnd  getro   getwrdn
jns     js      lockclr locknew lockret lockset mergeb  movbyts
msgin   msgout  qatn    qdiv    qexp    qlog    qmul    qrot
qsin    qsqr    rdfast  rdlut   rfbyte  rflong  rfword  rolbytn
rolwrdn sal     setbyts setdac  setfrq  setq    setwrdn splitb
waitpae waitpan waitpbe waitpbn waitpf  waitpr  waitpx  waitx
wfbyte  wflong  wfmask  wfword  wrfast  wrlut   xcont   xinit
xzero
