Commit | Line | Data |
---|---|---|
f6e94cb2 AT |
1 | # NED - Simulator # |
2 | ||
3 | A simulator, assembler, disassembler and graphical front panel implementing NED | |
4 | v1. Browse the [source | |
5 | code](http://gitweb.subgeniuskitty.com/?p=ned-v1-simulator/.git;a=tree). | |
6 | ||
7 | ## Status ## | |
8 | ||
9 | The assembler, disassembler, and front panel are fully functional. The CPU | |
10 | simulator only supports a single CPU and does not implement the `CMPSWP` | |
11 | instruction but is otherwise functional. | |
12 | ||
13 | The calculator included as an example of NED assembly is also fully functional. | |
14 | ||
15 | ## Getting Started ## | |
16 | ||
17 | Obtain a snapshot of the repository. | |
18 | ||
19 | wget -O ned.tgz "http://gitweb.subgeniuskitty.com/?p=ned-v1-simulator/.git;a=snapshot;h=HEAD;sf=tgz" | |
20 | tar xzf ned.tgz | |
21 | cd ned-v1-simulator-HEAD* | |
22 | ||
23 | Build all the tools by executing `make` in the top-level directory or use | |
24 | `make` in individual project subfolders. Note that `nedfp` requires SDL2 and | |
25 | SDL2_ttf but is not required for simulation. | |
26 | ||
27 | No `install` targets are supplied for `make`. Instead, manually copy the | |
28 | binaries wherever you want or adjust your `$PATH` to use them in place. For example: | |
29 | ||
30 | export PATH=/home/username/ned/nedasm:/home/username/ned/nedsim:$PATH | |
31 | ||
32 | Once the NED binaries are accessible from your `$PATH`, the calculator example | |
33 | can be run with `make sim`. Exit with `Ctrl-C`. | |
34 | ||
35 | cd software/4func_calculator | |
36 | make sim | |
37 | <calculator starts up and takes control of the screen> | |
38 | ||
39 | To use `nedfp` as a graphical front panel for debugging, first start `nedfp` | |
40 | with no arguments. Then, execute `nedsim` with flags for IP address and port. | |
41 | The `-s` flag can be useful in slowing the simulation down enough to understand | |
42 | `nedfp`'s output. | |
43 | ||
44 | nedfp/nedfp & | |
45 | nedasm/nedasm -i software/4func_calculator/calc/asm -o /tmp/calc.bin | |
46 | nedsim/nedsim -i /tmp/calc.bin -a 127.0.0.1 -p 4999 -s 10000 | |
47 | ||
48 | Binaries can be disassembled with `neddis`. Using the calculator as an example: | |
49 | ||
50 | % ./neddis/neddis -i ./calc.bin -s -l | |
51 | ||
52 | Summary | |
53 | ===================================== | |
54 | Magic: 0x00000107 | |
55 | Machine ID: 0x000000d7 | |
56 | Flags: 0x00000000 | |
57 | Text Size: 0x00000600 bytes | |
58 | Data Size: 0x00000000 bytes | |
59 | BSS Size: 0x00000000 bytes | |
60 | Symbol Table Size: 0x00000514 bytes | |
61 | Entry Point: 0x20000000 | |
62 | Text Reloc. Size: 0x00000000 bytes | |
63 | Data Reloc. Size: 0x00000000 bytes | |
64 | ||
65 | ||
66 | Offset || Hex || Binary || Description | |
67 | =========================================================================================================================================== | |
68 | 0x20000000 0x01041041 00 000001 000001 000001 000001 000001 NOP NOP NOP NOP NOP | |
69 | ||
70 | calc: | |
71 | 0x20000004 0x90000044 1 00100000 00000000 00000000 1000100 WORD =====> 0x20000088 04000000210 536871048 | |
72 | 0x20000008 0x2808d381 00 101000 000010 001101 001110 000001 IM_8 LOAD SWAP JMP NOP | |
73 | ||
74 | calcloop: | |
75 | 0x2000000c 0x900000d6 1 00100000 00000000 00000001 1010110 WORD =====> 0x200001ac 04000000654 536871340 | |
76 | 0x20000010 0x2808d381 00 101000 000010 001101 001110 000001 IM_8 LOAD SWAP JMP NOP | |
77 | 0x20000014 0x900002b8 1 00100000 00000000 00000101 0111000 WORD =====> 0x20000570 04000002560 536872304 | |
78 | 0x20000018 0x2808d381 00 101000 000010 001101 001110 000001 IM_8 LOAD SWAP JMP NOP | |
79 | 0x2000001c 0x18041041 00 011000 000001 000001 000001 000001 LDSP+0 NOP NOP NOP NOP | |
80 | 0x20000020 0x900000ec 1 00100000 00000000 00000001 1101100 WORD =====> 0x200001d8 04000000730 536871384 | |
81 | 0x20000024 0x2808d381 00 101000 000010 001101 001110 000001 IM_8 LOAD SWAP JMP NOP | |
82 | 0x20000028 0x18041041 00 011000 000001 000001 000001 000001 LDSP+0 NOP NOP NOP NOP | |
83 | 0x2000002c 0x90000122 1 00100000 00000000 00000010 0100010 WORD =====> 0x20000244 04000001104 536871492 | |
84 | 0x20000030 0x2808d381 00 101000 000010 001101 001110 000001 IM_8 LOAD SWAP JMP NOP | |
85 | 0x20000034 0x18041041 00 011000 000001 000001 000001 000001 LDSP+0 NOP NOP NOP NOP | |
86 | 0x20000038 0x900000fc 1 00100000 00000000 00000001 1111100 WORD =====> 0x200001f8 04000000770 536871416 | |
87 | 0x2000003c 0x2808d381 00 101000 000010 001101 001110 000001 IM_8 LOAD SWAP JMP NOP | |
88 | 0x20000040 0x18041041 00 011000 000001 000001 000001 000001 LDSP+0 NOP NOP NOP NOP | |
89 | 0x20000044 0x90000196 1 00100000 00000000 00000011 0010110 WORD =====> 0x2000032c 04000001454 536871724 | |
90 | 0x20000048 0x2808d381 00 101000 000010 001101 001110 000001 IM_8 LOAD SWAP JMP NOP | |
91 | 0x2000004c 0x18041041 00 011000 000001 000001 000001 000001 LDSP+0 NOP NOP NOP NOP | |
92 | 0x20000050 0x90000136 1 00100000 00000000 00000010 0110110 WORD =====> 0x2000026c 04000001154 536871532 | |
93 | 0x20000054 0x2808d381 00 101000 000010 001101 001110 000001 IM_8 LOAD SWAP JMP NOP | |
94 | 0x20000058 0x18041041 00 011000 000001 000001 000001 000001 LDSP+0 NOP NOP NOP NOP | |
95 | 0x2000005c 0x9000014a 1 00100000 00000000 00000010 1001010 WORD =====> 0x20000294 04000001224 536871572 | |
96 | 0x20000060 0x2808d381 00 101000 000010 001101 001110 000001 IM_8 LOAD SWAP JMP NOP | |
97 | 0x20000064 0x18041041 00 011000 000001 000001 000001 000001 LDSP+0 NOP NOP NOP NOP | |
98 | 0x20000068 0x90000160 1 00100000 00000000 00000010 1100000 WORD =====> 0x200002c0 04000001300 536871616 | |
99 | 0x2000006c 0x2808d381 00 101000 000010 001101 001110 000001 IM_8 LOAD SWAP JMP NOP | |
100 | 0x20000070 0x18041041 00 011000 000001 000001 000001 000001 LDSP+0 NOP NOP NOP NOP | |
101 | 0x20000074 0x90000176 1 00100000 00000000 00000010 1110110 WORD =====> 0x200002ec 04000001354 536871660 | |
102 | 0x20000078 0x2808d381 00 101000 000010 001101 001110 000001 IM_8 LOAD SWAP JMP NOP | |
103 | 0x2000007c 0x06041041 00 000110 000001 000001 000001 000001 TEST NOP NOP NOP NOP | |
104 | 0x20000080 0x90000006 1 00100000 00000000 00000000 0000110 WORD =====> 0x2000000c 04000000014 536870924 | |
105 | 0x20000084 0x0e001041 00 001110 000000 000001 000001 000001 JMP HALT NOP NOP NOP | |
106 | ||
107 | calcinit: | |
108 | 0x20000088 0xa0000000 1 01000000 00000000 00000000 0000000 WORD =====> 0x40000000 010000000000 1073741824 | |
109 | 0x2000008c 0x0d80d69a 00 001101 100000 001101 011010 011010 SWAP IM_0 SWAP LDSP+2 LDSP+2 | |
110 | ||
111 | calcinitzeroloop: | |
112 | 0x20000090 0x9000005a 1 00100000 00000000 00000000 1011010 WORD =====> 0x200000b4 04000000264 536871092 | |
113 | 0x20000094 0x2808d381 00 101000 000010 001101 001110 000001 IM_8 LOAD SWAP JMP NOP | |
114 | 0x20000098 0x2069a303 00 100000 011010 011010 001100 000011 IM_0 LDSP+2 LDSP+2 ADD STORE | |
115 | 0x2000009c 0x18041041 00 011000 000001 000001 000001 000001 LDSP+0 NOP NOP NOP NOP | |
116 | 0x200000a0 0x90000058 1 00100000 00000000 00000000 1011000 WORD =====> 0x200000b0 04000000260 536871088 | |
117 | 0x200000a4 0x07041041 00 000111 000001 000001 000001 000001 BRZ NOP NOP NOP NOP | |
118 | 0x200000a8 0x90000048 1 00100000 00000000 00000000 1001000 WORD =====> 0x20000090 04000000220 536871056 | |
119 | 0x200000ac 0x0e041041 00 001110 000001 000001 000001 000001 JMP NOP NOP NOP NOP | |
120 | ||
121 | calcinitzeroloopend: | |
122 | 0x200000b0 0x0618e041 00 000110 000110 001110 000001 000001 TEST TEST JMP NOP NOP | |
123 | ||
124 | incrementstackindex: | |
125 | 0x200000b4 0x0d90c62c 00 001101 100100 001100 011000 101100 SWAP IM_4 ADD LDSP+0 IM_12 | |
126 | 0x200000b8 0x90000066 1 00100000 00000000 00000000 1100110 WORD =====> 0x200000cc 04000000314 536871116 | |
127 | 0x200000bc 0x1a3522a1 00 011010 001101 010010 001010 100001 LDSP+2 SWAP STSP+2 NOT IM_1 | |
128 | 0x200000c0 0x0c306b02 00 001100 001100 000110 101100 000010 ADD ADD TEST IM_12 LOAD | |
129 | 0x200000c4 0x2220d1c6 00 100010 001000 001101 000111 000110 IM_2 AND SWAP BRZ TEST | |
130 | 0x200000c8 0x20041041 00 100000 000001 000001 000001 000001 IM_0 NOP NOP NOP NOP | |
131 | <snip> | |
132 |