19 #include <boost/test/unit_test.hpp>
32 BOOST_AUTO_TEST_SUITE(packer)
37 using namespace torc::architecture;
50 typedef std::map<std::string, PrimitiveStructureSharedPtr> PrimitiveStructuresSharedPtrMap;
51 PrimitiveStructuresSharedPtrMap primitiveStructures;
54 PrimitiveDefArray& primitiveDefs = sites.getSiteTypes();
55 PrimitiveDefArray::const_iterator p = primitiveDefs.
begin();
56 PrimitiveDefArray::const_iterator e = primitiveDefs.end();
61 = primitiveStructurePtr->getPrimitiveDefPtr();
64 primitiveStructures[primitiveDefName] = primitiveStructurePtr;
69 PrimitiveStructuresSharedPtrMap::iterator psp = primitiveStructures.begin();
70 PrimitiveStructuresSharedPtrMap::iterator pse = primitiveStructures.end();
75 (void) primitiveStructurePtr;
89 using namespace torc::architecture;
92 /
"torc" /
"physical" /
"DesignUnitTest.reference.xdl";
94 /
"regression" /
"DesignUnitTest.generated.xdl";
97 std::fstream fileStream(referencePath.string().c_str());
98 BOOST_REQUIRE(fileStream.good());
100 importer(fileStream, referencePath.string());
104 BOOST_REQUIRE(designPtr.get() != 0);
107 DDB* ddbPtr = importer.releaseDDBPtr();
112 typedef std::map<std::string, PrimitiveStructureSharedPtr> PrimitiveStructuresSharedPtrMap;
113 PrimitiveStructuresSharedPtrMap primitiveStructures;
116 PrimitiveDefArray& primitiveDefs = sites.getSiteTypes();
117 PrimitiveDefArray::const_iterator p = primitiveDefs.
begin();
118 PrimitiveDefArray::const_iterator e = primitiveDefs.end();
123 = primitiveStructurePtr->getPrimitiveDefPtr();
126 primitiveStructures[primitiveDefName] = primitiveStructurePtr;
131 = designPtr->findInstance(
"blink");
132 if(instancePtrIterator == designPtr->instancesEnd())
return;
135 const PrimitiveDef* primitiveDefPtr = primitiveStructurePtr->getPrimitiveDefPtr();
136 if(primitiveDefPtr == 0)
return;
148 Instance::InstancePinSharedPtrConstIterator ipp = instancePtr->pinsBegin();
149 Instance::InstancePinSharedPtrConstIterator ipe = instancePtr->pinsEnd();
153 const std::string& pinName = instancePinPtr->getPinName();
154 NetSharedPtr netPtr = instancePinPtr->getParentWeakPtr().lock();
155 std::cout <<
" found " << pinName <<
" connected to net " << netPtr->getName() <<
": ";
157 PinIndex pinIndex = primitiveDefPtr->findPinIndexByName(pinName);
158 if(static_cast<boost::int32_t>(pinIndex) < 0)
continue;
159 const PrimitivePin& primitivePin = primitivePins[pinIndex];
160 if(primitivePin.
isInput()) inputPins.push_back(instancePinPtr);
161 if(primitivePin.
isOutput()) outputPins.push_back(instancePinPtr);
162 std::cout << (primitivePin.
isInput() ?
"INPUT" : (primitivePin.
isOutput() ?
"OUTPUT" :
""))
167 InstancePinSharedPtrVector::const_iterator ip;
168 InstancePinSharedPtrVector::const_iterator ie;
169 ip = inputPins.begin();
170 ie = inputPins.end();
176 ip = outputPins.begin();
177 ie = outputPins.end();
186 BOOST_AUTO_TEST_SUITE_END()
bool isOutput(void) const
Returns true if this pin is a primitive output.
Device database, including complete wiring and logic support.
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.
std::vector< InstancePinSharedPtr > InstancePinSharedPtrVector
Vector of InstancePin shared pointers.
Header for the PrimitiveStructure class.
bool isInput(void) const
Returns true if this pin is a primitive input.
Encapsulation of a pin index in an unsigned 32-bit integer.
boost::shared_ptr< class InstancePin > InstancePinSharedPtr
Shared pointer encapsulation of an InstancePin.
const Sites & getSites(void) const
Returns a constant reference to the family and device site data.
Architecture aware importer from XDL format into a physical design.
std::vector< InstancePinSharedPtr > InstancePinSharedPtrVector
Vector of InstancePin shared pointers.
Physical design instance.
boost::shared_ptr< Net > NetSharedPtr
Site type and population data for the family and the device.
const Array< const Site > & getSites(void) const
Returns the sites for this family.
boost::shared_ptr< Net > NetSharedPtr
Shared pointer encapsulation of a Net.
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...
BOOST_AUTO_TEST_CASE(PrimitiveStructureUnitTest)
Unit test for the PrimitiveStructure class.
T * begin(void)
Returns the non-constant begin iterator.
boost::shared_ptr< PrimitiveStructure > PrimitiveStructureSharedPtr
Shared pointer encapsulation of a PrimitiveStructure.
Header for the DDB class.
Encapsulation of the site index, pin name, and pin flags for a package.
Header for the Net class.
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.
boost::shared_ptr< InstancePin > InstancePinSharedPtr
Shared pointer encapsulation of an InstancePin.
InstanceSharedPtrVector::iterator InstanceSharedPtrIterator
Non-constant iterator to Instance shared pointers.
const string & getName(void) const
Returns the name of the primitive.