torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
physical/Factory.hpp
Go to the documentation of this file.
1 // Torc - Copyright 2011-2013 University of Southern California. All Rights Reserved.
2 // $HeadURL$
3 // $Id$
4 
5 // This program is free software: you can redistribute it and/or modify it under the terms of the
6 // GNU General Public License as published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
11 // the GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License along with this program. If
14 // not, see <http://www.gnu.org/licenses/>.
15 
16 /// \file
17 /// \brief Header for the Factory class.
18 
19 #ifndef TORC_PHYSICAL_FACTORY_HPP
20 #define TORC_PHYSICAL_FACTORY_HPP
21 
22 #include "torc/physical/Design.hpp"
23 #include <string>
24 #include <boost/smart_ptr.hpp>
25 
26 namespace torc {
27 namespace physical {
28 
29  /// \brief Factory class for physical netlist elements.
30  /// \details Physical netlist elements must be created by this factory.
31  class Factory {
32  protected:
33  // friends
34  /// \brief Imported type name.
36  public:
37  // functions
38  /// \brief Create and return a new Design shared pointer.
39  /// \param inName The design name.
40  /// \param inDevice The design device.
41  /// \param inPackage The device package.
42  /// \param inSpeedGrade The device speed grade.
43  /// \param inXdlVersion The design XDL version.
44  static DesignSharedPtr newDesignPtr(const string& inName, const string& inDevice,
45  const string& inPackage, const string& inSpeedGrade, const string& inXdlVersion) {
46  DesignSharedPtr designPtr(new Design(inName, inDevice, inPackage, inSpeedGrade,
47  inXdlVersion));
48  designPtr->setSelfWeakPtr(designPtr);
49  return designPtr;
50  }
51  /// \brief Create and return a new Module shared pointer.
52  /// \param inName The module name.
53  /// \param inAnchor The anchor instance name for the module. The anchor designates the
54  /// instance in the module relative to which the module will be placed.
55  static ModuleSharedPtr newModulePtr(const string& inName, const string& inAnchor) {
56  ModuleSharedPtr modulePtr(new Module(inName, inAnchor));
57  modulePtr->Progenitor<Module>::setSelfWeakPtr(modulePtr);
58  return modulePtr;
59 
60  }
61  /// \brief Create and return a new Port shared pointer.
62  /// \param inName The port name.
63  /// \param inInstancePtr The port instance pointer.
64  /// \param inPinName The port pin name.
65  static PortSharedPtr newPortPtr(const string& inName, InstanceSharedPtr inInstancePtr,
66  const string& inPinName) {
67  PortSharedPtr portPtr(new Port(inName, inInstancePtr, inPinName));
68  return portPtr;
69  }
70  /// \brief Construct and return a new Instance shared pointer.
71  /// \param inName The instance name.
72  /// \param inType The instance type.
73  /// \param inTile The instance tile, or an empty string if unplaced.
74  /// \param inSite The instance site, or an empty string if unplaced.
75  /// \param inBonding The specified bonding for unplaced IO, or eInstanceBondingUnknown for
76  /// placed IO instances and non-IO instances. The default value is almost always
77  /// correct.
78  /// \param inInstanceReferencePtr The module instance reference, if applicable. The
79  /// default value is almost always correct. Note that instance references are never
80  /// required for XDL, and are only supported to faithfully replicate XDL designs.
81  static InstanceSharedPtr newInstancePtr(const string& inName, const string& inType,
82  const string& inTile, const string& inSite,
84  InstanceReferenceSharedPtr inInstanceReferencePtr = InstanceReferenceSharedPtr()) {
85  InstanceSharedPtr instancePtr(new Instance(inName, inType, inTile, inSite, inBonding,
86  inInstanceReferencePtr));
87  instancePtr->setSelfWeakPtr(instancePtr);
88  return instancePtr;
89  }
90  /// \brief Create and return a new Net share pointer.
91  /// \param inName The net name.
92  /// \param inNetType The net power type.
93  static NetSharedPtr newNetPtr(const string& inName, ENetType inNetType = eNetTypeNormal) {
94  NetSharedPtr netPtr(new Net(inName, inNetType));
95  netPtr->setSelfWeakPtr(netPtr);
96  return netPtr;
97  }
98  /// \brief Create and return a new InstanceReference shared pointer.
99  /// \param inInstantiationName The name under which the reference module was instantiated.
100  /// \param inModulePtr The module containing the referenced instance.
101  /// \param inInstancePtr The instance being referenced.
102  static InstanceReferenceSharedPtr newInstanceReferencePtr(const string& inInstantiationName,
103  ModuleSharedPtr inModulePtr, InstanceSharedPtr inInstancePtr) {
104  InstanceReferenceSharedPtr instanceReferencePtr(
105  new InstanceReference(inInstantiationName, inModulePtr, inInstancePtr));
106  return instanceReferencePtr;
107  }
108  /// \brief Construct and return a new InstancePin shared pointer.
109  /// \param inInstancePtr The pin instance pointer.
110  /// \param inPinName The pin name.
112  const string& inPinName) {
113  InstancePinSharedPtr instancePinPtr(new InstancePin(inInstancePtr, inPinName));
114  instancePinPtr->setSelfWeakPtr(instancePinPtr);
115  return instancePinPtr;
116  }
117  /// \brief Construct a pip and return it.
118  /// \param inTileName The containing tile.
119  /// \param inSourceWireName The source wire.
120  /// \param inSinkWireName The sink wire.
121  /// \param inPipDirection The pip directionality. See EPipDirection. The most common
122  /// value is ePipUnidirectionalBuffered, which represents a unidirectional buffered
123  /// connection from source to sink.
124  /// \param inRoutethroughPtr The routethrough shared pointer. The default value creates
125  /// no routethrough.
126  static torc::physical::Pip newPip(const string& inTileName, const string& inSourceWireName,
127  const string& inSinkWireName, EPipDirection inPipDirection,
128  RoutethroughSharedPtr inRoutethroughPtr = RoutethroughSharedPtr()) {
129  return Pip(inTileName, inSourceWireName, inSinkWireName, inPipDirection,
130  inRoutethroughPtr);
131  }
132  /// \brief Construct and return a new Routethrough shared pointer.
133  static RoutethroughSharedPtr newRoutethroughPtr(const string& inSetting,
134  const string& inName, const string& inValue, const InstanceWeakPtr& inInstancePtr,
135  const string& inSourceWireName, const string& inSinkWireName) {
136  RoutethroughSharedPtr routethroughPtr(new Routethrough(inSetting, inName, inValue,
137  inInstancePtr, inSourceWireName, inSinkWireName));
138  return routethroughPtr;
139  }
140  };
141 
142 } // namespace physical
143 } // namespace torc
144 
145 #endif // TORC_PHYSICAL_FACTORY_HPP
ENetType
Enumeration of net power types.
EInstanceBonding
Enumeration of pad bonding types.
static PortSharedPtr newPortPtr(const string &inName, InstanceSharedPtr inInstancePtr, const string &inPinName)
Create and return a new Port shared pointer.
boost::shared_ptr< Port > PortSharedPtr
Shared pointer encapsulation of a Port.
static NetSharedPtr newNetPtr(const string &inName, ENetType inNetType=eNetTypeNormal)
Create and return a new Net share pointer.
Physical netlist design.
boost::shared_ptr< class InstancePin > InstancePinSharedPtr
Shared pointer encapsulation of an InstancePin.
std::string string
boost::shared_ptr< Module > ModuleSharedPtr
Shared pointer encapsulation of a Module.
Definition: Module.hpp:114
std::string string
Imported type name.
Physical design instance.
Header for the Design class.
Physical design net.
static torc::physical::Pip newPip(const string &inTileName, const string &inSourceWireName, const string &inSinkWireName, EPipDirection inPipDirection, RoutethroughSharedPtr inRoutethroughPtr=RoutethroughSharedPtr())
Construct a pip and return it.
boost::shared_ptr< Net > NetSharedPtr
Shared pointer encapsulation of a Net.
static InstanceSharedPtr newInstancePtr(const string &inName, const string &inType, const string &inTile, const string &inSite, EInstanceBonding inBonding=eInstanceBondingUnknown, InstanceReferenceSharedPtr inInstanceReferencePtr=InstanceReferenceSharedPtr())
Construct and return a new Instance shared pointer.
Physical design instance-pin pair, suitable for specifying a net endpoint.
boost::shared_ptr< Instance > InstanceSharedPtr
Shared pointer encapsulation of an Instance.
Factory class for physical netlist elements.
boost::shared_ptr< Design > DesignSharedPtr
Shared pointer encapsulation of a Design.
Physical design programmable interconnect point.
Definition: Pip.hpp:34
boost::shared_ptr< Routethrough > RoutethroughSharedPtr
Shared pointer encapsulation of a Routethrough.
static RoutethroughSharedPtr newRoutethroughPtr(const string &inSetting, const string &inName, const string &inValue, const InstanceWeakPtr &inInstancePtr, const string &inSourceWireName, const string &inSinkWireName)
Construct and return a new Routethrough shared pointer.
static InstancePinSharedPtr newInstancePinPtr(InstanceSharedPtr inInstancePtr, const string &inPinName)
Construct and return a new InstancePin shared pointer.
static ModuleSharedPtr newModulePtr(const string &inName, const string &inAnchor)
Create and return a new Module shared pointer.
Module input or output port.
static DesignSharedPtr newDesignPtr(const string &inName, const string &inDevice, const string &inPackage, const string &inSpeedGrade, const string &inXdlVersion)
Create and return a new Design shared pointer.
Instantiation of a module instance.
EPipDirection
Enumeration of pip directionality.
boost::weak_ptr< Instance > InstanceWeakPtr
Weak pointer encapsulation of an Instance.
Hierarchical module.
Definition: Module.hpp:33
boost::shared_ptr< InstanceReference > InstanceReferenceSharedPtr
Shared pointer encapsulation of an InstanceReference.
static InstanceReferenceSharedPtr newInstanceReferencePtr(const string &inInstantiationName, ModuleSharedPtr inModulePtr, InstanceSharedPtr inInstancePtr)
Create and return a new InstanceReference shared pointer.