OpenCores
URL https://opencores.org/ocsvn/ssbcc/ssbcc/trunk

Subversion Repositories ssbcc

[/] [ssbcc/] [trunk/] [core/] [9x8/] [doc/] [opcodes.html] - Blame information for rev 4

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 sinclairrf
 
2
<!-- Copyright 2012, Sinclair R.F., Inc. -->
3
<html>
4
<title>
5
Opcodes
6
</title>
7
<body>
8
<h1>Opcodes for the 9x8 micro controller</h1><br/>
9
Copyright 2012, Sinclair R.F., Inc.<br/><br/>
10
This document describes the opcodes for the 9x8 micro controller.  The first
11
  section lists the opcodes in alphabetic order, the second lists them by their
12
  numerical value, and the final section describes each one in detail.<br/><br/>
13
Some of the opcodes are not directly accessible by the assembler and must be
14
  accessed through macros.  See <a href="macros.html">macros</a> for
15
  documentation on accessing these opcodes.  Other opcodes can be directly
16
  accessed or can be accessed through a macro.<br/><br/>
17
<h1>OPCODES</h1>
18
  This section documents the opcodes.<br/><br/>
19
  Alphabetic listing:
20
    <a href="#&">&amp;</a>,
21
    <a href="#+">+</a>,
22
    <a href="#-">-</a>,
23
    <a href="#-1<>">-1&lt;&gt;</a>,
24
    <a href="#-1=">-1=</a>,
25
    <a href="#0<>">0&lt;&gt;</a>,
26
    <a href="#0=">0=</a>,
27
    <a href="#0>>">0&gt;&gt;</a>,
28
    <a href="#1+">1+&gt;</a>,
29
    <a href="#1-">1-&gt;</a>,
30
    <a href="#1>>">1&gt;&gt;</a>,
31
    <a href="#<<0">&lt;&lt;0</a>,
32
    <a href="#<<1">&lt;&lt;1</a>,
33
    <a href="#<<msb">&lt;&lt;msb</a>,
34
    <a href="#>r">&gt;r</a>,
35
    <a href="#^">^</a>,
36
    <a href="#call">call</a>,
37
    <a href="#callc">callc</a>,
38
    <a href="#drop">drop</a>,
39
    <a href="#dup">dup</a>,
40
    <a href="#fetch">fetch</a>,
41
    <a href="#fetch+">fetch+</a>,
42
    <a href="#fetch-">fetch-</a>,
43
    <a href="#inport">inport</a>,
44
    <a href="#jump">jump</a>,
45
    <a href="#jumpc">jumpc</a>,
46
    <a href="#lsb>>">lsb&gt;&gt;</a>,
47
    <a href="#msb>>">msb&gt;&gt;</a>,
48
    <a href="#nip">nip</a>,
49
    <a href="#nop">nop</a>,
50
    <a href="#or">or</a>,
51
    <a href="#outport">outport</a>,
52
    <a href="#over">over</a>,
53
    <a href="#push">push</a>,
54
    <a href="#r>">r&gt;</a>,
55
    <a href="#r@">r@</a>,
56
    <a href="#return">return</a>,
57
    <a href="#store">store</a>,
58
    <a href="#store+">store+</a>,
59
    <a href="#store-">store-</a>,
60
    <a href="#swap">swap</a>
61
    <br/><br/>
62
<h1><a name="opcode_mapping">Opcode Mapping</a></h1>
63
  <table>
64
  <tr>
65
    <th align="left">Opcode&nbsp;&nbsp;&nbsp;</th>
66
      <th>8</th><th>7</th><th>6</th><th>5</th><th>4</th><th>3&nbsp;&nbsp;&nbsp;</th><th>2</th><th>1</th><th>0&nbsp;&nbsp;&nbsp;</th>
67
      <th align="left">Description</th>
68
      </tr>
69
    <th align="left"><a href="#nop">nop</a></th>
70
      <td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td>
71
      <td align="left">no operation</td>
72
      </tr>
73
    <th align="left"><a href="#<<0">&lt;&lt;0</a></th>
74
      <td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>1</td>
75
      <td align="left">left shift 1 bit and bring in a 0</td>
76
      </tr>
77
    <th align="left"><a href="#<<1">&lt;&lt;1</a></th>
78
      <td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>1</td><td>0</td>
79
      <td align="left">left shift 1 bit and bring in a 1</td>
80
      </tr>
81
    <th align="left"><a href="#<<msb">&lt;&lt;msb</a></th>
82
      <td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>1</td><td>1</td>
83
      <td align="left">left shift 1 bit and rotate the msb into the lsb</td>
84
      </tr>
85
    <th align="left"><a href="#0>>">0&gt;&gt;</a></th>
86
      <td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>1</td><td>0</td><td>0</td>
87
      <td align="left">right shift 1 bit and bring in a 0</td>
88
      </tr>
89
    <th align="left"><a href="#1>>">1&gt;&gt;</a></th>
90
      <td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>1</td><td>0</td><td>1</td>
91
      <td align="left">right shift 1 bit and bring in a 1</td>
92
      </tr>
93
    <th align="left"><a href="#msb>>">msb&gt;&gt;</a></th>
94
      <td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>1</td><td>1</td><td>0</td>
95
      <td align="left">right shift 1 bit and keep the msb the same</td>
96
      </tr>
