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

Subversion Repositories openhmc

[/] [openhmc/] [trunk/] [openHMC/] [sim/] [UVC/] [hmc/] [sv/] [hmc_tag_mon.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
//
40
//
41
// hmc link tag checker
42
//
43
//
44
 
45
`ifndef hmc_tag_mon_SV
46
`define hmc_tag_mon_SV
47
 
48
class hmc_tag_mon  extends uvm_component;
49
 
50
 
51
        int tags_in_use[int];
52
        int current_tag;
53
        int transaction_count;
54
        int max_tags_in_use;
55
 
56
        int max_tags_available = 512;
57
 
58
 
59
        covergroup tags_cg;
60
                option.per_instance = 1;
61
                TAGS_IN_USE : coverpoint tags_in_use.size(){
62
                        bins low_usage[]        = {[1:20]};
63
                        bins medium_usage[]     = {[21:250]};
64
                        bins high_usage[]       = {[251:511]};
65
                        bins no_tags_available = {512};
66
                }
67
 
68
                USED_TAGS       : coverpoint current_tag{
69
                        bins TAGS[] = {[1:511]};
70
                }
71
        endgroup
72
 
73
        `uvm_component_utils_begin(hmc_tag_mon)
74
                `uvm_field_int(max_tags_available, UVM_DEFAULT)
75
        `uvm_component_utils_end
76
 
77
 
78
        function new ( string name="hmc_tag_mon", uvm_component parent );
79
                super.new(name, parent);
80
                tags_in_use.delete();
81
                max_tags_in_use = 0;
82
                transaction_count = 0;
83
                tags_cg = new();
84
        endfunction : new
85
 
86
        function void reset();
87
                tags_in_use.delete();
88
        endfunction : reset
89
 
90
        function void use_tag(input bit [8:0] tag);
91
                int tmp[];
92
 
93
                if (tag > max_tags_available-1)
94
                        `uvm_fatal(get_type_name(), $psprintf("use_tag: tag (%0d) out of range!", tag))
95
 
96
                 if(!tags_in_use.exists(tag) ) begin
97
                        tags_in_use[tag] = tag;
98
                        current_tag = tag;
99
                        tags_cg.sample();
100
                end
101
 
102
        endfunction : use_tag
103
 
104
        function void release_tag(input bit [8:0] tag);
105
                if (tags_in_use.exists(tag))
106
                        tags_in_use.delete(tag);
107
                else
108
                        `uvm_fatal(get_type_name(), $psprintf("release_tag: tag (%0d) not in use!", tag))
109
 
110
                transaction_count++;
111
        endfunction : release_tag
112
 
113
        function bit idle_check();
114
                idle_check = 1;
115
                if (tags_in_use.size() > 0) begin
116
                        foreach (tags_in_use[i])
117
                                `uvm_info(get_type_name(), $psprintf("%0d tags still in use, Tag %0d is in use!", tags_in_use.size(), i),UVM_LOW)
118
                        idle_check = 0;
119
                end
120
        endfunction : idle_check
121
 
122
        function void check_phase(uvm_phase phase);
123
                if (!idle_check())
124
                        `uvm_fatal(get_type_name(),$psprintf("Tags are still in use"))
125
        endfunction : check_phase
126
 
127
        function void report_phase(uvm_phase phase);
128
                `uvm_info(get_type_name(),$psprintf("max_tags_in_use %0d, transaction_count %0d", max_tags_in_use, transaction_count), UVM_LOW)
129
        endfunction : report_phase
130
 
131
endclass : hmc_tag_mon
132
 
133
`endif // hmc_tag_mon_SV

powered by: WebSVN 2.1.0

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