PandA-2024.02
load_builtin_technology.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) 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  */
42 
43 #include "fileIO.hpp"
44 #include "structural_manager.hpp"
45 #include "structural_objects.hpp"
46 #include "technology_manager.hpp"
47 #include "technology_node.hpp"
48 
50  const DesignFlowManagerConstRef _design_flow_manager,
51  const ParameterConstRef _parameters)
52  : TechnologyFlowStep(_TM, _target, _design_flow_manager, TechnologyFlowStep_Type::LOAD_BUILTIN_TECHNOLOGY,
53  _parameters)
54 {
55 }
56 
58 
61 {
63 }
64 
66 {
67  std::string fu_name;
72  std::string NP_parameters;
73  std::string Library;
74 
75  Library = LIBRARY_STD;
76 
77  // AND
79  fu_name = AND_GATE_STD;
81  CM->set_top_info(fu_name, module_type);
82  top = CM->get_circ();
83  CM->add_port_vector("in", port_o::IN, port_o::PARAMETRIC_PORT, top, b_type);
84  CM->add_port("out1", port_o::OUT, top, b_type);
85  NP_parameters = fu_name + " in";
86  CM->add_NP_functionality(top, NP_functionality::LIBRARY, NP_parameters);
88  TM->add_resource(Library, fu_name, CM, true);
89 
90  // NAND
92  fu_name = NAND_GATE_STD;
94  CM->set_top_info(fu_name, module_type);
95  top = CM->get_circ();
96  CM->add_port_vector("in", port_o::IN, port_o::PARAMETRIC_PORT, top, b_type);
97  CM->add_port("out1", port_o::OUT, top, b_type);
98  NP_parameters = fu_name + " in";
99  CM->add_NP_functionality(top, NP_functionality::LIBRARY, NP_parameters);
100  CM->add_NP_functionality(top, NP_functionality::EQUATION, "out1=![*]");
101  TM->add_resource(Library, fu_name, CM, true);
102 
103  // OR
105  fu_name = OR_GATE_STD;
106  module_type = structural_type_descriptorRef(new structural_type_descriptor(fu_name));
107  CM->set_top_info(fu_name, module_type);
108  top = CM->get_circ();
109  CM->add_port_vector("in", port_o::IN, port_o::PARAMETRIC_PORT, top, b_type);
110  CM->add_port("out1", port_o::OUT, top, b_type);
111  NP_parameters = fu_name + " in";
112  CM->add_NP_functionality(top, NP_functionality::LIBRARY, NP_parameters);
113  CM->add_NP_functionality(top, NP_functionality::EQUATION, "out1=[+]");
114  TM->add_resource(Library, fu_name, CM, true);
115 
116  // NOR
118  fu_name = NOR_GATE_STD;
119  module_type = structural_type_descriptorRef(new structural_type_descriptor(fu_name));
120  CM->set_top_info(fu_name, module_type);
121  top = CM->get_circ();
122  CM->add_port_vector("in", port_o::IN, port_o::PARAMETRIC_PORT, top, b_type);
123  CM->add_port("out1", port_o::OUT, top, b_type);
124  NP_parameters = fu_name + " in";
125  CM->add_NP_functionality(top, NP_functionality::LIBRARY, NP_parameters);
126  CM->add_NP_functionality(top, NP_functionality::EQUATION, "out1=![+]");
127  TM->add_resource(Library, fu_name, CM, true);
128 
129  // XOR
131  fu_name = XOR_GATE_STD;
132  module_type = structural_type_descriptorRef(new structural_type_descriptor(fu_name));
133  CM->set_top_info(fu_name, module_type);
134  top = CM->get_circ();
135  CM->add_port_vector("in", port_o::IN, port_o::PARAMETRIC_PORT, top, b_type);
136  CM->add_port("out1", port_o::OUT, top, b_type);
137  NP_parameters = fu_name + " in";
138  CM->add_NP_functionality(top, NP_functionality::LIBRARY, NP_parameters);
139  CM->add_NP_functionality(top, NP_functionality::EQUATION, "out1=[^]");
140  TM->add_resource(Library, fu_name, CM, true);
141 
142  // XNOR
144  fu_name = XNOR_GATE_STD;
145  module_type = structural_type_descriptorRef(new structural_type_descriptor(fu_name));
146  CM->set_top_info(fu_name, module_type);
147  top = CM->get_circ();
148  CM->add_port_vector("in", port_o::IN, port_o::PARAMETRIC_PORT, top, b_type);
149  CM->add_port("out1", port_o::OUT, top, b_type);
150  NP_parameters = fu_name + " in";
151  CM->add_NP_functionality(top, NP_functionality::LIBRARY, NP_parameters);
152  CM->add_NP_functionality(top, NP_functionality::EQUATION, "out1=![^]");
153  TM->add_resource(Library, fu_name, CM, true);
154 
155  // NOT
157  fu_name = NOT_GATE_STD;
158  module_type = structural_type_descriptorRef(new structural_type_descriptor(fu_name));
159  CM->set_top_info(fu_name, module_type);
160  top = CM->get_circ();
161  CM->add_port("in1", port_o::IN, top, b_type);
162  CM->add_port("out1", port_o::OUT, top, b_type);
163  NP_parameters = fu_name;
164  CM->add_NP_functionality(top, NP_functionality::LIBRARY, NP_parameters);
165  CM->add_NP_functionality(top, NP_functionality::EQUATION, "out1=!in1");
166  TM->add_resource(Library, fu_name, CM, true);
167 
168  // DFF
170  fu_name = DFF_GATE_STD;
171  module_type = structural_type_descriptorRef(new structural_type_descriptor(fu_name));
172  CM->set_top_info(fu_name, module_type);
173  top = CM->get_circ();
174  CM->add_port("in1", port_o::IN, top, b_type);
175  CM->add_port("out1", port_o::OUT, top, b_type);
176  NP_parameters = fu_name;
177  CM->add_NP_functionality(top, NP_functionality::LIBRARY, NP_parameters);
178  TM->add_resource(Library, fu_name, CM, true);
179 
180  // BUFF
182  fu_name = BUFF_GATE_STD;
183  module_type = structural_type_descriptorRef(new structural_type_descriptor(fu_name));
184  CM->set_top_info(fu_name, module_type);
185  top = CM->get_circ();
186  CM->add_port("in1", port_o::IN, top, b_type);
187  CM->add_port("out1", port_o::OUT, top, b_type);
188  NP_parameters = fu_name;
189  CM->add_NP_functionality(top, NP_functionality::LIBRARY, NP_parameters);
190  TM->add_resource(Library, fu_name, CM, true);
192 }
#define OR_GATE_STD
void * top(node_stack *head)
Definition: tree.c:75
LoadBuiltinTechnology(const technology_managerRef TM, const generic_deviceRef target, const DesignFlowManagerConstRef design_flow_manager, const ParameterConstRef parameters)
Constructor.
refcount< structural_type_descriptor > structural_type_descriptorRef
RefCount type definition of the structural_type_descriptor class structure.
~LoadBuiltinTechnology() override
Destructor.
Structure representing the most relevant information about the type of a structural object...
static const unsigned int PARAMETRIC_PORT
const structural_objectRef get_circ() const
Get a reference to circ field.
#define AND_GATE_STD
RelationshipType
The relationship type.
This class manages the circuit structures.
#define DFF_GATE_STD
Class specification of the manager of the technology library data structures.
const CustomUnorderedSet< TechnologyFlowStep_Type > ComputeTechnologyRelationships(const DesignFlowStep::RelationshipType relationship_type) const override
Return the set of analyses in relationship with this design step.
static void add_NP_functionality(structural_objectRef cir, NP_functionality::NP_functionaly_type dt, std::string functionality_description)
Add a not-parsed functionality.
void set_top_info(const std::string &id, const technology_managerRef &LM, const std::string &Library="")
DesignFlowStep_Status Exec() override
Execute the step.
Class specification of the data structures used to manage technology information. ...
static structural_objectRef add_port(const std::string &id, port_o::port_direction pdir, structural_objectRef owner, structural_type_descriptorRef type_descr, unsigned int treenode=0)
Create a new port.
#define NAND_GATE_STD
const technology_managerRef TM
The technology manager.
#define LIBRARY_STD
standard library where all built-in ports are defined.
utility function used to read files.
const ParameterConstRef parameters
Set of input parameters.
DesignFlowStep_Status
The status of a step.
#define NOR_GATE_STD
refcount< structural_manager > structural_managerRef
RefCount type definition of the structural_manager class structure.
#define XOR_GATE_STD
TechnologyFlowStep_Type
This class describes all classes used to represent a structural object.
#define BUFF_GATE_STD
This class load builtin components in technology manager.
#define NOT_GATE_STD
Class implementation of the structural_manager.
static structural_objectRef add_port_vector(std::string id, port_o::port_direction pdir, unsigned int n_ports, structural_objectRef owner, structural_type_descriptorRef type_descr, unsigned int treenode=0)
Create a new port_vector.
#define XNOR_GATE_STD

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