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

Subversion Repositories zipcpu

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

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
        char    cpy[128], *cp = cpy, *point, *dollar, *plus, *comma,
88
                        *opc, *opb;
89
        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
        // paren = strchr(cpy, '(');
122
        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
 
159
        if (dollar) {
160
                // Figure out the base
161
                {
162
                        char *ip = dollar, mxd = 0;
163
                        if ((*ip == '0')&&(toupper(ip[1])=='X'))
164
                                imm = strtoul(dollar, NULL, 16);
165
                        else {
166
                                bool neg = false;
167
                                if (*ip == '-') {
168
                                        neg = true;
169
                                        ip++;
170
                                        dollar++;
171
                                }
172
                                while(isdigit(*ip)||((toupper(*ip)>='A')&&(toupper(*ip)<='F'))) {
173
                                        if (isalpha(*ip))
174
                                                mxd = (*ip-'a')+10;
175
                                        else
176
                                                mxd = (*ip-'0');
177
                                        ip++;
178
                                }
179
 
180
                                if ((mxd <= 1)&&(*ip=='d'))
181
                                        imm = strtoul(dollar, NULL, 2);
182
                                else if ((mxd <= 7)&&((*dollar == '0')||(toupper(*ip)=='O')))
183
                                        imm = strtoul(dollar, NULL, 8);
184
                                else if ((mxd <= 15)&&(toupper(*ip)=='H'))
185
                                        imm = strtoul(dollar, NULL, 16);
186
                                else if ((toupper(*ip)=='D')||(*ip == '+')||(isspace(*ip))||(*ip == '(')||(*ip == '\0'))
187
                                        imm = atoi(dollar);
188
                                else {
189
                                        printf("Cannot parse immediate, %s\n", dollar);
190
                                        printf("Assuming you meant %d\n", atoi(dollar));
191
                                        imm = atoi(dollar);
192
                                }
193
 
194
                                if (neg)
195
                                        imm = -imm;
196
                        }
197
                }
198
                opb = dollar;
199
                if (plus)
200
                        opb = plus;
201
        } else
202
                imm = 0;
203
        if (*opb) for(int i=31; i>=0; i--) {
204
                // printf("Checking for match: \'%s\' to %s", opb, zop_regstr[i]);
205
                if (NULL != strcasestr(opb, zop_regstr[i])) {
206
                        // printf(" --- Match\n");
207
                        rb = (ZIPREG)i;
208
                        break;
209
                } // else printf(" -- nope\n");
210
        } if (comma) for(int i=31; i>=0; i--) {
211
                // printf("Checking for match: ,%s to %s", comma, zop_regstr[i]);
212
                if (NULL != strcasestr(comma, zop_regstr[i])) {
213
                        ra = (ZIPREG)i;
214
                        // printf(" --- Match\n");
215
                        break;
216
                } // else printf(" -- nope\n");
217
        }
218
 
219
        if (strcasecmp("MOV",opc)!=0) {
220
                // Only move instructions can reference user regs
221
                if ((ra != ZIP_Rnone)&&(ra >= ZIP_uR0))
222
                        valid = false;
223
                if ((rb != ZIP_Rnone)&&(rb >= ZIP_uR0))
224
                        valid = false;
225
                if (!valid)
226
                        printf("ERR: Only Mov can specify user regs\n");
227
        }
228
 
229
        if ((!*opc)&&(strncasecmp("DAT",point,3)==0)) {
230
                ins = strtoul(opb, NULL, 0);
231
                valid = true;
232
        } else if (strcasecmp("CMP",opc)==0) {
233
                if (rb != ZIP_Rnone)
234
                        ins = op_cmp(cnd, imm, rb, ra);
235
                else    ins = op_cmp(cnd, imm, ra);
236
        } else if (strcasecmp("TST",opc)==0) {
237
                if (rb != ZIP_Rnone)
238
                        ins = op_tst(cnd, imm, rb, ra);
239
                else if (!dollar)
240
                        ins = op_tst(cnd, ra);
241
                else
242
                        ins = op_tst(cnd, imm, ra);
243
        } else if (strcasecmp("MOV",opc)==0) {
244
                if ((rb != ZIP_Rnone)&&(ra != ZIP_Rnone))
245
                        ins = op_mov(cnd, imm, rb, ra);
246
                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; }