97
    <th align="left"><a href="#lsb>>">lsb&gt;&gt;</a></th>
98
      <td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>1</td><td>1</td><td>1</td>
99
      <td align="left">right shift 1 bit and rotate the lsb into the msb</td>
100
      </tr>
101
    <th align="left"><a href="#dup">dup</a></th>
102
      <td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>1</td><td>0</td><td>0</td><td>0</td>
103
      <td align="left">push a duplicate of the top of the data stack onto the data stack</td>
104
      </tr>
105
    <th align="left"><a href="#r@">r@</a></th>
106
      <td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>1</td><td>0</td><td>0</td><td>1</td>
107
      <td align="left">push a duplicate of the top of the return stack onto the data stack</td>
108
      </tr>
109
    <th align="left"><a href="#over">over</a></th>
110
      <td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>1</td><td>0</td><td>1</td><td>0</td>
111
      <td align="left">push a duplicate of the next-to-top of the data stack onto the data stack</td>
112
      </tr>
113
    <th align="left"><a href="#swap">swap</a></th>
114
      <td>0</td><td>0</td><td>0</td><td>0</td><td>1</td><td>0</td><td>0</td><td>1</td><td>0</td>
115
      <td align="left">swap the top and the next-to-top of the data stack</td>
116
      </tr>
117
    <th align="left"><a href="#+">+</a></th>
118
      <td>0</td><td>0</td><td>0</td><td>0</td><td>1</td><td>1</td><td>0</td><td>0</td><td>0</td>
119
      <td align="left">pop the stack and replace the top with N+T</td>
120
      </tr>
121
    <th align="left"><a href="#-">-</a></th>
122
      <td>0</td><td>0</td><td>0</td><td>0</td><td>1</td><td>1</td><td>1</td><td>0</td><td>0</td>
123
      <td align="left">pop the stack and replace the top with N-T</td>
124
      </tr>
125
    <th align="left"><a href="#0=">0=</a></th>
126
      <td>0</td><td>0</td><td>0</td><td>1</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td>
127
      <td align="left">replace the top of the stack with "<tt>0xFF</tt>" if it is "<tt>0x00</tt>" (i.e., it is zero), otherwise replace it with "<tt>0x00</tt>"<br/>
128
      </tr>
129
    <th align="left"><a href="#0<>">0&lt;&gt;</a></th>
130
      <td>0</td><td>0</td><td>0</td><td>1</td><td>0</td><td>0</td><td>0</td><td>0</td><td>1</td>
131
      <td align="left">replace the top of the stack with "<tt>0xFF</tt>" if it is not "<tt>0x00</tt>" (i.e., it is non-zero), otherwise replace it with "<tt>0x00</tt>"<br/>
132
      </tr>
133
    <th align="left"><a href="#-1=">-1=</a></th>
134
      <td>0</td><td>0</td><td>0</td><td>1</td><td>0</td><td>0</td><td>0</td><td>1</td><td>0</td>
135
      <td align="left">replace the top of the stack with "<tt>0xFF</tt>" if it is "<tt>0xFF</tt>" (i.e., it is all ones), otherwise replace it with "<tt>0x00</tt>"<br/>
136
      </tr>
137
    <th align="left"><a href="#-1<>">-1&lt;&gt;</a></th>
138
      <td>0</td><td>0</td><td>0</td><td>1</td><td>0</td><td>0</td><td>0</td><td>1</td><td>1</td>
139
      <td align="left">replace the top of the stack with "<tt>0xFF</tt>" if it is not "<tt>0xFF</tt>" (i.e., it is not all ones), otherwise replace it with "<tt>0x00</tt>"<br/>
140
      </tr>
141
    <th align="left"><a href="#return">return</a></th>
142
      <td>0</td><td>0</td><td>0</td><td>1</td><td>0</td><td>1</td><td>0</td><td>0</td><td>0</td>
143
      <td align="left">return from a function call</td>
144
      </tr>
145
    <th align="left"><a href="#inport">inport</a></th>
146
      <td>0</td><td>0</td><td>0</td><td>1</td><td>1</td><td>0</td><td>0</td><td>0</td><td>0</td>
147
      <td align="left">replace the top of the stack with the contents of the specified input port</td>
148
      </tr>
149
    <th align="left"><a href="#outport">outport</a></th>
150
      <td>0</td><td>0</td><td>0</td><td>1</td><td>1</td><td>1</td><td>0</td><td>0</td><td>0</td>
151
      <td align="left">write the next-to-top of the data stack to the output port specified by the top of the data stack</td>
152
      </tr>
153
    <th align="left"><a href="#>r">&gt;r</a></th>
154
      <td>0</td><td>0</td><td>1</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td>
155
      <td align="left">Pop the top of the data stack and push it onto the return stack</td>
156
      </tr>
157
    <th align="left"><a href="#r>">r&gt;</a></th>
158
      <td>0</td><td>0</td><td>1</td><td>0</td><td>0</td><td>1</td><td>0</td><td>0</td><td>1</td>
159
      <td align="left">Pop the top of the return stack and push it onto the data stack</td>
160
      </tr>
161
    <th align="left"><a href="#&">&amp;</a></th>
162
      <td>0</td><td>0</td><td>1</td><td>0</td><td>1</td><td>0</td><td>0</td><td>0</td><td>0</td>
