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

Subversion Repositories qspiflash

[/] [qspiflash/] [trunk/] [bench/] [cpp/] [qspiflashsim.h] - Diff between revs 15 and 16

Show entire file | Details | Blame | View Log

Rev 15 Rev 16
Line 76... Line 76...
public:
public:
        QSPIFLASHSIM(const int lglen = 24, bool debug = false);
        QSPIFLASHSIM(const int lglen = 24, bool debug = false);
        void    load(const char *fname) { load(0, fname); }
        void    load(const char *fname) { load(0, fname); }
        void    load(const unsigned addr, const char *fname);
        void    load(const unsigned addr, const char *fname);
        void    load(const uint32_t offset, const char *data, const uint32_t len);
        void    load(const uint32_t offset, const char *data, const uint32_t len);
 
        bool    write_protect(void) { return ((m_sreg & QSPIF_WEL_FLAG)==0); }
 
        bool    write_in_progress(void) { return ((m_sreg | QSPIF_WIP_FLAG)!=0); }
 
        bool    xip_mode(void) { return (QSPIF_QUAD_READ_IDLE == m_state); }
 
        bool    quad_mode(void) { return m_quad_mode; }
        void    debug(const bool dbg) { m_debug = dbg; }
        void    debug(const bool dbg) { m_debug = dbg; }
        bool    debug(void) const { return m_debug; }
        bool    debug(void) const { return m_debug; }
        unsigned operator[](const int index) {
        unsigned operator[](const int index) {
                unsigned char   *cptr = (unsigned char *)&m_mem[index<<2];
                unsigned char   *cptr = (unsigned char *)&m_mem[index];
                unsigned        v;
                unsigned        v;
                v = (*cptr++);
                v = (*cptr++);
                v = (v<<8)|(*cptr++);
                v = (v<<8)|(*cptr++);
                v = (v<<8)|(*cptr++);
                v = (v<<8)|(*cptr++);
                v = (v<<8)|(*cptr);
                v = (v<<8)|(*cptr);
 
 
                return v; }
                return v; }
        void set(const unsigned addr, const unsigned val) {
        void set(const unsigned addr, const unsigned val) {
                unsigned char   *cptr = (unsigned char *)&m_mem[addr<<2];
                unsigned char   *cptr = (unsigned char *)&m_mem[addr];
                *cptr++ = (val>>24);
                *cptr++ = (val>>24);
                *cptr++ = (val>>16);
                *cptr++ = (val>>16);
                *cptr++ = (val>> 8);
                *cptr++ = (val>> 8);
                *cptr   = (val);
                *cptr   = (val);
                return;}
                return;}

powered by: WebSVN 2.1.0

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