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

Subversion Repositories zipcpu

[/] [zipcpu/] [trunk/] [sw/] [zasm/] [zparser.cpp] - Blame information for rev 12

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

Line No. Rev Author Line
1 2 dgisselq
////////////////////////////////////////////////////////////////////////////////
2
//
3
// Filename:    zparser.cpp
4
//
5
// Project:     Zip CPU -- a small, lightweight, RISC CPU core
6
//
7
// Purpose:     
8
//
9
// Creator:     Dan Gisselquist, Ph.D.
10
//              Gisselquist Tecnology, LLC
11
//
12
////////////////////////////////////////////////////////////////////////////////
13
//
14
// Copyright (C) 2015, Gisselquist Technology, LLC
15
//
16
// This program is free software (firmware): you can redistribute it and/or
17
// modify it under the terms of  the GNU General Public License as published
18
// by the Free Software Foundation, either version 3 of the License, or (at
19
// your option) any later version.
20
//
21
// This program is distributed in the hope that it will be useful, but WITHOUT
22
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
23
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
24
// for more details.
25
//
26
// You should have received a copy of the GNU General Public License along
27
// with this program.  (It's in the $(ROOT)/doc directory, run make with no
28
// target there if the PDF file isn't present.)  If not, see
29
// <http://www.gnu.org/licenses/> for a copy.
30
//
31
// License:     GPL, v3, as defined and found on www.gnu.org,
32
//              http://www.gnu.org/licenses/gpl.html
33
//
34
//
35
////////////////////////////////////////////////////////////////////////////////
36
 
37
#include <stdio.h>
38
#include <stdlib.h>
39
#include <string.h>
40
#include <ctype.h>
41
#include <strings.h>
42
 
43
#include "zparser.h"
44
#include "zopcodes.h"
45
 
46
typedef ZPARSER::ZIPI ZIPI;     // A Zip Instruction (i.e. uint32)
47
 
48
bool    ZPARSER::iscomment(const char *line) const {
49
        const   char    *sp = line;
50
        do {
51
                if (*sp == '\0')
52
                        return true;
53
                else if (*sp == ';')
54
                        return true;
55
                else if (*sp == '#')
56
                        return true;
57
                else if (*sp == '\n')
58
                        return true;
59
                else if (*sp == '\r')
60
                        return true;
61
                else if ((*sp == '/')&&(sp[1] == '/'))
62
                        return true;
63
                else if (!isspace(*sp))
64
                        return false;
65
        } while(*sp++);
66
 
67
        return true;
68
}
69
 
70
bool    ZPARSER::islabel(const char *line) const {
71
        const   char *sp = line;
72
        if (isspace(*line))
73
                return false;
74
        if (!isalpha(*line))
75
                return  false;
76
        while((isalpha(*sp))||(isdigit(*sp))||(*sp=='_'))
77
                sp++;
78
        if (*sp != ':')
79
                return false;
80
        sp++;
81
        return iscomment(sp);
82
}
83
 