163
      <td align="left">pop the stack and replace the top with N &amp; T</td>
164
      </tr>
165
    <th align="left"><a href="#or">or</a></th>
166
      <td>0</td><td>0</td><td>1</td><td>0</td><td>1</td><td>0</td><td>0</td><td>0</td><td>1</td>
167
      <td align="left">pop the stack and replace the top with N | T</td>
168
      </tr>
169
    <th align="left"><a href="#^">^</a></th>
170
      <td>0</td><td>0</td><td>1</td><td>0</td><td>1</td><td>0</td><td>0</td><td>1</td><td>0</td>
171
      <td align="left">pop the stack and replace the top with N ^ T</td>
172
      </tr>
173
    <th align="left"><a href="#nip">nip</a></th>
174
      <td>0</td><td>0</td><td>1</td><td>0</td><td>1</td><td>0</td><td>0</td><td>1</td><td>1</td>
175
      <td align="left">pop the next-to-top from the data stack</td>
176
      </tr>
177
    <th align="left"><a href="#drop">drop</a></th>
178
      <td>0</td><td>0</td><td>1</td><td>0</td><td>1</td><td>0</td><td>1</td><td>0</td><td>0</td>
179
      <td align="left">drop the top value from the stack<tt></td>
180
      </tr>
181
    <th align="left"><a href="#1+">1+</a></th>
182
      <td>0</td><td>0</td><td>1</td><td>0</td><td>1</td><td>1</td><td>0</td><td>0</td><td>0</td>
183
      <td align="left">Add 1 to T</td>
184
      </tr>
185
    <th align="left"><a href="#1-">1-</a></th>
186
      <td>0</td><td>0</td><td>1</td><td>0</td><td>1</td><td>1</td><td>1</td><td>0</td><td>0</td>
187
      <td align="left">Subtract 1 from T</td>
188
      </tr>
189
    <th align="left"><a href="#store">store</a></th>
190
      <td>0</td><td>0</td><td>1</td><td>1</td><td>0</td><td>0</td><td>0</td><td>b</td><td>b</td>
191
      <td align="left">Store N in the T'th entry in bank "<tt>bb</tt>", drop the top of the data stack</td>
192
      </tr>
193
    <th align="left"><a href="#fetch">fetch</a></th>
194
      <td>0</td><td>0</td><td>1</td><td>1</td><td>0</td><td>1</td><td>0</td><td>b</td><td>b</td>
195
      <td align="left">Exchange the top of the stack with the T'th value from bank "<tt>bb</tt>"</td>
196
      </tr>
197
    <th align="left"><a href="#store+">store+</a></th>
198
      <td>0</td><td>0</td><td>1</td><td>1</td><td>1</td><td>0</td><td>0</td><td>b</td><td>b</td>
199
      <td align="left">Store N in the T'th entry in bank "<tt>bb</tt>", nip the data stack, and increment T</td>
200
      </tr>
201
    <th align="left"><a href="#store-">store-</a></th>
202
      <td>0</td><td>0</td><td>1</td><td>1</td><td>1</td><td>0</td><td>1</td><td>b</td><td>b</td>
203
      <td align="left">Store N in the T'th entry in bank "<tt>bb</tt>", nip the data stack, and decrement T</td>
204
      </tr>
205
    <th align="left"><a href="#fetch+">fetch+</a></th>
206
      <td>0</td><td>0</td><td>1</td><td>1</td><td>1</td><td>1</td><td>0</td><td>b</td><td>b</td>
207
      <td align="left">Push the T'th entry from bank "<tt>bb</tt>" into the data stack as N and increment T</td>
208
      </tr>
209
    <th align="left"><a href="#fetch-">fetch-</a></th>
210
      <td>0</td><td>0</td><td>1</td><td>1</td><td>1</td><td>1</td><td>1</td><td>b</td><td>b</td>
211
      <td align="left">Push the T'th entry from bank "<tt>bb</tt>" into the data stack as N and decrement T</td>
212
      </tr>
213
    <th align="left"><a href="#jump">jump</a></th>
214
      <td>0</td><td>1</td><td>0</td><td>0</td><td>x</td><td>x</td><td>x</td><td>x</td><td>x</td>
215
      <td align="left">Jump to the address "<tt>x_xxxx_TTTT_TTTT</tt>"</td>
216
      </tr>
217
    <th align="left"><a href="#jumpc">jumpc</a></th>
218
      <td>0</td><td>1</td><td>0</td><td>1</td><td>x</td><td>x</td><td>x</td><td>x</td><td>x</td>
219
      <td align="left">Conditionally jump to the address "<tt>x_xxxx_TTTT_TTTT</tt>"</td>
220
      </tr>
221
    <th align="left"><a href="#call">call</a></th>
222
      <td>0</td><td>1</td><td>1</td><td>0</td><td>x</td><td>x</td><td>x</td><td>x</td><td>x</td>
223
      <td align="left">Call the function at address "<tt>x_xxxx_TTTT_TTTT</tt>"</td>
224
      </tr>
225
    <th align="left"><a href="#callc">callc</a></th>
226
      <td>0</td><td>1</td><td>1</td><td>1</td><td>x</td><td>x</td><td>x</td><td>x</td><td>x</td>
227
      <td align="left">Conditionally call the function at address "<tt>x_xxxx_TTTT_TTTT</tt>"</td>
