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

Subversion Repositories xge_mac

[/] [xge_mac/] [trunk/] [tbench/] [systemc/] [sc_xgmii_if.cpp] - Diff between revs 15 and 29

Show entire file | Details | Blame | View Log

Rev 15 Rev 29
Line 53... Line 53...
}
}
 
 
void xgmii_if::init(void) {
void xgmii_if::init(void) {
    allow_idle_errors = false;
    allow_idle_errors = false;
    disable_padding = false;
    disable_padding = false;
 
    inject_noise = false;
}
}
 
 
void xgmii_if::connect_scoreboard(scoreboard *sbptr, scoreboard::sbSourceId sid) {
void xgmii_if::connect_scoreboard(scoreboard *sbptr, scoreboard::sbSourceId sid) {
    sb = sbptr;
    sb = sbptr;
    sb_id = sid;
    sb_id = sid;
Line 67... Line 68...
    packet_t* pkt;
    packet_t* pkt;
 
 
    sc_uint<64> txd = 0;
    sc_uint<64> txd = 0;
    sc_uint<8> txc = 0;
    sc_uint<8> txc = 0;
 
 
 
    int64_t noise [] = {0x1, 0xd5555555555555fb,
 
                        0x1, 0xd5555555555555fb,
 
                        0x1, 0xd5555555555555fc,
 
                        0x0, 0xd5555555555555fb,
 
                        0x1, 0xd5555555555555fb,
 
                        0x0, 0xd5555555555555fb,
 
                        0x1, 0x1111111111111111,
 
                        };
 
 
    int lane = 0;
    int lane = 0;
    int bytecnt = 0;
    int bytecnt = 0;
    int length = 0;
    int length = 0;
    int preamblecnt = 0;
    int preamblecnt = 0;
    int ifg = 0;
    int ifg = 0;
Line 78... Line 88...
    int coding_offset = 0;
    int coding_offset = 0;
    int fault_cnt = 0;
    int fault_cnt = 0;
    int fault_byte = 0;
    int fault_byte = 0;
    int fault_spacing;
    int fault_spacing;
    int fault_spacing_cnt = 0;
    int fault_spacing_cnt = 0;
 
    int count = 0;
 
    int i = 0;
 
 
    while (true) {
    while (true) {
 
 
        if (length == 0 && tx_fifo.nb_read(pkt)) {
        if (length == 0 && tx_fifo.nb_read(pkt)) {
 
 
Line 262... Line 274...
        }
        }
        else {
        else {
            txd |= ((sc_uint<64>)0x07) << (8 * lane);
            txd |= ((sc_uint<64>)0x07) << (8 * lane);
            txc |= 0x01 << lane;
            txc |= 0x01 << lane;
        }
        }
        if (lane == 7) {
        if (inject_noise) {
 
            for (count = 0; count < 10000; count += 2) {
 
                i = 2 * (random() % (sizeof(noise)/16));
 
                cout << "NOISE: " << hex << noise[i] << " " << noise[i+1] << dec << endl;
 
                xgmii_rxd = noise[i+1];
 
                xgmii_rxc = noise[i];
 
                txd = 0;
 
                txc = 0;
 
                wait();
 
            }
 
            inject_noise = false;
 
        }
 
        else if (lane == 7) {
            xgmii_rxd = txd;
            xgmii_rxd = txd;
            xgmii_rxc = txc;
            xgmii_rxc = txc;
            txd = 0;
            txd = 0;
            txc = 0;
            txc = 0;
            wait();
            wait();

powered by: WebSVN 2.1.0

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