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

Diff utility class for comparing physical netlists. More...

#include <MarkExtracter.hpp>

Public Member Functions

 MarkExtracter (std::ostream &inOutStream, const DesignSharedPtr &inDesign, string inPattern)
 
DesignSharedPtr extract ()
 Top level call to diff two designs. More...
 
void pruneCircuit (CircuitSharedPtr circuit)
 
void filterOnPips (CircuitSharedPtr circuit)
 

Protected Types

typedef std::string string
 Imported type name. More...
 
typedef
torc::physical::DesignSharedPtr 
DesignSharedPtr
 Imported type name. More...
 
typedef
torc::physical::ModuleSharedPtr 
ModuleSharedPtr
 Imported type name. More...
 
typedef std::vector
< ModuleSharedPtr
ModuleSharedPtrVector
 Imported type name. More...
 
typedef
torc::physical::CircuitSharedPtr 
CircuitSharedPtr
 Imported type name. More...
 
typedef
torc::physical::InstanceSharedPtr 
InstanceSharedPtr
 Imported type name. More...
 
typedef std::vector
< InstanceSharedPtr
InstanceSharedPtrVector
 Imported type name. More...
 
typedef
torc::physical::NetSharedPtr 
NetSharedPtr
 Imported type name. More...
 
typedef std::vector< NetSharedPtrNetSharedPtrVector
 Imported type name. More...
 
typedef
torc::physical::Circuit::InstanceSharedPtrConstIterator 
InstanceSharedPtrConstIterator
 Imported type name. More...
 
typedef
torc::physical::Circuit::InstanceSharedPtrIterator 
InstanceSharedPtrIterator
 Imported type name. More...
 
typedef
torc::physical::Circuit::NetSharedPtrConstIterator 
NetSharedPtrConstIterator
 Imported type name. More...
 
typedef
torc::physical::Circuit::NetSharedPtrIterator 
NetSharedPtrIterator
 Imported type name. More...
 
typedef
torc::physical::InstanceWeakPtr 
InstanceWeakPtr
 Imported type name. More...
 
typedef
torc::physical::Design::ModuleSharedPtrConstIterator 
ModuleSharedPtrConstIterator
 Imported type name. More...
 
typedef
torc::physical::Design::ModuleSharedPtrIterator 
ModuleSharedPtrIterator
 Imported type name. More...
 
typedef
torc::physical::ConfigMap::const_iterator 
ConfigMapConstIterator
 Imported type name. More...
 
typedef
torc::physical::Net::InstancePinSharedPtrConstIterator 
InstancePinSharedPtrConstIterator
 Imported type name. More...
 
typedef
torc::physical::Net::PipConstIterator 
PipConstIterator
 Imported type name. More...
 
typedef boost::shared_ptr
< torc::physical::Named
NamedSharedPtr
 Imported type name. More...
 
typedef boost::shared_ptr
< torc::physical::ConfigMap
ConfigMapSharedPtr
 Imported type name. More...
 
typedef
torc::physical::Module::PortSharedPtrConstIterator 
PortSharedPtrConstIterator
 Imported type name. More...
 
typedef
torc::physical::Net::InstancePinSharedPtrIterator 
InstancePinSharedPtrIterator
 Imported type name. More...
 
typedef torc::physical::Pip Pip
 Imported type name. More...
 
typedef torc::physical::PipVector PipVector
 
typedef
torc::physical::Net::PipIterator 
PipIterator
 

Protected Attributes

std::ostream & mStream
 Output stream to use for comparison results. More...
 
DesignSharedPtr mDesign
 
DesignSharedPtr mNewDesign
 
const string mPattern
 
boost::regex mRegex
 

Detailed Description

Diff utility class for comparing physical netlists.

This class takes two design pointers and compares them.

Definition at line 43 of file MarkExtracter.hpp.

Member Typedef Documentation

Imported type name.

Definition at line 54 of file MarkExtracter.hpp.

Imported type name.

Definition at line 78 of file MarkExtracter.hpp.

Imported type name.

Definition at line 87 of file MarkExtracter.hpp.

Imported type name.

Definition at line 48 of file MarkExtracter.hpp.

Imported type name.

Definition at line 56 of file MarkExtracter.hpp.

Imported type name.

Definition at line 58 of file MarkExtracter.hpp.

Imported type name.

Definition at line 72 of file MarkExtracter.hpp.

Imported type name.

Definition at line 50 of file MarkExtracter.hpp.

Imported type name.

Definition at line 52 of file MarkExtracter.hpp.

typedef boost::shared_ptr<torc::physical::Named> torc::MarkExtracter::NamedSharedPtr
protected

Imported type name.

Definition at line 85 of file MarkExtracter.hpp.

Imported type name.

Definition at line 60 of file MarkExtracter.hpp.

Imported type name.

Definition at line 70 of file MarkExtracter.hpp.

typedef std::vector<NetSharedPtr> torc::MarkExtracter::NetSharedPtrVector
protected

Imported type name.

Definition at line 62 of file MarkExtracter.hpp.

Imported type name.

Definition at line 93 of file MarkExtracter.hpp.