228
      </tr>
229
    <th align="left"><a href="#push">push</a></th>
230
      <td>1</td><td>x</td><td>x</td><td>x</td><td>x</td><td>x</td><td>x</td><td>x</td><td>x</td>
231
      <td align="left">Push the 8-bit value "<tt>xxxx_xxxx</tt>" onto the data stack.</td>
232
      </tr>
233
  </table>
234
<h1>Detailed Descriptions</h1>
235
  <h2><a name="&">Instruction:  &amp;</a></h2>
236
    <b>Desription:</b>  Pop the data stack and replace the top with the bitwise
237
      and of the previous top and next-to-top.<br/><br/>
238
    <b>Operation:</b><br/><br/>
239
      PC &leftarrow; PC+1<br/>
240
      R and <tt>return</tt> unchanged<br/>
241
      T &leftarrow; T &amp; N<br/>
242
      N &leftarrow; <tt>stack--</tt><br/>
243
      <br/>
244
  <h2><a name="+">Instruction:  +</a></h2>
245
    <b>Desription:</b>  Pop the data stack and replace the top with the
246
      8&nbsp;sum of the previous top and next-to-top.<br/><br/>
247
    <b>Operation:</b><br/><br/>
248
      PC &leftarrow; PC+1<br/>
249
      R and <tt>return</tt> unchanged<br/>
250
      T &leftarrow; N + T<br/>
251
      N &leftarrow; <tt>stack--</tt><br/>
252
      <br/>
253
  <h2><a name="-">Instruction:  -</a></h2>
254
    <b>Desription:</b>  Pop the data stack and replace the top with the
255
      8&nbsp;difference of the previous top and next-to-top.<br/><br/>
256
    <b>Operation:</b><br/><br/>
257
      PC &leftarrow; PC+1<br/>
258
      R and <tt>return</tt> unchanged<br/>
259
      T &leftarrow; N - T<br/>
260
      N &leftarrow; <tt>stack--</tt><br/>
261
      <br/>
262
  <h2><a name="-1<>">Instruction:  -1<></a></h2>
263
    <b>Desription:</b>  Set the top of the stack to all ones if the previous
264
      value was not all ones, otherwise set it to all zeros.<br/><br/>
265
    <b>Operation:</b><br/><br/>
266
      PC &leftarrow; PC+1<br/>
267
      R and <tt>return</tt> unchanged<br/>
268
      T &leftarrow; 0xFF if T!=0xFF, 0x00 otherwise<br/>
269
      N and <tt>stack</tt> unchanged<br/>
270
      <br/>
271
  <h2><a name="-1=">Instruction:  -1=</a></h2>
272
    <b>Desription:</b>  Set the top of the stack to all ones if the previous
273
      value was all ones, otherwise set it to all zeros.<br/><br/>
274
    <b>Operation:</b><br/><br/>
275
      PC &leftarrow; PC+1<br/>
276
      R and <tt>return</tt> unchanged<br/>
277
      T &leftarrow; 0xFF if T=0xFF, 0x00 otherwise<br/>
278
      N and <tt>stack</tt> unchanged<br/>
279
      <br/>
280
  <h2><a name="0<>">Instruction:  0<></a></h2>
281
    <b>Desription:</b>  Set the top of the stack to all ones if the previous
282
      value was not all zeros, otherwise set it to all zeros.<br/><br/>
283
    <b>Operation:</b><br/><br/>
284
      PC &leftarrow; PC+1<br/>
285
      R and <tt>return</tt> unchanged<br/>
286
      T &leftarrow; 0xFF if T!=0x00, 0x00 otherwise<br/>
287
      N and <tt>stack</tt> unchanged<br/>
288
      <br/>
289
  <h2><a name="0=">Instruction:  0=</a></h2>
290
    <b>Desription:</b>  Set the top of the stack to all ones if the previous
291
      value was all zeros, otherwise set it to all zeros.<br/><br/>
292
    <b>Operation:</b><br/><br/>
293
      PC &leftarrow; PC+1<br/>
294
      R and <tt>return</tt> unchanged<br/>
295
      T &leftarrow; 0xFF if T=0x00, 0x00 otherwise<br/>
296
      N and <tt>stack</tt> unchanged<br/>
297
      <br/>
298
  <h2><a name="0>>">Instruction:  0&gt;&gt;</a></h2>
299
    <b>Desription:</b>  Right shift the top of the stack one bit, replacing the
300
      left-most bit with a zero.<br/><br/>
301
    <b>Operation:</b><br/><br/>
302
      PC &leftarrow; PC+1<br/>
303
      R and <tt>return</tt> unchanged<br/>
304
      T &leftarrow; { 0, T[7], T[6], ..., T[1] }<br/>
305
      N and <tt>stack</tt> unchanged<br/>
306
      <br/>
307
  <h2><a name="1+">Instruction:  1+</a></h2>
308
    <b>Desription:</b>  Add 1 to T.<br/><br/>
309
    <b>Operation:</b><br/><br/>
310
      PC &leftarrow; PC+1<br/>
311
      R and <tt>return</tt> unchanged<br/>
312
      T &leftarrow; T+1<br/>
313
      N and <tt>stack</tt> unchanged<br/>
314
      <br/>
315
  <h2><a name="1-">Instruction:  1-</a></h2>
