PandA-2024.02
area_info.cpp
Go to the documentation of this file.
1 /*
2  *
3  * _/_/_/ _/_/ _/ _/ _/_/_/ _/_/
4  * _/ _/ _/ _/ _/_/ _/ _/ _/ _/ _/
5  * _/_/_/ _/_/_/_/ _/ _/_/ _/ _/ _/_/_/_/
6  * _/ _/ _/ _/ _/ _/ _/ _/ _/
7  * _/ _/ _/ _/ _/ _/_/_/ _/ _/
8  *
9  * ***********************************************
10  * PandA Project
11  * URL: http://panda.dei.polimi.it
12  * Politecnico di Milano - DEIB
13  * System Architectures Group
14  * ***********************************************
15  * Copyright (C) 2023-2024 Politecnico di Milano
16  *
17  * This file is part of the PandA framework.
18  *
19  * The PandA framework is free software; you can redistribute it and/or modify
20  * it under the terms of the GNU General Public License as published by
21  * the Free Software Foundation; either version 3 of the License, or
22  * (at your option) any later version.
23  *
24  * This program is distributed in the hope that it will be useful,
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of
26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27  * GNU General Public License for more details.
28  *
29  * You should have received a copy of the GNU General Public License
30  * along with this program. If not, see <http://www.gnu.org/licenses/>.
31  *
32  */
40 #include "area_info.hpp"
41 #include "exceptions.hpp"
42 #include "generic_device.hpp"
43 
44 const double area_info::area_DEFAULT = 1.0;
45 
46 area_info::area_info(const ParameterConstRef& _Param) : Param(_Param)
47 {
48 }
49 
50 area_info::~area_info() = default;
51 
53 {
54  return area_infoRef(new area_info(Param));
55 }
56 
58 {
59  return static_cast<double>(area);
60 }
61 
62 void area_info::set_area_value(const double& _area)
63 {
64  area = _area;
65 }
66 
68 {
69  used_resources[val] = num;
70 }
71 
73 {
74  return used_resources.find(val) != used_resources.end();
75 }
76 
78 {
79  if(!is_used_resource(val))
80  {
81  return 0;
82  }
83  return used_resources.find(val)->second;
84 }
85 
86 void area_info::print(std::ostream& os) const
87 {
88  if(used_resources.find(LUT_FF_PAIRS) != used_resources.end())
89  {
90  os << "LUT/FF pairs: " << used_resources.find(LUT_FF_PAIRS)->second << std::endl;
91  }
92 }
Collect information about resource area.
static const double area_DEFAULT
default area value
Definition: area_info.hpp:118
refcount< area_info > area_infoRef
refcount definition of the class
Definition: area_info.hpp:121
exceptions managed by PandA
void set_resource_value(value_t val, double num)
Definition: area_info.cpp:67
double get_resource_value(value_t val) const
Definition: area_info.cpp:77
double get_area_value() const
Return the nominal value for the area of the component.
Definition: area_info.cpp:57
bool is_used_resource(value_t val) const
Definition: area_info.cpp:72
area_info(const ParameterConstRef &_Param)
Constructor.
Definition: area_info.cpp:46
static area_infoRef factory(const ParameterConstRef &Param)
Factory method.
Definition: area_info.cpp:52
void print(std::ostream &os) const
Print method.
Definition: area_info.cpp:86
std::map< value_t, double > used_resources
resources required for the component
Definition: area_info.hpp:76
void set_area_value(const double &_area_)
Set the nominal value for the area of the component.
Definition: area_info.cpp:62
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
Definition: refcount.hpp:94
Generic device description.
enum { REGISTERS, SLICE, SLICE_LUTS, LUT_FF_PAIRS, ALMS, LOGIC_ELEMENTS, FUNCTIONAL_ELEMENTS, LOGIC_AREA, DSP, BRAM, DRAM, POWER, URAM } value_t
type of resources
Definition: area_info.hpp:69
const ParameterConstRef Param
class containing all the parameters
Definition: area_info.hpp:79
~area_info()
Destructor.
double area
a double value representing the area of the component
Definition: area_info.hpp:73

Generated on Mon Feb 12 2024 13:02:55 for PandA-2024.02 by doxygen 1.8.13