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

Subversion Repositories xulalx25soc

[/] [xulalx25soc/] [trunk/] [sw/] [ttybus.cpp] - Diff between revs 93 and 109

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

Rev 93 Rev 109
Line 66... Line 66...
#define TTYC_ERR        '5'
#define TTYC_ERR        '5'
 
 
const   unsigned TTYBUS::MAXRDLEN = 1024;
const   unsigned TTYBUS::MAXRDLEN = 1024;
const   unsigned TTYBUS::MAXWRLEN = 32;
const   unsigned TTYBUS::MAXWRLEN = 32;
 
 
#define DBGPRINTF       null
 
// #define      DBGPRINTF       printf
// #define      DBGPRINTF       printf
// #define      DBGPRINTF       filedump
#define DBGPRINTF       filedump
 
#ifndef DBGPRINTF
 
#define DBGPRINTF       null
 
#endif
 
 
void    null(...) {}
void    null(...) {}
#include <stdarg.h>
#include <stdarg.h> // replaces the (defunct) varargs.h include file
// #include <varargs.h>
void    filedump(const char *fmt, ...) {
/*
        static  FILE *dbgfp = NULL;
void    filedump(const char *fmt, ...) {
        va_list args;
        static  FILE *dbgfp = NULL;
 
        va_list args;
        if (!dbgfp)
 
                dbgfp = fopen("debug.txt", "w");
        if (!dbgfp)
        va_start(args, fmt);
                dbgfp = fopen("debug.txt", "w");
        vfprintf(dbgfp, fmt, args);
        va_start(args, fmt);
        va_end(args);
        vfprintf(dbgfp, fmt, args);
        fflush(dbgfp);
        va_end(args);
 
        fflush(dbgfp);
        // If you want the debug output to go to stderr as well, you can
}
        // uncomment the next couple of lines
*/
        // va_start(args, fmt);
 
        // vfprintf(stderr, fmt, args);
 
        // va_end(args);
 
}
 
 
char    TTYBUS::charenc(const int sixbitval) const {
char    TTYBUS::charenc(const int sixbitval) const {
        if (sixbitval < 10)
        if (sixbitval < 10)
                return '0' + sixbitval;
                return '0' + sixbitval;
        else if (sixbitval < 10+26)
        else if (sixbitval < 10+26)
Line 122... Line 127...
}
}
 
 
int     TTYBUS::lclreadcode(char *buf, int len) {
int     TTYBUS::lclreadcode(char *buf, int len) {
        char    *sp, *dp;
        char    *sp, *dp;
        int     nr, ret;
        int     nr, ret;
 
        static  int     lastskip = 0;
 
 
        nr = m_dev->read(buf, len);
        nr = m_dev->read(buf, len);
        m_total_nread += nr;
        m_total_nread += nr;
        ret = nr; sp = buf; dp = buf;
        ret = nr; sp = buf; dp = buf;
        for(int i=0; i<nr; i++) {
        for(int i=0; i<nr; i++) {
                if (chardec(*sp)&(~0x3f)) {
                if (chardec(*sp)&(~0x3f)) {
 
                        int uv = (*sp)&0x0ff;
                        ret--;  // Skip this value, not a valid codeword
                        ret--;  // Skip this value, not a valid codeword
 
                        if ((false)&&((!lastskip)||(uv != lastskip))) {
 
                                DBGPRINTF("lclreadcode: Skipping %02x\n", uv);
 
                                lastskip = uv;
 
                        }
                        sp++;
                        sp++;
                } else {
                } else {
                        *sp++ = *dp++;
                        lastskip = 0;
 
                        // DBGPRINTF("lclreadcode: Read %c (%02x -> %02x)\n",
 
                        //      *sp, *sp, chardec(*sp));
 
                        *dp++ = *sp++;
                }
                }
        } return ret;
        } return ret;
}
}
 
 
void    TTYBUS::bufalloc(int len) {
void    TTYBUS::bufalloc(int len) {
Line 186... Line 200...
        m_lastaddr = a; m_addr_set = true;
        m_lastaddr = a; m_addr_set = true;
}
}
 
 
void    TTYBUS::writev(const BUSW a, const int p, const int len, const BUSW *buf) {
void    TTYBUS::writev(const BUSW a, const int p, const int len, const BUSW *buf) {
        char    *ptr;
        char    *ptr;
 
        int     nw = 0;
 
 
        // We'll never be called with more than MAXWRLEN words to write at once.
        // We'll never be called with more than MAXWRLEN words to write at once.
        // This is a configurable option length, set at the top of this file.
        // This is a configurable option length, set at the top of this file.
        // (currently set at 32, but subject to change ...)  This is important,
        // (currently set at 32, but subject to change ...)  This is important,
        // as the return channel *must* be capable of holding at least this many
        // as the return channel *must* be capable of holding at least this many
Line 204... Line 219...
        DBGPRINTF("WRITEV(%08x,%d,#%d,0x%08x ...)\n", a, p, len, buf[0]);
        DBGPRINTF("WRITEV(%08x,%d,#%d,0x%08x ...)\n", a, p, len, buf[0]);
        // Encode the address
        // Encode the address
        ptr = encode_address(a);
        ptr = encode_address(a);
        m_lastaddr = a; m_addr_set = true;
        m_lastaddr = a; m_addr_set = true;
 
 
        for(int i=0; i<len; i++) {
        while(nw < len) {
                BUSW    val = buf[i];
                int     ln = len-nw;
 
                if ((unsigned)ln > MAXWRLEN)
 
                        ln = MAXWRLEN;
 
 
 
                for(int i=0; i<ln; i++) {
 
                        BUSW    val = buf[nw+i];
 
 
                int     caddr = 0;
                int     caddr = 0;
                // Let's try compression
                // Let's try compression
                for(int i=1; i<256; i++) {
                for(int i=1; i<256; i++) {
                        unsigned        tstaddr;
                        unsigned        tstaddr;
Line 250... Line 270...
                }
                }
 
 
                if (p == 1) m_lastaddr++;
                if (p == 1) m_lastaddr++;
        }
        }
        // *ptr++ = charenc(0x2e);
        // *ptr++ = charenc(0x2e);
        *ptr++ = '\n'; *ptr = '\0';
                if (ln == len-nw)
 
                        *ptr++ = '\n';
 
                *ptr = '\0';
        m_dev->write(m_buf, ptr-m_buf);
        m_dev->write(m_buf, ptr-m_buf);
 
 
        DBGPRINTF(">> %s\n", m_buf);
        DBGPRINTF(">> %s\n", m_buf);
 
 
 
                readidle();
 
 
 
                nw += ln;
 
                ptr = m_buf;
 
        }
        DBGPRINTF("WR: LAST ADDRESS LEFT AT %08x\n", m_lastaddr);
        DBGPRINTF("WR: LAST ADDRESS LEFT AT %08x\n", m_lastaddr);
 
 
        // Need to clear the incoming queue ... if there's anything there.
        // Need to clear the incoming queue ... if there's anything there.
        // We could do a ...
        // We could do a ...
        //      readacks(len);
        //      readacks(len);
Line 270... Line 297...
        // message.
        // message.
        readidle();
        readidle();
}
}
 
 
void    TTYBUS::writez(const BUSW a, const int len, const BUSW *buf) {
void    TTYBUS::writez(const BUSW a, const int len, const BUSW *buf) {
        int     ln = len;
/*
        const TTYBUS::BUSW *bptr = buf;
        int     ln = len;
        TTYBUS::BUSW addr = a;
        const TTYBUS::BUSW *bptr = buf;
 
        TTYBUS::BUSW addr = a;
        while((unsigned)ln > MAXWRLEN) {
 
                writev(addr, 0, MAXWRLEN, bptr);
        while((unsigned)ln > MAXWRLEN) {
                bptr += MAXWRLEN;
                writev(addr, 0, MAXWRLEN, bptr);
                ln   -= MAXWRLEN;
                bptr += MAXWRLEN;
                // addr += MAXWRLEN;
                ln   -= MAXWRLEN;
        } if ((unsigned)ln > 0)
                // addr += MAXWRLEN;
                writev(addr, 0, ln, bptr);
        } if ((unsigned)ln > 0)
 
                writev(addr, 0, ln, bptr);
 
*/
 
        writev(a, 0, len, buf);
}
}
 
 
void    TTYBUS::writei(const BUSW a, const int len, const BUSW *buf) {
void    TTYBUS::writei(const BUSW a, const int len, const BUSW *buf) {
        int     ln = len;
/*
        const TTYBUS::BUSW *bptr = buf;
        int     ln = len;
        TTYBUS::BUSW addr = a;
        const TTYBUS::BUSW *bptr = buf;
 
        TTYBUS::BUSW addr = a;
        while((unsigned)ln > MAXWRLEN) {
 
                writev(addr, 1, MAXWRLEN, bptr);
        while((unsigned)ln > MAXWRLEN) {
                bptr += MAXWRLEN;
                writev(addr, 1, MAXWRLEN, bptr);
                ln   -= MAXWRLEN;
                bptr += MAXWRLEN;
                addr += MAXWRLEN;
                ln   -= MAXWRLEN;
        } if ((unsigned)ln > 0)
                addr += MAXWRLEN;
                writev(addr, 1, ln, bptr);
        } if ((unsigned)ln > 0)
 
                writev(addr, 1, ln, bptr);
 
*/
 
        writev(a, 1, len, buf);
}
}
 
 
TTYBUS::BUSW    TTYBUS::readio(const TTYBUS::BUSW a) {
TTYBUS::BUSW    TTYBUS::readio(const TTYBUS::BUSW a) {
        BUSW    v;
        BUSW    v;
 
 
Line 306... Line 339...
        // of one.
        // of one.
        DBGPRINTF("READIO(0x%08x)\n", a);
        DBGPRINTF("READIO(0x%08x)\n", a);
        try {
        try {
                readv(a, 0, 1, &v);
                readv(a, 0, 1, &v);
        } catch(BUSERR b) {
        } catch(BUSERR b) {
 
                DBGPRINTF("BUSERR trying to read %08x\n", a);
                throw BUSERR(a);
                throw BUSERR(a);
        }
        }
 
 
        if (m_lastaddr != a) {
        if (m_lastaddr != a) {
                DBGPRINTF("LAST-ADDR MIS-MATCH: (RCVD) %08x != %08x (XPECTED)\n", m_lastaddr, a);
                DBGPRINTF("LAST-ADDR MIS-MATCH: (RCVD) %08x != %08x (XPECTED)\n", m_lastaddr, a);
Line 323... Line 357...
 
 
char    *TTYBUS::encode_address(const TTYBUS::BUSW a) {
char    *TTYBUS::encode_address(const TTYBUS::BUSW a) {
        TTYBUS::BUSW    addr = a;
        TTYBUS::BUSW    addr = a;
        char    *ptr = m_buf;
        char    *ptr = m_buf;
 
 
// #warning DEBUG_APPROACH
 
        // encode(0, addr, ptr);
 
        // return ptr+6;
 
 
 
        if ((m_addr_set)&&(a == m_lastaddr))
        if ((m_addr_set)&&(a == m_lastaddr))
                return ptr;
                return ptr;
 
 
        if (m_addr_set) {
        if (m_addr_set) {
                // Encode a difference address
                // Encode a difference address
Line 354... Line 384...
                        *ptr++ = charenc((diffaddr>>12) & 0x03f);
                        *ptr++ = charenc((diffaddr>>12) & 0x03f);
                        *ptr++ = charenc((diffaddr>> 6) & 0x03f);
                        *ptr++ = charenc((diffaddr>> 6) & 0x03f);
                        *ptr++ = charenc( diffaddr      & 0x03f);
                        *ptr++ = charenc( diffaddr      & 0x03f);
                }
                }
                *ptr = '\0';
                *ptr = '\0';
                DBGPRINTF("DIF-ADDR: (%ld) \'%s\'\n", ptr-m_buf, m_buf);
                DBGPRINTF("DIF-ADDR: (%ld) \'%s\' encodes last_addr(0x%08x) %c %d(0x%08x)\n",
 
                        ptr-m_buf, m_buf,
 
                        m_lastaddr, (diffaddr<0)?'-':'+',
 
                        diffaddr, diffaddr&0x0ffffffff);
        }
        }
 
 
        {
        {
                // Encode an absolute (low memory) address
                // Encode an absolute (low memory) address
                // Prefer absolute address encoding over differential encoding,
                // Prefer absolute address encoding over differential encoding,
Line 367... Line 400...
                if ((addr <= 0x03f)&&((ptr == m_buf)||(ptr >= &m_buf[2]))) {
                if ((addr <= 0x03f)&&((ptr == m_buf)||(ptr >= &m_buf[2]))) {
                        ptr = m_buf;
                        ptr = m_buf;
                        *ptr++ = charenc(0x08);
                        *ptr++ = charenc(0x08);
                        *ptr++ = charenc(addr);
                        *ptr++ = charenc(addr);
                } else if((addr <= 0x0fff)&&((ptr == m_buf)||(ptr >= &m_buf[3]))) {
                } else if((addr <= 0x0fff)&&((ptr == m_buf)||(ptr >= &m_buf[3]))) {
                        DBGPRINTF("Setting ADDR.3 to %08x\n", addr);
                        // DBGPRINTF("Setting ADDR.3 to %08x\n", addr);
                        ptr = m_buf;
                        ptr = m_buf;
                        *ptr++ = charenc(0x0a);
                        *ptr++ = charenc(0x0a);
                        *ptr++ = charenc((addr>> 6) & 0x03f);
                        *ptr++ = charenc((addr>> 6) & 0x03f);
                        *ptr++ = charenc( addr      & 0x03f);
                        *ptr++ = charenc( addr      & 0x03f);
                } else if((addr <= 0x03ffff)&&((ptr == m_buf)||(ptr >= &m_buf[4]))) {
                } else if((addr <= 0x03ffff)&&((ptr == m_buf)||(ptr >= &m_buf[4]))) {
                        DBGPRINTF("Setting ADDR.4 to %08x\n", addr);
                        // DBGPRINTF("Setting ADDR.4 to %08x\n", addr);
                        ptr = m_buf;
                        ptr = m_buf;
                        *ptr++ = charenc(0x0c);
                        *ptr++ = charenc(0x0c);
                        *ptr++ = charenc((addr>>12) & 0x03f);
                        *ptr++ = charenc((addr>>12) & 0x03f);
                        *ptr++ = charenc((addr>> 6) & 0x03f);
                        *ptr++ = charenc((addr>> 6) & 0x03f);
                        *ptr++ = charenc( addr      & 0x03f);
                        *ptr++ = charenc( addr      & 0x03f);
                } else if((addr <= 0x0ffffff)&&((ptr == m_buf)||(ptr >= &m_buf[5]))) {
                } else if((addr <= 0x0ffffff)&&((ptr == m_buf)||(ptr >= &m_buf[5]))) {
                        DBGPRINTF("Setting ADDR.5 to %08x\n", addr);
                        // DBGPRINTF("Setting ADDR.5 to %08x\n", addr);
                        ptr = m_buf;
                        ptr = m_buf;
                        *ptr++ = charenc(0x0e);
                        *ptr++ = charenc(0x0e);
                        *ptr++ = charenc((addr>>18) & 0x03f);
                        *ptr++ = charenc((addr>>18) & 0x03f);
                        *ptr++ = charenc((addr>>12) & 0x03f);
                        *ptr++ = charenc((addr>>12) & 0x03f);
                        *ptr++ = charenc((addr>> 6) & 0x03f);
                        *ptr++ = charenc((addr>> 6) & 0x03f);
Line 395... Line 428...
                        ptr+=6;
                        ptr+=6;
                }
                }
        }
        }
 
 
        *ptr = '\0';
        *ptr = '\0';
        DBGPRINTF("ADDR-CMD: (%ld) \'%s\'\n", ptr-m_buf, m_buf);
        // DBGPRINTF("ADDR-CMD: (%ld) \'%s\'\n", ptr-m_buf, m_buf);
        m_rdaddr = 0;
        m_rdaddr = 0;
 
 
        return ptr;
        return ptr;
}
}
 
 
char    *TTYBUS::readcmd(const int inc, const int len, char *buf) {
char    *TTYBUS::readcmd(const int inc, const int len, char *buf) {
        char    *ptr = buf;
        char    *ptr = buf;
 
 
        DBGPRINTF("READCMD: LEN = %d\n", len);
        DBGPRINTF("READCMD: LEN = %d: ", len);
        assert(len < 520);
        assert(len < 520);
        assert(len > 0);
        assert(len > 0);
 
 
        if ((len < 8)||((len == 8)&&(inc))) {
        if (len <= 8) {
                *ptr++ = charenc(0x20 + (((len-1)&0x07)<<1) + (inc?1:0));
                *ptr++ = charenc(0x20 + (((len-1)&0x07)<<1) + (inc?1:0));
 
                DBGPRINTF("%c\n", ptr[-1]);
        } else {
        } else {
                *ptr++ = charenc(0x30 + (((len-8)>>5)&0x0e) + (inc?1:0));
                *ptr++ = charenc(0x30 + (((len-9)>>5)&0x0e) + (inc?1:0));
                *ptr++ = charenc( (len-8) & 0x03f);
                *ptr++ = charenc( (len-9) & 0x03f);
 
                DBGPRINTF("%c%c\n", ptr[-2], ptr[-1]);
        }
        }
 
 
        return ptr;
        return ptr;
}
}
 
 
void    TTYBUS::readv(const TTYBUS::BUSW a, const int inc, const int len, TTYBUS::BUSW *buf) {
void    TTYBUS::readv(const TTYBUS::BUSW a, const int inc, const int len, TTYBUS::BUSW *buf) {
        const   int     READAHEAD = MAXRDLEN/2, READBLOCK=MAXRDLEN/2;
        const   int     READAHEAD = 0, READBLOCK=(MAXRDLEN/2>512)?512:MAXRDLEN/2;
        int     cmdrd = 0, nread = 0;
        int     cmdrd = 0, nread = 0;
        // TTYBUS::BUSW addr = a;
        // TTYBUS::BUSW addr = a;
        char    *ptr = m_buf;
        char    *ptr = m_buf;
 
 
        if (len <= 0)
        if (len <= 0)
                return;
                return;
        DBGPRINTF("READV(%08x,%d,#%4d)\n", a, inc, len);
        // DBGPRINTF("READV(%08x,%d,#%4d)\n", a, inc, len);
 
 
        // m_addr_set = false;
 
        ptr = encode_address(a);
        ptr = encode_address(a);
        try {
        try {
            while(cmdrd < len) {
            while(cmdrd < len) {
                // ptr = m_buf;
                // ptr = m_buf;
                do {
                do {
Line 449... Line 483...
                m_dev->write(m_buf, (ptr-m_buf));
                m_dev->write(m_buf, (ptr-m_buf));
 
 
                while(nread<(cmdrd-READAHEAD)) {
                while(nread<(cmdrd-READAHEAD)) {
                        buf[nread++] = readword();
                        buf[nread++] = readword();
                } ptr = m_buf;
                } ptr = m_buf;
            } while(nread<len) {
            } // DBGPRINTF("Reading %d words, to end the read\n", len-nread);
 
            while(nread<len) {
                buf[nread++] = readword();
                buf[nread++] = readword();
            }
            }
        } catch(BUSERR b) {
        } catch(BUSERR b) {
 
                DBGPRINTF("READV::BUSERR trying to read %08x\n", a+((inc)?nread:0));
                throw BUSERR(a+((inc)?nread:0));
                throw BUSERR(a+((inc)?nread:0));
        }
        }
 
 
        if ((unsigned)m_lastaddr != (a+((inc)?(len):0))) {
        if ((unsigned)m_lastaddr != (a+((inc)?(len):0))) {
                DBGPRINTF("TTYBUS::READV(a=%08x,inc=%d,len=%4x,x) ERR: (Last) %08x != %08x + %08x (Expected)\n", a, inc, len, m_lastaddr, a, (inc)?(len):0);
                DBGPRINTF("TTYBUS::READV(a=%08x,inc=%d,len=%4x,x) ERR: (Last) %08x != %08x + %08x (Expected)\n", a, inc, len, m_lastaddr, a, (inc)?(len):0);
                printf("TTYBUS::READV(a=%08x,inc=%d,len=%4x,x) ERR: (Last) %08x != %08x + %08x (Expected)\n", a, inc, len, m_lastaddr, a, (inc)?(len):0);
                printf("TTYBUS::READV(a=%08x,inc=%d,len=%4x,x) ERR: (Last) %08x != %08x + %08x (Expected)\n", a, inc, len, m_lastaddr, a, (inc)?(len):0);
                sleep(1);
                sleep(1);
                assert((int)m_lastaddr == (a+(inc)?(len):0));
                assert((int)m_lastaddr == (a+(inc)?(len):0));
                exit(-3);
                exit(-3);
        }
        }
 
 
 
        DBGPRINTF("READV::COMPLETE\n");
}
}
 
 
void    TTYBUS::readi(const TTYBUS::BUSW a, const int len, TTYBUS::BUSW *buf) {
void    TTYBUS::readi(const TTYBUS::BUSW a, const int len, TTYBUS::BUSW *buf) {
        readv(a, 1, len, buf);
        readv(a, 1, len, buf);
}
}
Line 576... Line 614...
                rdaddr = (m_rdaddr-idx)&0x03ff;
                rdaddr = (m_rdaddr-idx)&0x03ff;
                val = m_readtbl[rdaddr];
                val = m_readtbl[rdaddr];
                m_lastaddr += (sixbits&1);
                m_lastaddr += (sixbits&1);
                DBGPRINTF("READ-WORD() -- long table value[%3d], %08x, A=%08x\n", idx, val, m_lastaddr);
                DBGPRINTF("READ-WORD() -- long table value[%3d], %08x, A=%08x\n", idx, val, m_lastaddr);
        } else if (0x20 == (sixbits & 0x030)) { // Tbl read, 2-9 into past
        } else if (0x20 == (sixbits & 0x030)) { // Tbl read, 2-9 into past
                rdaddr = (m_rdaddr - (((sixbits>>1)&0x07)+2)) & 0x03ff;
                int     idx;
 
                idx = (((sixbits>>1)&0x07)+2);
 
                rdaddr = (m_rdaddr - idx) & 0x03ff;
                val = m_readtbl[rdaddr];
                val = m_readtbl[rdaddr];
                m_lastaddr += (sixbits&1);
                m_lastaddr += (sixbits&1);
                DBGPRINTF("READ-WORD() -- short table value[%3d], %08x, A=%08x\n", rdaddr, val, m_lastaddr);
                DBGPRINTF("READ-WORD() -- short table value[%3d], %08x, A=%08x\n", idx, val, m_lastaddr);
        } else if (0x38 == (sixbits & 0x038)) { // Raw read
        } else if (0x38 == (sixbits & 0x038)) { // Raw read
                DBGPRINTF("READ-WORD() -- RAW-READ, nr = %d\n", nr);
                // DBGPRINTF("READ-WORD() -- RAW-READ, nr = %d\n", nr);
                do {
                do {
                        nr += lclreadcode(&m_buf[nr], 6-nr);
                        nr += lclreadcode(&m_buf[nr], 6-nr);
                } while (nr < 6);
                } while (nr < 6);
 
 
                val = (chardec(m_buf[0])>>1) & 0x03;
                val = (chardec(m_buf[0])>>1) & 0x03;
Line 625... Line 665...
                        ;
                        ;
                } else if (sixbits < 6) {
                } else if (sixbits < 6) {
                        switch(sixbits) {
                        switch(sixbits) {
                        case 0:  break; // Idle -- ignore
                        case 0:  break; // Idle -- ignore
                        case 1: break; // Idle, but the bus is busy
                        case 1: break; // Idle, but the bus is busy
                        case 2: break; // Write acknowledgement, ignore it here
                        case 2:
 
                                // Write acknowledgement, ignore it here
 
                                // This is one of the big reasons why we are
 
                                // doing this.
 
                                break;
                        case 3:
                        case 3:
                                m_bus_err = true;
                                m_bus_err = true;
                                DBGPRINTF("READ-IDLE() - BUSERR\n");
                                DBGPRINTF("READ-IDLE() - BUSERR\n");
                                throw BUSERR(0);
                                throw BUSERR(0);
                                break;
                                break;
Line 694... Line 738...
        if (found_start) {
        if (found_start) {
                // We're in readidle().  We don't expect to find any data.
                // We're in readidle().  We don't expect to find any data.
                // But ... we did.  So, just read it off and ignore it.
                // But ... we did.  So, just read it off and ignore it.
                int     rdaddr;
                int     rdaddr;
 
 
                // DBGPRINTF("READ-WORD() -- sixbits = %02x\n", sixbits);
                DBGPRINTF("READ-IDLE()  PANIC! -- sixbits = %02x\n", sixbits);
                if (0x06 == (sixbits & 0x03e)) { // Tbl read, last value
                if (0x06 == (sixbits & 0x03e)) { // Tbl read, last value
                        rdaddr = (m_rdaddr-1)&0x03ff;
                        rdaddr = (m_rdaddr-1)&0x03ff;
                        val = m_readtbl[rdaddr];
                        val = m_readtbl[rdaddr];
                        m_lastaddr += (sixbits&1);
                        m_lastaddr += (sixbits&1);
                        DBGPRINTF("READ-IDLE() -- repeat last value, %08x\n", val);
                        DBGPRINTF("READ-IDLE() -- repeat last value, %08x\n", val);
Line 718... Line 762...
                        rdaddr = (m_rdaddr - (((sixbits>>1)&0x07)+2)) & 0x03ff;
                        rdaddr = (m_rdaddr - (((sixbits>>1)&0x07)+2)) & 0x03ff;
                        val = m_readtbl[rdaddr];
                        val = m_readtbl[rdaddr];
                        m_lastaddr += (sixbits&1);
                        m_lastaddr += (sixbits&1);
                        DBGPRINTF("READ-IDLE() -- short table value[%3d], %08x\n", rdaddr, val);
                        DBGPRINTF("READ-IDLE() -- short table value[%3d], %08x\n", rdaddr, val);
                } else if (0x38 == (sixbits & 0x038)) { // Raw read
                } else if (0x38 == (sixbits & 0x038)) { // Raw read
                        DBGPRINTF("READ-IDLE() -- RAW-READ, nr = %d\n", nr);
 
                        do {
                        do {
                                nr += lclreadcode(&m_buf[nr], 6-nr);
                                nr += lclreadcode(&m_buf[nr], 6-nr);
                        } while (nr < 6);
                        } while (nr < 6);
 
 
                        val = (chardec(m_buf[0])>>1) & 0x03;
                        val = (chardec(m_buf[0])>>1) & 0x03;

powered by: WebSVN 2.1.0

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