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

Subversion Repositories openhmc

[/] [openhmc/] [trunk/] [openHMC/] [sim/] [UVC/] [hmc/] [sv/] [hmc_config.sv] - Blame information for rev 15

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 15 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
`ifndef hmc_config_SV
40
`define hmc_config_SV
41
 
42
 
43
 
44
 
45
class hmc_local_link_config extends uvm_object;
46
        // Configure the driver
47
        rand bit [15:0] reverse_polarity;
48
        rand bit                reverse_lanes;
49
        rand int                TS1_Messages;
50
 
51
        rand int                irtry_flit_count_to_send;
52
        rand int                irtry_flit_count_received_threshold;
53
 
54
        int                             random_retry_probability;
55
        rand int                max_retry_attempts;
56
 
57
        rand int                lane_delays[16];
58
        rand bit                lane_delays_enabled=1;
59
 
60
        bit                     errors_enabled          = 0;
61
        bit                     lane_errors_enabled     = 0;
62
        rand int                poisoned_probability;
63
        rand int                lng_error_probability;
64
        rand int                seq_error_probability;
65
        rand int                crc_error_probability;
66
        rand int                bitflip_error_probability;
67
 
68
        rand int                poisoned_packets_minimum_length;
69
        uvm_active_passive_enum active = UVM_PASSIVE;
70
        int                             width;
71
 
72
        rand int                send_tret_time;
73
        rand int                send_pret_time;
74
 
75
        bit requester = 1'b1;
76
        int run_length_limit = 85;
77
 
78
        covergroup config_cg;
79
                option.per_instance = 1;
80
                lane0_delay : coverpoint lane_delays[0]
81
                {bins delay[] = {[0:7]};}
82
                lane1_delay : coverpoint lane_delays[1]
83
                {bins delay[] = {[0:7]};}
84
                lane2_delay : coverpoint lane_delays[2]
85
                {bins delay[] = {[0:7]};}
86
                lane3_delay : coverpoint lane_delays[3]
87
                {bins delay[] = {[0:7]};}
88
                lane4_delay : coverpoint lane_delays[4]
89
                {bins delay[] = {[0:7]};}
90
                lane5_delay : coverpoint lane_delays[5]
91
                {bins delay[] = {[0:7]};}
92
                lane6_delay : coverpoint lane_delays[6]
93
                {bins delay[] = {[0:7]};}
94
                lane7_delay : coverpoint lane_delays[7]
95
                {bins delay[] = {[0:7]};}
96
                lane8_delay : coverpoint lane_delays[8]
97
                {bins delay[] = {[0:7]};}
98
                lane9_delay : coverpoint lane_delays[9]
99
                {bins delay[] = {[0:7]};}
100
                lane10_delay : coverpoint lane_delays[10]
101
                {bins delay[] = {[0:7]};}
102
                lane11_delay : coverpoint lane_delays[11]
103
                {bins delay[] = {[0:7]};}
104
                lane12_delay : coverpoint lane_delays[12]
105
                {bins delay[] = {[0:7]};}
106
                lane13_delay : coverpoint lane_delays[13]
107
                {bins delay[] = {[0:7]};}
108
                lane14_delay : coverpoint lane_delays[14]
109
                {bins delay[] = {[0:7]};}
110
                lane15_delay : coverpoint lane_delays[15]
111
                {bins delay[] = {[0:7]};}
112
 
113
                lane0_polarity : coverpoint reverse_polarity[0]
114
                {bins polarity = {1};}
115
                lane1_polarity : coverpoint reverse_polarity[1]
116
                {bins polarity = {1};}
117
                lane2_polarity : coverpoint reverse_polarity[2]
118
                {bins polarity = {1};}
119
                lane3_polarity : coverpoint reverse_polarity[3]
120
                {bins polarity = {1};}
121
                lane4_polarity : coverpoint reverse_polarity[4]
122
                {bins polarity = {1};}
123
                lane5_polarity : coverpoint reverse_polarity[5]
124
                {bins polarity = {1};}
125
                lane6_polarity : coverpoint reverse_polarity[6]
126
                {bins polarity = {1};}
127
                lane7_polarity : coverpoint reverse_polarity[7]
128
                {bins polarity = {1};}
129
                lane8_polarity : coverpoint reverse_polarity[8]
130
                {bins polarity = {1};}
131
                lane9_polarity : coverpoint reverse_polarity[9]
132
                {bins polarity = {1};}
133
                lane10_polarity : coverpoint reverse_polarity[10]
134
                {bins polarity = {1};}
135
                lane11_polarity : coverpoint reverse_polarity[11]
136
                {bins polarity = {1};}
137
                lane12_polarity : coverpoint reverse_polarity[12]
138
                {bins polarity = {1};}
139
                lane13_polarity : coverpoint reverse_polarity[13]
140
                {bins polarity = {1};}
141
                lane14_polarity : coverpoint reverse_polarity[14]
142
                {bins polarity = {1};}
143
                lane15_polarity : coverpoint reverse_polarity[15]
144
                {bins polarity = {1};}
145
 