84
bool    ZPARSER::parse_op(const char *line, ZPARSER::ZIPA pc,
85
                ZPARSER::ZIPI &ins, const unsigned lineno) const {
86
        const char      *sp = line;
87 9 dgisselq
        char    cpy[128], *cp = cpy, *point, *dollar, *plus, *comma, *paren,
88
                        *opc, *opb, *opa;
89 2 dgisselq
        ZPARSER::ZIPREG ra = ZPARSER::ZIP_Rnone, rb = ZPARSER::ZIP_Rnone;
90
        ZIPCOND cnd = ZIPC_ALWAYS;
91
        ZIPIMM  imm = 0;
92
        bool    valid = true;
93
 
94
        if (!isspace(*sp))
95
                return false;
96
 
97
        while(isspace(*sp))
98
                sp++;
99
        // Remove comments from our local copy
100
        for(unsigned int i=0; i<sizeof(cpy); i++) {
101
                if (*sp == '\0')
102
                        break;
103
                else if (*sp == ';')
104
                        break;
105
                else if (*sp == '#')
106
                        break;
107
                else if (*sp == '\n')
108
                        break;
109
                else if (*sp == '\r')
110
                        break;
111
                else if ((*sp == '/')&&(sp[1] == '/'))
112
                        break;
113
                *cp++ = *sp++;
114
        } if (cp-cpy >= (int)sizeof(cpy))
115
                return false;
116
        *cp = '\0';
117
        point = strchr(cpy, '.');
118
        comma = strchr(cpy, ',');
119
        plus  = strchr(cpy, '+');
120
        dollar= strchr(cpy, '$');
121 9 dgisselq
        paren = strchr(cpy, '(');
122 2 dgisselq
        if (point)  *point++  = '\0';
123
        if (comma)  *comma++  = '\0';
124
        if (plus)   *plus++   = '\0';
125
        if (dollar) *dollar++ = '\0';
126
        // if (paren)  *paren++  = '\0';
127
        cp = cpy;
128
        while(isalpha(*cp))
129
                cp++;
130
        opc = cpy;
131
        if ((*cp == '\0')&&(point == NULL))
132
                cp[1] = '\0';
133
        *cp = '\0';
134
 
135
        if ((point)&&(strncasecmp("DAT",point,3)!=0)) {
136
                cp = point;
137
                while(isalpha(*cp))
138
                        cp++;
139
                if (*cp == '\0')
140
                        cp[1] = '\0';
141
                *cp = '\0';
142
 
143
                for(int i=1; i<8; i++) {
144
                        if (strcasecmp(&zop_ccstr[i][1], point)==0) {
145
                                cnd = (ZIPCOND)i;
146
                                break;
147
                        }
148
                } if (cnd == ZIPC_ALWAYS) {
149
                        printf("ERR: Unrecognized condition, %s\n", point);
150
                        valid = false;
151
                }
152
        }
153
 
154
        cp++;
155
        while(isspace(*cp))
156
                cp++;
157
        opb = cp;
158 9 dgisselq
        opa = comma;
159 2 dgisselq
 
160 9 dgisselq
        if (paren) {
161
                opb = paren+1;
162
                if ((comma)&&(opb > comma))
163
                        opa = cp;
164
        } else if (plus)
165
                opb = plus;
166
 
167 2 dgisselq
        if (dollar) {
168
                // Figure out the base
169
                {
170
                        char *ip = dollar, mxd = 0;
171
                        if ((*ip == '0')&&(toupper(ip[1])=='X'))
172
                                imm = strtoul(dollar, NULL, 16);
173
                        else {
174
                                bool neg = false;
175
                                if (*ip == '-') {
176
                                        neg = true;
177
                                        ip++;
178
                                        dollar++;
179
                                }
180
                                while(isdigit(*ip)||((toupper(*ip)>='A')&&(toupper(*ip)<='F'))) {
181
                                        if (isalpha(*ip))
182
                                                mxd = (*ip-'a')+10;
183
                                        else
184
                                                mxd = (*ip-'0');
185
                                        ip++;
186
                                }
187
 
188
                                if ((mxd <= 1)&&(*ip=='d'))
189
                                        imm = strtoul(dollar, NULL, 2);
190
                                else if ((mxd <= 7)&&((*dollar == '0')||(toupper(*ip)=='O')))
191
                                        imm = strtoul(dollar, NULL, 8);
192
                                else if ((mxd <= 15)&&(toupper(*ip)=='H'))
193
                                        imm = strtoul(dollar, NULL, 16);
194
                                else if ((toupper(*ip)=='D')||(*ip == '+')||(isspace(*ip))||(*ip == '(')||(*ip == '\0'))
195
                                        imm = atoi(dollar);
196
                                else {
197
                                        printf("Cannot parse immediate, %s\n", dollar);
198
                                        printf("Assuming you meant %d\n", atoi(dollar));
199
                                        imm = atoi(dollar);
200
                                }
201
 
202
                                if (neg)
203
                                        imm = -imm;
204
                        }
205
                }
206
        } else
207
                imm = 0;
208 9 dgisselq
 
209 2 dgisselq
        if (*opb) for(int i=31; i>=0; i--) {
210 9 dgisselq
                // printf("%s Checking for match to opB: \'%s\' to %s", opc, opb, zop_regstr[i]);
211 2 dgisselq
                if (NULL != strcasestr(opb, zop_regstr[i])) {
212
                        // printf(" --- Match\n");
213
                        rb = (ZIPREG)i;
214
                        break;
215
                } // else printf(" -- nope\n");
216 9 dgisselq
        } if (opa) for(int i=31; i>=0; i--) {
217
                // printf("%s Checking for match to opA: ,%s to %s", opc, opa, zop_regstr[i]);
218
                if (NULL != strcasestr(opa, zop_regstr[i])) {
219 2 dgisselq
                        ra = (ZIPREG)i;
220
                        // printf(" --- Match\n");
221
                        break;
222
                } // else printf(" -- nope\n");
223
        }
224
 
225
        if (strcasecmp("MOV",opc)!=0) {
226
                // Only move instructions can reference user regs
227
                if ((ra != ZIP_Rnone)&&(ra >= ZIP_uR0))
228
                        valid = false;
229
                if ((rb != ZIP_Rnone)&&(rb >= ZIP_uR0))
230
                        valid = false;
231
                if (!valid)
232
                        printf("ERR: Only Mov can specify user regs\n");
233
        }
234
 
235
        if ((!*opc)&&(strncasecmp("DAT",point,3)==0)) {
236 12 dgisselq
                ins = imm;
237 2 dgisselq
                valid = true;
238
        } else if (strcasecmp("CMP",opc)==0) {
239
                if (rb != ZIP_Rnone)
240
                        ins = op_cmp(cnd, imm, rb, ra);
241
                else    ins = op_cmp(cnd, imm, ra);
242
        } else if (strcasecmp("TST",opc)==0) {
243
                if (rb != ZIP_Rnone)
244
                        ins = op_tst(cnd, imm, rb, ra);
245
                else if (!dollar)
246
                        ins = op_tst(cnd, ra);
247
                else
248
                        ins = op_tst(cnd, imm, ra);
249
        } else if (strcasecmp("MOV",opc)==0) {
250
                if ((rb != ZIP_Rnone)&&(ra != ZIP_Rnone))
251
                        ins = op_mov(cnd, imm, rb, ra);
252
                else    { printf("ERR MOV, ra = %d, rb = %d, imm = %d, cnd = %d\nLine was: %s", (int)ra, (int)rb, (int)imm, (int)cnd, line); valid = false; }
253
        } else if (strcasecmp("LDI",opc)==0) {
254
                if ((rb == ZIP_Rnone)&&(cnd == ZIPC_ALWAYS))
255
                        ins = op_ldi(imm, ra);
256
                else    valid = false;
257
        } else if (strcasecmp("trap",opc)==0) {
258
                if ((rb == ZIP_Rnone)&&(rb == ZIP_Rnone))
259
                        ins = op_trap(cnd, imm);
260
                else
261
                        valid = false;
262
        } else if (strcasecmp("CLR",opc)==0) {
263
                if ((ra == ZIP_Rnone)&&(!dollar)&&(cnd == ZIPC_ALWAYS))
264
                        ins = op_clr(rb);       // Good
265
                else    valid = false;
266
        } else if ((strcasecmp("NOOP",opc)==0)||(strcasecmp("NOP",opc)==0)) {
267
                if ((rb == ZIP_Rnone)&&(ra == ZIP_Rnone)&&(!dollar)&&(cnd == ZIPC_ALWAYS))
268
                        ins = op_noop();
269
                else    { printf("ERR: NOP, ra=%d, rb=%d, dollar = %s\n",
270
                                (int)ra, (int)rb, (dollar)?"true":"false"); valid = false; }
271
        } else if ((strcasecmp("BREAK",opc)==0)||(strcasecmp("BRK",opc)==0)) {
272
                if ((rb == ZIP_Rnone)&&(ra == ZIP_Rnone)&&(!dollar)&&(cnd == ZIPC_ALWAYS))
273
                        ins = op_break();
274
                else    { printf("ERR: BRK, ra=%d, rb=%d, dollar = %s\n",
275
                                (int)ra, (int)rb, (dollar)?"true":"false"); valid = false; }
276
        } else if ((strcasecmp("LDIHI",opc)==0)||(strcasecmp("LODIHI",opc)==0)) {
277
                if ((dollar)&&(ra != ZIP_Rnone))
278
                        ins = op_ldihi(cnd, imm, ra);
279
                else    valid = false;
280
        } else if ((strcasecmp("LDILO",opc)==0)||(strcasecmp("LODILO",opc)==0)){
281
                if ((dollar)&&(ra != ZIP_Rnone))
282
                        ins = op_ldilo(cnd, imm, ra);
283
                else    valid = false;
284
        } else if ((strcasecmp("LOD",opc)==0)||(strcasecmp("LOAD",opc)==0)) {
285
                if (rb != ZIP_Rnone)
286
                        ins = op_lod(cnd,imm,rb,ra);
287
                else    ins = op_lod(cnd,imm,ra);
288
        } else if ((strcasecmp("STO",opc)==0)||(strcasecmp("STOR",opc)==0)) {
289 9 dgisselq
                // printf("STO: Imm = %d, RA = %d, RB = %d\n", imm, ra, rb);
290 2 dgisselq
                if (rb != ZIP_Rnone)
291 9 dgisselq
                        ins = op_sto(cnd,ra,imm,rb);
292
                else    ins = op_sto(cnd,ra,imm);
293 2 dgisselq
        } else if (strcasecmp("SUB",opc)==0) {
294
                if (rb != ZIP_Rnone)
295
                        ins = op_sub(cnd,imm,rb,ra);
296
                else    ins = op_sub(cnd,imm,ra);
297
        } else if (strcasecmp("AND",opc)==0) {
298
                if (rb != ZIP_Rnone)
299
                        ins = op_and(cnd,imm,rb,ra);
300
                else    ins = op_and(cnd,imm,ra);
301
        } else if (strcasecmp("ADD",opc)==0) {
302
                if (rb != ZIP_Rnone)
303
                        ins = op_add(cnd,imm,rb,ra);
304
                else    ins = op_add(cnd,imm,ra);
305
        } else if (strcasecmp("OR",opc)==0) {
306
                if (rb != ZIP_Rnone)
307
                        ins = op_or(cnd,imm,rb,ra);
308
                else    ins = op_or(cnd,imm,ra);
309
        } else if (strcasecmp("XOR",opc)==0) {
310
                if (rb != ZIP_Rnone)
311
                        ins = op_xor(cnd,imm,rb,ra);
312
                else    ins = op_xor(cnd,imm,ra);
313
        } else if ((strcasecmp("LSL",opc)==0)||(strcasecmp("ASL",opc)==0)) {
314
                if (rb != ZIP_Rnone)
315
                        ins = op_lsl(cnd,imm,rb,ra);
316
                else    ins = op_lsl(cnd,imm,ra);
317
        } else if (strcasecmp("ASR",opc)==0) {
318
                if (rb != ZIP_Rnone)
319
                        ins = op_asr(cnd,imm,rb,ra);
320
                else    ins = op_asr(cnd,imm,ra);
321
        } else if (strcasecmp("LSR",opc)==0) {
322
                if (rb != ZIP_Rnone)
323
                        ins = op_lsr(cnd,imm,rb,ra);
324
                else    ins = op_lsr(cnd,imm,ra);
325
        } else if (strcasecmp("BR",opc)==0) {
326
                if ((dollar)||(ra != ZIP_Rnone)||(rb != ZIP_Rnone))
327
                        valid = false;
328
                else ins = op_bra(cnd, imm);
329
        } else if (strcasecmp("BRA",opc)==0) {
330
                if ((!dollar)||(ra != ZIP_Rnone)||(rb != ZIP_Rnone)||(cnd != ZIPC_ALWAYS))
331
                        valid = false;
332
                else ins = op_bra(imm);
333
        } else if (strcasecmp("BRZ",opc)==0) {
334
                if ((!dollar)||(ra != ZIP_Rnone)||(rb != ZIP_Rnone)||(cnd != ZIPC_ALWAYS))
335
                        valid = false;
336
                else ins = op_brz(imm);
337
        } else if ((strcasecmp("BRNZ",opc)==0)||(strcasecmp("BNZ",opc)==0)) {
338
                if ((!dollar)||(ra != ZIP_Rnone)||(rb != ZIP_Rnone)||(cnd != ZIPC_ALWAYS))
339
                        valid = false;
340
                else ins = op_bnz(imm);
341
        } else if ((strcasecmp("BRGE",opc)==0)||(strcasecmp("BGE",opc)==0)) {
342
                if ((!dollar)||(ra != ZIP_Rnone)||(rb != ZIP_Rnone)||(cnd != ZIPC_ALWAYS))
343
                        valid = false;
344
                else ins = op_bge(imm);
345
        } else if ((strcasecmp("BRGT",opc)==0)||(strcasecmp("BGT",opc)==0)) {
346
                if ((!dollar)||(ra != ZIP_Rnone)||(rb != ZIP_Rnone)||(cnd != ZIPC_ALWAYS))
347
                        valid = false;
348
                else ins = op_bgt(imm);
349
        } else if (strcasecmp("BRZ",opc)==0) {
350
        } else if ((strcasecmp("BRLT",opc)==0)||(strcasecmp("BLT",opc)==0)) {
351
                if ((!dollar)||(ra != ZIP_Rnone)||(rb != ZIP_Rnone)||(cnd != ZIPC_ALWAYS))
352
                        valid = false;
353
                else ins = op_blt(imm);
354
        } else if ((strcasecmp("BRC",opc)==0)||(strcasecmp("BC",opc)==0)) {
355
                if ((!dollar)||(ra != ZIP_Rnone)||(rb != ZIP_Rnone)||(cnd != ZIPC_ALWAYS))
356
                        valid = false;
357
                else ins = op_brc(imm);
358
        } else if ((strcasecmp("BRV",opc)==0)||(strcasecmp("BV",opc)==0)) {
359
                if ((!dollar)||(ra != ZIP_Rnone)||(rb != ZIP_Rnone)||(cnd != ZIPC_ALWAYS))
360
                        valid = false;
361
                else ins = op_brv(imm);
362
        } else if (strcasecmp("CLRF",opc)==0) {
363
                if ((ra == ZIP_Rnone)&&(!dollar)&&(imm==0))
364
                        ins = op_clrf(cnd, rb);
365
                else    valid = false;
366
        } else if((strcasecmp("HALT",opc)==0)||(strcasecmp("WAIT",opc)==0)) {
367 9 dgisselq
                if ((rb == ZIP_Rnone)&&(ra==ZIP_Rnone)&&(!opa)&&(!dollar))
368 2 dgisselq
                        ins = op_halt(cnd);
369
                else    valid = false;
370
        } else if (strcasecmp("BUSY",opc)==0) {
371 9 dgisselq
                if ((rb == ZIP_Rnone)&&(ra==ZIP_Rnone)&&(!opa)&&(!dollar))
372 2 dgisselq
                        ins = op_busy(cnd);
373
                else    valid = false;
374
        } else if (strcasecmp("RTU",opc)==0) {
375 9 dgisselq
                if ((rb == ZIP_Rnone)&&(ra==ZIP_Rnone)&&(imm==0)&&(!opa)&&(!dollar))
376 2 dgisselq
                        ins = op_rtu(cnd);
377
                else    { printf("ERRR,RTU, ra=%d,rb=%d,imm=%08x,comma=%s,dollar=%s\n",
378 9 dgisselq
                                (int)ra, (int)rb, imm, (opa)?"true":"false",
379 2 dgisselq
                                (dollar)?"true":"false");
380
                        valid = false;
381
                }
382
        } else if (strcasecmp("JMP",opc)==0) {
383 9 dgisselq
                if ((rb != ZIP_Rnone)&&(!opa))
384 2 dgisselq
                        ins = op_not(cnd, rb);
385
                else    valid = false;
386
        } else if (strcasecmp("NOT",opc)==0) {
387 9 dgisselq
                if ((rb != ZIP_Rnone)&&(ra==ZIP_Rnone)&&(!opa)&&(!dollar))
388 2 dgisselq
                        ins = op_not(cnd, rb);
389
                else    valid = false;
390
        } else  valid = false;
391
 
392
        return valid;
393
}
394
 
