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

Subversion Repositories openhmc

[/] [openhmc/] [trunk/] [openHMC/] [sim/] [UVC/] [cag_rgm/] [sv/] [cag_rgm_repeat_block.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_repeat_block extends cag_rgm_container;//cag_rgm_base;
41
 
42
        protected int unsigned loop;
43
        protected bit [63:0] iter_size;
44
        protected cag_rgm_container containers[$];
45
 
46
        `uvm_object_utils(cag_rgm_repeat_block)
47
 
48
        function new(string name = "cag_rgm_repeat_block");
49
                super.new(name);
50
                this.name = name;
51
                this.m_type = REPEAT_BLOCK;
52
        endfunction : new
53
 
54
        function void add_container(cag_rgm_container container);
55
                container.set_address(address + (loop*iter_size));
56
                container.set_loop(loop);
57
                this.containers.push_back(container);
58
                loop++;
59
        endfunction : add_container
60
 
61
        function void set_iter_size(bit [63:0] iter_size);
62
                this.iter_size = iter_size;
63
        endfunction : set_iter_size
64
 
65
        virtual function string do_print_rf(string s = "");
66
                return {s,$psprintf(", loops: %0d, iter_size: %0h",loop,iter_size)};
67
        endfunction : do_print_rf
68
 
69
        virtual function void print_rf(string prefix="");
70
                super.print_rf(prefix);
71
 
72
                foreach(containers[i])
73
                        containers[i].print_rf({prefix,"   "});
74
        endfunction : print_rf
75
 
76
        virtual function cag_rgm_base get_by_name(string full_name = "");
77
                bit check_registers = 1;
78
 
79
                string name;
80
 
81
                for( int i = 0; i < full_name.len(); i++) begin
82
                        if(full_name.getc(i) == ".") begin
83
                                name = full_name.substr(0, i-1);
84
                                full_name = full_name.substr(i + 1, full_name.len()-1);
85
                                check_registers = 0;
86
                                break;
87
                        end
88
                end
89
 
90
                if(check_registers) begin
91
                        foreach(containers[i]) begin
92
                                if(containers[i].get_name() == full_name) begin
93
                                        return containers[i];
94
                                end
95
                        end
96
                end else begin
97
                        foreach(containers[i]) begin
98
                                if(containers[i].get_name() == name) begin
99
                                        return containers[i].get_by_name(full_name);
100
                                end
101
                        end
102
                end
103
 
104
                return null;
105
 
106
        endfunction : get_by_name
107
 
108
        virtual function cag_rgm_base get_by_address(bit [63:0] address);
109
                foreach(containers[i]) begin
110
                        get_by_address = containers[i].get_by_address(address);
111
                        if( get_by_address != null)
112
                                return get_by_address;
113
                end
114
                return null;
115
        endfunction : get_by_address
116
 
117
endclass : cag_rgm_repeat_block

powered by: WebSVN 2.1.0

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