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

Subversion Repositories openhmc

[/] [openhmc/] [trunk/] [openHMC/] [sim/] [tb/] [bfm/] [src/] [hmc_link_config.sv] - Blame information for rev 15

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 juko
/*
2
 *                              .--------------. .----------------. .------------.
3
 *                             | .------------. | .--------------. | .----------. |
4
 *                             | | ____  ____ | | | ____    ____ | | |   ______ | |
5
 *                             | ||_   ||   _|| | ||_   \  /   _|| | | .' ___  || |
6
 *       ___  _ __   ___ _ __  | |  | |__| |  | | |  |   \/   |  | | |/ .'   \_|| |
7
 *      / _ \| '_ \ / _ \ '_ \ | |  |  __  |  | | |  | |\  /| |  | | || |       | |
8
 *       (_) | |_) |  __/ | | || | _| |  | |_ | | | _| |_\/_| |_ | | |\ `.___.'\| |
9
 *      \___/| .__/ \___|_| |_|| ||____||____|| | ||_____||_____|| | | `._____.'| |
10
 *           | |               | |            | | |              | | |          | |
11
 *           |_|               | '------------' | '--------------' | '----------' |
12
 *                              '--------------' '----------------' '------------'
13
 *
14
 *  openHMC - An Open Source Hybrid Memory Cube Controller
15
 *  (C) Copyright 2014 Computer Architecture Group - University of Heidelberg
16
 *  www.ziti.uni-heidelberg.de
17
 *  B6, 26
18
 *  68159 Mannheim
19
 *  Germany
20
 *
21
 *  Contact: openhmc@ziti.uni-heidelberg.de
22
 *  http://ra.ziti.uni-heidelberg.de/openhmc
23
 *
24
 *   This source file is free software: you can redistribute it and/or modify
25
 *   it under the terms of the GNU Lesser General Public License as published by
26
 *   the Free Software Foundation, either version 3 of the License, or
27
 *   (at your option) any later version.
28
 *
29
 *   This source file is distributed in the hope that it will be useful,
30
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
31
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
32
 *   GNU Lesser General Public License for more details.
33
 *
34
 *   You should have received a copy of the GNU Lesser General Public License
35
 *   along with this source file.  If not, see .
36
 *
37
 *
38
 */
39
 
40
`ifndef HMC_LINK_CONFIG_SV
41
`define HMC_LINK_CONFIG_SV
42
 
43
class hmc_link_config extends uvm_object;
44
 
45
//--
46
//-- variables
47
//--
48
 
49
        rand int                        hmc_tokens;
50
        rand int                        rx_tokens;
51 15 juko
        rand bit [5:0]          bit_slip_time;
52 12 juko
        rand bit [2:0]          cube_id;
53
 
54
        rand bit                        cfg_tx_lane_reverse;
55
        rand bit [15:0]         cfg_hsstx_inv;
56 15 juko
        bit                     cfg_scram_enb = 1;
57
        rand bit [15:0]         cfg_tx_lane_delay[16];
58 12 juko
        rand bit [ 3:0]         cfg_retry_limit                 = 3;    //-- LINKRETRY - infinite retry when cfg_retry_limit[3] == 1
59
        rand bit [ 2:0]         cfg_retry_timeout               = 5;
60
 
61
        rand bit                        cfg_check_pkt                   = 1;    //-- check for valid packet
62
 
63
        bit                             cfg_lane_auto_correct   = 1;
64 15 juko
        uvm_active_passive_enum                                 cfg_rsp_open_loop = UVM_PASSIVE;