Imported type name.

Definition at line 83 of file MarkExtracter.hpp.

Definition at line 94 of file MarkExtracter.hpp.

typedef std::string torc::MarkExtracter::string
protected

Imported type name.

Definition at line 46 of file MarkExtracter.hpp.

Constructor & Destructor Documentation

torc::MarkExtracter::MarkExtracter ( std::ostream &  inOutStream,
const DesignSharedPtr inDesign,
string  inPattern 
)
inline

Definition at line 105 of file MarkExtracter.hpp.

106  : mStream(inOutStream), mDesign(inDesign), mPattern(inPattern) {
107  mStream << "Searching for '" << mPattern << "'" << std::endl;
108  mStream << "NEAT" << std::endl;
109  mRegex.assign(mPattern);
110  }
DesignSharedPtr mDesign
std::ostream & mStream
Output stream to use for comparison results.

Member Function Documentation

DesignSharedPtr torc::MarkExtracter::extract ( )
inline

Top level call to diff two designs.

Definition at line 113 of file MarkExtracter.hpp.

113  {
114 
115  std::cout << "### " << mPattern << " ###" << std::endl;
116 
118  for (p = mDesign->modulesBegin(); p!= mDesign->modulesEnd(); p++) {
119  std::cout << "MODULES ARE NOT CURRENTLY SUPPORTED!" << std::endl;
120  }
121  mNewDesign = physical::Factory::newDesignPtr(mDesign->getName(), mDesign->getDevice(),
122  mDesign->getPackage(), mDesign->getSpeedGrade(), mDesign->getXdlVersion());
123 
125  //filterOnPips(mDesign);
126 
127  return mNewDesign;
128  }
DesignSharedPtr mNewDesign
DesignSharedPtr mDesign
torc::physical::Design::ModuleSharedPtrConstIterator ModuleSharedPtrConstIterator
Imported type name.
void pruneCircuit(CircuitSharedPtr circuit)
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.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void torc::MarkExtracter::filterOnPips ( CircuitSharedPtr  circuit)
inline

Definition at line 188 of file MarkExtracter.hpp.

188  {
190  NetSharedPtrIterator net_i;
191 
192  std::map<InstanceSharedPtr, bool> instanceMap;
193  std::map<NetSharedPtr, bool> netMap;
194 
195  boost::smatch smatches;
196 
197  for (inst_i = circuit->instancesBegin(); inst_i != circuit->instancesEnd(); inst_i++) {
198  instanceMap[*inst_i] = false;
199  }
200  for (net_i = circuit->netsBegin(); net_i != circuit->netsEnd(); net_i++) {
201  bool test = false;
202  for (PipIterator pip_i = (*net_i)->pipsBegin(); pip_i != (*net_i)->pipsEnd(); pip_i++) {
203  test = test || regex_match(pip_i->getTileName(), smatches, mRegex);
204  test = test || regex_match(pip_i->getSourceWireName(), smatches, mRegex);
205  test = test || regex_match(pip_i->getSinkWireName(), smatches, mRegex);
206  }
207  //bool test = regex_match((*net_i)->getName(), smatches, mRegex);
208  //std::cout << "NET: " << (*net_i)->getName() << " -- " << test << std::endl;
209  netMap[*net_i] = test;
210  if (!test) continue;
212  for (pin_i = (*net_i)->sourcesBegin(); pin_i != (*net_i)->sourcesEnd(); pin_i++) {
213  std::cout << "NET INST source: " << ((*pin_i)->getInstancePtr().lock())->getName()
214  << " -- " << true << std::endl;
215  instanceMap[(*pin_i)->getInstancePtr().lock()] = true;
216  }
217  for (pin_i = (*net_i)->sinksBegin(); pin_i != (*net_i)->sinksEnd(); pin_i++) {
218  std::cout << "NET INST sink: " << ((*pin_i)->getInstancePtr().lock())->getName()
219  << " -- " << true << std::endl;
220  instanceMap[(*pin_i)->getInstancePtr().lock()] = true;
221  }
222  }
223 
224  std::map<InstanceSharedPtr, bool>::iterator imap_i;
225  std::map<NetSharedPtr, bool>::iterator nmap_i;
226  std::cout << "Copying marked instances and nets..." << std::endl;
227  for (imap_i = instanceMap.begin(); imap_i != instanceMap.end(); imap_i++) {
228  //std::cout << "check INST: " << (*(imap_i->first)).getName()
229  // << " -- " << imap_i->second << std::endl;
230  if (imap_i->second) { // this is inverted for removing!
231  InstanceSharedPtr isp = imap_i->first;
232  mNewDesign->addInstance(isp);
233  }
234  }
235  for (nmap_i = netMap.begin(); nmap_i != netMap.end(); nmap_i++) {
236  //std::cout << "check NET: " << (*(nmap_i->first)).getName()
237  // << " -- " << nmap_i->second << std::endl;
238  if (nmap_i->second) {
239  NetSharedPtr nsp = nmap_i->first;
240  mNewDesign->addNet(nsp);
241  }
242  }
243 
244  }
DesignSharedPtr mNewDesign
torc::physical::InstanceSharedPtr InstanceSharedPtr
Imported type name.
torc::physical::NetSharedPtr NetSharedPtr
Imported type name.
torc::physical::Circuit::NetSharedPtrIterator NetSharedPtrIterator
Imported type name.
torc::physical::Net::PipIterator PipIterator
torc::physical::Circuit::InstanceSharedPtrIterator InstanceSharedPtrIterator
Imported type name.
torc::physical::Net::InstancePinSharedPtrIterator InstancePinSharedPtrIterator
Imported type name.
void torc::MarkExtracter::pruneCircuit ( CircuitSharedPtr  circuit)
inline

