PandA-2024.02
technology_node.hpp
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) 2004-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 #ifndef TECHNOLOGY_NODE_HPP
41 #define TECHNOLOGY_NODE_HPP
42 
43 #include "config_HAVE_CIRCUIT_BUILT.hpp"
44 #include "config_HAVE_EXPERIMENTAL.hpp"
45 
46 #include "refcount.hpp"
47 #include "simple_indent.hpp"
48 #include "utility.hpp"
49 #include <map>
50 #include <ostream>
51 #include <string>
52 #include <vector>
53 
60 #if HAVE_CIRCUIT_BUILT
63 #endif
64 class xml_element;
75 REF_FORWARD_DECL(layout_model);
79 REF_FORWARD_DECL(power_model);
81 
83 #define LUT_GATE_STD "LUT"
84 #define IBUF_GATE_STD "IBUF"
85 #define OBUF_GATE_STD "OBUF"
86 
87 // Logic Ports
88 #define AND_GATE_STD "AND_GATE"
89 #define NAND_GATE_STD "NAND_GATE"
90 #define OR_GATE_STD "OR_GATE"
91 #define NOR_GATE_STD "NOR_GATE"
92 #define XOR_GATE_STD "XOR_GATE"
93 #define XNOR_GATE_STD "XNOR_GATE"
94 #define NOT_GATE_STD "NOT_GATE"
95 #define DFF_GATE_STD "DFF_GATE"
96 #define BUFF_GATE_STD "BUFF_GATE"
97 
98 #define TEST_MUL_MUX_8 "TEST_MUL_MUX_8"
99 #define MUX_GATE_STD "MUX_GATE"
100 #define DEMUX_GATE_STD "DEMUX_GATE"
101 #define MUX_N_TO_1 "MUX_N_to_1"
102 #define MULTIPLIER_STD "mult_expr_FU"
103 #define UI_MULTIPLIER_STD "ui_mult_expr_FU"
104 #define UI_CONST_MULTIPLIER_STD "ui_const_mult_expr_FU"
105 #define ADDER_STD "plus_expr_FU"
106 #define COND_EXPR_STD "cond_expr_FU"
107 #define UI_ADDER_STD "ui_plus_expr_FU"
108 #define UI_ALIGN_ADDER_STD "ui_align_plus_expr_FU"
109 #define CONCAT4_STD "concat_4_constructor"
110 #define SIGNED_BITFIELD_FU_STD "Sbitfield_FU"
111 #define UNSIGNED_BITFIELD_FU_STD "Ubitfield_FU"
112 #define CONSTANT_STD "constant_value"
113 #define ASSIGN_SIGNED_STD "ASSIGN_SIGNED_FU"
114 #define ASSIGN_UNSIGNED_STD "ASSIGN_UNSIGNED_FU"
115 #define ASSIGN_REAL_STD "ASSIGN_REAL_FU"
116 #define ASSIGN_VECTOR_BOOL_STD "ASSIGN_VECTOR_BOOL_FU"
117 #define ASSIGN_VEC_SIGNED_STD "ASSIGN_VEC_SIGNED_FU"
118 #define ASSIGN_VEC_UNSIGNED_STD "ASSIGN_VEC_UNSIGNED_FU"
119 #define ADDR_EXPR_STD "addr_expr_FU"
120 #define ASSERT_EXPR_SIGNED_STD "assert_expr_FU"
121 #define ASSERT_EXPR_UNSIGNED_STD "ui_assert_expr_FU"
122 #define ASSERT_EXPR_REAL_STD "fp_assert_expr_FU"
123 #define BMEMORY_STD "BMEMORY_CTRL"
124 #define BMEMORY_STDN "BMEMORY_CTRLN"
125 #define MEMCPY_STD "__internal_bambu_memcpy"
126 #define ARRAY_1D_STD_BRAM "ARRAY_1D_STD_BRAM"
127 #define ARRAY_1D_STD_BRAM_SDS "ARRAY_1D_STD_BRAM_SDS"
128 #define ARRAY_1D_STD_BRAM_SDS_BUS "ARRAY_1D_STD_BRAM_SDS_BUS"
129 #define ARRAY_1D_STD_DISTRAM_SDS "ARRAY_1D_STD_DISTRAM_SDS"
130 #define ARRAY_1D_STD_BRAM_N1 "ARRAY_1D_STD_BRAM_N1"
131 #define ARRAY_1D_STD_BRAM_N1_SDS "ARRAY_1D_STD_BRAM_N1_SDS"
132 #define ARRAY_1D_STD_DISTRAM_N1_SDS "ARRAY_1D_STD_DISTRAM_N1_SDS"
133 #define ARRAY_1D_STD_BRAM_N1_SDS_BUS "ARRAY_1D_STD_BRAM_N1_SDS_BUS"
134 #define ARRAY_1D_STD_BRAM_NN "ARRAY_1D_STD_BRAM_NN"
135 #define ARRAY_1D_STD_BRAM_NN_SDS "ARRAY_1D_STD_BRAM_NN_SDS"
136 #define ARRAY_1D_STD_BRAM_NN_SDS_BUS "ARRAY_1D_STD_BRAM_NN_SDS_BUS"
137 #define ARRAY_1D_STD_DISTRAM_NN_SDS "ARRAY_1D_STD_DISTRAM_NN_SDS"
138 #define STD_BRAM "STD_BRAM"
139 #define STD_BRAMN "STD_BRAMN"
140 #define MEMLOAD_STD "__builtin_memload"
141 #define MEMSTORE_STD "__builtin_memstore"
142 #define MEMLOAD_STDN "__builtin_memload_N"
143 #define MEMSTORE_STDN "__builtin_memstore_N"
144 #define BUILTIN_EXIT_STD "__builtin_exit"
145 #define BUILTIN_ABORT_STD "__builtin_abort"
146 #define BUILTIN_WAIT_CALL_STD "__builtin_wait_call"
147 #define PROXY_CTRL "PROXY_CTRL"
148 #define PROXY_CTRLN "PROXY_CTRLN"
149 #define DPROXY_CTRL "DPROXY_CTRL"
150 #define DPROXY_CTRLN "DPROXY_CTRLN"
151 #define SPROXY_CTRL "SPROXY_CTRL"
152 #define SPROXY_CTRLN "SPROXY_CTRLN"
153 
154 #define MEMORY_TYPE_ASYNCHRONOUS "ASYNCHRONOUS"
155 #define MEMORY_TYPE_SYNCHRONOUS_UNALIGNED "SYNCHRONOUS_UNALIGNED"
156 #define MEMORY_TYPE_SYNCHRONOUS_SDS "SYNCHRONOUS_SDS"
157 #define MEMORY_TYPE_SYNCHRONOUS_SDS_BUS "SYNCHRONOUS_SDS_BUS"
158 
159 #define CHANNELS_TYPE_MEM_ACC_11 "MEM_ACC_11"
160 #define CHANNELS_TYPE_MEM_ACC_N1 "MEM_ACC_N1"
161 #define CHANNELS_TYPE_MEM_ACC_NN "MEM_ACC_NN"
162 #define CHANNELS_TYPE_MEM_ACC_P1N "MEM_ACC_P1N"
163 #define CHANNELS_TYPE_MEM_ACC_CS "MEM_ACC_CS"
164 
165 #define MEMORY_CTRL_TYPE_D00 "D00"
166 #define MEMORY_CTRL_TYPE_PROXY "PROXY"
167 #define MEMORY_CTRL_TYPE_DPROXY "DPROXY"
168 #define MEMORY_CTRL_TYPE_SPROXY "SPROXY"
169 #define MEMORY_CTRL_TYPE_PROXYN "PROXYN"
170 #define MEMORY_CTRL_TYPE_DPROXYN "DPROXYN"
171 #define MEMORY_CTRL_TYPE_SPROXYN "SPROXYN"
172 
173 #define UUDATA_CONVERTER_STD "UUdata_converter_FU"
174 #define IUDATA_CONVERTER_STD "IUdata_converter_FU"
175 #define UIDATA_CONVERTER_STD "UIdata_converter_FU"
176 #define IIDATA_CONVERTER_STD "IIdata_converter_FU"
177 #define BIVECTOR_CONVERTER_STD "BIvector_converter_FU"
178 #define BUVECTOR_CONVERTER_STD "BUvector_converter_FU"
179 #define UBVECTOR_CONVERTER_STD "UBvector_converter_FU"
180 #define IIVECTOR_CONVERTER_STD "IIvector_converter_FU"
181 #define UUVECTOR_CONVERTER_STD "UUvector_converter_FU"
182 #define UIVECTOR_CONVERTER_STD "UIvector_converter_FU"
183 #define IUVECTOR_CONVERTER_STD "IUvector_converter_FU"
184 
185 #define FFDATA_CONVERTER_STD "FFdata_converter_FU"
186 #define SF_FFDATA_CONVERTER_32_64_STD "sf_FFdata_converter_FU_32_64"
187 #define SF_FFDATA_CONVERTER_64_32_STD "sf_FFdata_converter_FU_64_32"
188 
189 #define UUCONVERTER_EXPR_STD "UUconvert_expr_FU"
190 #define IUCONVERTER_EXPR_STD "IUconvert_expr_FU"
191 #define UICONVERTER_EXPR_STD "UIconvert_expr_FU"
192 #define IICONVERTER_EXPR_STD "IIconvert_expr_FU"
193 #define VIEW_CONVERT_STD_INT "view_convert_expr_FU"
194 #define VIEW_CONVERT_STD_UINT "ui_view_convert_expr_FU"
195 #define VIEW_CONVERT_STD_REAL "fp_view_convert_expr_FU"
196 
197 #define EXTRACT_BIT_EXPR_SIGNED_STD "extract_bit_expr_FU"
198 #define EXTRACT_BIT_EXPR_UNSIGNED_STD "ui_extract_bit_expr_FU"
199 #define LUT_EXPR_STD "lut_expr_FU"
200 
201 // For distributed controller
202 #define CE_STD "CE_FU"
203 #define CE_FSM "CE_FSM"
204 #define CE_BYPASS "CE_BYPASS"
205 #define JOIN_STD "JOIN_FU"
206 #define SIMPLEJOIN_STD "SIMPLEJOIN_FU"
207 #define PT_STD "PT_FU"
208 #define START_STD "START_FU"
209 #define COND_STD "COND_FU"
210 #define SWITCH_CASE_STD "SWITCH_CASE_FU"
211 #define MC_STD "MC_FU"
212 #define FC_STD "FC_FU"
213 
215 #define register_SHIFT "register_SHIFT"
216 
218 #define register_STD "register_STD"
219 
221 #define register_SR "register_SR"
222 
224 #define flipflop_SR "flipflop_SR"
225 
227 #define register_AR "register_AR"
228 
230 #define flipflop_AR "flipflop_AR"
231 
233 #define register_AR_NORETIME "register_AR_NORETIME"
234 #define register_AR_NORETIME_INT "register_AR_NORETIME_INT"
235 #define register_AR_NORETIME_UINT "register_AR_NORETIME_UINT"
236 #define register_AR_NORETIME_REAL "register_AR_NORETIME_REAL"
237 #define register_SE "register_SE"
239 #define register_SRSE "register_SRSE"
241 #define register_ARSE "register_ARSE"
243 #define register_SARSE "register_SARSE"
245 #define MEMORY_MAPPED_REGISTER_FU "memory_mapped_register_FU"
247 #define RETURN_MM_REGISTER_FU "return_value_mm_register_FU"
248 #define NOTYFY_CALLER_MINIMAL_FU "notify_caller_minimal_FU"
249 #define STATUS_REGISTER_FU "status_register_FU"
250 #define STATUS_REGISTER_NO_NOTIFIED_FU "status_register_no_notified_FU"
251 #define MEMORY_MAPPED_REGISTERN_FU "memory_mapped_registerN_FU"
252 #define RETURN_MM_REGISTERN_FU "return_value_mm_registerN_FU"
253 #define NOTYFY_CALLER_MINIMALN_FU "notify_caller_minimalN_FU"
254 #define STATUS_REGISTERN_FU "status_registerN_FU"
255 #define STATUS_REGISTER_NO_NOTIFIEDN_FU "status_register_no_notifiedN_FU"
256 
260 #define GET_TEC_KIND_TEXT(meth) \
261  std::string get_kind_text() const override \
262  { \
263  return std::string(#meth); \
264  }
265 
271 {
275 };
276 
280 #define GET_TEC_KIND(meth) \
281  enum tec_kind get_kind() const override \
282  { \
283  return (meth##_K); \
284  }
285 
291 {
295  technology_node();
296 
300  virtual ~technology_node();
301 
305  virtual const std::string& get_name() const = 0;
306 
313  virtual void xload(const xml_element* Enode, const technology_nodeRef owner, const ParameterConstRef Param) = 0;
314 
319  virtual void xwrite(xml_element* rootnode, const technology_nodeRef tn, const ParameterConstRef Param) = 0;
320 
325  virtual void print(std::ostream& os) const = 0;
326 
332  virtual std::string get_kind_text() const = 0;
333 
339  virtual enum tec_kind get_kind() const = 0;
340 
344  friend std::ostream& operator<<(std::ostream& os, const technology_nodeRef& s)
345  {
346  if(s)
347  {
348  s->print(os);
349  }
350  return os;
351  }
352 
353  protected:
356 };
360 
364 struct operation : public technology_node
365 {
367  std::string operation_name;
368 
371 
372 #if HAVE_EXPERIMENTAL
373  power_modelRef power_m;
375 #endif
376 
379 
381  bool bounded;
382 
385 
387  std::map<std::string, std::vector<unsigned int>> supported_types;
388 
391  std::string pipe_parameters;
392 
394  std::string portsize_parameters;
395 
399  operation();
400 
404  ~operation() override;
405 
409  const std::string& get_name() const override
410  {
411  return operation_name;
412  }
413 
419  bool is_type_supported(const std::string& type_name) const;
420 
427  bool is_type_supported(const std::string& type_name, unsigned long long type_prec) const;
428 
435  bool is_type_supported(const std::string& type_name, const std::vector<unsigned long long>& type_prec,
436  const std::vector<unsigned long long>& type_n_element) const;
437 
441  std::string get_type_supported_string() const;
442 
449  void xload(const xml_element* Enode, const technology_nodeRef fu, const ParameterConstRef Param) override;
450 
455  void xwrite(xml_element* rootnode, const technology_nodeRef tn, const ParameterConstRef Param) override;
456 
457  bool is_bounded() const
458  {
459  return bounded;
460  }
461 
463  {
464  return primary_inputs_registered;
465  }
466 
471  void print(std::ostream& os) const override;
472 
477 
478 
482 };
483 
488 {
489  using type_t = enum { UNKNOWN = 0, COMBINATIONAL, STATETABLE, FF, LATCH, PHYSICAL };
490 
492  using operation_vec = std::vector<technology_nodeRef>;
493 
496 
498  std::string functional_unit_name;
499 
501  std::vector<std::string> ordered_attributes;
502 
504  std::map<std::string, attributeRef> attributes;
505 
507  double clock_period;
508 
511 
514 
515 #if HAVE_CIRCUIT_BUILT
518 #endif
519 
521  xml_nodeRef XML_description;
522 
524  std::string fu_template_name;
525 
528 
531 
534  std::string memory_type;
535 
537  std::string channels_type;
538 
541  std::string memory_ctrl_type;
542 
545  std::string bram_load_latency;
546 
550 
553 
557  functional_unit();
558 
562  explicit functional_unit(const xml_nodeRef XML_description);
563 
567  ~functional_unit() override;
568 
573  void add(const technology_nodeRef& curr)
574  {
575  if(op_name_to_op.count(curr->get_name()))
576  {
577  auto del = std::find(list_of_operation.begin(), list_of_operation.end(), op_name_to_op[curr->get_name()]);
578  if(del != list_of_operation.end())
579  {
580  list_of_operation.erase(del);
581  }
582  }
583  list_of_operation.push_back(curr);
584  op_name_to_op[curr->get_name()] = curr;
585  }
586 
591  void set_clock_period(double _clock_period);
592 
597  double get_clock_period() const
598  {
599  return clock_period;
600  }
601 
605  void set_clock_period_resource_fraction(double _clock_period_resource_fraction);
606 
611  {
612  return clock_period_resource_fraction;
613  }
614 
620  {
621  return list_of_operation;
622  }
623 
628  size_t get_operations_num() const
629  {
630  return list_of_operation.size();
631  }
632 
637  technology_nodeRef get_operation(const std::string& op_name) const;
638 
642  const std::string& get_name() const override
643  {
644  return functional_unit_name;
645  }
646 
652  void xload(const xml_element* node, const technology_nodeRef fu, const ParameterConstRef Param) override;
653 
658  void xwrite(xml_element* rootnode, const technology_nodeRef tn, const ParameterConstRef Param) override;
659 
664  void print(std::ostream& os) const override;
665 
670 
671 
675 
676  private:
678  std::map<std::string, technology_nodeRef> op_name_to_op;
679 
682 
683  friend class technology_manager;
684 };
685 
690 {
693 
695  std::string specialized;
696 
699 
702  std::string memory_type;
703 
705  std::string channels_type;
706 
709  std::string memory_ctrl_type;
710 
713  std::string bram_load_latency;
714 
717 
719 
721 
722  explicit functional_unit_template(const xml_nodeRef XML_description);
724 
728  const std::string& get_name() const override
729  {
730  return FU->get_name();
731  }
732 
738  void xload(const xml_element* Enode, const technology_nodeRef tnd, const ParameterConstRef Param) override;
739 
744  void xwrite(xml_element* rootnode, const technology_nodeRef tn, const ParameterConstRef Param) override;
745 
750  void print(std::ostream& os) const override;
751 
756 
757 
761 };
762 
763 #endif
virtual std::string get_kind_text() const =0
Virtual function used to get the string name of a technology_node instance.
std::map< std::string, std::vector< unsigned int > > supported_types
supported types and precision of the operation, in form (name, list_of_prec).
void add(const technology_nodeRef &curr)
Add the given operation to the current functional_unit.
std::string bram_load_latency
Specify the bram load latency the functional unit is compliant with.
#define GET_TEC_KIND(meth)
Macro used to implement get_kind() function in structural_object hierarchy classes.
Simple pretty print functor.
std::string pipe_parameters
comma separated string with the parameter for the different implementation of the pipeline...
std::string operation_name
name of the operation mappen on a given functional unit.
std::string fu_template_parameters
Template parameters.
std::vector< std::string > ordered_attributes
list of attributes associated to the components
std::string fu_template_name
Name of the template.
operation_vec list_of_operation
At each functional unit can be associate several operations with different performances.
bool is_bounded() const
std::string functional_unit_name
name of the functional unit.
std::map< std::string, technology_nodeRef > op_name_to_op
Redefinition of get_kind_text()
This class manages the circuit structures.
virtual void print(std::ostream &os) const =0
Virtual function that prints the class.
double clock_period_resource_fraction
clock period resource fraction
std::string bram_load_latency
Specify the bram load latency the functional unit is compliant with.
bool primary_inputs_registered
true when the primary input of the functional unit are registered
time_infoRef time_m
class representing the timing information associated with this operation
std::string channels_type
Specify the type of the channel the functional unit is compliant with.
const std::string & get_name() const override
Return the name of the operation.
std::string characterizing_constant_value
Value used during the characterization of this instance.
bool no_constant_characterization
The template will not consider constants connected to the inputs during the module characterization...
This class specifies the characteristic of a particular functional unit.
std::string portsize_parameters
comma separed string with the parameter for different portsize values.
TimeStamp characterization_timestamp
The timestamp of the characterization of this functional unit.
std::map< std::string, attributeRef > attributes
map between the attribute keys and the corresponding values
std::string memory_type
Specify the type of memory the functional unit is compliant with.
std::string channels_type
Specify the type of the channel the functional unit is compliant with.
xml_nodeRef XML_description
pointer to the XML description of the cell
technology_node()
Constructor.
This class specifies the characteristic of a particular operation working on a given functional unit...
area_infoRef area_m
This variable stores the resource information of the component.
This class manages the technology library structures.
bool is_primary_inputs_registered() const
std::string specialized
when non empty it defines with respect what the functional unit template has been specialized ...
virtual enum tec_kind get_kind() const =0
Virtual function used to find the real type of a technology_nodeinstance.
const operation_vec & get_operations() const
Return the operations that the functional unit can handle.
double get_clock_period() const
Returns the clock period adopted for the synthesis (0 means that it has been generated with unconstra...
bool bounded
flag to determine if the operation is bounded or not
const std::string & get_name() const override
Returns the name of the operation.
size_t get_operations_num() const
Return the number of the operations that the functional unit can handle.
double get_clock_period_resource_fraction() const
Returns the clock period resource fraction adopted for the synthesis.
std::string characterizing_constant_value
Value used during the characterization of templates.
This file collects some utility functions and macros.
std::string memory_ctrl_type
Specify the type of memory controller the functional unit is compliant with.
static simple_indent PP
pretty print functor object used by all print members to indent the output of the print function...
Template definition of refcount.
bool commutative
property of commutativity
virtual ~technology_node()
Destructor.
virtual void xwrite(xml_element *rootnode, const technology_nodeRef tn, const ParameterConstRef Param)=0
Add a technology_node to an xml tree.
Very simple pretty printer functor.
This class describe a functional unit template.
REF_FORWARD_DECL(technology_node)
RefCount type definition of the technology_node class structure.
friend std::ostream & operator<<(std::ostream &os, const technology_nodeRef &s)
Friend definition of the << operator.
#define GET_TEC_KIND_TEXT(meth)
Macro which defines the get_kind_text function that returns the parameter as a string.
CONSTREF_FORWARD_DECL(Parameter)
std::string memory_ctrl_type
Specify the type of memory controller the functional unit is compliant with.
const std::string & get_name() const override
Return the name of the operation.
virtual const std::string & get_name() const =0
Return the name of the technology node.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
Definition: refcount.hpp:94
std::string memory_type
Specify the type of memory the functional unit is compliant with.
The type used for timestamp.
Definition: utility.hpp:280
std::vector< technology_nodeRef > operation_vec
Type definition of a vector of functional_unit.
virtual void xload(const xml_element *Enode, const technology_nodeRef owner, const ParameterConstRef Param)=0
Load a technology_node starting from an xml file.
technology_nodeRef FU
Functional Unit.
std::string component_timing_alias
Specify that the functional unit has the same timing per operation it has the one specified by this f...
Abstract pure class for the technology structure.
tec_kind
Enumerative type for technology object classes, it is used with get_kind() function to know the actua...
type_t logical_type
return the logical type of the cell
double clock_period
clock period adopted for the synthesis (in ns)
enum { UNKNOWN=0, COMBINATIONAL, STATETABLE, FF, LATCH, PHYSICAL } type_t

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