146
        endgroup
147
 
148
        `uvm_object_utils_begin(hmc_local_link_config)
149
                `uvm_field_int(reverse_polarity, UVM_DEFAULT | UVM_BIN)
150
                `uvm_field_int(reverse_lanes, UVM_DEFAULT | UVM_DEC)
151
                `uvm_field_int(lane_delays_enabled, UVM_DEFAULT | UVM_DEC)
152
                `uvm_field_int(irtry_flit_count_to_send, UVM_DEFAULT | UVM_DEC)
153
                `uvm_field_int(irtry_flit_count_received_threshold, UVM_DEFAULT | UVM_DEC)
154
                `uvm_field_int(random_retry_probability, UVM_DEFAULT | UVM_DEC)
155
                `uvm_field_int(max_retry_attempts, UVM_DEFAULT | UVM_DEC)
156
                `uvm_field_int(poisoned_packets_minimum_length, UVM_DEFAULT | UVM_DEC)
157
                `uvm_field_int(poisoned_probability, UVM_DEFAULT| UVM_DEC)
158
                `uvm_field_int(lng_error_probability, UVM_DEFAULT| UVM_DEC)
159
                `uvm_field_int(seq_error_probability, UVM_DEFAULT| UVM_DEC)
160
                `uvm_field_int(crc_error_probability, UVM_DEFAULT| UVM_DEC)
161
                `uvm_field_int(bitflip_error_probability, UVM_DEFAULT| UVM_DEC)
162
                `uvm_field_int(width, UVM_DEFAULT | UVM_DEC)
163
                `uvm_field_int(send_pret_time, UVM_DEFAULT | UVM_DEC)
164
                `uvm_field_int(send_tret_time, UVM_DEFAULT | UVM_DEC)
165
                `uvm_field_enum(uvm_active_passive_enum, active, UVM_DEFAULT)
166
                `uvm_field_int(run_length_limit, UVM_DEFAULT | UVM_DEC)
167
                `uvm_field_int(requester, UVM_DEFAULT | UVM_DEC)
168
                `uvm_field_int(errors_enabled, UVM_DEFAULT)
169
                `uvm_field_int(lane_errors_enabled, UVM_DEFAULT)
170
 
171
        `uvm_object_utils_end
172
 
173
//      constraint c_token_count {
174
//              token_count > 27 && token_count < 1024;      //token count min=27, for compliance with tx_link. Could be refined if necessary
175
//      }
176
 
177
        constraint c_max_retry_attempts {
178
                max_retry_attempts == 10;
179
        }
180
 
181
        constraint c_TS1_Messages {
182
                soft TS1_Messages == 6;
183
        }
184
 
185
        constraint c_active_settings {
186
                active==UVM_ACTIVE ||
187
                        random_retry_probability == 0 && send_pret_time == 0 &&
188
                        send_tret_time == 0;// && bit_errors_allowed == 0;// &&
189
                //      poisoned_packets_allowed == 0;
190
        }
191
 
192
        constraint c_lane_delays {
193
                foreach (lane_delays[i]) {
194
                        if(lane_delays_enabled) lane_delays[i] inside {[0:7]};
195
                        else lane_delays[i]==0;
196
                }
197
        }
198
 
199
        constraint c_lane_polarity {
200
                foreach (reverse_polarity[i]) {
201
                        if ((width == 8) && (i >=8)) reverse_polarity[i] == 0;
202
                }
203
        }
204
 
205
        constraint c_send_pret_time {
206
                send_pret_time == 0;
207
        }
208
 
209
        constraint c_send_tret_time {
210
                send_tret_time == 0;
211
        }
212
 
213
        constraint c_irtry_flit_count_received_threshold {
214
                irtry_flit_count_received_threshold  == 16;
215
        }
216
        constraint c_irtry_flit_count_to_send {
217
                //irtry_flit_count_to_send > 16 && irtry_flit_count_to_send < 30;
218
                irtry_flit_count_to_send == 16;
219
        }
220
 
221
        constraint c_poisoned_packets_propability {
222
                poisoned_probability <=10;
223
                poisoned_probability >=0;
224
 
225
                soft poisoned_probability == 0;
226
                if (errors_enabled) (poisoned_probability == 6);
227
        }
228
 
229
        constraint c_lng_error_probability {
230
                lng_error_probability <=10;
231
                lng_error_probability >=0;
232
 
233
                soft lng_error_probability == 0;
234
                if (errors_enabled) (lng_error_probability == 6);
235
        }
236
 
237
        constraint c_seq_error_probability {
238
                seq_error_probability <=10;
239
                seq_error_probability >=0;
240
 
241
                soft seq_error_probability == 0;
242
                if (errors_enabled) (seq_error_probability == 6);
243
        }
244
 
245
        constraint c_crc_error_probability {
246
                crc_error_probability <=10;
247
                crc_error_probability >=0;
248
 
249
                soft crc_error_probability == 0;
250
                if (errors_enabled)(crc_error_probability == 6);
251
        }
252
 
253
        constraint c_bitflip_error_probability {
254
                soft bitflip_error_probability == 0;
255
                if (lane_errors_enabled)(bitflip_error_probability == 2);
256
        }
257
 
258
        constraint c_poisoned_packets_minimum_length {
259
                poisoned_packets_minimum_length > 4 &&
260
                poisoned_packets_minimum_length < 9;
261
        }
262
 
263
        function new(string name="hmc_local_link_config");
264
                super.new(name);
265
                config_cg = new();
266
        endfunction : new
267
 
268
        function void post_randomize();
269
        endfunction : post_randomize
270
 
271
        virtual function void do_print (uvm_printer printer);
272
                super.do_print(printer);
273
        endfunction : do_print
274
 
275
endclass : hmc_local_link_config
276
 
277
class hmc_link_config extends uvm_object;
278
 
279
        // Global Configuration (Requester, Responder, and Monitor)
280
        rand bit [2:0]          cube_id;
281
        rand bit                        scramblers_enabled;
282
        // Timing parameters
283
        int tINIT = 1us;  // 20ms in the spec, but that would take too long in simulation
284
        int tRESP1 = 1us; // 1us or 1.2ms with DFE
285
        int tRESP2 = 1us; // 1us
286
 
287
        int fpw;        //-- used for coverage
288
 
289
        time t_PST = 80ns;
290
        time t_SS =  500ns;
291
        time t_SME = 600ns;
292
 
293
        int retry_timeout_period = 614.4ns; // 10Gbps
294
                                                        // 491.52ns // 12.5Gbps
295
                                                        // 409.35ns // 15Gbps
296
 
297
        rand int        bit_rate;
298
        rand int        bit_time;
299
 
300
        rand int        hmc_tokens;
301
        rand int        rx_tokens;
302
 
303
 
304
        uvm_active_passive_enum cfg_rsp_open_loop = UVM_PASSIVE;
305
        uvm_active_passive_enum enable_tag_checking = UVM_ACTIVE;
306
 
307
        // Configure the Requester
308
        hmc_local_link_config requester;
309
        hmc_local_link_config responder;
310
 
311
        `uvm_object_utils_begin(hmc_link_config)