316
    <b>Desription:</b>  Subtract 1 from T.<br/><br/>
317
    <b>Operation:</b><br/><br/>
318
      PC &leftarrow; PC+1<br/>
319
      R and <tt>return</tt> unchanged<br/>
320
      T &leftarrow; T-1<br/>
321
      N and <tt>stack</tt> unchanged<br/>
322
      <br/>
323
  <h2><a name="1>>">Instruction:  1&gt;&gt;</a></h2>
324
    <b>Desription:</b>  Right shift the top of the stack one bit, replacing the
325
      left-most bit with a zero.<br/><br/>
326
    <b>Operation:</b><br/><br/>
327
      PC &leftarrow; PC+1<br/>
328
      R and <tt>return</tt> unchanged<br/>
329
      T &leftarrow; { 1, T[7], T[6], ..., T[1] }<br/>
330
      N and <tt>stack</tt> unchanged<br/>
331
      <br/>
332
  <h2><a name="<<0">Instruction:  &lt;&lt;0</a></h2>
333
    <b>Desription:</b>  Left shift the top of the stack one bit, replacing the
334
      right-most bit with a zero.
335
    <b>Operation:</b><br/><br/>
336
      PC &leftarrow; PC+1<br/>
337
      R and <tt>return</tt> unchanged<br/>
338
      T &leftarrow; { T[6], T[5], ..., T[0], 0 }<br/>
339
      N and <tt>stack</tt> unchanged<br/>
340
      <br/>
341
  <h2><a name="<<1">Instruction:  &lt;&lt;1</a></h2>
342
    <b>Desription:</b>  Left shift the top of the stack one bit, replacing the
343
      right-most bit with a one.<br/>
344
    <b>Operation:</b><br/><br/>
345
      PC &leftarrow; PC+1<br/>
346
      R and <tt>return</tt> unchanged<br/>
347
      T &leftarrow; { T[6], T[5], ..., T[0], 1 }<br/>
348
      N and <tt>stack</tt> unchanged<br/>
349
      <br/>
350
  <h2><a name="<<msb">Instruction:  &lt;&lt;msb</a></h2>
351
    <b>Desription:</b>  Left shift the top of the stack one bit, leaving the
352
      right-most bit unchanged.<br/><br/>
353
    <b>Operation:</b><br/><br/>
354
      PC &leftarrow; PC+1<br/>
355
      R and <tt>return</tt> unchanged<br/>
356
      T &leftarrow; { T[6], T[5], ..., T[0], T[7] }<br/>
357
      N and <tt>stack</tt> unchanged<br/>
358
      <br/>
359
  <h2><a name=">r">Instruction:  &gt;r</a></h2>
360
    <b>Desription:</b>  Pop the data stack and push its previous value onto the
361
      return stack.<br/><br/>
362
    <b>Operation:</b><br/><br/>
363
      PC &leftarrow; PC+1<br/>
364
      R &leftarrow; T<br/>
365
      <tt>++return</tt> &leftarrow; R<br/>
366
      T &leftarrow; N<br/>
367
      N &leftarrow; <tt>stack--</tt><br/>
368
      <br/>
369
  <h2><a name="^">Instruction:  ^</a></h2>
370
    <b>Desription:</b>  Pop the data stack and replace the top with the bitwise
371
      exclusive or of the previous top and next-to-top.<br/><br/>
372
    <b>Operation:</b><br/><br/>
373
      PC &leftarrow; PC+1<br/>
374
      R and <tt>return</tt> unchanged<br/>
375
      T &leftarrow; T ^ N<br/>
376
      N &leftarrow; <tt>stack--</tt><br/>
377
      <br/>
378
  <h2><a name="call">Instruction:  call</a></h2>
379
    <b>Desription:</b>  Call the function at the address constructed from the
380
      opcode and <tt>T</tt>.  Discard&nbsp;<tt>T</tt> and push the PC onto the
381
      return stack.<br/><br/>
382
    <b>Operation:</b><br/><br/>
383
      PC &leftarrow; { O[4], ..., O[0], T[7], T[6], ..., T[0] }<br/>
384
      R &leftarrow; PC+1<br/>
385
      <tt>++return</tt> &leftarrow; R<br/>
386
      T &leftarrow; N<br/>
387
      N &leftarrow; <tt>stack--</tt><br/>
388
      <br/>
389
    <b>Special:</b><br/><br/>
390
      Interrupts are disabled during the clock cycle immediately following a
391
      call instruction.<br/><br/>
392
      The assembler normally places a "<tt>nop</tt>" instruction immediately
393
      after the "<tt>call</tt>" instruction.<br/><br/>
394
  <h2><a name="callc">Instruction:  callc</a></h2>
395
    <b>Desription:</b>  Conditionally call the function at the address
396
      constructed from the opcode and <tt>T</tt>.  Discard&nbsp;<tt>T</tt> and
397
      conditionally push the next PC onto the return stack.<br/><br/>
398
    <b>Operation:</b><br/><br/>
399
      if N != 0 then<br/>
400
      &nbsp;&nbsp;PC &leftarrow; { O[4], ..., O[0], T[7], T[6], ..., T[0] }<br/>
401
      &nbsp;&nbsp;R &leftarrow; PC<br/>
402
      &nbsp;&nbsp;<tt>++return</tt> &leftarrow; R<br/>
