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

Subversion Repositories wbddr3

[/] [wbddr3/] [trunk/] [bench/] [cpp/] [pddrsim.cpp] - Diff between revs 16 and 18

Show entire file | Details | Blame | View Log

Rev 16 Rev 18
Line 41... Line 41...
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include "ddrsdramsim.h"
#include "ddrsdramsim.h"
#include "pddrsim.h"
#include "pddrsim.h"
 
 
unsigned long PDDRSIM::operator()(int reset_n, int cke, int busoe,
void PDDRSIM::operator()(int reset_n, int cke, int busoe,
                unsigned cmda, unsigned cmdb, unsigned long data) {
                unsigned cmda, unsigned cmdb, unsigned cmdc, unsigned cmdd,
 
                const unsigned *data_to_sdram, unsigned *data_from_sdram) {
        int     csn, rasn, casn, wen, dqs, dm, odt, addr, ba;
        int     csn, rasn, casn, wen, dqs, dm, odt, addr, ba;
        unsigned        hdata, ldata;
 
        unsigned long   odata;
 
 
 
        // if ((reset_n)&&(cke)) printf("PDDR: %08x/%08x/%016lx\n", cmda, cmdb, data);
 
        csn  = (cmda >> 26)&1;
        csn  = (cmda >> 26)&1;
        rasn = (cmda >> 25)&1;
        rasn = (cmda >> 25)&1;
        casn = (cmda >> 24)&1;
        casn = (cmda >> 24)&1;
        wen  = (cmda >> 23)&1;
        wen  = (cmda >> 23)&1;
        ba   = (cmda >> 20)&0x7;        //  3 bits
        ba   = (cmda >> 20)&0x7;        //  3 bits
        addr = (cmda >>  6)&0x3fff;     // 14 bits
        addr = (cmda >>  6)&0x3fff;     // 14 bits
        dqs  = (cmda >>  5)&0x01;       //  1 bits
        dqs  = (cmda >>  5)&0x01;       //  1 bits
        dm   = (cmda >>  1)&0x0f;       //  4 bits
        dm   = (cmda >>  1)&0x0f;       //  4 bits
        odt  = (cmda      )&0x01;       //  1 bits
        odt  = (cmda      )&0x01;       //  1 bits
 
 
        // if ((reset_n)&&(cke)) printf("PDDR: %s/%02x/%s\n", (dqs)?"DQS":"   ",dm,(odt)?"ODT":"   ");
        data_from_sdram[0] = DDRSDRAMSIM::apply(
 
                reset_n, cke, csn, rasn, casn, wen,
        hdata = DDRSDRAMSIM::apply(reset_n, cke, csn, rasn, casn, wen,
                        dqs, dm, odt, busoe, addr, ba, data_to_sdram[0]);
                        dqs, dm, odt, busoe, addr, ba, (unsigned)(data>>32));
 
 
 
        csn  = (cmdb >> 26)&1;
        csn  = (cmdb >> 26)&1;
        rasn = (cmdb >> 25)&1;
        rasn = (cmdb >> 25)&1;
        casn = (cmdb >> 24)&1;
        casn = (cmdb >> 24)&1;
        wen  = (cmdb >> 23)&1;
        wen  = (cmdb >> 23)&1;
Line 73... Line 70...
        addr = (cmdb >>  6)&0x3fff;     // 14 bits
        addr = (cmdb >>  6)&0x3fff;     // 14 bits
        dqs  = (cmdb >>  5)&0x01;       //  1 bits
        dqs  = (cmdb >>  5)&0x01;       //  1 bits
        dm   = (cmdb >>  1)&0x0f;       //  4 bits
        dm   = (cmdb >>  1)&0x0f;       //  4 bits
        odt  = (cmdb      )&0x01;       //  1 bits
        odt  = (cmdb      )&0x01;       //  1 bits
 
 
        // if ((reset_n)&&(cke)) printf("PDDR: %s/%02x/%s\n", (dqs)?"DQS":"   ",dm,(odt)?"ODT":"   ");
        data_from_sdram[1] = DDRSDRAMSIM::apply(
 
                reset_n, cke, csn, rasn, casn, wen,
        ldata = DDRSDRAMSIM::apply(reset_n, cke, csn, rasn, casn, wen,
                        dqs, dm, odt, busoe, addr, ba, data_to_sdram[1]);
                        dqs, dm, odt, busoe, addr, ba, (unsigned)(data&(~(-1l<<32))));
 
 
        csn  = (cmdc >> 26)&1;
 
        rasn = (cmdc >> 25)&1;
        odata = (((unsigned long)hdata)<<32)|((unsigned long)ldata);
        casn = (cmdc >> 24)&1;
        return odata;
        wen  = (cmdc >> 23)&1;
 
        ba   = (cmdc >> 20)&0x7;        //  3 bits
 
        addr = (cmdc >>  6)&0x3fff;     // 14 bits
 
        dqs  = (cmdc >>  5)&0x01;       //  1 bits
 
        dm   = (cmdc >>  1)&0x0f;       //  4 bits
 
        odt  = (cmdc      )&0x01;       //  1 bits
 
 
 
        data_from_sdram[2] = DDRSDRAMSIM::apply(
 
                reset_n, cke, csn, rasn, casn, wen,
 
                        dqs, dm, odt, busoe, addr, ba, data_to_sdram[2]);
 
 
 
        csn  = (cmdd >> 26)&1;
 
        rasn = (cmdd >> 25)&1;
 
        casn = (cmdd >> 24)&1;
 
        wen  = (cmdd >> 23)&1;
 
        ba   = (cmdd >> 20)&0x7;        //  3 bits
 
        addr = (cmdd >>  6)&0x3fff;     // 14 bits
 
        dqs  = (cmdd >>  5)&0x01;       //  1 bits
 
        dm   = (cmdd >>  1)&0x0f;       //  4 bits
 
        odt  = (cmdd      )&0x01;       //  1 bits
 
 
 
        data_from_sdram[3] = DDRSDRAMSIM::apply(
 
                reset_n, cke, csn, rasn, casn, wen,
 
                        dqs, dm, odt, busoe, addr, ba, data_to_sdram[3]);
}
}
 
 
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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