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

Subversion Repositories thor

[/] [thor/] [trunk/] [FT64v5/] [software/] [AS64/] [source/] [FT64.cpp] - Diff between revs 50 and 54

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

Rev 50 Rev 54
Line 56... Line 56...
#define OPTX32    1
#define OPTX32    1
#define OPTLUI0   0
#define OPTLUI0   0
#define LB16    -31653LL
#define LB16    -31653LL
 
 
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
 
// ----------------------------------------------------------------------------
 
 
 
static void error(char *msg)
 
{
 
        printf("%s. (%d)\n", msg, /*mname.c_str(), */lineno);
 
}
 
 
 
// ----------------------------------------------------------------------------
// Return the register number or -1 if not a register.
// Return the register number or -1 if not a register.
// Parses pretty register names like SP or BP in addition to r1,r2,etc.
// Parses pretty register names like SP or BP in addition to r1,r2,etc.
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
 
 
//static int getRegisterX()
//static int getRegisterX()
Line 1026... Line 1034...
        if (strchr("hsdtqHSDTQ",*inptr)) {
        if (strchr("hsdtqHSDTQ",*inptr)) {
            sz = tolower(*inptr);
            sz = tolower(*inptr);
            inptr++;
            inptr++;
        }
        }
        else
        else
            printf("Illegal float size.\r\n");
            error("Illegal float size");
    }
    }
        switch(sz) {
        switch(sz) {
        case 'h':       sz = 0; break;
        case 'h':       sz = 0; break;
        case 's':       sz = 1; break;
        case 's':       sz = 1; break;
        case 'd':       sz = 2; break;
        case 'd':       sz = 2; break;
Line 1060... Line 1068...
          hTable[htblmax].opcode = (int)oc;
          hTable[htblmax].opcode = (int)oc;
          hTable[htblmax].count = 1;
          hTable[htblmax].count = 1;
          htblmax++;
          htblmax++;
          return;
          return;
       }
       }
       printf("Too many instructions.\r\n");
       error("Too many instructions");
       return;
       return;
    }
    }
    if (pass > 3) {
    if (pass > 3) {
     if (can_compress && gCanCompress) {
     if (can_compress && gCanCompress) {
       for (ndx = 0; ndx < min(128,htblmax); ndx++) {
       for (ndx = 0; ndx < min(128,htblmax); ndx++) {
Line 1285... Line 1293...
                        *sz = 3;
                        *sz = 3;
                break;
                break;
        case 'd': case 'D': *sz = 0x83; break;
        case 'd': case 'D': *sz = 0x83; break;
        case 'i': case 'I': *sz = 0x43; break;
        case 'i': case 'I': *sz = 0x43; break;
    default:
    default:
             printf("%d bad size.\r\n", lineno);
    error("Bad size");
             *sz = 3;
             *sz = 3;
    }
    }
    inptr += 1;
    inptr += 1;
}
}
 
 
Line 1358... Line 1366...
                                                (0 << 12) |
                                                (0 << 12) |
                                                (((val >> 4) & 0x0F) << 8) |
                                                (((val >> 4) & 0x0F) << 8) |
                                                (2 << 6) |
                                                (2 << 6) |
                                                (((val >> 3) & 0x1) << 5) |
                                                (((val >> 3) & 0x1) << 5) |
                                                regSP, 0, 2);
                                                regSP, 0, 2);
                                        return;
                                        goto xit;
                                }
                                }
                        }
                        }
                        else {
                        else {
                                if (val >= -16 && val < 16) {
                                if (val >= -16 && val < 16) {
                                        emit_insn(
                                        emit_insn(
                                                (0 << 12) |
                                                (0 << 12) |
                                                (((val >> 1) & 0x0F) << 8) |
                                                (((val >> 1) & 0x0F) << 8) |
                                                (2 << 6) |
                                                (2 << 6) |
                                                ((val & 0x1) << 5) |
                                                ((val & 0x1) << 5) |
                                                Ra, 0, 2);
                                                Ra, 0, 2);
                                        return;
                                        goto xit;
                                }
                                }
                        }
                        }
                }
                }
        }
        }
        // Compress ANDI ?
        // Compress ANDI ?