403
      else<br/>
404
      &nbsp;&nbsp;PC &leftarrow; PC+1<br/>
405
      &nbsp;&nbsp;R and <tt>return</tt> unchanged<br/>
406
      endif<br/>
407
      T &leftarrow; N<br/>
408
      N &leftarrow; <tt>stack--</tt><br/>
409
      <br/>
410
    <b>Special:</b><br/><br/>
411
      Interrupts are disabled during the clock cycle immediately following a
412
      callc instruction.<br/><br/>
413
      The assembler normally places a "<tt>drop</tt>" instruction immediately
414
      after the "<tt>callc</tt>" instruction.<br/><br/>
415
  <h2><a name="drop">Instruction:  drop</a></h2>
416
    <b>Desription:</b>  Pop the data stack, discarding the value that had been
417
      on the top.<br/><br/>
418
    <b>Operation:</b><br/><br/>
419
      PC &leftarrow; PC+1<br/>
420
      R and <tt>return</tt> unchanged<br/>
421
      T &leftarrow; N<br/>
422
      N &leftarrow; <tt>stack--</tt><br/>
423
      <br/>
424
  <h2><a name="dup">Instruction:  dup</a></h2>
425
    <b>Desription:</b>  Push the top of the data stack onto the data
426
      stack.<br/><br/>
427
    <b>Operation:</b><br/><br/>
428
      PC &leftarrow; PC+1<br/>
429
      R and <tt>return</tt> unchanged<br/>
430
      T &leftarrow; T<br/>
431
      N &leftarrow; T<br/>
432
      <tt>++stack</tt> &leftarrow; N<br/>
433
      <br/>
434
  <h2><a name="fetch">Instruction:  fetch</a></h2>
435
    <b>Desription:</b>  Replace the top of the data stack with an 8&nbsp;bit
436
      value from memory.  The memory bank is specified by the two
437
      least-significant bits of the opcode.  The index within the memory bank is
438
      specified by the previous value of the top of the stack.<br/><br/>
439
    <b>Operation:</b><br/><br/>
440
      PC &leftarrow; PC+1<br/>
441
      R and <tt>return</tt> unchanged<br/>
442
      T &leftarrow; bb[T] where "bb" is the bank<br/>
443
      N and <tt>stack</tt> unchanged<br/>
444
    <b>Special:</b>
445
      See <a href="#memory">memory</a> for instructions on using the fetch and
446
      vectorized fetch macros.<br/>
447
      <br/>
448
  <h2><a name="fetch+">Instruction:  fetch+</a></h2>
449
    <b>Desription:</b>  Push the T'th entry from bank "<tt>bb</tt>" onto the
450
      data stack as N and increment the top of the data stack.<br/><br/>
451
    <b>Operation:</b><br/><br/>
452
      PC &leftarrow; PC+1<br/>
453
      R and <tt>return</tt> unchanged<br/>
454
      T &leftarrow; T+1<br/>
455
      N &leftarrow; bb[T] where "bb" is the bank<br/>
456
      <tt>++stack</tt><br/>
457
    <b>Special:</b>
458
      See <a href="#memory">memory</a> for instructions on using the fetch and
459
      vectorized fetch macros.<br/>
460
      <br/>
461
  <h2><a name="fetch-">Instruction:  fetch-</a></h2>
462
    <b>Desription:</b>  Push the T'th entry from bank "<tt>bb</tt>" onto the
463
      data stack as N and decrement the top of the data stack.<br/><br/>
464
    <b>Operation:</b><br/><br/>
465
      PC &leftarrow; PC+1<br/>
466
      R and <tt>return</tt> unchanged<br/>
467
      T &leftarrow; T-1<br/>
468
      N &leftarrow; bb[T] where "bb" is the bank<br/>
469
      <tt>++stack</tt><br/>
470
    <b>Special:</b>
471
      See <a href="#memory">memory</a> for instructions on using the fetch and
472
      vectorized fetch macros.<br/>
473
      <br/>
474
  <h2><a name="inport">Instruction:  inport</a></h2>
475
    <b>Desription:</b>  Replace the top of the data stack with the 8&nbsp;value
476
      from the port specified by the previous value of the top of the data
477
      stack.<br/><br/>
478
    <b>Operation:</b><br/><br/>
479
      PC &leftarrow; PC+1<br/>
480
      R and <tt>return</tt> unchanged<br/>
481
      T &leftarrow; <tt>input_port</tt>[T]<br/>
482
      N and <tt>stack</tt> unchanged<br/>
483
      <br/>
484
    <b>Special:</b><br/><br/>
485
      The recommended procedure to read from an inport port is to use the
486
      "<tt>.inport</tt>" macro.<br/><br/>
487
  <h2><a name="jump">Instruction:  jump</a></h2>
488
    <b>Desription:</b>  Jump to the address constructed from the opcode and
489
      <tt>T</tt>.  Discard&nbsp;<tt>T</tt>.<br/><br/>
490
    <b>Operation:</b><br/><br/>
491
      PC &leftarrow; { O[4], ..., O[0], T[7], T[6], ..., T[0] }<br/>
492
      R and <tt>return</tt> unchanged<br/>
493
      T &leftarrow; N<br/>
494
      N &leftarrow; <tt>stack--</tt><br/>
495
      <br/>
