19 #include <boost/test/unit_test.hpp> 
   29 #include <boost/regex.hpp> 
   37 namespace architecture {
 
   39 BOOST_AUTO_TEST_SUITE(architecture)
 
   46     using namespace torc::physical;
 
   50         / 
"torc" / 
"physical" / 
"DesignUnitTest.reference.xdl";
 
   53     std::fstream fileStream(referencePath.string().c_str());
 
   54     BOOST_REQUIRE(fileStream.good());
 
   57     importer(fileStream, referencePath.string());
 
   61     BOOST_REQUIRE(designPtr.get() != 0);
 
   68         std::cout << 
"Instance:" << instancePtr->getName() << std::endl;
 
   72             std::cout << 
"\tConfig:" << cp->first << 
"---->" << cp->second.getName() << 
":" << cp->second.getValue() << std::endl;
 
   85     static const boost::regex e(
"(^(<eqn>)|((#LUT:|#RAM:|#ROM:)<eqn>)$)");    
 
   86     return regex_match(isit, e);  
 
   91     static const boost::regex e(
"(^#(FF|LATCH)$)");    
 
   92     return regex_match(isit, e);  
 
   97         static const boost::regex e(
"^.*_B$");
 
   98     return regex_match(isit, e);
 
  103         static const boost::regex e(
"^_ROUTETHROUGH.*");
 
  104     return regex_match(isit, e);
 
  109         static const boost::regex e(
"^.*AND.*");
 
  110     return regex_match(isit, e);
 
  115         static const boost::regex e(
"^.*VCC$");
 
  116     return regex_match(isit, e);
 
  121         static const boost::regex e(
"^.*GND$");
 
  122     return regex_match(isit, e);
 
  138     PrimitiveDefArray& primitiveDefs = sites.
getSiteTypes();  
 
  139     PrimitiveDefArray::const_iterator p = primitiveDefs.begin();  
 
  140     PrimitiveDefArray::const_iterator e = primitiveDefs.end();
 
  143     typedef std::map<std::string, PrimitiveElement*> AllElements;
 
  144     AllElements allElements;
 
  146     typedef std::map<std::string, PrimitiveElement*> AllTerminals;
 
  147     AllTerminals allTerminals;
 
  149     typedef std::map<std::string, PrimitiveElement*> AllSwitches;
 
  150     AllSwitches allSwitches;
 
  152     typedef std::map<std::string, PrimitiveElement*> AllOrphans;
 
  153     AllOrphans allOrphans;
 
  155     typedef std::map<std::string, PrimitiveElement*> AllMuxes;
 
  158     typedef std::map<std::string, PrimitiveElement*> AllInverters;
 
  159     AllInverters allInverters;
 
  161     typedef std::map<std::string, PrimitiveElement*> AllLuts;
 
  164     typedef std::map<std::string, PrimitiveElement*> AllFlops;
 
  167     typedef std::map<std::string, PrimitiveElement*> AllMains;
 
  170     typedef std::map<std::string, PrimitiveElement*> AllAnds;
 
  173     typedef std::map<std::string, PrimitiveElement*> AllVccs;
 
  176     typedef std::map<std::string, PrimitiveElement*> AllGnds;
 
  187         const PrimitivePinArray& primitivePins = primitiveDef.
getPins();
 
  192         std::vector<std::string> primitivePinNames; 
 
  193         std::vector<std::string>::const_iterator spe = unique(primitivePinNames.begin(), primitivePinNames.end());
 
  197         if(primitivePins.
getSize() > 0) {
 
  201                 primitivePinNames.push_back(primitivePin.
getName());          
 
  225                     allElements.erase(element.
getName());
 
  236                 int totalPinCount = 0;          
 
  245                 std::vector<std::string> elementPinNames;   
 
  246                 std::vector<std::string>::const_iterator ppe = unique(elementPinNames.begin(), elementPinNames.end());
 
  256                         typedef std::set<std::string> StringSet;        
 
  257                         const StringSet elementCfgs = element.
getCfgs();        
 
  258                         StringSet::const_iterator cp = elementCfgs.begin();     
 
  259                         StringSet::const_iterator ce = elementCfgs.end();
 
  266                             if(elementPin.
getName() == isit){       
 
  268                                     elementPinNames.push_back(elementPin.
getName());          
 
  272                                     elementPinNames.push_back(elementPin.
getName());          
 
  279                             cfgSize = elementCfgs.size();
 
  280                             if(!elementCfgs.empty()) notEmpty = 1;
 
  304                         allElements.erase(element.
getName());
 
  305                         }
else if(isINV == 1){       
 
  309                         allElements.erase(element.
getName());
 
  310                     }
else if(isINV == 0){       
 
  313                         allElements.erase(element.
getName());
 
  317                     for(std::vector<std::string>::const_iterator b = elementPinNames.begin(); b != elementPinNames.end(); b++) {        
 
  322                         if(countPins != cfgSize) 
throw 0;
 
  325                 }
else if(isLUT == 1){
 
  328                     allElements.erase(element.
getName());
 
  332                     allElements.erase(element.
getName());      
 
  334                 if(totalPinCount == 0){
 
  337                     allElements.erase(element.
getName());
 
  341                     allElements.erase(element.
getName());
 
  345                     allElements.erase(element.
getName());
 
  349                     allElements.erase(element.
getName());
 
  353                     allElements.erase(element.
getName());
 
  355                 for(std::vector<std::string>::const_iterator s = primitivePinNames.begin(); s != primitivePinNames.end(); s++) {        
 
  359                         allElements.erase(element.
getName());
 
  369     std::map<std::string, PrimitiveElement*>::const_iterator pos;
 
  370     std::cout << 
"------ UNCLASSIFIED ELEMENTS -------" <<std::endl;
 
  371     for(pos = allElements.begin(); pos != allElements.end(); ++pos) {
 
  372         std::cout << 
"Element: " << pos->first << std::endl;
 
  375     std::cout << std::endl;
 
  376     std::cout << 
"------ MUXES -------" <<std::endl;
 
  377     for(pos = allMuxes.begin(); pos != allMuxes.end(); ++pos) {
 
  378         std::cout << 
"Element: " << pos->first  << std::endl; 
 
  381     std::cout << std::endl;
 
  382     std::cout << 
"------ LUTS -------" <<std::endl;
 
  383     for(pos = allLuts.begin(); pos != allLuts.end(); ++pos) {
 
  384             std::cout << 
"Element: " << pos->first  << std::endl; 
 
  387     std::cout << std::endl;
 
  388     std::cout << 
"------ FLOPS -------" <<std::endl;
 
  389     for(pos = allFlops.begin(); pos != allFlops.end(); ++pos) {
 
  390         std::cout << 
"Element: " << pos->first  << std::endl; 
 
  393     std::cout << std::endl;
 
  394     std::cout << 
"------ TERMINALS -------" <<std::endl;
 
  395     for(pos = allTerminals.begin(); pos != allTerminals.end(); ++pos) {
 
  396         std::cout << 
"Element: " << pos->first  << std::endl; 
 
  399     std::cout << std::endl;
 
  400     std::cout << 
"------ SWITCHES -------" <<std::endl;
 
  401     for(pos = allSwitches.begin(); pos != allSwitches.end(); ++pos) {
 
  402         std::cout << 
"Element: " << pos->first  << std::endl; 
 
  405     std::cout << std::endl;
 
  406     std::cout << 
"------ ANDS -------" <<std::endl;
 
  407     for(pos = allAnds.begin(); pos != allAnds.end(); ++pos) {
 
  408         std::cout << 
"Element: " << pos->first  << std::endl; 
 
  411     std::cout << std::endl;
 
  412     std::cout << 
"------ VCCS -------" <<std::endl;
 
  413     for(pos = allVccs.begin(); pos != allVccs.end(); ++pos) {
 
  414         std::cout << 
"Element: " << pos->first  << std::endl; 
 
  417         std::cout << std::endl;
 
  418     std::cout << 
"------ GNDS -------" <<std::endl;
 
  419     for(pos = allGnds.begin(); pos != allGnds.end(); ++pos) {
 
  420         std::cout << 
"Element: " << pos->first  << std::endl; 
 
  444         PrimitiveDefArray& primitiveDefs = sites.
getSiteTypes();
 
  445         PrimitiveDefArray::const_iterator p = primitiveDefs.begin();
 
  446         PrimitiveDefArray::const_iterator e = primitiveDefs.end();
 
  452         std::cout << i << 
": " << primitiveDef.
getName() << std::endl;
 
  455         const PrimitivePinArray& primitivePins = primitiveDef.
getPins();
 
  459         if(
false && primitivePins.
getSize() > 0) {
 
  464                 std::cout << primitivePin.
getName() << 
" ";
 
  465                 std::cout << primitivePin.
getFlags() << 
" ";
 
  467             std::cout << std::endl;
 
  475         if(
true && elements.
getSize() > 0) {
 
  479                 std::cout << 
"ELEMENT NAME:" << element.
getName() << 
" "<< std::endl;
 
  513                     std::cout << std::endl;
 
  516             std::cout << std::endl;
 
  522         while(
true && ccp < cce) {
 
  527             PrimitiveElementPinPtrVector::const_iterator epp = sinks.begin();
 
  528             PrimitiveElementPinPtrVector::const_iterator epe = sinks.end();
 
  533             std::cout << std::endl;
 
  541 BOOST_AUTO_TEST_SUITE_END()
 
const PrimitiveElementPinPtrVector & getSinks(void) const 
Returns a vector of pointers to the sink primitive element pins. 
 
bool findROUTETHROUGH(const std::string isit)
 
PinFlags getFlags(void) const 
Returns the pin direction flags. 
 
const const PrimitivePin * const_iterator
Constant T iterator type. 
 
Header for the ConfigMap class. 
 
Device database, including complete wiring and logic support. 
 
BOOST_AUTO_TEST_CASE(ArcUnitTest)
Unit test for the Arc class. 
 
const PrimitiveElementPin * getSourcePtr(void) const 
Returns a pointer to the source primitive element pin. 
 
DesignSharedPtr getDesignPtr(void)
Returns a shared pointer for the design. 
 
Header for the DirectoryTree class. 
 
Header for the Instance class. 
 
Encapsulation of primitive site definition, with associated connections, elements, and pins. 
 
T * end(void)
Returns the non-constant end iterator. 
 
Header for the Sites class. 
 
InstanceSharedPtrVector::const_iterator InstanceSharedPtrConstIterator
Constant iterator to Instance shared pointers. 
 
bool findAND(const std::string isit)
 
bool findFFbyCfg(const std::string isit)
 
bool findINV(const std::string isit)
 
const string & getName(void) const 
Returns the pin name. 
 
const Sites & getSites(void) const 
Returns a constant reference to the family and device site data. 
 
const string & getName(void) const 
Returns the pin name. 
 
const_iterator const_iterator
Constant iterator to {setting,Config} pairs. 
 
const string & getName(void) const 
Returns the name of the element. 
 
PrimitiveElementPinArray & getPins(void)
Returns a non-constant array of element pins.  This function should only be used by the Sites class d...
 
Architecture aware importer from XDL format into a physical design. 
 
const Array< const PrimitiveDef > & getSiteTypes(void) const 
Returns the site types for this family. 
 
bool findGND(const std::string isit)
 
bool isInput(void) const 
Returns true if this pin is a primitive input. 
 
const PrimitiveConnSharedPtrArray & getConnections(void) const 
Returns a constant array of primitive connection shared pointers. 
 
Site type and population data for the family and the device. 
 
Header for the Design class. 
 
Encapsulation of a PrimitiveDef internal connection.  This class is analogous to a permanent net with...
 
Header for the Named class. 
 
Array< const PrimitivePin > PrimitivePinArray
Array of constant PrimitivePin objects. 
 
const PrimitiveElement * getElementPtr(void) const 
Returns a pointer to the primitive element that owns this pin. 
 
PrimitivePinArray & getPins(void)
Returns a non-constant array of element pins.  This function should only be used by the Sites class d...
 
boost::filesystem::path path
 
boost::shared_ptr< Instance > InstanceSharedPtr
Shared pointer encapsulation of an Instance. 
 
boost::shared_ptr< Design > DesignSharedPtr
Shared pointer encapsulation of a Design. 
 
Encapsulation of a primitive pin's name and flags.  Primitive pins are logic site inputs or outputs...
 
const PrimitiveElementArray & getElements(void) const 
Returns a constant array of primitive elements. 
 
Encapsulation of a primitive site element.  Primitive elements are subcomponents of logic primitive s...
 
Encapsulation of a primitive element pin's name, flags, and element pointer.  Primitive element pins ...
 
bool findLUTbyCfg(const std::string isit)
 
T * begin(void)
Returns the non-constant begin iterator. 
 
Header for the DDB class. 
 
const StringSet & getCfgs(void) const 
Returns the set of allowable configuration values. 
 
Header for the Circuit class. 
 
std::vector< const PrimitiveElementPin * > PrimitiveElementPinPtrVector
Vector of constant PrimitiveElementPin pointers. 
 
bool findVCC(const std::string isit)
 
Header for the XdlImporter class. 
 
static const boost::filesystem::path & getExecutablePath(void)
Returns the absolute path to the executable directory. 
 
Encapsulation of a static array. 
 
uint32_t getSize(void) const 
Returns the array size. 
 
const string & getName(void) const 
Returns the name of the primitive.