65
        bit                             cfg_half_link_mode_rx   = (`LOG_NUM_LANES==3);
66 12 juko
        bit [7:0]                       cfg_tx_rl_lim                   = 85;
67 15 juko
        `ifdef HMC_12G
68
        int                             cfg_rx_clk_ratio                = 50;   //Set to 50 for 12.5Gbit , 60 for 15Gbit
69
        int                             cfg_tx_clk_ratio                = 50;   //Set to 50 for 12.5Gbit , 60 for 15Gbit
70
        `else
71
        int                             cfg_rx_clk_ratio                = 40;   //Set to 50 for 12.5Gbit , 60 for 15Gbit
72
        int                             cfg_tx_clk_ratio                = 40;   //Set to 50 for 12.5Gbit , 60 for 15Gbit
73
        `endif
74
        bit                             cfg_half_link_mode_tx   = (`LOG_NUM_LANES==3);
75
        rand bit [7:0]          cfg_init_retry_rxcnt;
76
        rand bit [7:0]          cfg_init_retry_txcnt;   //-- Actual value in BFM is 4times this value
77 12 juko
        realtime                        cfg_tsref                               = 1us;
78
        realtime                        cfg_top                                 = 1us;
79
 
80
        bit                             cfg_retry_enb                   = 1;
81
 
82
        //-- error injection is defined in 0.1% granularity
83
    rand int unsigned   cfg_rsp_dln,    cfg_rsp_lng,            cfg_rsp_crc,    cfg_rsp_seq,
84
                                                cfg_rsp_dinv,   cfg_rsp_errstat,        cfg_rsp_err,    cfg_rsp_poison,
85
                                                cfg_req_dln,    cfg_req_lng,            cfg_req_crc,    cfg_req_seq;
86
 
87
//--
88
//-- constrains
89
//--
90
 
91 15 juko
        constraint cfg_init_retry_rxcnt_c {
92
                cfg_init_retry_rxcnt == 16;
93
                // cfg_init_retry_rxcnt <= 20;
94
        }
95
 
96
        constraint cfg_init_retry_txcnt_c {
97
                //Actual Value is constraint*4
98
                // cfg_init_retry_txcnt >= 5;
99
                cfg_init_retry_txcnt == 7;
100
        }
101
 
102
        constraint bit_slip_time_c {
103
                bit_slip_time >= 32;
104
                bit_slip_time <= 63;
105
        }
106
 
107 12 juko
        constraint hmc_tokens_c {
108
                hmc_tokens >= 25;
109 15 juko
                // soft hmc_tokens dist{[25:30]:/5, [31:100]:/15, [101:1023]:/80};
110
                soft hmc_tokens dist{[25:30]:/5, [31:219]:/95}; //Current hardware
111 12 juko
        }
112
 
113
        constraint cfg_hsstx_inv_c {
114
                cfg_hsstx_inv >= 0;
115
        }
116
 
117
        constraint rx_tokens_c {
118
                rx_tokens >= 9;
119 15 juko
                // soft rx_tokens dist{[9:30]:/5, [31:100]:/15, [101:1023]:/80};        //Make sure to increase the input buffer accordingly
120
                soft rx_tokens dist{[9:30]:/5, [31:255]:/95};   //Safe value for input buffer address size = 8. Leave some FLITs for poisoned packets
121 12 juko
        }
122
 
123
        constraint cube_id_c {
124
                cube_id >= 0;
125
                soft cube_id == 0;
126
        }
127
        constraint lane_delay_c{
128
                foreach (cfg_tx_lane_delay[i]) {
129
                        cfg_tx_lane_delay[i] >= 0;
130
                        cfg_tx_lane_delay[i] <= 8;
131
                }
132
        }
133
 
134
        constraint retry_timeout_c {
135
                cfg_retry_timeout == 7;
136
        }
137
 
138
 
139
        constraint error_rates_c {
140 15 juko
                soft cfg_rsp_dln        ==0;//dist{[0:10]};
141
                soft cfg_rsp_lng        ==0;//dist{[0:10]};
142
                soft cfg_rsp_crc        ==0;//dist{[0:10]};
143
                soft cfg_rsp_seq        ==0;//dist{[0:10]};
144
                soft cfg_rsp_poison     ==0;//dist{[0:10]};
145
                soft cfg_req_dln        ==0;//dist{[0:10]};
146
                soft cfg_req_lng        ==0;//dist{[0:10]};
147
                soft cfg_req_crc        ==0;//dist{[0:10]};
148
                soft cfg_req_seq        ==0; // Must be zero for BFM 28965 !
149 12 juko
 
150
        (
151
        cfg_rsp_dln          ||
152
        cfg_rsp_lng          ||
153
        cfg_rsp_crc          ||
154
        cfg_rsp_seq          ||
155
        cfg_rsp_dinv         ||
156
        cfg_rsp_errstat      ||
157
        cfg_rsp_err          ||
158
        cfg_rsp_poison       ||
159
 
160
        cfg_req_dln          ||
161
        cfg_req_lng          ||
162
        cfg_req_crc          ||
163
        cfg_req_seq
164
        ) -> {
165
            cfg_check_pkt      == 0; //-- disable packet checking
166
            cfg_retry_limit[3] == 1; //-- enable infinite retry
167
        }
168
        }
169
 
170
 
171
        `uvm_object_utils_begin(hmc_link_config)
172
                `uvm_field_int(hmc_tokens, UVM_DEFAULT)
173
                `uvm_field_int(rx_tokens, UVM_DEFAULT)
174
        `uvm_object_utils_end
175
 
176
        function new(string name = "hmc_link_config");
177
                super.new(name);
178
        endfunction : new
179
 
180
        virtual function void do_print (uvm_printer printer);
181
                super.do_print(printer);
182
        endfunction : do_print
183
 
184
endclass : hmc_link_config
185
 
186 15 juko
`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.