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

Subversion Repositories zipcpu

[/] [zipcpu/] [trunk/] [sw/] [zasm/] [zparser.h] - Diff between revs 46 and 69

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 46 Rev 69
Line 12... Line 12...
//              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 Tecnology, LLC
//              Gisselquist Technology, LLC
//
//
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//
//
// Copyright (C) 2015, Gisselquist Technology, LLC
// Copyright (C) 2015, Gisselquist Technology, LLC
//
//
Line 57... Line 57...
                        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_Z, ZIPC_NZ, ZIPC_GE, ZIPC_GT, ZIPC_LT,
                ZIPC_ALWAYS, ZIPC_LT, ZIPC_Z, ZIPC_NZ,
                ZIPC_C, ZIPC_V
                ZIPC_GT, ZIPC_GE, ZIPC_C, ZIPC_V
        } ZIPCOND;
        } ZIPCOND;
 
 
 
        typedef enum {
 
                // 16 ALU instructions
 
                ZIPO_SUB=0, ZIPO_AND, ZIPO_ADD, ZIPO_OR, // 5'h000xx
 
                ZIPO_XOR, ZIPO_LSR, ZIPO_LSL, ZIPO_ASR,         // 5'h001xx
 
                ZIPO_LDIHI, ZIPO_LDILO, ZIPO_MPYU, ZIPO_MPYS,   // 5'h010xx
 
                ZIPO_BREV, ZIPO_POPC, ZIPO_ROL, ZIPO_MOV,       // 5'h011xx
 
                ZIPO_CMP, ZIPO_TST,                             // 5'h1000x
 
                ZIPO_LOD, ZIPO_STO,                             // 5'h1001w
 
                ZIPO_DIVU, ZIPO_DIVS,                           // 5'h1010s
 
                ZIPO_LDI, ZIPO_LDIn,                            // 5'h1011x
 
                // ZIPO_, ZIPO_DIVS,                            // 5'h11000
 
                ZIPO_FPADD=0x18, ZIPO_FPSUB,                    // 5'h1100x
 
                ZIPO_FPMUL, ZIPO_FPDIV,                         // 5'h1101x
 
                ZIPO_FPCVT, ZIPO_FPINT,                         // 5'h1110x
 
        } 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); }
Line 90... Line 106...
                { 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_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); }
Line 119... Line 136...
        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 a) const;
 
        ZIPI    op_popc(ZIPIMM imm, ZIPREG b, ZIPREG a) const
 
                { return op_popc(ZIPC_ALWAYS, imm, b, a); }
 
        ZIPI    op_popc(ZIPIMM imm, ZIPREG a) const
 
                { 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 a) const;
 
        ZIPI    op_brev(ZIPIMM imm, ZIPREG b, ZIPREG a) const
 
                { return op_brev(ZIPC_ALWAYS, imm, b, a); }
 
        ZIPI    op_brev(ZIPIMM imm, ZIPREG a) const
 
                { 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
Line 222... Line 253...
 
 
        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, 0x10, 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 {
Line 253... Line 284...
        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 a) const;
 
        ZIPI    op_divs(ZIPCOND cnd, ZIPIMM imm, ZIPREG b, ZIPREG a) const;
 
        ZIPI    op_divs(ZIPCOND cnd, ZIPIMM imm, ZIPREG a) const;
 
 
 
        bool    can_merge(const ZIPI a, const ZIPI b);
 
        ZIPI    merge(const ZIPI a, const ZIPI b);
 
        ZIPIMM  immediate(const ZIPI a);
 
 
};
};
 
 
#endif
#endif
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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