Line 1384... Line 1392...
                                (((val >> 4) & 0x0F) << 8) |
                                (((val >> 4) & 0x0F) << 8) |
                                (2 << 6) |
                                (2 << 6) |
                                (((val >> 3) & 0x1) << 5) |
                                (((val >> 3) & 0x1) << 5) |
                                Rt, 0, 2
                                Rt, 0, 2
                        );
                        );
                        return;
                        goto xit;
                }
                }
        }
        }
        // Compress ORI ?
        // Compress ORI ?
        if (opcode6 == 0x09 && Ra == Rt && (Rtp = CmpReg(Ra)) >= 0) {
        if (opcode6 == 0x09 && Ra == Rt && (Rtp = CmpReg(Ra)) >= 0) {
                if (val > -16 && val < 16) {
                if (val > -16 && val < 16) {
Line 1399... Line 1407...
                                (2 << 4) |
                                (2 << 4) |
                                ((val & 1) << 3) |
                                ((val & 1) << 3) |
                                Rtp, 0, 2
                                Rtp, 0, 2
                        );
                        );
                }
                }
                return;
                goto xit;
        }
        }
        if (!IsNBit(val, 14)) {
        if (!IsNBit(val, 14)) {
                if (!IsNBit(val, 30)) {
                if (!IsNBit(val, 30)) {
                        Lui34(val, 23);
                        Lui34(val, 23);
                        emit_insn(
                        emit_insn(
Line 1418... Line 1426...
                                (sz << 23) |            // set size to word size op
                                (sz << 23) |            // set size to word size op
                                (Rt << 18) |
                                (Rt << 18) |
                                (23 << 13) |
                                (23 << 13) |
                                (Ra << 8) |
                                (Ra << 8) |
                                0x02, !expand_flag, 4);
                                0x02, !expand_flag, 4);
                        return;
                        goto xit;
                }
                }
                emit_insn(
                emit_insn(
                        (val << 18LL) |
                        (val << 18LL) |
                        (Rt << 13) |
                        (Rt << 13) |
                        (Ra << 8) |
                        (Ra << 8) |
                        (1 << 6) |
                        (1 << 6) |
                        opcode6, !expand_flag, 6);
                        opcode6, !expand_flag, 6);
                return;
                goto xit;
        }
        }
        emit_insn(
        emit_insn(
                (val << 18)|(Rt << 13)|(Ra << 8)|opcode6,!expand_flag,4);
                (val << 18)|(Rt << 13)|(Ra << 8)|opcode6,!expand_flag,4);
 
