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

Subversion Repositories openhmc

[/] [openhmc/] [trunk/] [openHMC/] [sim/] [UVC/] [cag_rgm/] [sv/] [cag_rgm_container.sv] - Blame information for rev 12

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
class cag_rgm_container extends cag_rgm_base;
41
 
42
        protected cag_rgm_base m_registers[$];
43
        protected cag_rgm_base m_ramblocks[$];
44
 
45
        `uvm_object_utils(cag_rgm_container)
46
 
47
        function new(string name = "cag_rgm_container");
48
                super.new(name);
49
                this.name = name;
50
                this.m_type = CONTAINER;
51
        endfunction : new
52
 
53
        function void add_register(cag_rgm_register register, bit set_address = 0);
54
                if(set_address)
55
                        register.set_address(address);
56
                m_registers.push_back(register);
57
        endfunction : add_register
58
 
59
        function void add_ramblock(cag_rgm_base ramblock, bit set_address = 0);
60
                if(set_address)
61
                        ramblock.set_address(address);
62
                m_ramblocks.push_back(ramblock);
63
        endfunction : add_ramblock
64
 
65
        virtual function void set_address(bit [63:0] address);
66
                super.set_address(address);
67
 
68
                foreach(m_registers[i])
69
                        m_registers[i].set_address(address);
70
 
71
                foreach(m_ramblocks[i])
72
                        m_ramblocks[i].set_address(address);
73
 
74
        endfunction : set_address
75
 
76
        virtual function void set_loop(int loop);
77
                super.set_loop(loop);
78
 
79
                foreach(m_registers[i])
80
                        m_registers[i].set_loop(loop);
81
 
82
                foreach(m_ramblocks[i])
83
                        m_ramblocks[i].set_loop(loop);
84
 
85
        endfunction : set_loop
86
 
87
        virtual function cag_rgm_base get_by_name(string full_name = "");
88
 
89
                foreach(m_registers[i]) begin
90
                        if(m_registers[i].get_name() == full_name) begin
91
                                return m_registers[i];
92
                        end
93
                end
94
                foreach(m_ramblocks[i]) begin
95
                        if(m_ramblocks[i].get_name() == full_name) begin
96
                                return m_ramblocks[i];
97
                        end
98
                end
99
 
100
                return null;
101
        endfunction : get_by_name
102
 
103
        virtual function cag_rgm_base get_by_address(bit [63:0] address);
104
                foreach(m_registers[i]) begin
105
                        if(m_registers[i].address_match(address) != -1) begin
106
                                return m_registers[i];
107
                        end
108
                end
109
                foreach(m_ramblocks[i]) begin
110
                        if(m_ramblocks[i].address_match(address) != -1) begin
111
                                return m_ramblocks[i];
112
                        end
113
                end
114
 
115
                return null;
116
        endfunction : get_by_address
117
 
118
        virtual function void print_rf(string prefix = "");
119
                super.print_rf(prefix);
120
 
121
                foreach (m_registers[i]) begin
122
                        m_registers[i].print_rf({prefix,"   "});
123
                end
124
 
125
                foreach (m_ramblocks[i]) begin
126
                        m_ramblocks[i].print_rf({prefix,"   "});
127
                end
128
 
129
        endfunction : print_rf
130
 
131
endclass : cag_rgm_container
132
 
133
/******************************************************************************
134
*
135
* REVISION HISTORY:
136
*
137
*******************************************************************************/

powered by: WebSVN 2.1.0

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