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

Subversion Repositories xge_mac

[/] [xge_mac/] [trunk/] [tbench/] [systemc/] [sc_pkt_generator.cpp] - Diff between revs 7 and 29

Show entire file | Details | Blame | View Log

Rev 7 Rev 29
Line 46... Line 46...
 
 
 
 
void pkt_generator::init(void) {
void pkt_generator::init(void) {
    crc_interval = 0;
    crc_interval = 0;
    fragment_interval = 0;
    fragment_interval = 0;
 
    lenght_err_interval = 0;
 
    lenght_err_size = 10000;
    coding_interval = 0;
    coding_interval = 0;
    local_fault_interval = 0;
    local_fault_interval = 0;
    remote_fault_interval = 0;
    remote_fault_interval = 0;
}
}
 
 
Line 61... Line 63...
void pkt_generator::gen_packet() {
void pkt_generator::gen_packet() {
 
 
    int len = 0;
    int len = 0;
    int crc_int = 0;
    int crc_int = 0;
    int fragment_int = 0;
    int fragment_int = 0;
 
    int lenght_err_int = 0;
    int coding_int = 0;
    int coding_int = 0;
    int local_fault_int = 0;
    int local_fault_int = 0;
    int remote_fault_int = 0;
    int remote_fault_int = 0;
    int fault_spacing = 120;
    int fault_spacing = 120;
    int pause_int = 0;
    int pause_int = 0;
Line 135... Line 138...
            }
            }
            else {
            else {
                fragment_int = 0;
                fragment_int = 0;
            }
            }
 
 
 
            if (lenght_err_interval != 0) {
 
                if (lenght_err_int >= lenght_err_interval) {
 
                    pkt->err_flags |= PKT_FLAG_ERR_LENGHT;
 
                    lenght_err_int = 0;
 
                    pkt->length = lenght_err_size;
 
                }
 
                else {
 
                    lenght_err_int++;
 
                }
 
            }
 
            else {
 
                lenght_err_int = 0;
 
            }
 
 
            if (coding_interval != 0) {
            if (coding_interval != 0) {
                if (coding_int >= coding_interval) {
                if (coding_int >= coding_interval) {
                    pkt->err_flags |= PKT_FLAG_ERR_CODING;
                    pkt->err_flags |= PKT_FLAG_ERR_CODING;
                    coding_int = 0;
                    coding_int = 0;
                }
                }
Line 246... Line 263...
 
 
void pkt_generator::set_fragment_errors(int interval) {
void pkt_generator::set_fragment_errors(int interval) {
    fragment_interval = interval;
    fragment_interval = interval;
}
}
 
 
 
void pkt_generator::set_lenght_errors(int interval, int size) {
 
    lenght_err_interval = interval;
 
    lenght_err_size = size;
 
}
 
 
void pkt_generator::set_coding_errors(int interval) {
void pkt_generator::set_coding_errors(int interval) {
    coding_interval = interval;
    coding_interval = interval;
}
}
 
 
void pkt_generator::set_local_fault(int interval) {
void pkt_generator::set_local_fault(int interval) {

powered by: WebSVN 2.1.0

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