xit:
 
        ScanToEOL();
}
}
 
 
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
// slti r1,r2,#1234
// slti r1,r2,#1234
//
//
Line 1509... Line 1519...
                                (0 << 6) |
                                (0 << 6) |
                                0x02, !expand_flag, 4
                                0x02, !expand_flag, 4
                        );
                        );
                        return;
                        return;
                }
                }
                printf("Illegal set immediate instruction %d.", lineno);
                error("Illegal set immediate instruction");
                return;
                return;
        }
        }
        if (!IsNBit(val, 14)) {
        if (!IsNBit(val, 14)) {
                emit_insn(
                emit_insn(
                        (val << 18) |
                        (val << 18) |
Line 1643... Line 1653...
    Ra = getRegisterX();
    Ra = getRegisterX();
    need(',');
    need(',');
    NextToken();
    NextToken();
    if (token=='#') {
    if (token=='#') {
                if (iop < 0 && iop!=-4)
                if (iop < 0 && iop!=-4)
                        printf("Immediate mode not supported (%d).", lineno);
                        error("Immediate mode not supported");
        inptr = p;
        inptr = p;
        process_riop(iop);
        process_riop(iop);
        return;
        return;
    }
    }
    prevToken();
    prevToken();
Line 1660... Line 1670...
                        (3 << 6) |
                        (3 << 6) |
                        ((Ra & 1) << 5) |
                        ((Ra & 1) << 5) |
                        (Rt),
                        (Rt),
                        0,2
                        0,2
                );
                );
                return;
                goto xit;
        }
        }
        // Compress SUB
        // Compress SUB
        if (funct6 == 0x05 && Ra == Rt && (Rtp = CmpReg(Rt)) >= 0 && (Rbp = CmpReg(Rb)) >= 0) {
        if (funct6 == 0x05 && Ra == Rt && (Rtp = CmpReg(Rt)) >= 0 && (Rbp = CmpReg(Rb)) >= 0) {
                emit_insn(
                emit_insn(
                        (4 << 12) |
                        (4 << 12) |
Line 1674... Line 1684...
                        (3 << 4) |
                        (3 << 4) |
                        ((Rbp & 1) << 3) |
                        ((Rbp & 1) << 3) |
                        (Rtp),
                        (Rtp),
                        0, 2
                        0, 2
                );
                );
                return;
                goto xit;
        }
        }
        // Compress AND
        // Compress AND
        if (funct6 == 0x08 && Ra == Rt && (Rtp = CmpReg(Rt)) >= 0 && (Rbp = CmpReg(Rb)) >= 0) {
        if (funct6 == 0x08 && Ra == Rt && (Rtp = CmpReg(Rt)) >= 0 && (Rbp = CmpReg(Rb)) >= 0) {
                emit_insn(
                emit_insn(
                        (4 << 12) |
                        (4 << 12) |
Line 1688... Line 1698...
                        (3 << 4) |
                        (3 << 4) |
                        ((Rbp & 1) << 3) |
                        ((Rbp & 1) << 3) |
                        (Rtp),
                        (Rtp),
                        0, 2
                        0, 2
                );
                );
                return;
                goto xit;
        }
        }
        // Compress OR
        // Compress OR
        if (funct6 == 0x09 && Ra == Rt && (Rtp = CmpReg(Rt)) >= 0 && (Rbp = CmpReg(Rb)) >= 0) {
        if (funct6 == 0x09 && Ra == Rt && (Rtp = CmpReg(Rt)) >= 0 && (Rbp = CmpReg(Rb)) >= 0) {
                emit_insn(
                emit_insn(
                        (4 << 12) |
                        (4 << 12) |
Line 1702... Line 1712...
                        (3 << 4) |
                        (3 << 4) |
                        ((Rbp & 1) << 3) |
                        ((Rbp & 1) << 3) |
                        (Rtp),
                        (Rtp),
                        0, 2
                        0, 2
                );
                );
                return;
                goto xit;
        }
        }
        // Compress XOR
        // Compress XOR
        if (funct6 == 0x0A && Ra == Rt && (Rtp = CmpReg(Rt)) >= 0 && (Rbp = CmpReg(Rb)) >= 0) {
        if (funct6 == 0x0A && Ra == Rt && (Rtp = CmpReg(Rt)) >= 0 && (Rbp = CmpReg(Rb)) >= 0) {
                emit_insn(
                emit_insn(
                        (4 << 12) |
                        (4 << 12) |
Line 1716... Line 1726...
                        (3 << 4) |
                        (3 << 4) |
                        ((Rbp & 1) << 3) |
                        ((Rbp & 1) << 3) |
                        (Rtp),
                        (Rtp),
                        0, 2
                        0, 2
                );
                );
                return;
                goto xit;
        }
        }
        //prevToken();
        //prevToken();
        if (funct6==0x2E || funct6==0x2C || funct6==0x2D) {
        if (funct6==0x2E || funct6==0x2C || funct6==0x2D) {
                funct6 += 0x10; // change to divmod
                funct6 += 0x10; // change to divmod
            emit_insn((funct6<<26LL)||(1<<23)||(Rt<<18)|(Rb<<13)|(Ra<<8)|0x02,!expand_flag,4);
            emit_insn((funct6<<26LL)||(1<<23)||(Rt<<18)|(Rb<<13)|(Ra<<8)|0x02,!expand_flag,4);
                return;
                goto xit;
        }
        }
        else if (funct6==0x3C || funct6==0x3D || funct6==0x3E) {
        else if (funct6==0x3C || funct6==0x3D || funct6==0x3E) {
            emit_insn((funct6<<26LL)||(0<<23)|(Rt<<18)|(Rb<<13)|(Ra<<8)|0x02,!expand_flag,4);
            emit_insn((funct6<<26LL)||(0<<23)|(Rt<<18)|(Rb<<13)|(Ra<<8)|0x02,!expand_flag,4);
                return;
                        goto xit;
        }
        }
    emit_insn((funct6<<26LL)|(sz << 23)|(Rt<<18)|(Rb<<13)|(Ra<<8)|0x02,!expand_flag,4);
    emit_insn((funct6<<26LL)|(sz << 23)|(Rt<<18)|(Rb<<13)|(Ra<<8)|0x02,!expand_flag,4);
 
