|
1 |
| -Spinsim 0.75 |
2 |
| - |
3 |
| -This version of spinsim supports about two-thirds of the opcodes in the P2 |
4 |
| -instruction set. The list of implemented opcodes is shown below, along with |
5 |
| -the list of opcodes that have not been implemented yet. Spinsim runs in the P1 |
6 |
| -mode by default. It can be set to run in the P2 mode with the -t parameter. |
7 |
| - |
8 |
| -In the P2 mode, spinsim will load a P2 OBJ file into hub RAM, and start cog 0 |
9 |
| -with the code located at $E00. A simulated serial port is supported by using |
10 |
| -the -b option. The default baud rate is 115,200, but other rates can be used |
11 |
| -by specifying it with -b, such as -b9600. The serial port uses pin 31 and 30, |
12 |
| -just like with P1. |
13 |
| - |
14 |
| -Spinsim is built using the Makefile, and typing make. I have successfully |
15 |
| -built and run it under Cygwin and Ubuntu Linux. |
16 |
| - |
17 |
| -The sample program, pfth.spin can be run by building it with the PNut P2 |
18 |
| -assembler. PNut is contained in the Terasic_Prop2_Emulation zip file, |
19 |
| -which can be downloaded from the first post in the "HUB EXEC Update Here" |
20 |
| -thread in the Propeller 2 forum. |
21 |
| - |
22 |
| -There are two demo programs, which are the pfth Forth interpreter and the |
23 |
| -p1spin Spin interpreter that runs P1 Spin binaries on the P2 processor. |
24 |
| -The pfth program is run under spinsim as follows: |
25 |
| - |
26 |
| -./spinsim -t -b pfth.obj |
27 |
| - |
28 |
| -p1spin runs at a baud rate of 57600, so it is run as follows: |
29 |
| - |
30 |
| -./spinsim -t -b57600 p1spin.obj |
31 |
| - |
32 |
| -Spinsim supports execution from cog memory and hub execution, but it does not |
33 |
| -support multi-tasking. Only the core processor is supported, and none of the |
34 |
| -counters, video hardware or cordic hardware is simulated. Support for multi- |
35 |
| -tasking, peripheral hardware and cordic instructions will be added later. |
36 |
| - |
37 |
| -Spinsim contains a simple debugger, which is enabled with the -d command-line |
38 |
| -option. The debugger prints the prompt "DEBUG>" to indicate that it is ready |
39 |
| -to accept a command. The "help" command will print the following: |
40 |
| - |
41 |
| -Debug Commands |
42 |
| -help - Print command list |
43 |
| -exit - Exit spinsim |
44 |
| -step - Run one cycle |
45 |
| -stepx - Run next executed instruction |
46 |
| -run - Run continuously |
47 |
| -verbose # - Set verbosity level |
48 |
| -reboot - Reboot the Prop |
49 |
| -setbr cog addr - Set breakpoint for cog to addr |
50 |
| -state cog - Dump cog state |
51 |
| - |
52 |
| -The "step" command will run one cycle, and the "stepx" command will run any |
53 |
| -non-executing cycles until it encounters an instruction that is executed. |
54 |
| -The previous command can be executed again by just pushing the enter key. |
55 |
| -This is useful for stepping where the "step" command is typed once, and |
56 |
| -the enter key can then be used to step again. |
57 |
| - |
58 |
| -The "run" command will run until a breakpoint is encountered or ^] is typed. |
59 |
| -^] is typed by holding down the control key and pressing the "]" key. |
60 |
| -While running, spinsim will print out the results of each cycle as |
61 |
| -controlled by the verbosity level, which is set by the "verbose" command. |
62 |
| -The verbosity level can also be set with the command-line parameter "-v#". |
63 |
| - |
64 |
| -The verbosity levels are as follows: |
65 |
| - |
66 |
| -0 - Disable printing |
67 |
| -1 - Print only the executed instructions |
68 |
| -2 - Print only the executed instructions, and show the execution results |
69 |
| -3 - Print executed and instruction not executed due to condition code |
70 |
| -4 - Also print instructions invalidated in the pipeline due to jumps |
71 |
| -5 - Also print instructions that include hub and hardware waits |
72 |
| -6 - Also print instructions that include icache waits |
73 |
| -7 - Also print instructions waiting for a pin state |
74 |
| -8 - Print all cycles, including waitcnt waits |
75 |
| - |
76 |
| -The verbosity level is entered as a hexadecimal number. If the verbosity level |
77 |
| -is entered as a single digit it will apply to all cogs. If more than one digit |
78 |
| -is entered each digit will be used for each cog, starting with cog 0 for the |
79 |
| -right-most digit. As an example, a value of 456 will cause 6 to be used for |
80 |
| -cog 0, 5 for cog 1, and 4 for cog 2. All other cogs will use 0. |
81 |
| - |
82 |
| - |
83 |
| -Implemented Opcodes |
84 |
| -------------------- |
85 |
| -abs add addabs addptra addptrb addptrx addptry adds |
86 |
| -addsx addx and andn augd augs bingry blmask |
87 |
| -call calla callad callb callbd calld callx callxd |
88 |
| -cally callyd chkptrx chkptry clkset clracca clraccb clraccs |
89 |
| -clrb clrp cmp cmpcnt cmps cmpsub cmpsx cmpx |
90 |
| -cogid coginit cognew cogstop dcachex decd decds decmod |
91 |
| -decod2 decod3 decod4 decod5 div32 div32u div64 div64d |
92 |
| -div64u djnz djnzd djz djzd encod fixinda fixindb |
93 |
| -fixindx frac getacah getacal getacbh getacbl getbyte getcnt |
94 |
| -getdivq getdivr getmulh getmull getnib getnp getp getptra |
95 |
| -getptrb getptrx getptry getsqrt getword icachen icachep icachex |
96 |
| -ijnz ijnzd ijz ijzd incd incds incmod isob |
97 |
| -jmp jmpd jmpsw jmpswd jnp jnpd jnz jnzd |
98 |
| -jp jpd jz jzd locbase locbyte lockclr locknew |
99 |
| -lockret lockset loclong locptra locptrb locword maca macb |
100 |
| -max maxs mergew min mins mov mul mul32 |
101 |
| -mul32u muxc muxnc muxnz muxz neg negc negnc |
102 |
| -negnz negz not notb notp offp onecnt or |
103 |
| -pop popzc push pushzc rcl rcr rdaux rdauxr |
104 |
| -rdbyte rdbytec rdlong rdlongc rdwide rdwidec rdword rdwordc |
105 |
| -repd reps ret reta retad retb retbd retd |
106 |
| -retx retxd rety retyd rev rol ror sar |
107 |
| -saracca saraccb saraccs setacca setaccb setb setbc setbnc |
108 |
| -setbnz setbyte setbz setd seti setindb setindx setnib |
109 |
| -setp setpc setpnc setpnz setptra setptrb setptrx setptry |
110 |
| -setpz sets setwide setwidz setword setzc seussf seussr |
111 |
| -shl shr splitw sqrt32 sqrt64 sub subabs subcnt |
112 |
| -subptra subptrb subptrx subptry subr subs subsx subx |
113 |
| -sumc sumnc sumnz sumz test testn wait waitcnt |
114 |
| -waitpeq waitpne wraux wrauxr wrbyte wrlong wrwide wrword |
115 |
| -xor zercnt |
116 |
| - |
117 |
| - |
118 |
| -Opcodes Not Implemented |
119 |
| ------------------------ |
120 |
| -addphsa addphsb addphss addpix bcdbin binbcd blnpix capctra |
121 |
| -capctrb capctrs cfgdac0 cfgdac1 cfgdac2 cfgdac3 cfgdacs cfgpins |
122 |
| -cmpr decpat eswap4 eswap8 getcntx getcosa getcosb getlfsr |
123 |
| -getphsa getphsb getphza getphzb getpix getqx getqy getqz |
124 |
| -getsina getsinb grybin incpat jmplist jmptask locinst mergeb |
125 |
| -mixpix movbyts mulpix packrgb passcnt polctra polctrb polvid |
126 |
| -qartan qexp qlog qrotate qsincos rolbyte rolnib rolword |
127 |
| -scl serina serinb serouta seroutb setbyts setctra setctrb |
128 |
| -setctrs setdac0 setdac1 setdac2 setdac3 setdacs setfrqa setfrqb |
129 |
| -setfrqs setmap setmix setphsa setphsb setphss setpix setpixa |
130 |
| -setpixb setpixg setpixr setpixu setpixv setpixw setpixz setpora |
131 |
| -setporb setporc setpord setqi setqz setrace setsera setserb |
132 |
| -settask setvid setvidi setvidq setvidy setwava setwavb setwavs |
133 |
| -setwrds setx setxch setxft splitb subphsa subphsb subphss |
134 |
| -synctra synctrb taskid testb unpkrgb waitpf waitpr waitpx |
135 |
| -waitvid |
| 1 | +Spinsim 0.97 |
| 2 | + |
| 3 | +This version of spinsim supports most of the opcodes in the P2 v20 instruction |
| 4 | +set. The opcodes that are not supported are as follows: |
| 5 | + |
| 6 | + xzero xinit xcont clkset setdacs setxfrq getxcos getxsin |
| 7 | + setbrk setcy setci setcq setcfrq setcmod getrnd xoro32 |
| 8 | + skip skipf execf |
| 9 | + |
| 10 | +skip, skipf and execf have been partially implemented, but do not handle jumps |
| 11 | +or interrupts correctly. |
| 12 | + |
| 13 | +Spinsim runs in the P1 mode by default. It can be set to run in the P2 mode |
| 14 | +with the -t parameter. In the P2 mode, spinsim will load a P2 binary file into |
| 15 | +hub RAM, and start cog 0 with the code located at $000. A simulated serial |
| 16 | +port is supported by using the -b option. The default baud rate is 115200, but |
| 17 | +other rates can be used by specifying it with -b, such as -b9600. The serial |
| 18 | +port uses pins 63 and 62 when in the P2 mode. |
| 19 | + |
| 20 | +Spinsim is built under Linux, MinGW or Cygwin by using the Makefile, and typing |
| 21 | +make. The Windows executable, spinsim.exe is included with this distribution. |
| 22 | + |
| 23 | +The sub-directory verify contains five programs that have been used to test |
| 24 | +spinsim against the FPGA implementation. Approximately 150 instructions have |
| 25 | +been verified to match the hardware. The verify directory contains the |
| 26 | +original C source code and the binary each of the five programs. It also |
| 27 | +contains the output from running the test programs on the FPGA. |
| 28 | + |
| 29 | +A test program can be run by going into the verify directory and typing |
| 30 | + |
| 31 | +../spinsim -t -b testopsa.bin |
| 32 | + |
| 33 | +The output can be redirected to a file and compared with the hardware file |
| 34 | +to verify that spinsim matches the hardware. |
| 35 | + |
| 36 | +Spinsim supports the cordic instructions, but implements them with C functions |
| 37 | +instead of simulating the cordic hardware. The instructions xvector and |
| 38 | +xrotate are functionally equivalent to the P2, but will produce slightly |
| 39 | +different results. qdiv and qfract bit exact results as long as the quotient |
| 40 | +fits within 32 bits. It produces different results if the quotient overflows |
| 41 | +a 32-bit value. The I/O streamer is currently not supported. |
| 42 | + |
| 43 | +Spinsim contains a simple debugger, which is enabled with the -d command-line |
| 44 | +option. The debugger prints the prompt "DEBUG>" to indicate that it is ready |
| 45 | +to accept a command. The "help" command will print the following: |
| 46 | + |
| 47 | +Debug Commands |
| 48 | +help - Print command list |
| 49 | +exit - Exit spinsim |
| 50 | +step - Run one cycle |
| 51 | +stepx - Run next executed instruction |
| 52 | +run - Run continuously |
| 53 | +verbose # - Set verbosity level |
| 54 | +reboot - Reboot the Prop |
| 55 | +setbr cog addr - Set breakpoint for cog to addr |
| 56 | +state cog - Dump cog state |
| 57 | +peekc cog addr - Print out a cog memory location |
| 58 | +peekh addr - Print out a hub memory location |
| 59 | + |
| 60 | +The "step" command will run one cycle, and the "stepx" command will run any |
| 61 | +non-executing cycles until it encounters an instruction that is executed. |
| 62 | +The previous command can be executed again by just pushing the enter key. |
| 63 | +This is useful for stepping where the "step" command is typed once, and |
| 64 | +the enter key can then be used to step again. |
| 65 | + |
| 66 | +The "run" command will run until a breakpoint is encountered or ^] is typed. |
| 67 | +^] is typed by holding down the control key and pressing the "]" key. |
| 68 | +While running, spinsim will print out the results of each cycle as |
| 69 | +controlled by the verbosity level, which is set by the "verbose" command. |
| 70 | +The verbosity level can also be set with the command-line parameter "-v#". |
| 71 | + |
| 72 | +The verbosity levels are as follows: |
| 73 | + |
| 74 | +0 - Disable printing |
| 75 | +1 - Print only the executed instructions |
| 76 | +2 - Print only the executed instructions, and show the execution results |
| 77 | +3 - Print executed and instruction not executed due to condition code |
| 78 | +4 - Also print instructions invalidated in the pipeline due to jumps |
| 79 | +5 - Also print instructions that include hub and hardware waits |
| 80 | +6 - Also print instructions that include icache waits |
| 81 | +7 - Also print instructions waiting for a pin state |
| 82 | +8 - Print all cycles, including waitcnt waits |
| 83 | + |
| 84 | +The verbosity level is entered as a hexadecimal number. If the verbosity level |
| 85 | +is entered as a single digit it will apply to all cogs. If more than one digit |
| 86 | +is entered each digit will be used for each cog, starting with cog 0 for the |
| 87 | +right-most digit. As an example, a value of 456 will cause 6 to be used for |
| 88 | +cog 0, 5 for cog 1, and 4 for cog 2. All other cogs will use 0. |
0 commit comments