496
    <b>Special:</b><br/><br/>
497
      Interrupts are disabled during the clock cycle immediately following a
498
      jump instruction.<br/><br/>
499
      The assembler normally places a "<tt>nop</tt>" instruction immediately
500
      after the "<tt>jump</tt>" instruction.<br/><br/>
501
  <h2><a name="jumpc">Instruction:  jumpc</a></h2>
502
    <b>Desription:</b>  Jump to the address constructed from the opcode and
503
      <tt>T</tt> if <tt>N</tt> is non-zero.  Discard <tt>S</tt>
504
      and&nbsp;<tt>N</tt>.<br/><br/>
505
    <b>Operation:</b><br/><br/>
506
      if N != 0 then<br/>
507
      &nbsp;&nbsp;PC &leftarrow; { O[4], ..., O[0], T[7], T[6], ..., T[0] }<br/>
508
      else<br/>
509
      &nbsp;&nbsp;PC &leftarrow; PC+1<br/>
510
      end if<br/>
511
      R and <tt>return</tt> unchanged<br/>
512
      T &leftarrow; N<br/>
513
      N &leftarrow; <tt>stack--</tt><br/>
514
      <br/>
515
    <b>Special:</b><br/><br/>
516
      Interrupts are disabled during the clock cycle immediately following a
517
      jumpc instruction.<br/><br/>
518
      The assembler normally places a "<tt>drop</tt>" instruction immediately
519
      after the "<tt>jump</tt>" instruction so that the conditional is dropped
520
      from the data stack.<br/><br/>
521
  <h2><a name="lsb>>">Instruction:  lsb&gt;&gt;</a></h2>
522
    <b>Desription:</b>  Right shift the top of the stack one bit, replacing the
523
      left-most bit with the previous value of the right-most bit.<br/><br/>
524
    <b>Operation:</b><br/><br/>
525
      PC &leftarrow; PC+1<br/>
526
      R and <tt>return</tt> unchanged<br/>
527
      T &leftarrow; { T[0], T[7], T[6], ..., T[1] }<br/>
528
      N and <tt>stack</tt> unchanged<br/>
529
      <br/>
530
  <h2><a name="msb>>">Instruction:  msb&gt;&gt;</a></h2>
531
    <b>Desription:</b>  Right shift the top of the stack one bit, preserving the
532
      value of the left-most bit.<br/><br/>
533
    <b>Operation:</b><br/><br/>
534
      PC &leftarrow; PC+1<br/>
535
      R and <tt>return</tt> unchanged<br/>
536
      T &leftarrow; { T[7], T[7], T[6], ..., T[1] }<br/>
537
      N and <tt>stack</tt> unchanged<br/>
538
      <br/>
539
  <h2><a name="nip">Instruction:  nip</a></h2>
540
    <b>Desription:</b>  Discard the next-to-top value on the data
541
      stack.<br/><br/>
542
    <b>Operation:</b><br/><br/>
543
      PC &leftarrow; PC+1<br/>
544
      R and <return</tt> unchanged<br/>
545
      T &leftarrow; T<br/>
546
      N &leftarrow; <tt>stack--</tt><br/>
547
      <br/>
548
  <h2><a name="nop">Instruction:  nop</a></h2>
549
    <b>Desription:</b>  No operation.<br/><br/>
550
    <b>Operation:</b><br/><br/>
551
      PC &leftarrow PC + 1<br/>
552
      R, <tt>return</tt>, T, N, and <tt>stack</tt> unchanged<br/>
553
      <br/>
554
  <h2><a name="or">Instruction:  or</a></h2>
555
    <b>Desription:</b>  Pop the data stack and replace the top with the bitwise
556
      or of the previous top and next-to-top.<br/><br/>
557
    <b>Operation:</b><br/><br/>
558
      PC &leftarrow; PC+1<br/>
559
      R and <tt>return</tt> unchanged<br/>
560
      T &leftarrow; T or N<br/>
561
      N &leftarrow; <tt>stack--</tt><br/>
562
      <br/>
563
  <h2><a name="outport">Instruction:  outport</a></h2>
564
    <b>Desription:</b>  Pop the data stack and write the previous next-to-top to
565
      the port specified by the previous top.<br/>
566
    <b>Operation:</b><br/><br/>
567
      PC &leftarrow; PC+1<br/>
568
      R and <tt>return</tt> unchanged<br/>
569
      T &leftarrow; N<br/>
570
      N &leftarrow; <tt>stack--</tt><br/>
571
      <tt>outport</tt>[T] &leftarrow; N<br/>
572
      <br/>
573
    <b>Special:</b><br/><br/>
574
      This instruction must be following by a "<tt>drop</tt>" in order to
575
      discard the value from the data stack that had been written to the data
576
      port.  The recommended procedure to write to an output port is to use the
577
      "<tt>.outport</tt>" macro.<br/><br/>
578
  <h2><a name="over">Instruction:  over</a></h2>
579
    <b>Desription:</b>  Push the next-to-top of the data stack onto the data
580
      stack.<br/><br/>
581
    <b>Operation:</b><br/><br/>
582
      PC &leftarrow; PC+1<br/>
583
      R and <tt>return</tt> unchanged<br/>
584
      T &leftarrow; N<br/>
585
      N &leftarrow; T<br/>
