torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
torc::placer::PlacerNetlist Class Reference

#include <PlacerNetlist.hpp>

+ Collaboration diagram for torc::placer::PlacerNetlist:

Public Member Functions

 PlacerNetlist (DesignSharedPtr inDesign, DeviceWrapper &inDevice)
 
 ~PlacerNetlist ()
 
void printInstances ()
 
uint32 getInstanceType (std::string &inType)
 
uint32 addInstance (InstanceSharedPtr inInstance)
 
uint32 addNet (std::string inName, ENetType inType)
 
uint32 addNetTerminal (std::string inNetName, std::string inInstanceName, std::string inPortName, bool isNetSource)
 
NetlistInstancegetInstance (std::string inName)
 
NetlistInstancegetInstance (uint32 i)
 
NetlistInstancegetInstance (uint32 type, uint32 index)
 
NetlistNetgetNet (std::string inName)
 
NetlistNetgetNet (uint32 i)
 
uint32 getNumNets ()
 
uint32 getNumInstances ()
 
uint32 getNumInstancesByType (uint32 type)
 
uint32 getNumTypes ()
 
void print ()
 
void temporaryPrune ()
 

Protected Attributes

DesignSharedPtr mDesign
 
DeviceWrappermDevice
 
std::vector< NetlistInstance * > mInstances
 
std::vector< NetlistNet * > mNets
 
std::vector< NetlistPin * > mPins
 
std::vector< std::vector
< NetlistInstance * > > 
mInstancesByType
 
std::map< std::string, uint32mInstanceLookup
 
std::map< std::string, uint32mNetLookup
 

Private Types

typedef physical::DesignSharedPtr DesignSharedPtr
 
typedef physical::InstanceSharedPtr InstanceSharedPtr
 
typedef
physical::InstanceSharedPtrVector 
InstanceSharedPtrVector
 
typedef
physical::Circuit::InstanceSharedPtrConstIterator 
InstanceSharedPtrConstIterator
 
typedef
physical::Circuit::NetSharedPtrConstIterator 
NetSharedPtrConstIterator
 
typedef
physical::Net::InstancePinSharedPtrConstIterator 
InstancePinSharedPtrConstIterator
 
typedef physical::ENetType ENetType
 
typedef boost::uint32_t uint32
 

Detailed Description

Definition at line 34 of file PlacerNetlist.hpp.

Member Typedef Documentation

typedef boost::uint32_t torc::placer::PlacerNetlist::uint32
private

Definition at line 43 of file PlacerNetlist.hpp.

Constructor & Destructor Documentation

torc::placer::PlacerNetlist::PlacerNetlist ( DesignSharedPtr  inDesign,
DeviceWrapper inDevice 
)
inline

Definition at line 63 of file PlacerNetlist.hpp.

64  : mDesign(inDesign), mDevice(inDevice) {
65 
66  // populate the netlist with the design information (or at least wrap it)
67 
68 
69  InstanceSharedPtrConstIterator p = inDesign->instancesBegin();
70  InstanceSharedPtrConstIterator e = inDesign->instancesEnd();
71  for ( ; p != e; p++) {
72  //mInstances.push_back(new NetlistInstance(*p,
73  // mDevice.mTypeMapping.getType((*p)->getType())));
74  addInstance(*p);
75  }
76 
77  NetSharedPtrConstIterator q = inDesign->netsBegin();
78  NetSharedPtrConstIterator f = inDesign->netsEnd();
79  for ( ; q != f; q++) {
80  const std::string& netName = (*q)->getName();
81  //mNets.push_back(new NetlistNet((*q)->getName(), (*q)->getNetType(), mNets.size()));
82  addNet(netName, (*q)->getNetType());
83 
86  r = (*q)->sourcesBegin();
87  g = (*q)->sourcesEnd();
88  for ( ; r != g; r++) {
89  InstanceSharedPtr instance = (*r)->getInstancePtr().lock();
90  addNetTerminal(netName, instance->getName(), (*r)->getPinName(), true);
91  }
92  r = (*q)->sinksBegin();
93  g = (*q)->sinksEnd();
94  for ( ; r != g; r++) {
95  InstanceSharedPtr instance = (*r)->getInstancePtr().lock();
96  addNetTerminal(netName, instance->getName(), (*r)->getPinName(), false);
97  }
98  }
99  }
physical::InstanceSharedPtr InstanceSharedPtr
uint32 addNet(std::string inName, ENetType inType)
std::string string
uint32 addNetTerminal(std::string inNetName, std::string inInstanceName, std::string inPortName, bool isNetSource)
uint32 addInstance(InstanceSharedPtr inInstance)
physical::Circuit::InstanceSharedPtrConstIterator InstanceSharedPtrConstIterator
physical::Circuit::NetSharedPtrConstIterator NetSharedPtrConstIterator
physical::Net::InstancePinSharedPtrConstIterator InstancePinSharedPtrConstIterator