Definition at line 129 of file MarkExtracter.hpp.

129  {
131  NetSharedPtrIterator net_i;
132 
133  std::map<InstanceSharedPtr, bool> instanceMap;
134  std::map<NetSharedPtr, bool> netMap;
135 
136  boost::smatch smatches;
137 
138  for (inst_i = circuit->instancesBegin(); inst_i != circuit->instancesEnd(); inst_i++) {
139  bool test = regex_match((*inst_i)->getName(), smatches, mRegex);
140  std::multimap<std::string, physical::Config>::const_iterator p;
141  for (p = (*inst_i)->configBegin(); p != (*inst_i)->configEnd(); p++) {
142  test = test || regex_match((*p).first, smatches, mRegex);
143  test = test || regex_match((*p).second.getName(), smatches, mRegex);
144  test = test || regex_match((*p).second.getValue(), smatches, mRegex);
145  }
146  //std::cout << "INSTANCE: " << (*inst_i)->getName() << " -- " << test << std::endl;
147  instanceMap[*inst_i] = test;
148  }
149  for (net_i = circuit->netsBegin(); net_i != circuit->netsEnd(); net_i++) {
150  bool test = regex_match((*net_i)->getName(), smatches, mRegex);
151  //std::cout << "NET: " << (*net_i)->getName() << " -- " << test << std::endl;
152  netMap[*net_i] = test;
153  if (!test) continue;
155  for (pin_i = (*net_i)->sourcesBegin(); pin_i != (*net_i)->sourcesEnd(); pin_i++) {
156  std::cout << "NET INST source: " << ((*pin_i)->getInstancePtr().lock())->getName()
157  << " -- " << true << std::endl;
158  instanceMap[(*pin_i)->getInstancePtr().lock()] = true;
159  }
160  for (pin_i = (*net_i)->sinksBegin(); pin_i != (*net_i)->sinksEnd(); pin_i++) {
161  std::cout << "NET INST sink: " << ((*pin_i)->getInstancePtr().lock())->getName()
162  << " -- " << true << std::endl;
163  instanceMap[(*pin_i)->getInstancePtr().lock()] = true;
164  }
165  }
166 
167  std::map<InstanceSharedPtr, bool>::iterator imap_i;
168  std::map<NetSharedPtr, bool>::iterator nmap_i;
169  std::cout << "Copying marked instances and nets..." << std::endl;
170  for (imap_i = instanceMap.begin(); imap_i != instanceMap.end(); imap_i++) {
171  //std::cout << "check INST: " << (*(imap_i->first)).getName()
172  // << " -- " << imap_i->second << std::endl;
173  if (imap_i->second) { // this is inverted for removing!
174  InstanceSharedPtr isp = imap_i->first;
175  mNewDesign->addInstance(isp);
176  }
177  }
178  for (nmap_i = netMap.begin(); nmap_i != netMap.end(); nmap_i++) {
179  //std::cout << "check NET: " << (*(nmap_i->first)).getName()
180  // << " -- " << nmap_i->second << std::endl;
181  if (nmap_i->second) {
182  NetSharedPtr nsp = nmap_i->first;
183  mNewDesign->addNet(nsp);
184  }
185  }
186 
187  }
DesignSharedPtr mNewDesign
torc::physical::InstanceSharedPtr InstanceSharedPtr
Imported type name.
torc::physical::NetSharedPtr NetSharedPtr
Imported type name.
torc::physical::Circuit::NetSharedPtrIterator NetSharedPtrIterator
Imported type name.
torc::physical::Circuit::InstanceSharedPtrIterator InstanceSharedPtrIterator
Imported type name.
torc::physical::Net::InstancePinSharedPtrIterator InstancePinSharedPtrIterator
Imported type name.

+ Here is the caller graph for this function:

Field Documentation

DesignSharedPtr torc::MarkExtracter::mDesign
protected

Definition at line 99 of file MarkExtracter.hpp.

DesignSharedPtr torc::MarkExtracter::mNewDesign
protected

Definition at line 100 of file MarkExtracter.hpp.

const string torc::MarkExtracter::mPattern
protected

Definition at line 101 of file MarkExtracter.hpp.

boost::regex torc::MarkExtracter::mRegex
protected

Definition at line 102 of file MarkExtracter.hpp.

std::ostream& torc::MarkExtracter::mStream
protected

Output stream to use for comparison results.

Definition at line 98 of file MarkExtracter.hpp.


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