xit:
 
                ScanToEOL();
}
}
 
 
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
// or r1,r2,r3,r4
// or r1,r2,r3,r4
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
Line 1826... Line 1838...
        if (token == '(' || token == '[') {
        if (token == '(' || token == '[') {
        j1:
        j1:
                Ra = getRegisterX();
                Ra = getRegisterX();
                if (Ra == -1) {
                if (Ra == -1) {
                        printf("Expecting a register\r\n");
                        printf("Expecting a register\r\n");
                        return;
                        goto xit;
                }
                }
                // Simple jmp [Rn]
                // Simple jmp [Rn]
                else {
 
                        if (token != ')' && token != ']')
                        if (token != ')' && token != ']')
                                printf("Missing close bracket\r\n");
                        printf("Missing close bracket %d\n", lineno);
                        emit_insn((Ra << 8) | (Rt << 13) | 0x18, 0, 4);
                        emit_insn((Ra << 8) | (Rt << 13) | 0x18, 0, 4);
                        return;
                goto xit;
                }
 
        }
        }
        else
        else
                inptr = p;
                inptr = p;
    Rt = getRegisterX();
    Rt = getRegisterX();
    if (Rt >= 0) {
    if (Rt >= 0) {
Line 1869... Line 1879...
                emit_insn(
                emit_insn(
                        (val << 18) |
                        (val << 18) |
                        (Rt << 13) |
                        (Rt << 13) |
                        (Ra << 8) |
                        (Ra << 8) |
                        0x18, !expand_flag, 4);
                        0x18, !expand_flag, 4);
                return;
                goto xit;
        }
        }
        if (IsNBit(val, 30)) {
        if (IsNBit(val, 30)) {
                emit_insn(
                emit_insn(
                        (val << 18) |
                        (val << 18) |
                        (Rt << 13) |
                        (Rt << 13) |
                        (Ra << 8) |
                        (Ra << 8) |
                        (1 << 6) |
                        (1 << 6) |
                        0x18, !expand_flag, 6);
                        0x18, !expand_flag, 6);
                return;
                goto xit;
        }
        }
 
 
        {
        {
                LoadConstant(val, 23);
                LoadConstant(val, 23);
                if (Ra != 0) {
                if (Ra != 0) {
Line 1898... Line 1908...
                        // jal Rt,r23
                        // jal Rt,r23
                        emit_insn(
                        emit_insn(
                                (0 << 18) |
                                (0 << 18) |
                                (Rt << 12) |
                                (Rt << 12) |
                                (23 << 8) | 0x18, !expand_flag, 4);
                                (23 << 8) | 0x18, !expand_flag, 4);
                        return;
                        goto xit;
                }
                }
                emit_insn(
                emit_insn(
                        (Rt << 12) |
                        (Rt << 12) |
                        (23 << 8) | 0x18, !expand_flag, 4);
                        (23 << 8) | 0x18, !expand_flag, 4);
                return;
                goto xit;
        }
        }
 