+ Here is the call graph for this function:

torc::placer::PlacerNetlist::~PlacerNetlist ( )
inline

Definition at line 100 of file PlacerNetlist.hpp.

100 {}

Member Function Documentation

uint32 torc::placer::PlacerNetlist::addInstance ( InstanceSharedPtr  inInstance)
inline

Definition at line 121 of file PlacerNetlist.hpp.

121  {
122  uint32 index = mInstances.size(); // return index of added instance
123  //mInstanceLookup.insert(std::pair<std::string, uint32>(inName, index));
124  mInstanceLookup.insert(std::pair<std::string, uint32>(inInstance->getName(), index));
125 
126  // put the instance in a type indexed structure
127  // this time, the same as the database!!
128  //if (inIntType >= mInstancesByType.size()) {
129  // for (uint32 i = mInstancesByType.size(); i < inIntType + 1; i++) {
130  // mInstancesByType.push_back(std::vector<NetlistInstance*>());
131  // }
132  //}
133 
134  //NetlistInstance* instance = new NetlistInstance(inName, inType, inIntType);
135  NetlistInstance* instance = new NetlistInstance(inInstance,
136  mDevice.mTypeMapping.getTypeIndex(inInstance->getType()));
137  mInstances.push_back(instance);
138  //mInstancesByType[inIntType].push_back(instance);
139 
140  return index;
141 
142  }
std::map< std::string, uint32 > mInstanceLookup
std::vector< NetlistInstance * > mInstances
uint32 getTypeIndex(const std::string &inType)
Get the type index for a given type name, creates a new entry if not found.
PlacementSiteTypeMapping & mTypeMapping

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32 torc::placer::PlacerNetlist::addNet ( std::string  inName,
ENetType  inType 
)
inline

Definition at line 143 of file PlacerNetlist.hpp.

143  {
144  uint32 index = mNets.size(); // returns index of added instance
145  mNets.push_back(new NetlistNet(inName, inType, index));
146  mNetLookup.insert(std::pair<std::string, uint32>(inName, index));
147  return index;
148  }
std::vector< NetlistNet * > mNets
std::map< std::string, uint32 > mNetLookup

+ Here is the caller graph for this function:

uint32 torc::placer::PlacerNetlist::addNetTerminal ( std::string  inNetName,
std::string  inInstanceName,
std::string  inPortName,
bool  isNetSource 
)
inline

Definition at line 149 of file PlacerNetlist.hpp.

149  {
150  NetlistPin* pin = new NetlistPin(inPortName, isNetSource);
151  NetlistNet* net = getNet(inNetName);
152  NetlistInstance* instance = getInstance(inInstanceName);
153  mPins.push_back(pin);
154  pin->setInstance(instance);
155  pin->setNet(net);
156  instance->addPin(pin);
157  if (isNetSource) {
158  return net->addSource(pin);
159  } else {
160  return net->addSink(pin);
161  }
162  if (pin->getInstance() == NULL) {
163  std::cout << "BAD PIN DEFINITION!!! " << pin->getName() << " " << net->getName() << std::endl;
164  }
165  }
NetlistNet * getNet(std::string inName)
std::vector< NetlistPin * > mPins
NetlistInstance * getInstance(std::string inName)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

NetlistInstance* torc::placer::PlacerNetlist::getInstance ( std::string  inName)
inline

Definition at line 167 of file PlacerNetlist.hpp.