586
      <tt>++stack</tt> &leftarrow; N<br/>
587
      <br/>
588
  <h2><a name="push">Instruction:  push</a></h2>
589
    <b>Description:</b>  Push the specified 8-bit value onto the 8-bit
590
      stack.<br/><br/>
591
    <b>Operation:</b><br/><br/>
592
      PC &leftarrow; PC+1<br/>
593
      R and <tt>return</tt> unchanged<br/>
594
      T &leftarrow; <tt>opcode</tt>[7:0]<br/>
595
      N &leftarrow; T<br/>
596
      <tt>++stack</tt> &leftarrow; N<br/>
597
      <br/>
598
  <h2><a name="r>">Instruction:  r&gt;</a></h2>
599
    <b>Desription:</b>  Pop the return stack and push its previous value onto
600
      the data stack.<br/><br/>
601
    <b>Operation:</b><br/><br/>
602
      PC &leftarrow; PC+1<br/>
603
      R &leftarrow; <tt>return--</tt><br/>
604
      T &leftarrow; R<br/>
605
      N &leftarrow; T<br/>
606
      <tt>++stack</tt> &leftarrow; N<br/>
607
      <br/>
608
  <h2><a name="r@">Instruction:  r@</a></h2>
609
    <b>Desription:</b>  Push the top of the return stack onto the data
610
      stack.<br/><br/>
611
    <b>Operation:</b><br/><br/>
612
      PC &leftarrow; PC+1<br/>
613
      R and <tt>return</tt> unchanged<br/>
614
      T &leftarrow; R<br/>
615
      N &leftarrow; T<br/>
616
      <tt>++stack</tt> &leftarrow; N<br/>
617
  <h2><a name="return">Instruction:  return</a></h2>
618
    <b>Description:</b>  Popd the top of the return stack into the PC.<br/><br/>
619
    <b>Operation:</b><br/><br/>
620
      PC &leftarrow; R<br/>
621
      R &leftarrow; <tt>return--</tt><br/>
622
      T, N, and <tt>stack</tt> unchanged<br/>
623
      <br/>
624
    <b>Special:</b>
625
      This instruction must be followed by a "<tt>nop</tt>"
626
      instruction.<br/><br/>
627
  <h2><a name="store">Instruction:  store</a></h2>
628
    <b>Desription:</b>  Drop the top of the data stack and store the previous
629
      next-to-top of the data stack at the memory location specified by the top
630
      of the data stack.  The memory bank is specified by the two least
631
      significant bits of the opcode.<br/><br/>
632
    <b>Operation:</b><br/><br/>
633
      PC &leftarrow; PC+1<br/>
634
      R and <tt>return</tt> unchanged<br/>
635
      T &leftarrow; N<br/>
636
      N &leftarrow; <tt>stack--</tt><br/>
637
      bb[T] &leftarrow; N where "<tt>bb</tt>" is the bank<br/>
638
      <br/>
639
    <b>Special:</b>
640
      See <a href="#memory">memory</a> for instructions on using the store and
641
      vectorized store macros.<br/>
642
      <br/>
643
  <h2><a name="store+">Instruction:  store+</a></h2>
644
    <b>Desription:</b>  Nip the data stack and store the previous next-to-top of
645
      the data stack at the memory location specified by the top of the data
646
      stack.  Increment the top of the data stack  The memory bank is specified
647
      by the two least significant bits of the opcode.<br/><br/>
648
    <b>Operation:</b><br/><br/>
649
      PC &leftarrow; PC+1<br/>
650
      R and <tt>return</tt> unchanged<br/>
651
      T &leftarrow; T+1<br/>
652
      N &leftarrow; <tt>stack--</tt><br/>
653
      bb[T] &leftarrow; N where "<tt>bb</tt>" is the bank<br/>
654
      <br/>
655
    <b>Special:</b>
656
      See <a href="#memory">memory</a> for instructions on using the store and
657
      vectorized store macros.<br/>
658
      <br/>
659
  <h2><a name="store-">Instruction:  store-</a></h2>
660
    <b>Desription:</b>  Nip the data stack and store the previous next-to-top of
661
      the data stack at the memory location specified by the top of the data
662
      stack.  Decrement the top of the data stack  The memory bank is specified
663
      by the two least significant bits of the opcode.<br/><br/>
664
    <b>Operation:</b><br/><br/>
665
      PC &leftarrow; PC+1<br/>
666
      R and <tt>return</tt> unchanged<br/>
667
      T &leftarrow; T-1<br/>
668
      N &leftarrow; <tt>stack--</tt><br/>
669
      bb[T] &leftarrow; N where "<tt>bb</tt>" is the bank<br/>
670
      <br/>
671
    <b>Special:</b>
672
      See <a href="#memory">memory</a> for instructions on using the store and
673
      vectorized store macros.<br/>
674
      <br/>
675
  <h2><a name="swap">Instruction:  swap</a></h2>
676
    <b>Desription:</b>  Swap the top two values on the data stack.<br/><br/>
677
    <b>Operation:</b><br/><br/>
678
      PC &leftarrow; PC+1<br/>
679
      R and <tt>return</tt> unchanged<br/>
680
      T &leftarrow; N<br/>
681
      N &leftarrow; T<br/>
682
      <tt>stack</tt> unchanged<br/>
683
      <br/>
684
</body>
685
</html>

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.