312
                `uvm_field_int(tINIT, UVM_DEFAULT | UVM_DEC)
313
                `uvm_field_int(tRESP1, UVM_DEFAULT | UVM_DEC)
314
                `uvm_field_int(tRESP2, UVM_DEFAULT | UVM_DEC)
315
                `uvm_field_int(retry_timeout_period, UVM_DEFAULT | UVM_DEC)
316
                `uvm_field_int(scramblers_enabled, UVM_DEFAULT | UVM_DEC)
317
                `uvm_field_int(bit_rate, UVM_DEFAULT | UVM_DEC)
318
                `uvm_field_int(bit_time, UVM_DEFAULT | UVM_DEC)
319
                `uvm_field_object(requester, UVM_DEFAULT)
320
                `uvm_field_object(responder, UVM_DEFAULT)
321
                `uvm_field_int(hmc_tokens, UVM_DEC)
322
                `uvm_field_int(rx_tokens, UVM_DEC)
323
                `uvm_field_enum(uvm_active_passive_enum, cfg_rsp_open_loop, UVM_DEFAULT)
324
                `uvm_field_enum(uvm_active_passive_enum, enable_tag_checking, UVM_DEFAULT)
325
 
326
        `uvm_object_utils_end
327
 
328
        //-- Constraints
329
 
330
        constraint cube_id_c {
331
                cube_id >= 0;
332
                soft cube_id == 0;
333
        }
334
 
335
        constraint c_bit_rate {
336
                                                        // Eventually allow 10, 12.5, and 15 Gb/s
337
                bit_rate == 10_000; //10Gbit/s = 10_000 Mbit/s
338
        }
339
 
340
        constraint c_bit_time {
341
                //bit_time > 0 && bit_time == 1us/bit_rate;
342
                bit_time == 100ps; // 10Gbit
343
                //bit_time == 80ps; // 12.5Gbit
344
                //bit_time == 66ps; // 15Gbit TODO: Rounding problems?!?
345
        }
346
 
347
        constraint hmc_tokens_c {
348
                hmc_tokens >= 25;
349
                soft hmc_tokens dist{[25:30]:/5, [31:219]:/95};
350
        }
351
 
352
        constraint rx_tokens_c {
353
                rx_tokens >=30;
354
                soft rx_tokens dist{[9:30]:/5, [31:255]:/95};
355
        }
356
 
357
        function new(string name="hmc_link_config");
358
                super.new(name);
359
                requester = new;
360
                responder = new;
361
        endfunction : new
362
 
363
        function void post_randomize();
364
                assert (requester.randomize());
365
                assert (responder.randomize());
366
        endfunction : post_randomize
367
 
368
        virtual function void do_print (uvm_printer printer);
369
                super.do_print(printer);
370
                requester.do_print(printer);
371
                responder.do_print(printer);
372
        endfunction : do_print
373
 
374
endclass : hmc_link_config
375
 
376
`endif // hmc_config_SV

powered by: WebSVN 2.1.0

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