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_register_file extends cag_rgm_container;
|
41 |
|
|
|
42 |
|
|
protected cag_rgm_register_file m_register_files[$];
|
43 |
|
|
protected cag_rgm_repeat_block m_repeat_blocks[$];
|
44 |
|
|
|
45 |
|
|
`uvm_object_utils(cag_rgm_register_file)
|
46 |
|
|
|
47 |
|
|
function new(string name="cag_rgm_register_file");
|
48 |
|
|
super.new(name);
|
49 |
|
|
this.name = name;
|
50 |
|
|
this.m_type = REGISTER_FILE;
|
51 |
|
|
endfunction : new
|
52 |
|
|
|
53 |
|
|
function void add_register_file(cag_rgm_register_file register_file);
|
54 |
|
|
m_register_files.push_back(register_file);
|
55 |
|
|
endfunction : add_register_file
|
56 |
|
|
|
57 |
|
|
function void add_repeat_block(cag_rgm_repeat_block repeat_block);
|
58 |
|
|
m_repeat_blocks.push_back(repeat_block);
|
59 |
|
|
endfunction : add_repeat_block
|
60 |
|
|
|
61 |
|
|
function cag_rgm_base get_by_name(string full_name = "");
|
62 |
|
|
bit check_registers = 1;
|
63 |
|
|
cag_rgm_base base;
|
64 |
|
|
cag_rgm_register_file m_reg_file;
|
65 |
|
|
cag_rgm_repeat_block m_repeat;
|
66 |
|
|
string name;
|
67 |
|
|
|
68 |
|
|
for( int i = 0; i < full_name.len(); i++) begin
|
69 |
|
|
if(full_name.getc(i) == ".") begin
|
70 |
|
|
name = full_name.substr(0, i-1);
|
71 |
|
|
full_name = full_name.substr(i + 1, full_name.len()-1);
|
72 |
|
|
check_registers = 0;
|
73 |
|
|
break;
|
74 |
|
|
end
|
75 |
|
|
end
|
76 |
|
|
|
77 |
|
|
if(check_registers) begin
|
78 |
|
|
base = super.get_by_name(full_name);
|
79 |
|
|
if(base != null)
|
80 |
|
|
return base;
|
81 |
|
|
|
82 |
|
|
foreach(m_repeat_blocks[i]) begin
|
83 |
|
|
if(m_repeat_blocks[i].get_name() == full_name) begin
|
84 |
|
|
return m_repeat_blocks[i];
|
85 |
|
|
end
|
86 |
|
|
end
|
87 |
|
|
end else begin
|
88 |
|
|
foreach(m_register_files[i]) begin
|
89 |
|
|
if(m_register_files[i].get_name() == name) begin
|
90 |
|
|
$cast(m_reg_file,m_register_files[i]);
|
91 |
|
|
return m_reg_file.get_by_name(full_name);
|
92 |
|
|
end
|
93 |
|
|
end
|
94 |
|
|
foreach(m_repeat_blocks[i]) begin
|
95 |
|
|
if(m_repeat_blocks[i].get_name() == name) begin
|
96 |
|
|
$cast(m_repeat,m_repeat_blocks[i]);
|
97 |
|
|
return m_repeat_blocks[i].get_by_name(full_name);
|
98 |
|
|
end
|
99 |
|
|
end
|
100 |
|
|
end
|
101 |
|
|
|
102 |
|
|
return null;
|
103 |
|
|
|
104 |
|
|
endfunction : get_by_name
|
105 |
|
|
|
106 |
|
|
virtual function cag_rgm_base get_by_address(bit [63:0] address);
|
107 |
|
|
// check registers and ram blocks
|
108 |
|
|
get_by_address = super.get_by_address(address);
|
109 |
|
|
if(get_by_address != null)
|
110 |
|
|
return get_by_address;
|
111 |
|
|
|
112 |
|
|
// check sub registerfiles
|
113 |
|
|
foreach(m_register_files[i]) begin
|
114 |
|
|
get_by_address = m_register_files[i].get_by_address(address);
|
115 |
|
|
if(get_by_address != null)
|
116 |
|
|
return get_by_address;
|
117 |
|
|
end
|
118 |
|
|
|
119 |
|
|
// check repeat blocks
|
120 |
|
|
foreach(m_repeat_blocks[i]) begin
|
121 |
|
|
get_by_address = m_repeat_blocks[i].get_by_address(address);
|
122 |
|
|
if(get_by_address != null)
|
123 |
|
|
return get_by_address;
|
124 |
|
|
end
|
125 |
|
|
|
126 |
|
|
return null;
|
127 |
|
|
endfunction : get_by_address
|
128 |
|
|
|
129 |
|
|
virtual function void print_rf(string prefix = "");
|
130 |
|
|
super.print_rf(prefix);
|
131 |
|
|
|
132 |
|
|
foreach(m_register_files[i])
|
133 |
|
|
m_register_files[i].print_rf({prefix," "});
|
134 |
|
|
|
135 |
|
|
foreach(m_repeat_blocks[i])
|
136 |
|
|
m_repeat_blocks[i].print_rf({prefix," "});
|
137 |
|
|
endfunction : print_rf
|
138 |
|
|
|
139 |
|
|
endclass : cag_rgm_register_file
|
140 |
|
|
|
141 |
|
|
/******************************************************************************
|
142 |
|
|
*
|
143 |
|
|
* REVISION HISTORY:
|
144 |
|
|
*
|
145 |
|
|
*******************************************************************************/
|