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

Subversion Repositories openhmc

[/] [openhmc/] [trunk/] [openHMC/] [sim/] [tb/] [common/] [testlib/] [seq_lib/] [hmc_base_pkt_seq.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_BASE_PKT_SEQ
40
`define HMC_BASE_PKT_SEQ
41
 
42
typedef enum {
43
                POSTED,
44
                ATOMIC,
45
                NON_POSTED,
46
                ALL_TYPES
47
        //      MISC
48
} request_class_e;
49
 
50
class hmc_base_pkt_seq extends hmc_base_seq;
51
 
52
 
53
 
54
        rand int num_packets ;
55
        rand int pkts_per_req;
56
 
57
 
58
        rand request_class_e req_class;
59
 
60
        //-- delay constraints
61
        rand int min_flit_delay  ;
62
        rand int max_flit_delay  ;
63
 
64
        rand int min_packet_length ;
65
        rand int max_packet_length ;
66
 
67
 
68
 
69
        constraint delay_c {
70
                !(min_flit_delay        > max_flit_delay);
71
                min_flit_delay          >= 0;
72
                soft max_flit_delay     <= 50;
73
        }
74
 
75
        constraint pkt_length_c {
76
                min_packet_length <= max_packet_length;
77
                min_packet_length >= 0;
78
                max_packet_length <= 9;
79
        }
80
 
81
        constraint num_packets_c {
82
                num_packets > 0;
83
                soft num_packets <= 50;
84
        }
85
 
86
        constraint pkts_per_req_c {
87
                pkts_per_req > 0;
88
                soft pkts_per_req <= 10;
89
                pkts_per_req <= num_packets;
90
        }
91
 
92
        `uvm_object_utils(hmc_base_pkt_seq)
93
        `uvm_declare_p_sequencer(vseqr)
94
 
95
        hmc_2_axi4_sequence #(.DATA_BYTES(`AXI4BYTES), .TUSER_WIDTH(`AXI4BYTES)) requests;
96
 
97
        function new(string name="hmc_base_pkt_seq");
98
                super.new(name);
99
        endfunction : new
100
 
101
        virtual task body();
102
                `uvm_info(get_type_name(), "starting...", UVM_HIGH)
103
 
104
                while (num_packets > 0) begin
105
                        `uvm_create_on(requests, p_sequencer.axi4_req_seqr)
106
                        if(req_class == POSTED)
107
                                `uvm_info(get_type_name(),$psprintf("sending posted requests"), UVM_MEDIUM)
108
                        else if (req_class == NON_POSTED)
109
                                `uvm_info(get_type_name(),$psprintf("sending non_posted requests"), UVM_MEDIUM)
110
                        else if (req_class == ATOMIC)
111
                                `uvm_info(get_type_name(),$psprintf("sending atomic requests"), UVM_MEDIUM)
112
                        else if (req_class == ALL)
113
                                `uvm_info(get_type_name(),$psprintf("sending all requests"), UVM_MEDIUM)
114
                        requests.num_packets = pkts_per_req;
115
                        void'(requests.randomize() with {
116
                                foreach(requests.hmc_items[i]) {
117
                                        requests.hmc_items[i].flit_delay inside {[min_flit_delay:max_flit_delay]};
118
                                        soft requests.hmc_items[i].packet_length inside {[min_packet_length:max_packet_length]};
119
                                        if(req_class == POSTED) {
120
                                                requests.hmc_items[i].command inside {
121
                                                        HMC_POSTED_WRITE_16,
122
                                                        HMC_POSTED_WRITE_32,
123
                                                        HMC_POSTED_WRITE_48,
124
                                                        HMC_POSTED_WRITE_64,
125
                                                        HMC_POSTED_WRITE_80,
126
                                                        HMC_POSTED_WRITE_96,
127
                                                        HMC_POSTED_WRITE_112,
128
                                                        HMC_POSTED_WRITE_128,
129
                                                        HMC_POSTED_BIT_WRIT
130
                                                };
131
                                        }
132
                                        if(req_class == NON_POSTED) {
133
                                                requests.hmc_items[i].command inside {
134
                                                        HMC_WRITE_16,
135
                                                        HMC_WRITE_32,
136
                                                        HMC_WRITE_48,
137
                                                        HMC_WRITE_64,
138
                                                        HMC_WRITE_80,
139
                                                        HMC_WRITE_96,
140
                                                        HMC_WRITE_112,
141
                                                        HMC_WRITE_128,
142
 
143
                                                        HMC_MODE_READ,
144
                                                        HMC_READ_16,
145
                                                        HMC_READ_32,
146
                                                        HMC_READ_48,
147
                                                        HMC_READ_64,
148
                                                        HMC_READ_80,
149
                                                        HMC_READ_96,
150
                                                        HMC_READ_112,
151
                                                        HMC_READ_128};
152
                                        }
153
                                        if(req_class == ATOMIC) {
154
                                                requests.hmc_items[i].command inside {
155
                                                        //HMC_MODE_WRITE,
156
                                                        HMC_BIT_WRITE,
157
                                                        HMC_DUAL_8B_ADDI,
158
                                                        HMC_SINGLE_16B_ADDI,
159
                                                        HMC_POSTED_BIT_WRIT,
160
 
161
                                                        HMC_POSTED_BIT_WRIT,
162
                                                        HMC_POSTED_DUAL_8B_ADDI,
163
                                                        HMC_POSTED_SINGLE_16B_ADDI
164
 
165
                        //                              HMC_MODE_READ
166
                                                };
167
                                        }
168
                //                      if(req_class == MISC) {
169
                //                              requests.hmc_items[i].command inside {
170
                //              //                      //HMC_MODE_WRITE
171
                //                                      HMC_MODE_READ};
172
                //                      }
173
 
174
 
175
 
176
                                }
177
                        });
178
                        num_packets -= pkts_per_req;
179
                        `uvm_info(get_type_name(),$psprintf("Packets sent!"), UVM_MEDIUM)
180
 
181
                        `uvm_send(requests)
182
                end
183
 
184
        endtask : body
185
 
186
endclass : hmc_base_pkt_seq
187
 
188
 
189
`endif

powered by: WebSVN 2.1.0

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