167  {
168  return mInstances[mInstanceLookup[inName]];
169  }
std::map< std::string, uint32 > mInstanceLookup
std::vector< NetlistInstance * > mInstances

+ Here is the caller graph for this function:

NetlistInstance* torc::placer::PlacerNetlist::getInstance ( uint32  i)
inline

Definition at line 170 of file PlacerNetlist.hpp.

170  {
171  return mInstances[i];
172  }
std::vector< NetlistInstance * > mInstances
NetlistInstance* torc::placer::PlacerNetlist::getInstance ( uint32  type,
uint32  index 
)
inline

Definition at line 173 of file PlacerNetlist.hpp.

173  {
174  return mInstancesByType[type][index];
175  }
std::vector< std::vector< NetlistInstance * > > mInstancesByType
uint32 torc::placer::PlacerNetlist::getInstanceType ( std::string &  inType)
inline

Definition at line 114 of file PlacerNetlist.hpp.

114  {
115  throw "getInstanceType(string) not used";
116  //std::map<std::string, int>::iterator typeit = mInstanceTypeLookup.find(inType);
117  //return typeit->second;
118  return 0;
119  }
NetlistNet* torc::placer::PlacerNetlist::getNet ( std::string  inName)
inline

Definition at line 177 of file PlacerNetlist.hpp.

177  {
178  return mNets[mNetLookup[inName]];
179  }
std::vector< NetlistNet * > mNets
std::map< std::string, uint32 > mNetLookup

+ Here is the caller graph for this function:

NetlistNet* torc::placer::PlacerNetlist::getNet ( uint32  i)
inline

Definition at line 180 of file PlacerNetlist.hpp.

180  {
181  return mNets[i];
182  }
std::vector< NetlistNet * > mNets
uint32 torc::placer::PlacerNetlist::getNumInstances ( )
inline

Definition at line 186 of file PlacerNetlist.hpp.

186  {
187  return mInstances.size();
188  }
std::vector< NetlistInstance * > mInstances
uint32 torc::placer::PlacerNetlist::getNumInstancesByType ( uint32  type)
inline

Definition at line 189 of file PlacerNetlist.hpp.

189  {
190  if (type >= mInstancesByType.size()) {
191  return -1; // does not exist
192  }
193  return mInstancesByType[type].size();
194  }
std::vector< std::vector< NetlistInstance * > > mInstancesByType
uint32 torc::placer::PlacerNetlist::getNumNets ( )
inline

Definition at line 183 of file PlacerNetlist.hpp.

183  {
184  return mNets.size();
185  }
std::vector< NetlistNet * > mNets
uint32 torc::placer::PlacerNetlist::getNumTypes ( )
inline

Definition at line 195 of file PlacerNetlist.hpp.

195  {
196  return mInstancesByType.size();
197  }
std::vector< std::vector< NetlistInstance * > > mInstancesByType
void torc::placer::PlacerNetlist::print ( )
inline

Definition at line 198 of file PlacerNetlist.hpp.

198  {
199  std::cout << "### INSTANCES ###" << std::endl;
200  for (uint32 i = 0; i < mInstances.size(); i++) {
201  NetlistInstance* instance = mInstances[i];
202  std::cout << "\t" << instance->getInstance()->getName()
203  << " type: " << instance->getType() << std::endl;
204  for (uint32 j = 0; j < instance->getNumPins(); j++) {
205  NetlistPin* pin = instance->getPin(j);
206  std::cout << "\t\tpin: " << pin->getName() << std::endl;
207  }
208  }
209  std::cout << "### NETS ###" << std::endl;
210  for (uint32 i = 0; i < mNets.size(); i++) {
211  NetlistNet* net = mNets[i];
212  std::cout << "\t" << net->getName() << " type: " << net->getType() << std::endl;
213  for (uint32 j = 0; j < net->getNumSources(); j++) {
214  NetlistPin* pin = net->getSource(j);
215  std::cout << "\t\tsource: " << pin->getInstance()->getInstance()->getName() << " pin " << pin->getName() << std::endl;
216  }
217  for (uint32 j = 0; j < net->getNumSinks(); j++) {
218  NetlistPin* pin = net->getSink(j);
219  std::cout << "\t\tsink: " << pin->getInstance()->getInstance()->getName() << " pin " << pin->getName() << std::endl;
220  }
221  }
222 
223  }
std::vector< NetlistInstance * > mInstances
std::vector< NetlistNet * > mNets

