1 |
2 |
dgisselq |
////////////////////////////////////////////////////////////////////////////////
|
2 |
|
|
//
|
3 |
|
|
// Filename: zparser.h
|
4 |
|
|
//
|
5 |
|
|
// Project: Zip CPU -- a small, lightweight, RISC CPU core
|
6 |
|
|
//
|
7 |
13 |
dgisselq |
// Purpose: This file is really mis-named. At one time it was going to
|
8 |
|
|
// be header file for the parser for the Zip Assembler, zasm.
|
9 |
|
|
// Since then, I discovered Flex and Bison and have written a
|
10 |
|
|
// parser using those tools. The true parser may therefore be
|
11 |
|
|
// found in zasm.y. This file, however, still declares some
|
12 |
|
|
// very valuable tools. In particular, all of the routines used
|
13 |
|
|
// to build instructions from the appropriate fields are declared
|
14 |
|
|
// in this file.
|
15 |
2 |
dgisselq |
//
|
16 |
|
|
// Creator: Dan Gisselquist, Ph.D.
|
17 |
69 |
dgisselq |
// Gisselquist Technology, LLC
|
18 |
2 |
dgisselq |
//
|
19 |
|
|
////////////////////////////////////////////////////////////////////////////////
|
20 |
|
|
//
|
21 |
|
|
// Copyright (C) 2015, Gisselquist Technology, LLC
|
22 |
|
|
//
|
23 |
|
|
// This program is free software (firmware): you can redistribute it and/or
|
24 |
|
|
// modify it under the terms of the GNU General Public License as published
|
25 |
|
|
// by the Free Software Foundation, either version 3 of the License, or (at
|
26 |
|
|
// your option) any later version.
|
27 |
|
|
//
|
28 |
|
|
// This program is distributed in the hope that it will be useful, but WITHOUT
|
29 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
30 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
31 |
|
|
// for more details.
|
32 |
|
|
//
|
33 |
|
|
// You should have received a copy of the GNU General Public License along
|
34 |
|
|
// with this program. (It's in the $(ROOT)/doc directory, run make with no
|
35 |
|
|
// target there if the PDF file isn't present.) If not, see
|
36 |
|
|
// <http://www.gnu.org/licenses/> for a copy.
|
37 |
|
|
//
|
38 |
|
|
// License: GPL, v3, as defined and found on www.gnu.org,
|
39 |
|
|
// http://www.gnu.org/licenses/gpl.html
|
40 |
|
|
//
|
41 |
|
|
//
|
42 |
|
|
////////////////////////////////////////////////////////////////////////////////
|
43 |
|
|
|
44 |
|
|
#ifndef ZPARSER_H
|
45 |
|
|
#define ZPARSER_H
|
46 |
|
|
|
47 |
143 |
dgisselq |
/*
|
48 |
|
|
* LONG_MPY controls whether or not the instruction set has:
|
49 |
|
|
* (if not defined)
|
50 |
|
|
* LDIHI - load the value into the upper 16 bits of a register
|
51 |
|
|
* MPYS - Multiplies two 16-bit values into a signed 32-bit result
|
52 |
|
|
* MPYU - Multiplies two 16-bit values into an unsigned 32-bit result
|
53 |
|
|
* (if defined)
|
54 |
|
|
* MPY - Multiplies two 32-bit values and returns the lower 32-bits of
|
55 |
|
|
* the result. Works for signed and unsigned values.
|
56 |
|
|
* MPYSHI - Multiplies two 32-bit values and returns the upper 32-bits of
|
57 |
|
|
* the signed 64-bit result
|
58 |
|
|
* MPYUHI - Multiplies two 32-bit values and returns the upper 32-bits of
|
59 |
|
|
* the unsigned 64-bit result
|
60 |
|
|
*
|
61 |
|
|
*/
|
62 |
|
|
#define LONG_MPY
|
63 |
|
|
|
64 |
|
|
#include "zopcodes.h"
|
65 |
|
|
|
66 |
2 |
dgisselq |
class ZPARSER {
|
67 |
|
|
public:
|
68 |
143 |
dgisselq |
typedef unsigned int ZIPA;
|
69 |
2 |
dgisselq |
typedef int ZIPIMM;
|
70 |
|
|
typedef enum {
|
71 |
|
|
ZIP_R0, ZIP_R1, ZIP_R2, ZIP_R3, ZIP_R4, ZIP_R5, ZIP_R6, ZIP_R7,
|
72 |
|
|
ZIP_R8, ZIP_R9, ZIP_R10, ZIP_R11, ZIP_R12,
|
73 |
|
|
ZIP_SP, ZIP_CC, ZIP_PC,
|
74 |
|
|
ZIP_uR0, ZIP_uR1, ZIP_uR2, ZIP_uR3, ZIP_uR4, ZIP_uR5, ZIP_uR6, ZIP_uR7,
|
75 |
|
|
ZIP_uR8, ZIP_uR9, ZIP_uR10, ZIP_uR11, ZIP_uR12,
|
76 |
|
|
ZIP_uSP, ZIP_uCC, ZIP_uPC,
|
77 |
|
|
ZIP_Rnone
|
78 |
|
|
} ZIPREG;
|
79 |
|
|
|
80 |
|
|
typedef enum {
|
81 |
69 |
dgisselq |
ZIPC_ALWAYS, ZIPC_LT, ZIPC_Z, ZIPC_NZ,
|
82 |
|
|
ZIPC_GT, ZIPC_GE, ZIPC_C, ZIPC_V
|
83 |
2 |
dgisselq |
} ZIPCOND;
|
84 |
|
|
|
85 |
69 |
dgisselq |
typedef enum {
|
86 |
|
|
// 16 ALU instructions
|
87 |
|
|
ZIPO_SUB=0, ZIPO_AND, ZIPO_ADD, ZIPO_OR, // 5'h000xx
|
88 |
|
|
ZIPO_XOR, ZIPO_LSR, ZIPO_LSL, ZIPO_ASR, // 5'h001xx
|
89 |
143 |
dgisselq |
#ifdef LONG_MPY
|
90 |
|
|
ZIPO_MPY, ZIPO_LDILO, ZIPO_MPYUHI, ZIPO_MPYSHI, // 5'h010xx
|
91 |
|
|
#else
|
92 |
69 |
dgisselq |
ZIPO_LDIHI, ZIPO_LDILO, ZIPO_MPYU, ZIPO_MPYS, // 5'h010xx
|
93 |
143 |
dgisselq |
#endif
|
94 |
69 |
dgisselq |
ZIPO_BREV, ZIPO_POPC, ZIPO_ROL, ZIPO_MOV, // 5'h011xx
|
95 |
|
|
ZIPO_CMP, ZIPO_TST, // 5'h1000x
|
96 |
|
|
ZIPO_LOD, ZIPO_STO, // 5'h1001w
|
97 |
|
|
ZIPO_DIVU, ZIPO_DIVS, // 5'h1010s
|
98 |
|
|
ZIPO_LDI, ZIPO_LDIn, // 5'h1011x
|
99 |
|
|
// ZIPO_, ZIPO_DIVS, // 5'h11000
|
100 |
|
|
ZIPO_FPADD=0x18, ZIPO_FPSUB, // 5'h1100x
|
101 |
|
|
ZIPO_FPMUL, ZIPO_FPDIV, // 5'h1101x
|
102 |
|
|
ZIPO_FPCVT, ZIPO_FPINT, // 5'h1110x
|
103 |
|
|
} ZIPOP;
|
104 |
2 |
dgisselq |
|
105 |
126 |
dgisselq |
ZIPIMM brev(ZIPIMM) const;
|
106 |
|
|
|
107 |
2 |
dgisselq |
ZIPI op_cmp(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
|
108 |
|
|
ZIPI op_cmp(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
|
109 |
|
|
ZIPI op_cmp(ZIPIMM imm, ZIPREG b, ZIPREG a) const
|
110 |
|
|
{ return op_cmp(ZIPC_ALWAYS, imm, b, a); }
|
111 |
|
|
ZIPI op_cmp(ZIPIMM imm, ZIPREG a) const
|
112 |
|
|
{ return op_cmp(ZIPC_ALWAYS, imm, a); }
|
113 |
|
|
|
114 |
|
|
ZIPI op_tst(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
|
115 |
|
|
ZIPI op_tst(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
|
116 |
|
|
ZIPI op_tst(ZIPIMM imm, ZIPREG a) const
|
117 |
|
|
{ return op_tst(ZIPC_ALWAYS, imm, a); }
|
118 |
|
|
ZIPI op_tst(ZIPCOND cnd, ZIPREG a) const
|
119 |
|
|
{ return op_tst(cnd, -1, a); }
|
120 |
|
|
|
121 |
|
|
ZIPI op_mov(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
|
122 |
|
|
ZIPI op_mov(ZIPIMM imm, ZIPREG b, ZIPREG a) const
|
123 |
|
|
{ return op_mov(ZIPC_ALWAYS, imm, b, a); }
|
124 |
|
|
ZIPI op_mov(ZIPREG b, ZIPREG a) const
|
125 |
|
|
{ return op_mov(ZIPC_ALWAYS, 0, b, a); }
|
126 |
|
|
|
127 |
|
|
ZIPI op_ldi(ZIPIMM imm, ZIPREG a) const;
|
128 |
|
|
ZIPI op_trap(ZIPCOND cnd, ZIPIMM imm) const;
|
129 |
|
|
ZIPI op_trap(ZIPIMM imm) const
|
130 |
|
|
{ return op_trap(ZIPC_ALWAYS, imm); }
|
131 |
|
|
ZIPI op_clr(ZIPREG a) const { return op_ldi(0, a); }
|
132 |
|
|
|
133 |
|
|
ZIPI op_noop(void) const;
|
134 |
|
|
ZIPI op_break(void) const;
|
135 |
69 |
dgisselq |
ZIPI op_lock(void) const;
|
136 |
2 |
dgisselq |
|
137 |
143 |
dgisselq |
#ifdef LONG_MPY
|
138 |
|
|
ZIPI op_mpy(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
|
139 |
126 |
dgisselq |
ZIPI op_mpy(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
|
140 |
143 |
dgisselq |
ZIPI op_mpy(ZIPIMM imm, ZIPREG b, ZIPREG a) const
|
141 |
|
|
{ return op_mpy(ZIPC_ALWAYS, imm, b, a); }
|
142 |
|
|
ZIPI op_mpy(ZIPIMM imm, ZIPREG a) const
|
143 |
|
|
{ return op_mpy(ZIPC_ALWAYS, imm, a); }
|
144 |
|
|
#else
|
145 |
2 |
dgisselq |
ZIPI op_ldihi(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
|
146 |
|
|
ZIPI op_ldihi(ZIPIMM imm, ZIPREG a) const
|
147 |
|
|
{ return op_ldihi(ZIPC_ALWAYS, imm, a); }
|
148 |
143 |
dgisselq |
#endif
|
149 |
126 |
dgisselq |
ZIPI op_ldilo(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
|
150 |
2 |
dgisselq |
ZIPI op_ldilo(ZIPIMM imm, ZIPREG a) const
|
151 |
|
|
{ return op_ldilo(ZIPC_ALWAYS, imm, a); }
|
152 |
|
|
|
153 |
143 |
dgisselq |
#ifdef LONG_MPY
|
154 |
|
|
ZIPI op_mpyuhi(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
|
155 |
|
|
ZIPI op_mpyuhi(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
|
156 |
|
|
ZIPI op_mpyuhi(ZIPIMM imm, ZIPREG b, ZIPREG a) const
|
157 |
|
|
{ return op_mpyuhi(ZIPC_ALWAYS, imm, b, a); }
|
158 |
|
|
ZIPI op_mpyuhi(ZIPIMM imm, ZIPREG a) const
|
159 |
|
|
{ return op_mpyuhi(ZIPC_ALWAYS,imm,a); }
|
160 |
|
|
#else
|
161 |
26 |
dgisselq |
ZIPI op_mpyu(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
|
162 |
|
|
ZIPI op_mpyu(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
|
163 |
|
|
ZIPI op_mpyu(ZIPIMM imm, ZIPREG b, ZIPREG a) const
|
164 |
|
|
{ return op_mpyu(ZIPC_ALWAYS, imm, b, a); }
|
165 |
|
|
ZIPI op_mpyu(ZIPIMM imm, ZIPREG a) const
|
166 |
|
|
{ return op_mpyu(ZIPC_ALWAYS, imm, a); }
|
167 |
143 |
dgisselq |
#endif
|
168 |
126 |
dgisselq |
//
|
169 |
8 |
dgisselq |
|
170 |
143 |
dgisselq |
#ifdef LONG_MPY
|
171 |
|
|
ZIPI op_mpyshi(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
|
172 |
|
|
ZIPI op_mpyshi(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
|
173 |
|
|
ZIPI op_mpyshi(ZIPIMM imm, ZIPREG b, ZIPREG a) const
|
174 |
|
|
{ return op_mpyshi(ZIPC_ALWAYS, imm, b, a); }
|
175 |
|
|
ZIPI op_mpyshi(ZIPIMM imm, ZIPREG a) const
|
176 |
|
|
{ return op_mpyshi(ZIPC_ALWAYS, imm, a); }
|
177 |
|
|
#else
|
178 |
26 |
dgisselq |
ZIPI op_mpys(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
|
179 |
|
|
ZIPI op_mpys(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
|
180 |
|
|
ZIPI op_mpys(ZIPIMM imm, ZIPREG b, ZIPREG a) const
|
181 |
|
|
{ return op_mpys(ZIPC_ALWAYS, imm, b, a); }
|
182 |
|
|
ZIPI op_mpys(ZIPIMM imm, ZIPREG a) const
|
183 |
|
|
{ return op_mpys(ZIPC_ALWAYS, imm, a); }
|
184 |
143 |
dgisselq |
#endif
|
185 |
26 |
dgisselq |
|
186 |
8 |
dgisselq |
ZIPI op_rol(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
|
187 |
|
|
ZIPI op_rol(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
|
188 |
|
|
ZIPI op_rol(ZIPIMM imm, ZIPREG b, ZIPREG a) const
|
189 |
|
|
{ return op_rol(ZIPC_ALWAYS, imm, b, a); }
|
190 |
|
|
ZIPI op_rol(ZIPIMM imm, ZIPREG a) const
|
191 |
|
|
{ return op_rol(ZIPC_ALWAYS, imm, a); }
|
192 |
|
|
|
193 |
69 |
dgisselq |
ZIPI op_popc(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
|
194 |
|
|
ZIPI op_popc(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
|
195 |
|
|
ZIPI op_popc(ZIPIMM imm, ZIPREG b, ZIPREG a) const
|
196 |
|
|
{ return op_popc(ZIPC_ALWAYS, imm, b, a); }
|
197 |
|
|
ZIPI op_popc(ZIPIMM imm, ZIPREG a) const
|
198 |
|
|
{ return op_popc(ZIPC_ALWAYS, imm, a); }
|
199 |
|
|
|
200 |
|
|
ZIPI op_brev(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
|
201 |
|
|
ZIPI op_brev(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
|
202 |
|
|
ZIPI op_brev(ZIPIMM imm, ZIPREG b, ZIPREG a) const
|
203 |
|
|
{ return op_brev(ZIPC_ALWAYS, imm, b, a); }
|
204 |
|
|
ZIPI op_brev(ZIPIMM imm, ZIPREG a) const
|
205 |
|
|
{ return op_brev(ZIPC_ALWAYS, imm, a); }
|
206 |
|
|
|
207 |
2 |
dgisselq |
ZIPI op_lod(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
|
208 |
|
|
ZIPI op_lod(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
|
209 |
|
|
ZIPI op_lod(ZIPIMM imm, ZIPREG b, ZIPREG a) const
|
210 |
|
|
{ return op_lod(ZIPC_ALWAYS, imm, b, a); }
|
211 |
|
|
ZIPI op_lod(ZIPIMM imm, ZIPREG a) const
|
212 |
|
|
{ return op_lod(ZIPC_ALWAYS, imm, a); }
|
213 |
|
|
|
214 |
|
|
ZIPI op_sto(ZIPCOND cnd, ZIPREG v, ZIPIMM imm, ZIPREG b) const;
|
215 |
|
|
ZIPI op_sto(ZIPCOND cnd, ZIPREG v, ZIPIMM imm) const;
|
216 |
|
|
ZIPI op_sto(ZIPREG v, ZIPIMM imm, ZIPREG b) const
|
217 |
|
|
{ return op_sto(ZIPC_ALWAYS, v, imm, b); }
|
218 |
|
|
ZIPI op_sto(ZIPREG v, ZIPIMM imm) const
|
219 |
|
|
{ return op_sto(ZIPC_ALWAYS, v, imm); }
|
220 |
|
|
|
221 |
|
|
ZIPI op_sub(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
|
222 |
|
|
ZIPI op_sub(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
|
223 |
|
|
ZIPI op_sub(ZIPIMM imm, ZIPREG b, ZIPREG a) const
|
224 |
|
|
{ return op_sub(ZIPC_ALWAYS, imm, b, a); }
|
225 |
|
|
ZIPI op_sub(ZIPIMM imm, ZIPREG a) const
|
226 |
|
|
{ return op_sub(ZIPC_ALWAYS, imm, a); }
|
227 |
|
|
|
228 |
|
|
ZIPI op_and(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
|
229 |
|
|
ZIPI op_and(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
|
230 |
|
|
ZIPI op_and(ZIPIMM imm, ZIPREG b, ZIPREG a) const
|
231 |
|
|
{ return op_and(ZIPC_ALWAYS, imm, b, a); }
|
232 |
|
|
ZIPI op_and(ZIPIMM imm, ZIPREG a) const
|
233 |
|
|
{ return op_and(ZIPC_ALWAYS, imm, a); }
|
234 |
|
|
|
235 |
|
|
ZIPI op_add(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
|
236 |
|
|
ZIPI op_add(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
|
237 |
|
|
ZIPI op_add(ZIPIMM imm, ZIPREG b, ZIPREG a) const
|
238 |
|
|
{ return op_add(ZIPC_ALWAYS, imm, b, a); }
|
239 |
|
|
ZIPI op_add(ZIPIMM imm, ZIPREG a) const // GOOD
|
240 |
|
|
{ return op_add(ZIPC_ALWAYS, imm, a); }
|
241 |
|
|
|
242 |
|
|
ZIPI op_or(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
|
243 |
|
|
ZIPI op_or(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
|
244 |
|
|
ZIPI op_or(ZIPIMM imm, ZIPREG b, ZIPREG a) const
|
245 |
|
|
{ return op_or(ZIPC_ALWAYS, imm, b, a); }
|
246 |
|
|
ZIPI op_or(ZIPIMM imm, ZIPREG a) const
|
247 |
|
|
{ return op_or(ZIPC_ALWAYS, imm, a); }
|
248 |
|
|
|
249 |
|
|
ZIPI op_xor(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
|
250 |
|
|
ZIPI op_xor(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
|
251 |
|
|
ZIPI op_xor(ZIPIMM imm, ZIPREG b, ZIPREG a) const
|
252 |
|
|
{ return op_xor(ZIPC_ALWAYS, imm, b, a); }
|
253 |
|
|
ZIPI op_xor(ZIPIMM imm, ZIPREG a) const
|
254 |
|
|
{ return op_xor(ZIPC_ALWAYS, imm, a); }
|
255 |
|
|
|
256 |
|
|
ZIPI op_lsl(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
|
257 |
|
|
ZIPI op_lsl(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
|
258 |
|
|
ZIPI op_lsl(ZIPIMM imm, ZIPREG b, ZIPREG a) const
|
259 |
|
|
{ return op_lsl(ZIPC_ALWAYS, imm, b, a); }
|
260 |
|
|
ZIPI op_lsl(ZIPIMM imm, ZIPREG a) const
|
261 |
|
|
{ return op_lsl(ZIPC_ALWAYS, imm, a); }
|
262 |
|
|
ZIPI op_asl(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const
|
263 |
|
|
{ return op_lsl(cnd, imm, b, a); }
|
264 |
|
|
ZIPI op_asl(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const
|
265 |
|
|
{ return op_lsl(cnd, imm, a); }
|
266 |
|
|
ZIPI op_asl(ZIPIMM imm, ZIPREG b, ZIPREG a) const
|
267 |
|
|
{ return op_lsl(ZIPC_ALWAYS, imm, b, a); }
|
268 |
|
|
ZIPI op_asl(ZIPIMM imm, ZIPREG a) const
|
269 |
|
|
{ return op_lsl(ZIPC_ALWAYS, imm, a); }
|
270 |
|
|
|
271 |
|
|
ZIPI op_asr(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
|
272 |
|
|
ZIPI op_asr(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
|
273 |
|
|
ZIPI op_asr(ZIPIMM imm, ZIPREG b, ZIPREG a) const
|
274 |
|
|
{ return op_asr(ZIPC_ALWAYS, imm, b, a); }
|
275 |
|
|
ZIPI op_asr(ZIPIMM imm, ZIPREG a) const
|
276 |
|
|
{ return op_asr(ZIPC_ALWAYS, imm, a); }
|
277 |
|
|
|
278 |
|
|
ZIPI op_lsr(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
|
279 |
|
|
ZIPI op_lsr(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
|
280 |
|
|
ZIPI op_lsr(ZIPIMM imm, ZIPREG b, ZIPREG a) const
|
281 |
|
|
{ return op_lsr(ZIPC_ALWAYS, imm, b, a); }
|
282 |
|
|
ZIPI op_lsr(ZIPIMM imm, ZIPREG a) const
|
283 |
|
|
{ return op_lsr(ZIPC_ALWAYS, imm, a); }
|
284 |
|
|
|
285 |
|
|
ZIPI op_bra(ZIPCOND cnd, ZIPIMM imm) const
|
286 |
100 |
dgisselq |
{ return op_add(cnd, imm, ZIP_PC); }
|
287 |
2 |
dgisselq |
ZIPI op_bra(ZIPIMM imm) const
|
288 |
89 |
dgisselq |
{ return op_add(ZIPC_ALWAYS, imm, ZIP_PC); }
|
289 |
2 |
dgisselq |
ZIPI op_brz(ZIPIMM imm) const
|
290 |
100 |
dgisselq |
{ return op_add(ZIPC_Z, imm, ZIP_PC); }
|
291 |
2 |
dgisselq |
ZIPI op_bnz(ZIPIMM imm) const
|
292 |
100 |
dgisselq |
{ return op_add(ZIPC_NZ, imm, ZIP_PC); }
|
293 |
2 |
dgisselq |
ZIPI op_bge(ZIPIMM imm) const
|
294 |
100 |
dgisselq |
{ return op_add(ZIPC_GE, imm, ZIP_PC); }
|
295 |
2 |
dgisselq |
ZIPI op_bgt(ZIPIMM imm) const
|
296 |
100 |
dgisselq |
{ return op_add(ZIPC_GT, imm, ZIP_PC); }
|
297 |
2 |
dgisselq |
ZIPI op_blt(ZIPIMM imm) const
|
298 |
100 |
dgisselq |
{ return op_add(ZIPC_LT, imm, ZIP_PC); }
|
299 |
2 |
dgisselq |
ZIPI op_brc(ZIPIMM imm) const
|
300 |
100 |
dgisselq |
{ return op_add(ZIPC_C, imm, ZIP_PC); }
|
301 |
2 |
dgisselq |
ZIPI op_brv(ZIPIMM imm) const
|
302 |
100 |
dgisselq |
{ return op_add(ZIPC_V, imm, ZIP_PC); }
|
303 |
2 |
dgisselq |
ZIPI op_bv(ZIPIMM imm) const
|
304 |
|
|
{ return op_brv(imm); }
|
305 |
|
|
|
306 |
|
|
ZIPI op_clrf(ZIPCOND cnd, ZIPREG a) const
|
307 |
|
|
{ return op_xor(cnd, 0, a, a); }
|
308 |
|
|
ZIPI op_clrf(ZIPREG a) const
|
309 |
|
|
{ return op_xor(ZIPC_ALWAYS, 0, a, a); }
|
310 |
69 |
dgisselq |
// ZIPI op_retn(ZIPCOND c) const
|
311 |
|
|
// { return op_lod(c, 1, ZIP_SP, ZIP_PC); }
|
312 |
2 |
dgisselq |
ZIPI op_halt(ZIPCOND c) const {
|
313 |
|
|
return op_or(c, 0x10, ZIP_CC); }
|
314 |
|
|
ZIPI op_wait(ZIPCOND c) const {
|
315 |
69 |
dgisselq |
return op_or(c, 0x30, ZIP_CC); }
|
316 |
2 |
dgisselq |
ZIPI op_halt(void) const {
|
317 |
|
|
return op_or(ZIPC_ALWAYS, 0x10, ZIP_CC); }
|
318 |
|
|
ZIPI op_wait(void) const {
|
319 |
|
|
return op_or(ZIPC_ALWAYS, 0x10, ZIP_CC); }
|
320 |
|
|
ZIPI op_busy(ZIPCOND c) const {
|
321 |
100 |
dgisselq |
return op_add(c, -1, ZIP_PC); }
|
322 |
2 |
dgisselq |
ZIPI op_busy(void) const {
|
323 |
100 |
dgisselq |
return op_add(ZIPC_ALWAYS, -1, ZIP_PC); }
|
324 |
2 |
dgisselq |
|
325 |
|
|
ZIPI op_rtu(void) const {
|
326 |
|
|
return op_or(ZIPC_ALWAYS, 0x20, ZIP_CC); }
|
327 |
|
|
ZIPI op_rtu(ZIPCOND cnd) const {
|
328 |
|
|
return op_or(cnd, 0x20, ZIP_CC); }
|
329 |
|
|
|
330 |
|
|
ZIPI op_jmp(ZIPCOND c, ZIPIMM imm, ZIPREG r) const
|
331 |
|
|
{ return op_mov(ZIPC_ALWAYS, imm, r, ZIP_PC); }
|
332 |
|
|
|
333 |
100 |
dgisselq |
ZIPI op_ljmp(void) const { return 0x7c87c000; }
|
334 |
|
|
|
335 |
2 |
dgisselq |
ZIPI op_ljmp(ZIPCOND c, ZIPIMM imm) const {
|
336 |
|
|
return op_add(ZIPC_ALWAYS, imm, ZIP_PC); }
|
337 |
|
|
|
338 |
|
|
ZIPI op_not(ZIPCOND c, ZIPREG r) const
|
339 |
|
|
{ return op_xor(c, -1, r); }
|
340 |
|
|
ZIPI op_not(ZIPREG r) const
|
341 |
|
|
{ return op_xor(ZIPC_ALWAYS, -1, r); }
|
342 |
|
|
|
343 |
69 |
dgisselq |
ZIPI op_divu(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
|
344 |
|
|
ZIPI op_divu(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
|
345 |
|
|
ZIPI op_divs(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
|
346 |
|
|
ZIPI op_divs(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
|
347 |
|
|
|
348 |
|
|
bool can_merge(const ZIPI a, const ZIPI b);
|
349 |
|
|
ZIPI merge(const ZIPI a, const ZIPI b);
|
350 |
|
|
ZIPIMM immediate(const ZIPI a);
|
351 |
|
|
|
352 |
2 |
dgisselq |
};
|
353 |
|
|
|
354 |
|
|
#endif
|