247
        } else if (strcasecmp("LDI",opc)==0) {
248
                if ((rb == ZIP_Rnone)&&(cnd == ZIPC_ALWAYS))
249
                        ins = op_ldi(imm, ra);
250
                else    valid = false;
251
        } else if (strcasecmp("trap",opc)==0) {
252
                if ((rb == ZIP_Rnone)&&(rb == ZIP_Rnone))
253
                        ins = op_trap(cnd, imm);
254
                else
255
                        valid = false;
256
        } else if (strcasecmp("CLR",opc)==0) {
257
                if ((ra == ZIP_Rnone)&&(!dollar)&&(cnd == ZIPC_ALWAYS))
258
                        ins = op_clr(rb);       // Good
259
                else    valid = false;
260
        } else if ((strcasecmp("NOOP",opc)==0)||(strcasecmp("NOP",opc)==0)) {
261
                if ((rb == ZIP_Rnone)&&(ra == ZIP_Rnone)&&(!dollar)&&(cnd == ZIPC_ALWAYS))
262
                        ins = op_noop();
263
                else    { printf("ERR: NOP, ra=%d, rb=%d, dollar = %s\n",
264
                                (int)ra, (int)rb, (dollar)?"true":"false"); valid = false; }
265
        } else if ((strcasecmp("BREAK",opc)==0)||(strcasecmp("BRK",opc)==0)) {
266
                if ((rb == ZIP_Rnone)&&(ra == ZIP_Rnone)&&(!dollar)&&(cnd == ZIPC_ALWAYS))
267
                        ins = op_break();
268
                else    { printf("ERR: BRK, ra=%d, rb=%d, dollar = %s\n",
269
                                (int)ra, (int)rb, (dollar)?"true":"false"); valid = false; }
270
        } else if ((strcasecmp("LDIHI",opc)==0)||(strcasecmp("LODIHI",opc)==0)) {
271
                if ((dollar)&&(ra != ZIP_Rnone))
272
                        ins = op_ldihi(cnd, imm, ra);
273
                else    valid = false;
274
        } else if ((strcasecmp("LDILO",opc)==0)||(strcasecmp("LODILO",opc)==0)){
275
                if ((dollar)&&(ra != ZIP_Rnone))
276
                        ins = op_ldilo(cnd, imm, ra);
277
                else    valid = false;
278
        } else if ((strcasecmp("LOD",opc)==0)||(strcasecmp("LOAD",opc)==0)) {
279
                if (rb != ZIP_Rnone)
280
                        ins = op_lod(cnd,imm,rb,ra);
281
                else    ins = op_lod(cnd,imm,ra);
282
        } else if ((strcasecmp("STO",opc)==0)||(strcasecmp("STOR",opc)==0)) {
283
                if (rb != ZIP_Rnone)
284
                        ins = op_sto(cnd,rb,imm,ra);
285
                else    ins = op_sto(cnd,rb,imm);
286
        } else if (strcasecmp("SUB",opc)==0) {
287
                if (rb != ZIP_Rnone)
288
                        ins = op_sub(cnd,imm,rb,ra);
289
                else    ins = op_sub(cnd,imm,ra);
290
        } else if (strcasecmp("AND",opc)==0) {
291
                if (rb != ZIP_Rnone)
292
                        ins = op_and(cnd,imm,rb,ra);
293
                else    ins = op_and(cnd,imm,ra);
294
        } else if (strcasecmp("ADD",opc)==0) {
295
                if (rb != ZIP_Rnone)
296
                        ins = op_add(cnd,imm,rb,ra);
297
                else    ins = op_add(cnd,imm,ra);
298
        } else if (strcasecmp("OR",opc)==0) {
299
                if (rb != ZIP_Rnone)
300
                        ins = op_or(cnd,imm,rb,ra);
301
                else    ins = op_or(cnd,imm,ra);
302
        } else if (strcasecmp("XOR",opc)==0) {
303
                if (rb != ZIP_Rnone)
304
                        ins = op_xor(cnd,imm,rb,ra);
305
                else    ins = op_xor(cnd,imm,ra);
306
        } else if ((strcasecmp("LSL",opc)==0)||(strcasecmp("ASL",opc)==0)) {
307
                if (rb != ZIP_Rnone)
308
                        ins = op_lsl(cnd,imm,rb,ra);
309
                else    ins = op_lsl(cnd,imm,ra);
310
        } else if (strcasecmp("ASR",opc)==0) {
311
                if (rb != ZIP_Rnone)
312
                        ins = op_asr(cnd,imm,rb,ra);
313
                else    ins = op_asr(cnd,imm,ra);
314
        } else if (strcasecmp("LSR",opc)==0) {
315
                if (rb != ZIP_Rnone)
316
                        ins = op_lsr(cnd,imm,rb,ra);
317
                else    ins = op_lsr(cnd,imm,ra);
318
        } else if (strcasecmp("BR",opc)==0) {
319
                if ((dollar)||(ra != ZIP_Rnone)||(rb != ZIP_Rnone))
320
                        valid = false;
321
                else ins = op_bra(cnd, imm);
322
        } else if (strcasecmp("BRA",opc)==0) {
323
                if ((!dollar)||(ra != ZIP_Rnone)||(rb != ZIP_Rnone)||(cnd != ZIPC_ALWAYS))
324
                        valid = false;
325
                else ins = op_bra(imm);
326
        } else if (strcasecmp("BRZ",opc)==0) {
327
                if ((!dollar)||(ra != ZIP_Rnone)||(rb != ZIP_Rnone)||(cnd != ZIPC_ALWAYS))
328
                        valid = false;
329
                else ins = op_brz(imm);
330
        } else if ((strcasecmp("BRNZ",opc)==0)||(strcasecmp("BNZ",opc)==0)) {
331
                if ((!dollar)||(ra != ZIP_Rnone)||(rb != ZIP_Rnone)||(cnd != ZIPC_ALWAYS))
332
                        valid = false;
333
                else ins = op_bnz(imm);
334
        } else if ((strcasecmp("BRGE",opc)==0)||(strcasecmp("BGE",opc)==0)) {
335
                if ((!dollar)||(ra != ZIP_Rnone)||(rb != ZIP_Rnone)||(cnd != ZIPC_ALWAYS))
336
                        valid = false;
337
                else ins = op_bge(imm);
338
        } else if ((strcasecmp("BRGT",opc)==0)||(strcasecmp("BGT",opc)==0)) {
339
                if ((!dollar)||(ra != ZIP_Rnone)||(rb != ZIP_Rnone)||(cnd != ZIPC_ALWAYS))
340
                        valid = false;
341
                else ins = op_bgt(imm);
342
        } else if (strcasecmp("BRZ",opc)==0) {
343
        } else if ((strcasecmp("BRLT",opc)==0)||(strcasecmp("BLT",opc)==0)) {
344
                if ((!dollar)||(ra != ZIP_Rnone)||(rb != ZIP_Rnone)||(cnd != ZIPC_ALWAYS))
345
                        valid = false;
346
                else ins = op_blt(imm);
347
        } else if ((strcasecmp("BRC",opc)==0)||(strcasecmp("BC",opc)==0)) {
348
                if ((!dollar)||(ra != ZIP_Rnone)||(rb != ZIP_Rnone)||(cnd != ZIPC_ALWAYS))
349
                        valid = false;
350
                else ins = op_brc(imm);
351
        } else if ((strcasecmp("BRV",opc)==0)||(strcasecmp("BV",opc)==0)) {
352
                if ((!dollar)||(ra != ZIP_Rnone)||(rb != ZIP_Rnone)||(cnd != ZIPC_ALWAYS))
353
                        valid = false;
354
                else ins = op_brv(imm);
355
        } else if (strcasecmp("CLRF",opc)==0) {
356
                if ((ra == ZIP_Rnone)&&(!dollar)&&(imm==0))
357
                        ins = op_clrf(cnd, rb);
358
                else    valid = false;
359
        } else if((strcasecmp("HALT",opc)==0)||(strcasecmp("WAIT",opc)==0)) {
360
                if ((rb == ZIP_Rnone)&&(ra==ZIP_Rnone)&&(!comma)&&(!dollar))
361
                        ins = op_halt(cnd);
362
                else    valid = false;
363
        } else if (strcasecmp("BUSY",opc)==0) {
364
                if ((rb == ZIP_Rnone)&&(ra==ZIP_Rnone)&&(!comma)&&(!dollar))
365
                        ins = op_busy(cnd);
366
                else    valid = false;
367
        } else if (strcasecmp("RTU",opc)==0) {
368
                if ((rb == ZIP_Rnone)&&(ra==ZIP_Rnone)&&(imm==0)&&(!comma)&&(!dollar))
369
                        ins = op_rtu(cnd);
370
                else    { printf("ERRR,RTU, ra=%d,rb=%d,imm=%08x,comma=%s,dollar=%s\n",
371
                                (int)ra, (int)rb, imm, (comma)?"true":"false",
372
                                (dollar)?"true":"false");
373
                        valid = false;
374
                }
375
        } else if (strcasecmp("JMP",opc)==0) {
376
                if ((rb != ZIP_Rnone)&&(!comma))
377
                        ins = op_not(cnd, rb);
378
                else    valid = false;
379
        } else if (strcasecmp("NOT",opc)==0) {
380
                if ((rb != ZIP_Rnone)&&(ra==ZIP_Rnone)&&(!comma)&&(!dollar))
381
                        ins = op_not(cnd, rb);
382
                else    valid = false;
383
        } else  valid = false;