xit:
 
        ScanToEOL();
}
}
 
 
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
// subui r1,r2,#1234
// subui r1,r2,#1234
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
Line 2248... Line 2260...
static void process_bcc(int opcode6, int opcode4)
static void process_bcc(int opcode6, int opcode4)
{
{
    int Ra, Rb, pred;
    int Ra, Rb, pred;
        int fmt;
        int fmt;
    int64_t val;
    int64_t val;
    int64_t disp;
  int64_t disp, cdisp;
        char *p1;
        char *p1;
        bool ins48 = false;
        bool ins48 = false;
 
 
    fmt = GetFPSize();
    fmt = GetFPSize();
        pred = 0;
        pred = 0;
Line 2267... Line 2279...
                process_beqi(0x32,0);
                process_beqi(0x32,0);
                return;
                return;
        }
        }
        val = expr();
        val = expr();
        disp = val - (code_address + 4);
        disp = val - (code_address + 4);
 
        cdisp = val - (code_address + 2);
        if (!IsNBit(disp, 12)) {
        if (!IsNBit(disp, 12)) {
 
                error("Branch displacement too large");
                disp = val - (code_address + 6);
                disp = val - (code_address + 6);
                ins48 = true;
                ins48 = true;
        }
        }
        disp >>= 1;
        disp >>= 1;
 
        cdisp >>= 1;
        // Check for compressed bnez
        // Check for compressed bnez
        if (opcode4 == 1 && Rb == 0 && IsNBit(disp+1,7)) {       // disp+1 to account for 2 byte instruction
        if (opcode4 == 1 && Rb == 0 && IsNBit(cdisp,7)) {
                disp++;
 
                emit_insn(
                emit_insn(
                        (3 << 14) |
                        (3 << 14) |
                        (((disp >> 1) & 0x3f) << 8) |
                        (((cdisp >> 1) & 0x3f) << 8) |
                        (2 << 6) |
                        (2 << 6) |
                        ((disp & 1) << 5) |
                        ((cdisp & 1) << 5) |
                        Ra,0,2
                        Ra,0,2
                );
                );
                return;
                return;
        }
        }
        // compressed beqz
        // compressed beqz
        if (opcode4 == 0 && Rb == 0 && IsNBit(disp+1, 7)) {
        if (opcode4 == 0 && Rb == 0 && IsNBit(cdisp, 7)) {
                disp++;
 
                emit_insn(
                emit_insn(
                        (2 << 14) |
                        (2 << 14) |
                        (((disp >> 1) & 0x3f) << 8) |
                        (((cdisp >> 1) & 0x3f) << 8) |
                        (2 << 6) |
                        (2 << 6) |
                        ((disp & 1) << 5) |
                        ((cdisp & 1) << 5) |
                        Ra, 0, 2
                        Ra, 0, 2
                );
                );
                return;
                return;
        }
        }
        if (opcode4 < 0) {
        if (opcode4 < 0) {
Line 2346... Line 2359...
        if (Rc==-1) {
        if (Rc==-1) {
                inptr = p;
                inptr = p;
            NextToken();
            NextToken();
                val = expr();
                val = expr();
                disp = val - (code_address + 4LL);
                disp = val - (code_address + 4LL);
                disp >>= 1;
                disp >>= 1LL;
                emit_insn(
                emit_insn(
                        (disp << 21LL) |
                        (disp << 21LL) |
                        ((opcode3 & 3) << 19) |
                        ((opcode3 & 3) << 19) |
                        (0 << 13) |
                        (0 << 13) |
                        (Ra << 8) |
                        (Ra << 8) |
                        opcode6,!expand_flag,4
                        opcode6,!expand_flag,4
                );
                );
                return;
                return;
        }
        }
        printf("dbnz: target must be a label %d.\n", lineno);
        error("dbnz: target must be a label");
        emit_insn(
        emit_insn(
                (opcode3 << 19) |
                (opcode3 << 19) |
                (0 << 13) |
                (0 << 13) |
                (Ra << 8) |
                (Ra << 8) |
                opcode6,!expand_flag,4
                opcode6,!expand_flag,4
Line 2411... Line 2424...
                        (Ra << 8) |
                        (Ra << 8) |
                        opcode6,!expand_flag,isn48 ? 6 : 4
                        opcode6,!expand_flag,isn48 ? 6 : 4
                );
                );
                return;
                return;
        }
        }
        printf("ibne: target must be a label %d.\n", lineno);
        error("ibne: target must be a label");
        emit_insn(
        emit_insn(
                (opcode3 << 19) |
                (opcode3 << 19) |
                (Rb << 13) |
                (Rb << 13) |
                (Ra << 8) |
                (Ra << 8) |
                0x03,!expand_flag,4
                0x03,!expand_flag,4
        );
        );
}
}
 
 
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
// bfextu r1,r2,#1,#63
// bfextu r1,#1,#63,r2
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
 
 
static void process_bitfield(int64_t oc)
static void process_bitfield(int64_t oc)
{
{
    int Ra;
        int Ra, Rb, Rc;
    int Rt;
    int Rt;
    int64_t mb;
    int64_t mb;
    int64_t me;
    int64_t me;
        int64_t val;
        int64_t val;
 
        int64_t op;
        int sz = 3;
        int sz = 3;
        char *p;
        char *p;
 
        bool gmb, gme, gval;
 
 
 
        gmb = gme = gval = false;
        p = inptr;
        p = inptr;
        if (*p == '.')
        if (*p == '.')
                getSz(&sz);
                getSz(&sz);
 
 
    Rt = getRegisterX();
    Rt = getRegisterX();
    need(',');
    need(',');
        if (oc==4) {
        p = inptr;
                NextToken();
 
                val = expr();
 
                Ra = 0;
 
        }
 
        else {
 
                val = 0LL;
 
                Ra = getRegisterX();
                Ra = getRegisterX();
        }
        if (Ra == -1) {
    need(',');
                inptr = p;
    NextToken();
    NextToken();
    mb = expr();
    mb = expr();
 
                gmb = true;
 
        }
    need(',');
    need(',');
 
        p = inptr;
 
        Rb = getRegisterX();
 
        if (Rb == -1) {
 
                inptr = p;
    NextToken();
    NextToken();
    me = expr();
    me = expr();
        emit_insn(
                gme = true;
                (oc << 34LL) |
        }
                (me << 27LL) |
        need(',');
                (sz << 24) |
        p = inptr;
                (mb << 18) |
        Rc = getRegisterX();
                (Rt << 12) |
        if (Rc == -1) {
                ((Ra|(val & 0x3f)) << 6) |
                inptr = p;
                0x22,!expand_flag,5
                NextToken();
        );
                val = expr();
 
                gval = true;
 
        }
 
        op =
 
                (oc << 44LL) |
 
                ((gval?1LL:0LL) << 32LL) |
 
                ((gme?1LL:0LL) << 31LL) |
 
                ((gmb?1:0) << 30) |
 
                (Rt << 23) |
 
                (1 << 6) |
 
                0x22;
 
        if (gmb)
 
                op |= ((mb & 31) << 8) | (((mb >> 5) & 1) << 28);
 
        else
 
                op |= (Ra << 8);
 
        if (gme)
 
                op |= ((me & 31) << 13) | (((me >> 5) & 1) << 29);
 
        else
 
                op |= (Rb << 13);
 
        if (gval)
 
                op |= ((val & 31) << 18) | (((val >> 5) & 0x7ff) << 33LL);
 
        else
 
                op |= (Rc << 18);
 
 
 
        emit_insn(op, 0, 6);
 
        ScanToEOL();
}
}
 
 
 
 
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
// bra label
// bra label
Line 2475... Line 2516...
 
 
static void process_bra(int oc)
static void process_bra(int oc)
{
{
    int Ra = 0, Rb = 0;
    int Ra = 0, Rb = 0;
    int64_t val;
    int64_t val;
    int64_t disp;
    int64_t disp, cdisp;
        bool ins48 = false;
        bool ins48 = false;
 
 
    NextToken();
    NextToken();
    val = expr();
    val = expr();
    disp = val - (code_address + 4LL);
    disp = val - (code_address + 4LL);
 
        cdisp = val - (code_address + 2LL);
        if (!IsNBit(disp, 12)) {
        if (!IsNBit(disp, 12)) {
 
                error("Branch displacement too large");
                disp = val - (code_address + 6LL);
                disp = val - (code_address + 6LL);
                ins48 = true;
                ins48 = true;
        }
        }
        disp >>= 1;
        disp >>= 1;
        if (disp+1 > -512 && disp+1 < 512) {    // disp+1 accounts for instruction size of 2 not 4
        cdisp >>= 1;
                disp++;
        if (cdisp > -512 && cdisp < 512) {      // disp+1 accounts for instruction size of 2 not 4
                emit_insn(
                emit_insn(
                        (7 << 12) |
                        (7 << 12) |
                        (((disp >> 6) & 0xf) << 8) |
                        (((cdisp >> 6) & 0xf) << 8) |
                        (2 << 6) |
                        (2 << 6) |
                        (disp & 0x3f), 0, 2
                        (cdisp & 0x3f), 0, 2
                );
                );
                return;
                return;
        }
        }
        emit_insn((disp << 21) |
        emit_insn((disp << 21) |
                (0 << 18) |      // BEQ
                (0 << 18) |      // BEQ
Line 2766... Line 2809...
        prevToken();
        prevToken();
    }
    }
        if (neg) incamt = -incamt;
        if (neg) incamt = -incamt;
        if (Rb >= 0) {
        if (Rb >= 0) {
       if (disp != 0)
       if (disp != 0)
           printf("displacement not allowed with indexed addressing.\r\n");
           error("displacement not allowed with indexed addressing");
       oc = 0x1A;  // INCX
       oc = 0x1A;  // INCX
           // ToDo: fix this
           // ToDo: fix this
       emit_insn(
       emit_insn(
                   (oc << 26LL) |
                   (oc << 26LL) |
                   (0 << 23) |           // Sc = 0
                   (0 << 23) |           // Sc = 0
Line 4520... Line 4563...
        case tk_end_expand: expandedBlock = 0; break;
        case tk_end_expand: expandedBlock = 0; break;
        case tk_endpublic: break;
        case tk_endpublic: break;
        case tk_eor: process_rrop(0x0A,0x0A); break;
        case tk_eor: process_rrop(0x0A,0x0A); break;
        case tk_eori: process_riop(0x0A); break;
        case tk_eori: process_riop(0x0A); break;
        case tk_extern: process_extern(); break;
        case tk_extern: process_extern(); break;
 
                                case tk_file:
 
                                        NextToken();
 
                                        if (token==tk_strconst)
 
                                                mname = std::string(laststr);
 
                                        //NextToken();
 
                                        //if (token == ',') {
 
                                        //      NextToken();
 
                                        //      lineno = expr();
 
                                        //}
 
                                        break;
                case tk_ftoi:   process_ftoi(0x12); break;
                case tk_ftoi:   process_ftoi(0x12); break;
                case tk_fadd:   process_fprrop(0x04); break;
                case tk_fadd:   process_fprrop(0x04); break;
        case tk_fbeq:   process_fbcc(0); break;
        case tk_fbeq:   process_fbcc(0); break;
        case tk_fbge:   process_fbcc(3); break;
        case tk_fbge:   process_fbcc(3); break;
        case tk_fblt:   process_fbcc(2); break;
        case tk_fblt:   process_fbcc(2); break;
Line 4563... Line 4616...
                case tk_lvh: ProcessLoadVolatile(0x3B,4); break;
                case tk_lvh: ProcessLoadVolatile(0x3B,4); break;
                case tk_lvhu: ProcessLoadVolatile(0x3B,-4); break;
                case tk_lvhu: ProcessLoadVolatile(0x3B,-4); break;
                case tk_lvw: ProcessLoadVolatile(0x3B,8); break;
                case tk_lvw: ProcessLoadVolatile(0x3B,8); break;
        case tk_lw:  process_load(0x20,4); break;
        case tk_lw:  process_load(0x20,4); break;
        case tk_lwr:  process_load(0x1D,0); break;
        case tk_lwr:  process_load(0x1D,0); break;
 
                                case tk_macro:  process_macro(); break;
                case tk_memdb: emit_insn(0x04400002,0,4); break;
                case tk_memdb: emit_insn(0x04400002,0,4); break;
                case tk_memsb: emit_insn(0x04440002,0,4); break;
                case tk_memsb: emit_insn(0x04440002,0,4); break;
                case tk_message: process_message(); break;
                case tk_message: process_message(); break;
                case tk_mod: process_rrop(0x16,0x2E); break;
                case tk_mod: process_rrop(0x16,0x2E); break;
                case tk_modu: process_rrop(0x14,-1); break;
                case tk_modu: process_rrop(0x14,-1); break;

powered by: WebSVN 2.1.0

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