+ Here is the call graph for this function:

void torc::placer::PlacerNetlist::printInstances ( )
inline

Definition at line 101 of file PlacerNetlist.hpp.

101  {
102  std::cout << "### PlacerNetlist Instances ###" << std::endl;
103  std::vector<NetlistInstance*>::iterator p = mInstances.begin();
104  std::vector<NetlistInstance*>::iterator e = mInstances.end();
105  for ( ; p != e; p++) {
106  std::cout << (*p)->getInstance()->getName() << " : "
107  << (*p)->getInstance()->getType() << " ";
108  if ((*p)->getSite() == NULL)
109  std::cout << "UNPLACED!!!" << std::endl;
110  else
111  std::cout << (*p)->getSite()->getName() << std::endl;
112  }
113  }
std::vector< NetlistInstance * > mInstances
void torc::placer::PlacerNetlist::temporaryPrune ( )
inline

Definition at line 224 of file PlacerNetlist.hpp.

224  {
225  std::vector<NetlistNet*> newNets;
226  for (uint32 i = 0; i < mNets.size(); i++) {
227  // if any part of a net is not touching a sliceL, kill it
228  NetlistNet* net = mNets[i];
229  NetlistPin* pin;
230  bool killnet = false;
231  //std::cout << "net: " << net->getName() << std::endl;
232  for (uint32 j = 0; j < net->getNumSources(); j++) {
233  pin = net->getSource(j);
234  //std::cout << "\tsource: " << pin->getInstance()->getName() << " " << pin->getInstance()->getIntType() << std::endl;
235  //if (pin->getInstance()->getInstance()->getIntType() != 46) {
236  // std::cout << "\t\tKILLED" << std::endl;
237  // killnet = true;
238  //}
239  }
240  for (uint32 j = 0; j < net->getNumSinks(); j++) {
241  pin = net->getSink(j);
242  //std::cout << "\tsink: " << pin->getInstance()->getName() << " " << pin->getInstance()->getIntType() << std::endl;
243  //if (pin->getInstance()->getInstance()->getIntType() != 46) {
244  // std::cout << "\t\tKILLED" << std::endl;
245  // killnet = true;
246  //} else {
247  //}
248  }
249  if (!killnet) {
250  newNets.push_back(net);
251  } else {
252  std::cout << "KILL NET: " << net->getName() << std::endl;
253  }
254  }
255  std::cout << "PRUNE: " << mNets.size() << " " << newNets.size() << std::endl;
256  mNets.clear();
257  for (uint32 i = 0; i < newNets.size(); i++) {
258  mNets.push_back(newNets[i]);
259  }
260  }
std::vector< NetlistNet * > mNets

+ Here is the call graph for this function:

Field Documentation

DesignSharedPtr torc::placer::PlacerNetlist::mDesign
protected

Definition at line 46 of file PlacerNetlist.hpp.

DeviceWrapper& torc::placer::PlacerNetlist::mDevice
protected

Definition at line 47 of file PlacerNetlist.hpp.

std::map<std::string, uint32> torc::placer::PlacerNetlist::mInstanceLookup
protected

Definition at line 56 of file PlacerNetlist.hpp.

std::vector<NetlistInstance*> torc::placer::PlacerNetlist::mInstances
protected

Definition at line 49 of file PlacerNetlist.hpp.

std::vector<std::vector<NetlistInstance*> > torc::placer::PlacerNetlist::mInstancesByType
protected

Definition at line 53 of file PlacerNetlist.hpp.

std::map<std::string, uint32> torc::placer::PlacerNetlist::mNetLookup
protected

Definition at line 57 of file PlacerNetlist.hpp.

std::vector<NetlistNet*> torc::placer::PlacerNetlist::mNets
protected

Definition at line 50 of file PlacerNetlist.hpp.

std::vector<NetlistPin*> torc::placer::PlacerNetlist::mPins
protected

Definition at line 51 of file PlacerNetlist.hpp.


The documentation for this class was generated from the following file: