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

Subversion Repositories openhmc

[/] [openhmc/] [trunk/] [openHMC/] [sim/] [tb/] [bfm/] [src/] [hmc_link_config.sv] - Diff between revs 12 and 15

Only display areas with differences | Details | Blame | View Log

Rev 12 Rev 15
/*
/*
 *                              .--------------. .----------------. .------------.
 *                              .--------------. .----------------. .------------.
 *                             | .------------. | .--------------. | .----------. |
 *                             | .------------. | .--------------. | .----------. |
 *                             | | ____  ____ | | | ____    ____ | | |   ______ | |
 *                             | | ____  ____ | | | ____    ____ | | |   ______ | |
 *                             | ||_   ||   _|| | ||_   \  /   _|| | | .' ___  || |
 *                             | ||_   ||   _|| | ||_   \  /   _|| | | .' ___  || |
 *       ___  _ __   ___ _ __  | |  | |__| |  | | |  |   \/   |  | | |/ .'   \_|| |
 *       ___  _ __   ___ _ __  | |  | |__| |  | | |  |   \/   |  | | |/ .'   \_|| |
 *      / _ \| '_ \ / _ \ '_ \ | |  |  __  |  | | |  | |\  /| |  | | || |       | |
 *      / _ \| '_ \ / _ \ '_ \ | |  |  __  |  | | |  | |\  /| |  | | || |       | |
 *       (_) | |_) |  __/ | | || | _| |  | |_ | | | _| |_\/_| |_ | | |\ `.___.'\| |
 *       (_) | |_) |  __/ | | || | _| |  | |_ | | | _| |_\/_| |_ | | |\ `.___.'\| |
 *      \___/| .__/ \___|_| |_|| ||____||____|| | ||_____||_____|| | | `._____.'| |
 *      \___/| .__/ \___|_| |_|| ||____||____|| | ||_____||_____|| | | `._____.'| |
 *           | |               | |            | | |              | | |          | |
 *           | |               | |            | | |              | | |          | |
 *           |_|               | '------------' | '--------------' | '----------' |
 *           |_|               | '------------' | '--------------' | '----------' |
 *                              '--------------' '----------------' '------------'
 *                              '--------------' '----------------' '------------'
 *
 *
 *  openHMC - An Open Source Hybrid Memory Cube Controller
 *  openHMC - An Open Source Hybrid Memory Cube Controller
 *  (C) Copyright 2014 Computer Architecture Group - University of Heidelberg
 *  (C) Copyright 2014 Computer Architecture Group - University of Heidelberg
 *  www.ziti.uni-heidelberg.de
 *  www.ziti.uni-heidelberg.de
 *  B6, 26
 *  B6, 26
 *  68159 Mannheim
 *  68159 Mannheim
 *  Germany
 *  Germany
 *
 *
 *  Contact: openhmc@ziti.uni-heidelberg.de
 *  Contact: openhmc@ziti.uni-heidelberg.de
 *  http://ra.ziti.uni-heidelberg.de/openhmc
 *  http://ra.ziti.uni-heidelberg.de/openhmc
 *
 *
 *   This source file is free software: you can redistribute it and/or modify
 *   This source file is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU Lesser General Public License as published by
 *   it under the terms of the GNU Lesser General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *   (at your option) any later version.
 *
 *
 *   This source file is distributed in the hope that it will be useful,
 *   This source file is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU Lesser General Public License for more details.
 *   GNU Lesser General Public License for more details.
 *
 *
 *   You should have received a copy of the GNU Lesser General Public License
 *   You should have received a copy of the GNU Lesser General Public License
 *   along with this source file.  If not, see .
 *   along with this source file.  If not, see .
 *
 *
 *
 *
 */
 */
`ifndef HMC_LINK_CONFIG_SV
`ifndef HMC_LINK_CONFIG_SV
`define HMC_LINK_CONFIG_SV
`define HMC_LINK_CONFIG_SV
class hmc_link_config extends uvm_object;
class hmc_link_config extends uvm_object;
//--
//--
//-- variables
//-- variables
//--
//--
        rand int                        hmc_tokens;
        rand int                        hmc_tokens;
        rand int                        rx_tokens;
        rand int                        rx_tokens;
 
        rand bit [5:0]          bit_slip_time;
        rand bit [2:0]          cube_id;
        rand bit [2:0]          cube_id;
        rand bit                        cfg_tx_lane_reverse;
        rand bit                        cfg_tx_lane_reverse;
        rand bit [15:0]         cfg_hsstx_inv;
        rand bit [15:0]         cfg_hsstx_inv;
        rand bit                        cfg_scram_enb;
        bit                     cfg_scram_enb = 1;
        rand bit [15:0]         cfg_tx_lane_delay[16]   = '{16{4'h0}};
        rand bit [15:0]         cfg_tx_lane_delay[16];
        rand bit [ 3:0]         cfg_retry_limit                 = 3;    //-- LINKRETRY - infinite retry when cfg_retry_limit[3] == 1
        rand bit [ 3:0]         cfg_retry_limit                 = 3;    //-- LINKRETRY - infinite retry when cfg_retry_limit[3] == 1
        rand bit [ 2:0]         cfg_retry_timeout               = 5;
        rand bit [ 2:0]         cfg_retry_timeout               = 5;
        rand bit                        cfg_check_pkt                   = 1;    //-- check for valid packet
        rand bit                        cfg_check_pkt                   = 1;    //-- check for valid packet
        bit                             cfg_lane_auto_correct   = 1;
        bit                             cfg_lane_auto_correct   = 1;
        bit                             cfg_rsp_open_loop               = 0;
        uvm_active_passive_enum                                 cfg_rsp_open_loop = UVM_PASSIVE;
        int                             cfg_rx_clk_ratio                = 40;
        bit                             cfg_half_link_mode_rx   = (`LOG_NUM_LANES==3);
        bit                             cfg_half_link_mode_rx   = (2**`LOG_NUM_LANES==8);
 
        bit [7:0]                       cfg_tx_rl_lim                   = 85;
        bit [7:0]                       cfg_tx_rl_lim                   = 85;
        int                             cfg_tx_clk_ratio                = 40;
        `ifdef HMC_12G
        bit                             cfg_half_link_mode_tx   = (2**`LOG_NUM_LANES==8);
        int                             cfg_rx_clk_ratio                = 50;   //Set to 50 for 12.5Gbit , 60 for 15Gbit
        bit [7:0]                       cfg_init_retry_rxcnt    = 16;
        int                             cfg_tx_clk_ratio                = 50;   //Set to 50 for 12.5Gbit , 60 for 15Gbit
        bit [7:0]                       cfg_init_retry_txcnt    = 6;    //-- Actual value in BFM is 4times this value
        `else
 
        int                             cfg_rx_clk_ratio                = 40;   //Set to 50 for 12.5Gbit , 60 for 15Gbit
 
        int                             cfg_tx_clk_ratio                = 40;   //Set to 50 for 12.5Gbit , 60 for 15Gbit
 
        `endif
 
        bit                             cfg_half_link_mode_tx   = (`LOG_NUM_LANES==3);
 
        rand bit [7:0]          cfg_init_retry_rxcnt;
 
        rand bit [7:0]          cfg_init_retry_txcnt;   //-- Actual value in BFM is 4times this value
        realtime                        cfg_tsref                               = 1us;
        realtime                        cfg_tsref                               = 1us;
        realtime                        cfg_top                                 = 1us;
        realtime                        cfg_top                                 = 1us;
        bit                             cfg_retry_enb                   = 1;
        bit                             cfg_retry_enb                   = 1;
        //-- error injection is defined in 0.1% granularity
        //-- error injection is defined in 0.1% granularity
    rand int unsigned   cfg_rsp_dln,    cfg_rsp_lng,            cfg_rsp_crc,    cfg_rsp_seq,
    rand int unsigned   cfg_rsp_dln,    cfg_rsp_lng,            cfg_rsp_crc,    cfg_rsp_seq,
                                                cfg_rsp_dinv,   cfg_rsp_errstat,        cfg_rsp_err,    cfg_rsp_poison,
                                                cfg_rsp_dinv,   cfg_rsp_errstat,        cfg_rsp_err,    cfg_rsp_poison,
                                                cfg_req_dln,    cfg_req_lng,            cfg_req_crc,    cfg_req_seq;
                                                cfg_req_dln,    cfg_req_lng,            cfg_req_crc,    cfg_req_seq;
//--
//--
//-- constrains
//-- constrains
//--
//--
 
 
 
        constraint cfg_init_retry_rxcnt_c {
 
                cfg_init_retry_rxcnt == 16;
 
                // cfg_init_retry_rxcnt <= 20;
 
        }
 
 
 
        constraint cfg_init_retry_txcnt_c {
 
                //Actual Value is constraint*4
 
                // cfg_init_retry_txcnt >= 5;
 
                cfg_init_retry_txcnt == 7;
 
        }
 
 
 
        constraint bit_slip_time_c {
 
                bit_slip_time >= 32;
 
                bit_slip_time <= 63;
 
        }
 
 
        constraint hmc_tokens_c {
        constraint hmc_tokens_c {
                hmc_tokens >= 25;
                hmc_tokens >= 25;
                soft hmc_tokens dist{[25:30]:/5, [31:100]:/15, [101:1023]:/80};
                // soft hmc_tokens dist{[25:30]:/5, [31:100]:/15, [101:1023]:/80};
 
                soft hmc_tokens dist{[25:30]:/5, [31:219]:/95}; //Current hardware
        }
        }
        constraint cfg_hsstx_inv_c {
        constraint cfg_hsstx_inv_c {
                cfg_hsstx_inv >= 0;
                cfg_hsstx_inv >= 0;
        }
        }
        constraint rx_tokens_c {
        constraint rx_tokens_c {
                rx_tokens >= 9;
                rx_tokens >= 9;
                soft rx_tokens dist{[9:30]:/5, [31:100]:/15, [101:1023]:/80};
                // soft rx_tokens dist{[9:30]:/5, [31:100]:/15, [101:1023]:/80};        //Make sure to increase the input buffer accordingly
 
                soft rx_tokens dist{[9:30]:/5, [31:255]:/95};   //Safe value for input buffer address size = 8. Leave some FLITs for poisoned packets
        }
        }
        constraint cube_id_c {
        constraint cube_id_c {
                cube_id >= 0;
                cube_id >= 0;
                soft cube_id == 0;
                soft cube_id == 0;
        }
        }
        constraint lane_delay_c{
        constraint lane_delay_c{
                foreach (cfg_tx_lane_delay[i]) {
                foreach (cfg_tx_lane_delay[i]) {
                        cfg_tx_lane_delay[i] >= 0;
                        cfg_tx_lane_delay[i] >= 0;
                        cfg_tx_lane_delay[i] <= 8;
                        cfg_tx_lane_delay[i] <= 8;
                }
                }
        }
        }
        constraint retry_timeout_c {
        constraint retry_timeout_c {
                cfg_retry_timeout == 7;
                cfg_retry_timeout == 7;
        }
        }
        constraint error_rates_c {
        constraint error_rates_c {
                soft cfg_rsp_dln        == 5;
                soft cfg_rsp_dln        ==0;//dist{[0:10]};
                soft cfg_rsp_lng        == 5;
                soft cfg_rsp_lng        ==0;//dist{[0:10]};
                soft cfg_rsp_crc        == 5;
                soft cfg_rsp_crc        ==0;//dist{[0:10]};
                soft cfg_rsp_seq        == 5;
                soft cfg_rsp_seq        ==0;//dist{[0:10]};
                soft cfg_rsp_poison     == 5;
                soft cfg_rsp_poison     ==0;//dist{[0:10]};
 
                soft cfg_req_dln        ==0;//dist{[0:10]};
                soft cfg_req_dln        == 5;
                soft cfg_req_lng        ==0;//dist{[0:10]};
                soft cfg_req_lng        == 5;
                soft cfg_req_crc        ==0;//dist{[0:10]};
                soft cfg_req_crc        == 5;
 
                soft cfg_req_seq        == 0; // Must be zero for BFM 28965 !
                soft cfg_req_seq        == 0; // Must be zero for BFM 28965 !
 
 
 
 
        (
        (
        cfg_rsp_dln          ||
        cfg_rsp_dln          ||
        cfg_rsp_lng          ||
        cfg_rsp_lng          ||
        cfg_rsp_crc          ||
        cfg_rsp_crc          ||
        cfg_rsp_seq          ||
        cfg_rsp_seq          ||
        cfg_rsp_dinv         ||
        cfg_rsp_dinv         ||
        cfg_rsp_errstat      ||
        cfg_rsp_errstat      ||
        cfg_rsp_err          ||
        cfg_rsp_err          ||
        cfg_rsp_poison       ||
        cfg_rsp_poison       ||
        cfg_req_dln          ||
        cfg_req_dln          ||
        cfg_req_lng          ||
        cfg_req_lng          ||
        cfg_req_crc          ||
        cfg_req_crc          ||
        cfg_req_seq
        cfg_req_seq
        ) -> {
        ) -> {
            cfg_check_pkt      == 0; //-- disable packet checking
            cfg_check_pkt      == 0; //-- disable packet checking
            cfg_retry_limit[3] == 1; //-- enable infinite retry
            cfg_retry_limit[3] == 1; //-- enable infinite retry
        }
        }
        }
        }
        `uvm_object_utils_begin(hmc_link_config)
        `uvm_object_utils_begin(hmc_link_config)
                `uvm_field_int(hmc_tokens, UVM_DEFAULT)
                `uvm_field_int(hmc_tokens, UVM_DEFAULT)
                `uvm_field_int(rx_tokens, UVM_DEFAULT)
                `uvm_field_int(rx_tokens, UVM_DEFAULT)
        `uvm_object_utils_end
        `uvm_object_utils_end
        function new(string name = "hmc_link_config");
        function new(string name = "hmc_link_config");
                super.new(name);
                super.new(name);
        endfunction : new
        endfunction : new
        virtual function void do_print (uvm_printer printer);
        virtual function void do_print (uvm_printer printer);
                super.do_print(printer);
                super.do_print(printer);
        endfunction : do_print
        endfunction : do_print
endclass : hmc_link_config
endclass : hmc_link_config
 
 
`endif // AXI4_STREAM_CONFIG_SV
`endif // HMC_LINK_CONFIG_SV
 
 

powered by: WebSVN 2.1.0

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