Exemplo n.º 1
0
Arquivo: mem.c Projeto: apwan06/sim
bool_t diff_reg(mem_t oldr, mem_t newr, FILE *outfile)
{
    word_t pos;
    int len = oldr->len;
    bool_t diff = FALSE;
    if (newr->len < len)
    len = newr->len;
    //write back
    if(oldr->ca) oldr->ca->clear(TRUE);
    if(newr->ca) newr->ca->clear(TRUE);

    for (pos = 0; (!diff || outfile) && pos < len; pos += 4) {
        word_t ov = 0;
        word_t nv = 0;
    oldr->getWord(pos, &ov);
    newr->getWord(pos, &nv);
    if (nv != ov) {
        diff = TRUE;
        if (outfile)
        fprintf(outfile, "%s:\t0x%.8x\t0x%.8x\n",
            reg_table[pos/4].name, ov, nv);
    }
    }
    return diff;
}
Exemplo n.º 2
0
Arquivo: mem.c Projeto: apwan06/sim
bool_t diff_mem(mem_t oldm, mem_t newm, FILE *outfile)
{
    word_t pos;
    int len = oldm->len;
    bool_t diff = FALSE;
    if (newm->len < len)
    len = newm->len;

    // write back
    if(oldm->ca) oldm->ca->clear(TRUE);
    if(newm->ca) newm->ca->clear(TRUE);

    //remove bus
    /*
    if(oldm->bus) oldm->bus->remove(oldm);
    if(newm->bus) newm->bus->remove(newm);
    */


    for (pos = 0; (!diff || outfile) && pos+4 <= len; pos += 4) {
        word_t ov = 0;  word_t nv = 0;
        oldm->getWord(pos, &ov);
        newm->getWord(pos, &nv);
        if (nv != ov) {
            diff = TRUE;
            if (outfile)
                fprintf(outfile, "0x%.4x:\t0x%.8x\t0x%.8x\n", pos, ov, nv);
        }
    }
    //return *oldm->m != *newm->m;
    return diff;
}