384
 
385
        return valid;
386
}
387
 
388
bool    ZPARSER::parse(const char *line, ZPARSER::ZIPA &pc, ZPARSER::ZIPI &instruction, const unsigned int lineno) {
389
        bool    v = parse_op(line, pc, instruction, lineno);
390
        pc = pc + 1;
391
        return v;
392
}
393
 
394
#define IMMOP(OP,CND,IMM,A) (((OP&0x0f)<<28)|((A&0x0f)<<24)|((CND&0x07)<<21) \
395
                        | (IMM & 0x0fffff))
396
 
397
#define DBLREGOP(OP,CND,IMM,B,A) (((OP&0x0f)<<28)|((A&0x0f)<<24)        \
398
                        |((CND&0x07)<<21)|(1<<20)|((B&0x0f)<<16)         \
399
                        | (IMM & 0x0ffff))
400
 
401
ZIPI    ZPARSER::op_cmp(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const {
402
        return DBLREGOP(0x0, cnd, imm, b, a);
403
}
404
 
405
ZIPI    ZPARSER::op_cmp(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const {
406
        return IMMOP(0x0, cnd, imm, a);
407
}
408
 
409
 
410
ZIPI    ZPARSER::op_tst(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const {
411
        return DBLREGOP(0x1, cnd, imm, b, a);
412
} ZIPI  ZPARSER::op_tst(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const {
413
        return IMMOP(0x1, cnd, imm, a);
414
}
415
 
416
ZIPI    ZPARSER::op_mov(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const {
417
        ZIPI    in;
418
        in = (0x02 << 28)|((a&0x0f)<<24)|((cnd&0x07)<<21);
419
        in |= (a&0x10)<<16;
420
        in |= (b&0x0f)<<16;
421
        in |= (b&0x10)<<11;
422
        in |= imm & 0x07fff;
423
        return in;
424
}
425
 
426
 
427
ZIPI    ZPARSER::op_ldi(ZIPIMM imm, ZIPREG a) const {
428
        ZIPI    in;
429
        in = ((0x03)<<28) | ((a&0x0f)<<24) | (imm & ((1<<24)-1));
430
        return in;
431
}
432
 
433
ZIPI    ZPARSER::op_trap(ZIPCOND cnd, ZIPIMM imm) const {
434
        ZIPI    in;
435
        in  = ((0x4f)<<24)|((cnd&0x07)<<21)|(1<<20)|((0x0e)<<16);
436
        in |= (imm & 0x0ffff);
437
        return in;
438
}
439
 
440
ZIPI    ZPARSER::op_noop(void) const {
441
        return 0x4e000000;
442
}
443
ZIPI    ZPARSER::op_break(void) const {
444
        return 0x4e000001;
445
}
446
 
447
ZIPI    ZPARSER::op_ldihi(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const {
448
        ZIPI    in;
449
        in  = ((0x4f)<<24)|((cnd&0x07)<<21)|(1<<20)|((a&0x0f)<<16);
450
        in |= (imm & 0x0ffff);
451
        return in;
452
}
453
ZIPI    ZPARSER::op_ldilo(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const {
454
        ZIPI    in;
455
        in  = ((0x4f)<<24)|((cnd&0x07)<<21)|(0<<20)|((a&0x0f)<<16);
456
        in |= (imm & 0x0ffff);
457
        return in;
458
}
459
 
460
ZIPI    ZPARSER::op_lod(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const {
461
        return DBLREGOP(0x6, cnd, imm, b, a);
462
}
463
 
464
ZIPI    ZPARSER::op_lod(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const {
465
        return IMMOP(0x6, cnd, imm, a);
466
}
467
 
468
 
469
ZIPI    ZPARSER::op_sto(ZIPCOND cnd, ZIPREG v, ZIPIMM imm, ZIPREG b) const {
470
        return DBLREGOP(0x7, cnd, imm, b, v);
471
} ZIPI  ZPARSER::op_sto(ZIPCOND cnd, ZIPREG v, ZIPIMM imm) const {
472
        return IMMOP(0x7, cnd, imm, v);
473
}
474
 
475
 
476
ZIPI    ZPARSER::op_sub(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const {
477
        return DBLREGOP(0x8, cnd, imm, b, a);
478
} ZIPI  ZPARSER::op_sub(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const {
479
        return IMMOP(0x8, cnd, imm, a);
480
}
481
 
482
 
483
ZIPI    ZPARSER::op_and(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const {
484
        return DBLREGOP(0x9, cnd, imm, b, a);
485
} ZIPI  ZPARSER::op_and(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const {
486
        return IMMOP(0x9, cnd, imm, a);
487
}
488
 
489
 
490
ZIPI    ZPARSER::op_add(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const {
491
        return DBLREGOP(0xa, cnd, imm, b, a);
492
} ZIPI  ZPARSER::op_add(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const {
493
        return IMMOP(0xa, cnd, imm, a);
494
}
495
 
496
 
497
ZIPI    ZPARSER::op_or(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const {
498
        return DBLREGOP(0xb, cnd, imm, b, a);
499
} ZIPI  ZPARSER::op_or(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const {
500
        return IMMOP(0xb, cnd, imm, a);
501
}
502
 
503
ZIPI    ZPARSER::op_xor(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const {
504
        return DBLREGOP(0xc, cnd, imm, b, a);
505
} ZIPI  ZPARSER::op_xor(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const {
506
        return IMMOP(0xc, cnd, imm, a);
507
}
508
 
509
ZIPI    ZPARSER::op_lsl(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const {
510
        return DBLREGOP(0xd, cnd, imm, b, a);
511
} ZIPI  ZPARSER::op_lsl(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const {
512
        return IMMOP(0xd, cnd, imm, a);
513
}
514
 
515
ZIPI    ZPARSER::op_asr(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const {
516
        return DBLREGOP(0xe, cnd, imm, b, a);
517
} ZIPI  ZPARSER::op_asr(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const {
518
        return IMMOP(0xe, cnd, imm, a);
519
}
520
 
521
ZIPI    ZPARSER::op_lsr(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const {
522
        return DBLREGOP(0xf, cnd, imm, b, a);
523
} ZIPI  ZPARSER::op_lsr(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const {
524
        return IMMOP(0xf, cnd, imm, a);
525
}
526
 

powered by: WebSVN 2.1.0

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