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

Subversion Repositories wbddr3

[/] [wbddr3/] [trunk/] [bench/] [cpp/] [ddrsdram_tb.cpp] - Diff between revs 7 and 8

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

Rev 7 Rev 8
Line 81... Line 81...
                        m_core->o_ddr_addr,
                        m_core->o_ddr_addr,
                        m_core->o_ddr_ba,
                        m_core->o_ddr_ba,
                        m_core->o_ddr_data);
                        m_core->o_ddr_data);
 
 
                bool    writeout = (!m_core->v__DOT__reset_override);
                bool    writeout = (!m_core->v__DOT__reset_override);
                writeout = true;
 
 
 
                if (writeout) {
                if (writeout) {
                        int cmd;
                        int cmd;
                        cmd = (m_core->o_ddr_reset_n?0:32)
                        cmd = (m_core->o_ddr_reset_n?0:32)
                                |(m_core->o_ddr_cke?0:16)
                                |(m_core->o_ddr_cke?0:16)
Line 136... Line 135...
                                (m_core->v__DOT__bus_active),
                                (m_core->v__DOT__bus_active),
                                (m_core->v__DOT__bus_read),
                                (m_core->v__DOT__bus_read),
                                (m_core->v__DOT__bus_new),
                                (m_core->v__DOT__bus_new),
                                (m_core->v__DOT__bus_subaddr[8]));
                                (m_core->v__DOT__bus_subaddr[8]));
 
 
                        // Reset logic
                        /*
                        printf(" RST(%06x%s[%d] - %08x->%08x)",
                        // Reset logic
                                m_core->v__DOT__reset_timer,
                        printf(" RST(%06x%s[%d] - %08x->%08x)",
                                (m_core->v__DOT__reset_ztimer)?"Z":" ",
                                m_core->v__DOT__reset_timer,
                                (m_core->v__DOT__reset_address),
                                (m_core->v__DOT__reset_ztimer)?"Z":" ",
                                (m_core->v__DOT__reset_instruction),
                                (m_core->v__DOT__reset_address),
                                (m_core->v__DOT__reset_cmd));
                                (m_core->v__DOT__reset_instruction),
 
                                (m_core->v__DOT__reset_cmd));
 
                        */
 
 
                        printf(" %s%03x[%d]%04x:%d",
                        printf(" %s%03x[%d]%04x:%d",
                                (m_core->v__DOT__r_pending)?"R":" ",
                                (m_core->v__DOT__r_pending)?"R":" ",
                                (m_core->v__DOT__r_row),
                                (m_core->v__DOT__r_row),
                                (m_core->v__DOT__r_bank),
                                (m_core->v__DOT__r_bank),
Line 429... Line 430...
        // Before testing, let's give the unit time enough to warm up
        // Before testing, let's give the unit time enough to warm up
        tb->reset();
        tb->reset();
        for(int i=0; i<141195; i++)
        for(int i=0; i<141195; i++)
                tb->wb_tick();
                tb->wb_tick();
 
 
 
        // Let's short circuit the test, and only test *some* of the memory
 
        // space.  It'll probably be good enough, and it'll finish while I'm
 
        // waiting ...
 
        mlen = 1<<16;
 
 
        printf("Getting some memory ...\n");
        printf("Getting some memory ...\n");
        rdbuf = new unsigned[mlen];
        rdbuf = new unsigned[mlen];
        mbuf  = new unsigned[mlen]; // Match buffer
        mbuf  = new unsigned[mlen]; // Match buffer
        printf("Charging my memory with random values\n");
        printf("Charging my memory with random values\n");
        uload(mlen, rdbuf);
        uload(mlen, rdbuf);
Line 485... Line 491...
                                i, mbuf[i], rdbuf[i]);
                                i, mbuf[i], rdbuf[i]);
                        goto test_failure;
                        goto test_failure;
                }
                }
        }
        }
 
 
        // Third test: Vector writes going through all memory, an prime number
        // Third test: Vector writes going through all memory, in prime numbers
        // of values at a time, followed by reads via a different prime number
        // of values at a time, followed by reads via a different prime number
 
        uload(mlen, rdbuf); // Get some new values
        for(int i=0; i<(int)mlen; i+=nw) {
        for(int i=0; i<(int)mlen; i+=nw) {
                int     ln = ((int)mlen-i>nw)?nw:mlen-i;
                int     ln = ((int)mlen-i>nw)?nw:mlen-i;
                tb->wb_write(i, nw, &rdbuf[i]);
                tb->wb_write(i, nw, &rdbuf[i]);
                for(int j=0; j<ln; j++) {
                for(int j=0; j<ln; j++) {
                        if ((*tb)[i+j] != rdbuf[i+j]) {
                        if ((*tb)[i+j] != rdbuf[i+j]) {
Line 500... Line 507...
                        }
                        }
                } if (tb->bombed())
                } if (tb->bombed())
                        goto test_failure;
                        goto test_failure;
        } for(int i=0; i<(int)mlen; i+=nr) {
        } for(int i=0; i<(int)mlen; i+=nr) {
                int     ln = ((int)mlen-i>nr)?nr:mlen-i;
                int     ln = ((int)mlen-i>nr)?nr:mlen-i;
                tb->wb_write(i, nr, &mbuf[i]);
                tb->wb_read(i, nr, &mbuf[i]);
                for(int j=0; j<ln; j++) {
                for(int j=0; j<ln; j++) {
                        if (mbuf[i+j] != rdbuf[i+j]) {
                        if (mbuf[i+j] != rdbuf[i+j]) {
                                printf("P-READ[%06x] = %08x (Expecting %08x) FAILED\n",
                                printf("P-READ[%06x] = %08x (Expecting %08x) FAILED\n",
                                        i, mbuf[i], rdbuf[i]);
                                        i, mbuf[i], rdbuf[i]);
                                goto test_failure;
                                goto test_failure;
                        }
                        }
                } if (tb->bombed())
                } if (tb->bombed())
                        goto test_failure;
                        goto test_failure;
        }
        }
 
 
 
        // Fourth test: Singular writes though all of memory, skipping by some
 
        // prime address increment each time, followed by reads via a different
 
        // prime numbered increment.
 
        uload(mlen, rdbuf); // Get some new values
 
        for(int i=0; i<(int)mlen; i++) {
 
                int     loc = (i*13)&0x3ffffff;
 
                tb->wb_write(loc, rdbuf[loc]);
 
                if ((*tb)[loc] != rdbuf[loc]) {
 
                        printf("R-WRITE[%06x] = %08x (Expecting %08x) FAILED\n",
 
                                i, (*tb)[loc], rdbuf[loc]);
 
                        goto test_failure;
 
                } if (tb->bombed())
 
                        goto test_failure;
 
        } for(int i=0; i<(int)mlen; i++) {
 
                int     loc = (i*19)&0x3ffffff;
 
                mbuf[loc] = tb->wb_read(loc);
 
                if (mbuf[loc] != rdbuf[loc]) {
 
                        printf("R-READ[%06x] = %08x (Expecting %08x) FAILED\n",
 
                                loc, mbuf[loc], rdbuf[loc]);
 
                        goto test_failure;
 
                } if (tb->bombed())
 
                        goto test_failure;
 
        }
 
 
 
 
        printf("SUCCESS!!\n");
        printf("SUCCESS!!\n");
        exit(0);
        exit(0);
test_failure:
test_failure:
        printf("FAIL-HERE\n");
        printf("FAIL-HERE\n");

powered by: WebSVN 2.1.0

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