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

Subversion Repositories zipcpu

[/] [zipcpu/] [trunk/] [sw/] [zasm/] [zparser.h] - Diff between revs 89 and 100

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 89 Rev 100
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//
//
// Filename:    zparser.h
// Filename:    zparser.h
//
//
// Project:     Zip CPU -- a small, lightweight, RISC CPU core
// Project:     Zip CPU -- a small, lightweight, RISC CPU core
//
//
// Purpose:     This file is really mis-named.  At one time it was going to
// Purpose:     This file is really mis-named.  At one time it was going to
//              be header file for the parser for the Zip Assembler, zasm. 
//              be header file for the parser for the Zip Assembler, zasm. 
//              Since then, I discovered Flex and Bison and have written a
//              Since then, I discovered Flex and Bison and have written a
//              parser using those tools.  The true parser may therefore be
//              parser using those tools.  The true parser may therefore be
//              found in zasm.y.  This file, however, still declares some
//              found in zasm.y.  This file, however, still declares some
//              very valuable tools.  In particular, all of the routines used
//              very valuable tools.  In particular, all of the routines used
//              to build instructions from the appropriate fields are declared
//              to build instructions from the appropriate fields are declared
//              in this file. 
//              in this file. 
//
//
// Creator:     Dan Gisselquist, Ph.D.
// Creator:     Dan Gisselquist, Ph.D.
//              Gisselquist Technology, LLC
//              Gisselquist Technology, LLC
//
//
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//
//
// Copyright (C) 2015, Gisselquist Technology, LLC
// Copyright (C) 2015, Gisselquist Technology, LLC
//
//
// This program is free software (firmware): you can redistribute it and/or
// This program is free software (firmware): you can redistribute it and/or
// modify it under the terms of  the GNU General Public License as published
// modify it under the terms of  the GNU General Public License as published
// by the Free Software Foundation, either version 3 of the License, or (at
// by the Free Software Foundation, either version 3 of the License, or (at
// your option) any later version.
// your option) any later version.
//
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
// for more details.
// for more details.
//
//
// You should have received a copy of the GNU General Public License along
// You should have received a copy of the GNU General Public License along
// with this program.  (It's in the $(ROOT)/doc directory, run make with no
// with this program.  (It's in the $(ROOT)/doc directory, run make with no
// target there if the PDF file isn't present.)  If not, see
// target there if the PDF file isn't present.)  If not, see
// <http://www.gnu.org/licenses/> for a copy.
// <http://www.gnu.org/licenses/> for a copy.
//
//
// License:     GPL, v3, as defined and found on www.gnu.org,
// License:     GPL, v3, as defined and found on www.gnu.org,
//              http://www.gnu.org/licenses/gpl.html
//              http://www.gnu.org/licenses/gpl.html
//
//
//
//
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
 
 
#ifndef ZPARSER_H
#ifndef ZPARSER_H
#define ZPARSER_H
#define ZPARSER_H
 
 
class   ZPARSER {
class   ZPARSER {
public:
public:
        typedef unsigned int    ZIPI, ZIPA;
        typedef unsigned int    ZIPI, ZIPA;
        typedef int     ZIPIMM;
        typedef int     ZIPIMM;
        typedef enum {
        typedef enum {
                ZIP_R0, ZIP_R1, ZIP_R2, ZIP_R3, ZIP_R4, ZIP_R5, ZIP_R6, ZIP_R7,
                ZIP_R0, ZIP_R1, ZIP_R2, ZIP_R3, ZIP_R4, ZIP_R5, ZIP_R6, ZIP_R7,
                ZIP_R8, ZIP_R9, ZIP_R10, ZIP_R11, ZIP_R12,
                ZIP_R8, ZIP_R9, ZIP_R10, ZIP_R11, ZIP_R12,
                        ZIP_SP, ZIP_CC, ZIP_PC,
                        ZIP_SP, ZIP_CC, ZIP_PC,
                ZIP_uR0, ZIP_uR1, ZIP_uR2, ZIP_uR3, ZIP_uR4, ZIP_uR5, ZIP_uR6, ZIP_uR7,
                ZIP_uR0, ZIP_uR1, ZIP_uR2, ZIP_uR3, ZIP_uR4, ZIP_uR5, ZIP_uR6, ZIP_uR7,
                ZIP_uR8, ZIP_uR9, ZIP_uR10, ZIP_uR11, ZIP_uR12,
                ZIP_uR8, ZIP_uR9, ZIP_uR10, ZIP_uR11, ZIP_uR12,
                        ZIP_uSP, ZIP_uCC, ZIP_uPC,
                        ZIP_uSP, ZIP_uCC, ZIP_uPC,
                ZIP_Rnone
                ZIP_Rnone
        } ZIPREG;
        } ZIPREG;
 
 
        typedef enum {
        typedef enum {
                ZIPC_ALWAYS, ZIPC_LT, ZIPC_Z, ZIPC_NZ,
                ZIPC_ALWAYS, ZIPC_LT, ZIPC_Z, ZIPC_NZ,
                ZIPC_GT, ZIPC_GE, ZIPC_C, ZIPC_V
                ZIPC_GT, ZIPC_GE, ZIPC_C, ZIPC_V
        } ZIPCOND;
        } ZIPCOND;
 
 
        typedef enum {
        typedef enum {
                // 16 ALU instructions
                // 16 ALU instructions
                ZIPO_SUB=0, ZIPO_AND, ZIPO_ADD, ZIPO_OR, // 5'h000xx
                ZIPO_SUB=0, ZIPO_AND, ZIPO_ADD, ZIPO_OR, // 5'h000xx
                ZIPO_XOR, ZIPO_LSR, ZIPO_LSL, ZIPO_ASR,         // 5'h001xx
                ZIPO_XOR, ZIPO_LSR, ZIPO_LSL, ZIPO_ASR,         // 5'h001xx
                ZIPO_LDIHI, ZIPO_LDILO, ZIPO_MPYU, ZIPO_MPYS,   // 5'h010xx
                ZIPO_LDIHI, ZIPO_LDILO, ZIPO_MPYU, ZIPO_MPYS,   // 5'h010xx
                ZIPO_BREV, ZIPO_POPC, ZIPO_ROL, ZIPO_MOV,       // 5'h011xx
                ZIPO_BREV, ZIPO_POPC, ZIPO_ROL, ZIPO_MOV,       // 5'h011xx
                ZIPO_CMP, ZIPO_TST,                             // 5'h1000x
                ZIPO_CMP, ZIPO_TST,                             // 5'h1000x
                ZIPO_LOD, ZIPO_STO,                             // 5'h1001w
                ZIPO_LOD, ZIPO_STO,                             // 5'h1001w
                ZIPO_DIVU, ZIPO_DIVS,                           // 5'h1010s
                ZIPO_DIVU, ZIPO_DIVS,                           // 5'h1010s
                ZIPO_LDI, ZIPO_LDIn,                            // 5'h1011x
                ZIPO_LDI, ZIPO_LDIn,                            // 5'h1011x
                // ZIPO_, ZIPO_DIVS,                            // 5'h11000
                // ZIPO_, ZIPO_DIVS,                            // 5'h11000
                ZIPO_FPADD=0x18, ZIPO_FPSUB,                    // 5'h1100x
                ZIPO_FPADD=0x18, ZIPO_FPSUB,                    // 5'h1100x
                ZIPO_FPMUL, ZIPO_FPDIV,                         // 5'h1101x
                ZIPO_FPMUL, ZIPO_FPDIV,                         // 5'h1101x
                ZIPO_FPCVT, ZIPO_FPINT,                         // 5'h1110x
                ZIPO_FPCVT, ZIPO_FPINT,                         // 5'h1110x
        } ZIPOP;
        } ZIPOP;
 
 
 
 
        ZIPI    op_cmp(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
        ZIPI    op_cmp(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
        ZIPI    op_cmp(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
        ZIPI    op_cmp(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
        ZIPI    op_cmp(ZIPIMM imm, ZIPREG b, ZIPREG a) const
        ZIPI    op_cmp(ZIPIMM imm, ZIPREG b, ZIPREG a) const
                { return op_cmp(ZIPC_ALWAYS, imm, b, a); }
                { return op_cmp(ZIPC_ALWAYS, imm, b, a); }
        ZIPI    op_cmp(ZIPIMM imm, ZIPREG a) const
        ZIPI    op_cmp(ZIPIMM imm, ZIPREG a) const
                { return op_cmp(ZIPC_ALWAYS, imm, a); }
                { return op_cmp(ZIPC_ALWAYS, imm, a); }
 
 
        ZIPI    op_tst(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
        ZIPI    op_tst(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
        ZIPI    op_tst(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
        ZIPI    op_tst(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
        ZIPI    op_tst(ZIPIMM imm, ZIPREG a) const
        ZIPI    op_tst(ZIPIMM imm, ZIPREG a) const
                { return op_tst(ZIPC_ALWAYS, imm, a); }
                { return op_tst(ZIPC_ALWAYS, imm, a); }
        ZIPI    op_tst(ZIPCOND cnd, ZIPREG a) const
        ZIPI    op_tst(ZIPCOND cnd, ZIPREG a) const
                { return op_tst(cnd, -1, a); }
                { return op_tst(cnd, -1, a); }
 
 
        ZIPI    op_mov(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
        ZIPI    op_mov(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
        ZIPI    op_mov(ZIPIMM imm, ZIPREG b, ZIPREG a) const
        ZIPI    op_mov(ZIPIMM imm, ZIPREG b, ZIPREG a) const
                { return op_mov(ZIPC_ALWAYS, imm, b, a); }
                { return op_mov(ZIPC_ALWAYS, imm, b, a); }
        ZIPI    op_mov(ZIPREG b, ZIPREG a) const
        ZIPI    op_mov(ZIPREG b, ZIPREG a) const
                { return op_mov(ZIPC_ALWAYS, 0, b, a); }
                { return op_mov(ZIPC_ALWAYS, 0, b, a); }
 
 
        ZIPI    op_ldi(ZIPIMM imm, ZIPREG a) const;
        ZIPI    op_ldi(ZIPIMM imm, ZIPREG a) const;
        ZIPI    op_trap(ZIPCOND cnd, ZIPIMM imm) const;
        ZIPI    op_trap(ZIPCOND cnd, ZIPIMM imm) const;
        ZIPI    op_trap(ZIPIMM imm) const
        ZIPI    op_trap(ZIPIMM imm) const
                { return op_trap(ZIPC_ALWAYS, imm); }
                { return op_trap(ZIPC_ALWAYS, imm); }
        ZIPI    op_clr(ZIPREG a) const { return op_ldi(0, a); }
        ZIPI    op_clr(ZIPREG a) const { return op_ldi(0, a); }
 
 
        ZIPI    op_noop(void) const;
        ZIPI    op_noop(void) const;
        ZIPI    op_break(void) const;
        ZIPI    op_break(void) const;
        ZIPI    op_lock(void) const;
        ZIPI    op_lock(void) const;
 
 
        ZIPI    op_ldihi(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
        ZIPI    op_ldihi(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
        ZIPI    op_ldilo(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
        ZIPI    op_ldilo(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
        ZIPI    op_ldihi(ZIPIMM imm, ZIPREG a) const
        ZIPI    op_ldihi(ZIPIMM imm, ZIPREG a) const
                { return op_ldihi(ZIPC_ALWAYS, imm, a); }
                { return op_ldihi(ZIPC_ALWAYS, imm, a); }
        ZIPI    op_ldilo(ZIPIMM imm, ZIPREG a) const
        ZIPI    op_ldilo(ZIPIMM imm, ZIPREG a) const
                { return op_ldilo(ZIPC_ALWAYS, imm, a); }
                { return op_ldilo(ZIPC_ALWAYS, imm, a); }
 
 
        ZIPI    op_mpyu(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
        ZIPI    op_mpyu(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
        ZIPI    op_mpyu(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
        ZIPI    op_mpyu(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
        ZIPI    op_mpyu(ZIPIMM imm, ZIPREG b, ZIPREG a) const
        ZIPI    op_mpyu(ZIPIMM imm, ZIPREG b, ZIPREG a) const
                { return op_mpyu(ZIPC_ALWAYS, imm, b, a); }
                { return op_mpyu(ZIPC_ALWAYS, imm, b, a); }
        ZIPI    op_mpyu(ZIPIMM imm, ZIPREG a) const
        ZIPI    op_mpyu(ZIPIMM imm, ZIPREG a) const
                { return op_mpyu(ZIPC_ALWAYS, imm, a); }
                { return op_mpyu(ZIPC_ALWAYS, imm, a); }
 
 
        ZIPI    op_mpys(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
        ZIPI    op_mpys(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
        ZIPI    op_mpys(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
        ZIPI    op_mpys(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
        ZIPI    op_mpys(ZIPIMM imm, ZIPREG b, ZIPREG a) const
        ZIPI    op_mpys(ZIPIMM imm, ZIPREG b, ZIPREG a) const
                { return op_mpys(ZIPC_ALWAYS, imm, b, a); }
                { return op_mpys(ZIPC_ALWAYS, imm, b, a); }
        ZIPI    op_mpys(ZIPIMM imm, ZIPREG a) const
        ZIPI    op_mpys(ZIPIMM imm, ZIPREG a) const
                { return op_mpys(ZIPC_ALWAYS, imm, a); }
                { return op_mpys(ZIPC_ALWAYS, imm, a); }
 
 
        ZIPI    op_rol(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
        ZIPI    op_rol(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
        ZIPI    op_rol(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
        ZIPI    op_rol(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
        ZIPI    op_rol(ZIPIMM imm, ZIPREG b, ZIPREG a) const
        ZIPI    op_rol(ZIPIMM imm, ZIPREG b, ZIPREG a) const
                { return op_rol(ZIPC_ALWAYS, imm, b, a); }
                { return op_rol(ZIPC_ALWAYS, imm, b, a); }
        ZIPI    op_rol(ZIPIMM imm, ZIPREG a) const
        ZIPI    op_rol(ZIPIMM imm, ZIPREG a) const
                { return op_rol(ZIPC_ALWAYS, imm, a); }
                { return op_rol(ZIPC_ALWAYS, imm, a); }
 
 
        ZIPI    op_popc(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
        ZIPI    op_popc(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
        ZIPI    op_popc(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
        ZIPI    op_popc(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
        ZIPI    op_popc(ZIPIMM imm, ZIPREG b, ZIPREG a) const
        ZIPI    op_popc(ZIPIMM imm, ZIPREG b, ZIPREG a) const
                { return op_popc(ZIPC_ALWAYS, imm, b, a); }
                { return op_popc(ZIPC_ALWAYS, imm, b, a); }
        ZIPI    op_popc(ZIPIMM imm, ZIPREG a) const
        ZIPI    op_popc(ZIPIMM imm, ZIPREG a) const
                { return op_popc(ZIPC_ALWAYS, imm, a); }
                { return op_popc(ZIPC_ALWAYS, imm, a); }
 
 
        ZIPI    op_brev(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
        ZIPI    op_brev(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
        ZIPI    op_brev(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
        ZIPI    op_brev(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
        ZIPI    op_brev(ZIPIMM imm, ZIPREG b, ZIPREG a) const
        ZIPI    op_brev(ZIPIMM imm, ZIPREG b, ZIPREG a) const
                { return op_brev(ZIPC_ALWAYS, imm, b, a); }
                { return op_brev(ZIPC_ALWAYS, imm, b, a); }
        ZIPI    op_brev(ZIPIMM imm, ZIPREG a) const
        ZIPI    op_brev(ZIPIMM imm, ZIPREG a) const
                { return op_brev(ZIPC_ALWAYS, imm, a); }
                { return op_brev(ZIPC_ALWAYS, imm, a); }
 
 
        ZIPI    op_lod(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
        ZIPI    op_lod(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
        ZIPI    op_lod(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
        ZIPI    op_lod(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
        ZIPI    op_lod(ZIPIMM imm, ZIPREG b, ZIPREG a) const
        ZIPI    op_lod(ZIPIMM imm, ZIPREG b, ZIPREG a) const
                { return op_lod(ZIPC_ALWAYS, imm, b, a); }
                { return op_lod(ZIPC_ALWAYS, imm, b, a); }
        ZIPI    op_lod(ZIPIMM imm, ZIPREG a) const
        ZIPI    op_lod(ZIPIMM imm, ZIPREG a) const
                { return op_lod(ZIPC_ALWAYS, imm, a); }
                { return op_lod(ZIPC_ALWAYS, imm, a); }
 
 
        ZIPI    op_sto(ZIPCOND cnd, ZIPREG v, ZIPIMM imm, ZIPREG b) const;
        ZIPI    op_sto(ZIPCOND cnd, ZIPREG v, ZIPIMM imm, ZIPREG b) const;
        ZIPI    op_sto(ZIPCOND cnd, ZIPREG v, ZIPIMM imm) const;
        ZIPI    op_sto(ZIPCOND cnd, ZIPREG v, ZIPIMM imm) const;
        ZIPI    op_sto(ZIPREG v, ZIPIMM imm, ZIPREG b) const
        ZIPI    op_sto(ZIPREG v, ZIPIMM imm, ZIPREG b) const
                { return op_sto(ZIPC_ALWAYS, v, imm, b); }
                { return op_sto(ZIPC_ALWAYS, v, imm, b); }
        ZIPI    op_sto(ZIPREG v, ZIPIMM imm) const
        ZIPI    op_sto(ZIPREG v, ZIPIMM imm) const
                { return op_sto(ZIPC_ALWAYS, v, imm); }
                { return op_sto(ZIPC_ALWAYS, v, imm); }
 
 
        ZIPI    op_sub(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
        ZIPI    op_sub(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
        ZIPI    op_sub(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
        ZIPI    op_sub(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
        ZIPI    op_sub(ZIPIMM imm, ZIPREG b, ZIPREG a) const
        ZIPI    op_sub(ZIPIMM imm, ZIPREG b, ZIPREG a) const
                { return op_sub(ZIPC_ALWAYS, imm, b, a); }
                { return op_sub(ZIPC_ALWAYS, imm, b, a); }
        ZIPI    op_sub(ZIPIMM imm, ZIPREG a) const
        ZIPI    op_sub(ZIPIMM imm, ZIPREG a) const
                { return op_sub(ZIPC_ALWAYS, imm, a); }
                { return op_sub(ZIPC_ALWAYS, imm, a); }
 
 
        ZIPI    op_and(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
        ZIPI    op_and(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
        ZIPI    op_and(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
        ZIPI    op_and(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
        ZIPI    op_and(ZIPIMM imm, ZIPREG b, ZIPREG a) const
        ZIPI    op_and(ZIPIMM imm, ZIPREG b, ZIPREG a) const
                { return op_and(ZIPC_ALWAYS, imm, b, a); }
                { return op_and(ZIPC_ALWAYS, imm, b, a); }
        ZIPI    op_and(ZIPIMM imm, ZIPREG a) const
        ZIPI    op_and(ZIPIMM imm, ZIPREG a) const
                { return op_and(ZIPC_ALWAYS, imm, a); }
                { return op_and(ZIPC_ALWAYS, imm, a); }
 
 
        ZIPI    op_add(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
        ZIPI    op_add(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
        ZIPI    op_add(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
        ZIPI    op_add(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
        ZIPI    op_add(ZIPIMM imm, ZIPREG b, ZIPREG a) const
        ZIPI    op_add(ZIPIMM imm, ZIPREG b, ZIPREG a) const
                { return op_add(ZIPC_ALWAYS, imm, b, a); }
                { return op_add(ZIPC_ALWAYS, imm, b, a); }
        ZIPI    op_add(ZIPIMM imm, ZIPREG a) const      // GOOD
        ZIPI    op_add(ZIPIMM imm, ZIPREG a) const      // GOOD
                { return op_add(ZIPC_ALWAYS, imm, a); }
                { return op_add(ZIPC_ALWAYS, imm, a); }
 
 
        ZIPI    op_or(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
        ZIPI    op_or(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
        ZIPI    op_or(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
        ZIPI    op_or(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
        ZIPI    op_or(ZIPIMM imm, ZIPREG b, ZIPREG a) const
        ZIPI    op_or(ZIPIMM imm, ZIPREG b, ZIPREG a) const
                { return op_or(ZIPC_ALWAYS, imm, b, a); }
                { return op_or(ZIPC_ALWAYS, imm, b, a); }
        ZIPI    op_or(ZIPIMM imm, ZIPREG a) const
        ZIPI    op_or(ZIPIMM imm, ZIPREG a) const
                { return op_or(ZIPC_ALWAYS, imm, a); }
                { return op_or(ZIPC_ALWAYS, imm, a); }
 
 
        ZIPI    op_xor(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
        ZIPI    op_xor(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
        ZIPI    op_xor(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
        ZIPI    op_xor(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
        ZIPI    op_xor(ZIPIMM imm, ZIPREG b, ZIPREG a) const
        ZIPI    op_xor(ZIPIMM imm, ZIPREG b, ZIPREG a) const
                { return op_xor(ZIPC_ALWAYS, imm, b, a); }
                { return op_xor(ZIPC_ALWAYS, imm, b, a); }
        ZIPI    op_xor(ZIPIMM imm, ZIPREG a) const
        ZIPI    op_xor(ZIPIMM imm, ZIPREG a) const
                { return op_xor(ZIPC_ALWAYS, imm, a); }
                { return op_xor(ZIPC_ALWAYS, imm, a); }
 
 
        ZIPI    op_lsl(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
        ZIPI    op_lsl(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
        ZIPI    op_lsl(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
        ZIPI    op_lsl(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
        ZIPI    op_lsl(ZIPIMM imm, ZIPREG b, ZIPREG a) const
        ZIPI    op_lsl(ZIPIMM imm, ZIPREG b, ZIPREG a) const
                { return op_lsl(ZIPC_ALWAYS, imm, b, a); }
                { return op_lsl(ZIPC_ALWAYS, imm, b, a); }
        ZIPI    op_lsl(ZIPIMM imm, ZIPREG a) const
        ZIPI    op_lsl(ZIPIMM imm, ZIPREG a) const
                { return op_lsl(ZIPC_ALWAYS, imm, a); }
                { return op_lsl(ZIPC_ALWAYS, imm, a); }
        ZIPI    op_asl(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const
        ZIPI    op_asl(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const
                { return op_lsl(cnd, imm, b, a); }
                { return op_lsl(cnd, imm, b, a); }
        ZIPI    op_asl(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const
        ZIPI    op_asl(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const
                { return op_lsl(cnd, imm, a); }
                { return op_lsl(cnd, imm, a); }
        ZIPI    op_asl(ZIPIMM imm, ZIPREG b, ZIPREG a) const
        ZIPI    op_asl(ZIPIMM imm, ZIPREG b, ZIPREG a) const
                { return op_lsl(ZIPC_ALWAYS, imm, b, a); }
                { return op_lsl(ZIPC_ALWAYS, imm, b, a); }
        ZIPI    op_asl(ZIPIMM imm, ZIPREG a) const
        ZIPI    op_asl(ZIPIMM imm, ZIPREG a) const
                { return op_lsl(ZIPC_ALWAYS, imm, a); }
                { return op_lsl(ZIPC_ALWAYS, imm, a); }
 
 
        ZIPI    op_asr(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
        ZIPI    op_asr(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
        ZIPI    op_asr(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
        ZIPI    op_asr(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
        ZIPI    op_asr(ZIPIMM imm, ZIPREG b, ZIPREG a) const
        ZIPI    op_asr(ZIPIMM imm, ZIPREG b, ZIPREG a) const
                { return op_asr(ZIPC_ALWAYS, imm, b, a); }
                { return op_asr(ZIPC_ALWAYS, imm, b, a); }
        ZIPI    op_asr(ZIPIMM imm, ZIPREG a) const
        ZIPI    op_asr(ZIPIMM imm, ZIPREG a) const
                { return op_asr(ZIPC_ALWAYS, imm, a); }
                { return op_asr(ZIPC_ALWAYS, imm, a); }
 
 
        ZIPI    op_lsr(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
        ZIPI    op_lsr(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
        ZIPI    op_lsr(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
        ZIPI    op_lsr(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
        ZIPI    op_lsr(ZIPIMM imm, ZIPREG b, ZIPREG a) const
        ZIPI    op_lsr(ZIPIMM imm, ZIPREG b, ZIPREG a) const
                { return op_lsr(ZIPC_ALWAYS, imm, b, a); }
                { return op_lsr(ZIPC_ALWAYS, imm, b, a); }
        ZIPI    op_lsr(ZIPIMM imm, ZIPREG a) const
        ZIPI    op_lsr(ZIPIMM imm, ZIPREG a) const
                { return op_lsr(ZIPC_ALWAYS, imm, a); }
                { return op_lsr(ZIPC_ALWAYS, imm, a); }
 
 
        ZIPI    op_bra(ZIPCOND cnd, ZIPIMM imm) const
        ZIPI    op_bra(ZIPCOND cnd, ZIPIMM imm) const
                { return op_mov(cnd, imm, ZIP_PC, ZIP_PC); }
                { return op_add(cnd, imm, ZIP_PC); }
        ZIPI    op_bra(ZIPIMM imm) const
        ZIPI    op_bra(ZIPIMM imm) const
                { return op_add(ZIPC_ALWAYS, imm, ZIP_PC); }
                { return op_add(ZIPC_ALWAYS, imm, ZIP_PC); }
        ZIPI    op_brz(ZIPIMM imm) const
        ZIPI    op_brz(ZIPIMM imm) const
                { return op_mov(ZIPC_Z, imm, ZIP_PC, ZIP_PC); }
                { return op_add(ZIPC_Z, imm, ZIP_PC); }
        ZIPI    op_bnz(ZIPIMM imm) const
        ZIPI    op_bnz(ZIPIMM imm) const
                { return op_mov(ZIPC_NZ, imm, ZIP_PC, ZIP_PC); }
                { return op_add(ZIPC_NZ, imm, ZIP_PC); }
        ZIPI    op_bge(ZIPIMM imm) const
        ZIPI    op_bge(ZIPIMM imm) const
                { return op_mov(ZIPC_GE, imm, ZIP_PC, ZIP_PC); }
                { return op_add(ZIPC_GE, imm, ZIP_PC); }
        ZIPI    op_bgt(ZIPIMM imm) const
        ZIPI    op_bgt(ZIPIMM imm) const
                { return op_mov(ZIPC_GT, imm, ZIP_PC, ZIP_PC); }
                { return op_add(ZIPC_GT, imm, ZIP_PC); }
        ZIPI    op_blt(ZIPIMM imm) const
        ZIPI    op_blt(ZIPIMM imm) const
                { return op_mov(ZIPC_LT, imm, ZIP_PC, ZIP_PC); }
                { return op_add(ZIPC_LT, imm, ZIP_PC); }
        ZIPI    op_brc(ZIPIMM imm) const
        ZIPI    op_brc(ZIPIMM imm) const
                { return op_mov(ZIPC_C, imm, ZIP_PC, ZIP_PC); }
                { return op_add(ZIPC_C, imm, ZIP_PC); }
        ZIPI    op_brv(ZIPIMM imm) const
        ZIPI    op_brv(ZIPIMM imm) const
                { return op_mov(ZIPC_V, imm, ZIP_PC, ZIP_PC); }
                { return op_add(ZIPC_V, imm, ZIP_PC); }
        ZIPI    op_bv(ZIPIMM imm) const
        ZIPI    op_bv(ZIPIMM imm) const
                { return op_brv(imm); }
                { return op_brv(imm); }
 
 
        ZIPI    op_clrf(ZIPCOND cnd, ZIPREG a) const
        ZIPI    op_clrf(ZIPCOND cnd, ZIPREG a) const
                { return op_xor(cnd, 0, a, a); }
                { return op_xor(cnd, 0, a, a); }
        ZIPI    op_clrf(ZIPREG a) const
        ZIPI    op_clrf(ZIPREG a) const
                { return op_xor(ZIPC_ALWAYS, 0, a, a); }
                { return op_xor(ZIPC_ALWAYS, 0, a, a); }
        // ZIPI op_retn(ZIPCOND c) const
        // ZIPI op_retn(ZIPCOND c) const
                // { return op_lod(c, 1, ZIP_SP, ZIP_PC); }
                // { return op_lod(c, 1, ZIP_SP, ZIP_PC); }
        ZIPI    op_halt(ZIPCOND c) const {
        ZIPI    op_halt(ZIPCOND c) const {
                return op_or(c, 0x10, ZIP_CC); }
                return op_or(c, 0x10, ZIP_CC); }
        ZIPI    op_wait(ZIPCOND c) const {
        ZIPI    op_wait(ZIPCOND c) const {
                return op_or(c, 0x30, ZIP_CC); }
                return op_or(c, 0x30, ZIP_CC); }
        ZIPI    op_halt(void) const {
        ZIPI    op_halt(void) const {
                return op_or(ZIPC_ALWAYS, 0x10, ZIP_CC); }
                return op_or(ZIPC_ALWAYS, 0x10, ZIP_CC); }
        ZIPI    op_wait(void) const {
        ZIPI    op_wait(void) const {
                return op_or(ZIPC_ALWAYS, 0x10, ZIP_CC); }
                return op_or(ZIPC_ALWAYS, 0x10, ZIP_CC); }
        ZIPI    op_busy(ZIPCOND c) const {
        ZIPI    op_busy(ZIPCOND c) const {
                return op_mov(c, -1, ZIP_PC, ZIP_PC); }
                return op_add(c, -1, ZIP_PC); }
        ZIPI    op_busy(void) const {
        ZIPI    op_busy(void) const {
                return op_mov(ZIPC_ALWAYS, -1, ZIP_PC, ZIP_PC); }
                return op_add(ZIPC_ALWAYS, -1, ZIP_PC); }
 
 
        ZIPI    op_rtu(void) const {
        ZIPI    op_rtu(void) const {
                return op_or(ZIPC_ALWAYS, 0x20, ZIP_CC); }
                return op_or(ZIPC_ALWAYS, 0x20, ZIP_CC); }
        ZIPI    op_rtu(ZIPCOND cnd) const {
        ZIPI    op_rtu(ZIPCOND cnd) const {
                return op_or(cnd, 0x20, ZIP_CC); }
                return op_or(cnd, 0x20, ZIP_CC); }
 
 
        ZIPI    op_jmp(ZIPCOND c, ZIPIMM imm, ZIPREG r) const
        ZIPI    op_jmp(ZIPCOND c, ZIPIMM imm, ZIPREG r) const
                { return op_mov(ZIPC_ALWAYS, imm, r, ZIP_PC); }
                { return op_mov(ZIPC_ALWAYS, imm, r, ZIP_PC); }
 
 
 
        ZIPI    op_ljmp(void) const { return 0x7c87c000; }
 
 
        ZIPI    op_ljmp(ZIPCOND c, ZIPIMM imm) const {
        ZIPI    op_ljmp(ZIPCOND c, ZIPIMM imm) const {
                return op_add(ZIPC_ALWAYS, imm, ZIP_PC); }
                return op_add(ZIPC_ALWAYS, imm, ZIP_PC); }
 
 
        ZIPI    op_not(ZIPCOND c, ZIPREG r) const
        ZIPI    op_not(ZIPCOND c, ZIPREG r) const
                { return op_xor(c, -1, r); }
                { return op_xor(c, -1, r); }
        ZIPI    op_not(ZIPREG r) const
        ZIPI    op_not(ZIPREG r) const
                { return op_xor(ZIPC_ALWAYS, -1, r); }
                { return op_xor(ZIPC_ALWAYS, -1, r); }
 
 
        ZIPI    op_divu(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
        ZIPI    op_divu(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
        ZIPI    op_divu(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
        ZIPI    op_divu(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
        ZIPI    op_divs(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
        ZIPI    op_divs(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
        ZIPI    op_divs(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
        ZIPI    op_divs(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
 
 
        bool    can_merge(const ZIPI a, const ZIPI b);
        bool    can_merge(const ZIPI a, const ZIPI b);
        ZIPI    merge(const ZIPI a, const ZIPI b);
        ZIPI    merge(const ZIPI a, const ZIPI b);
        ZIPIMM  immediate(const ZIPI a);
        ZIPIMM  immediate(const ZIPI a);
 
 
};
};
 
 
#endif
#endif
 
 

powered by: WebSVN 2.1.0

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