395
bool    ZPARSER::parse(const char *line, ZPARSER::ZIPA &pc, ZPARSER::ZIPI &instruction, const unsigned int lineno) {
396
        bool    v = parse_op(line, pc, instruction, lineno);
397
        pc = pc + 1;
398
        return v;
399
}
400
 
401
#define IMMOP(OP,CND,IMM,A) (((OP&0x0f)<<28)|((A&0x0f)<<24)|((CND&0x07)<<21) \
402
                        | (IMM & 0x0fffff))
403
 
404
#define DBLREGOP(OP,CND,IMM,B,A) (((OP&0x0f)<<28)|((A&0x0f)<<24)        \
405
                        |((CND&0x07)<<21)|(1<<20)|((B&0x0f)<<16)         \
406
                        | (IMM & 0x0ffff))
407
 
408
ZIPI    ZPARSER::op_cmp(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const {
409
        return DBLREGOP(0x0, cnd, imm, b, a);
410
}
411
 
412
ZIPI    ZPARSER::op_cmp(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const {
413
        return IMMOP(0x0, cnd, imm, a);
414
}
415
 
416
 
417
ZIPI    ZPARSER::op_tst(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const {
418
        return DBLREGOP(0x1, cnd, imm, b, a);
419
} ZIPI  ZPARSER::op_tst(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const {
420
        return IMMOP(0x1, cnd, imm, a);
421
}
422
 
423
ZIPI    ZPARSER::op_mov(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const {
424
        ZIPI    in;
425
        in = (0x02 << 28)|((a&0x0f)<<24)|((cnd&0x07)<<21);
426
        in |= (a&0x10)<<16;
427
        in |= (b&0x0f)<<16;
428
        in |= (b&0x10)<<11;
429
        in |= imm & 0x07fff;
430
        return in;
431
}
432
 
433
 
434
ZIPI    ZPARSER::op_ldi(ZIPIMM imm, ZIPREG a) const {
435
        ZIPI    in;
436
        in = ((0x03)<<28) | ((a&0x0f)<<24) | (imm & ((1<<24)-1));
437
        return in;
438
}
439
 
440
ZIPI    ZPARSER::op_trap(ZIPCOND cnd, ZIPIMM imm) const {
441
        ZIPI    in;
442
        in  = ((0x4f)<<24)|((cnd&0x07)<<21)|(1<<20)|((0x0e)<<16);
443
        in |= (imm & 0x0ffff);
444
        return in;
445
}
446
 
447
ZIPI    ZPARSER::op_noop(void) const {
448
        return 0x4e000000;
449
}
450
ZIPI    ZPARSER::op_break(void) const {
451
        return 0x4e000001;
452
}
453
 
454
ZIPI    ZPARSER::op_ldihi(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const {
455
        ZIPI    in;
456
        in  = ((0x4f)<<24)|((cnd&0x07)<<21)|(1<<20)|((a&0x0f)<<16);
457
        in |= (imm & 0x0ffff);
458
        return in;
459
}
460
ZIPI    ZPARSER::op_ldilo(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const {
461
        ZIPI    in;
462
        in  = ((0x4f)<<24)|((cnd&0x07)<<21)|(0<<20)|((a&0x0f)<<16);
463
        in |= (imm & 0x0ffff);
464
        return in;
465
}
466
 
467 8 dgisselq
ZIPI    ZPARSER::op_mpy(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const {
468
        return DBLREGOP(0x4, cnd, imm, b, a);
469
} ZIPI  ZPARSER::op_mpy(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const {
470
        return IMMOP(0x4, cnd, imm, a);
471
}
472
 
473
ZIPI    ZPARSER::op_rol(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const {
474
        return DBLREGOP(0x5, cnd, imm, b, a);
475
} ZIPI  ZPARSER::op_rol(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const {
476
        return IMMOP(0x5, cnd, imm, a);
477
}
478
 
479 2 dgisselq
ZIPI    ZPARSER::op_lod(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const {
480
        return DBLREGOP(0x6, cnd, imm, b, a);
481 8 dgisselq
} ZIPI  ZPARSER::op_lod(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const {
482 2 dgisselq
        return IMMOP(0x6, cnd, imm, a);
483
}
484
 
485
 
486
ZIPI    ZPARSER::op_sto(ZIPCOND cnd, ZIPREG v, ZIPIMM imm, ZIPREG b) const {
487
        return DBLREGOP(0x7, cnd, imm, b, v);
488
} ZIPI  ZPARSER::op_sto(ZIPCOND cnd, ZIPREG v, ZIPIMM imm) const {
489
        return IMMOP(0x7, cnd, imm, v);
490
}
491
 
492
 
493
ZIPI    ZPARSER::op_sub(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const {
494
        return DBLREGOP(0x8, cnd, imm, b, a);
495
} ZIPI  ZPARSER::op_sub(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const {
496
        return IMMOP(0x8, cnd, imm, a);
497
}
498
 
499
 
500
ZIPI    ZPARSER::op_and(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const {
501
        return DBLREGOP(0x9, cnd, imm, b, a);
502
} ZIPI  ZPARSER::op_and(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const {
503
        return IMMOP(0x9, cnd, imm, a);
504
}
505
 
506
 
507
ZIPI    ZPARSER::op_add(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const {
508
        return DBLREGOP(0xa, cnd, imm, b, a);
509
} ZIPI  ZPARSER::op_add(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const {
510
        return IMMOP(0xa, cnd, imm, a);
511
}
512
 
513
 
514
ZIPI    ZPARSER::op_or(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const {
515
        return DBLREGOP(0xb, cnd, imm, b, a);
516
} ZIPI  ZPARSER::op_or(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const {
517
        return IMMOP(0xb, cnd, imm, a);
518
}
519
 
520
ZIPI    ZPARSER::op_xor(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const {
521
        return DBLREGOP(0xc, cnd, imm, b, a);
522
} ZIPI  ZPARSER::op_xor(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const {
523
        return IMMOP(0xc, cnd, imm, a);
524
}
525
 
526
ZIPI    ZPARSER::op_lsl(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const {
527
        return DBLREGOP(0xd, cnd, imm, b, a);
528
} ZIPI  ZPARSER::op_lsl(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const {
529
        return IMMOP(0xd, cnd, imm, a);
530
}
531
 
532
ZIPI    ZPARSER::op_asr(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const {
533
        return DBLREGOP(0xe, cnd, imm, b, a);
534
} ZIPI  ZPARSER::op_asr(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const {
535
        return IMMOP(0xe, cnd, imm, a);
536
}
537
 
538
ZIPI    ZPARSER::op_lsr(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const {
539
        return DBLREGOP(0xf, cnd, imm, b, a);
540
} ZIPI  ZPARSER::op_lsr(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const {
541
        return IMMOP(0xf, cnd, imm, a);
542
}
543
 

powered by: WebSVN 2.1.0

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