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

Namespace for the Torc architecture support, providing device logic and wiring information, and design usage tracking. More...

Namespaces

 architecture
 
 xilinx
 Namespace for Xilinx architecture support.
 

Data Structures

class  Arc
 Encapsulation of an arc between two tilewires. More...
 
class  InvalidArcException
 
class  ArcUsage
 Encapsulation the design arc usage. More...
 
class  Array
 Encapsulation of a static array. More...
 
class  Array2D
 Encapsulation of a 2D static array. More...
 
class  DDB
 Device database, including complete wiring and logic support. More...
 
class  DDBConsoleStreams
 Device database console streams class. More...
 
class  DDBStreamHelper
 Device database stream helper class. More...
 
class  DigestStream
 Encapsulation of a device or family digest stream. More...
 
class  ExtendedWireInfo
 Verbose encapsulation of a wire's information. More...
 
class  InstancePin
 Physical design instance-pin pair, suitable for specifying a net endpoint. More...
 
class  Package
 Encapsulation of a physical device package and its pins. More...
 
class  Pad
 Encapsulation of the site index, pin name, and pin flags for a package. More...
 
class  PrimitiveConn
 Encapsulation of a PrimitiveDef internal connection. This class is analogous to a permanent net with one and only source pin. All PrimitiveConn objects are initialized from a family database by the Sites class. More...
 
class  PrimitiveDef
 Encapsulation of primitive site definition, with associated connections, elements, and pins. More...
 
class  PrimitiveElement
 Encapsulation of a primitive site element. Primitive elements are subcomponents of logic primitive sites. More...
 
class  PrimitiveElementPin
 Encapsulation of a primitive element pin's name, flags, and element pointer. Primitive element pins are sub-site inputs or outputs. More...
 
class  PinDirection
 
class  PrimitivePin
 Encapsulation of a primitive pin's name and flags. Primitive pins are logic site inputs or outputs. More...
 
class  Segments
 Segment and irregular arc data for the device. More...
 
class  segments_regression_test_helper
 Regression test class for segments consistency across all devices. More...
 
class  segments_unit_test_helper
 
class  Site
 Encapsulation of a device logic site. More...
 
class  Sites
 Site type and population data for the family and the device. More...
 
class  TileInfo
 Encapsulation of a tile within a device tile map. More...
 
class  Tiles
 Tile map, tile type, and wire information for the family and device. More...
 
class  Tilewire
 Encapsulation of a device tile and wire pair. More...
 
class  Versions
 Encapsulation of database version information. More...
 
class  VprExporter
 Device database exporter for the University of Toronto's VPR. More...
 
class  WireArray
 Array of wire indexes. More...
 
class  WireInfo
 Encapsulation of a wire within a tile type. More...
 
class  WireUsage
 Encapsulation the design wire usage. More...
 
class  XdlImporter
 Architecture aware importer from XDL format into a physical design. More...
 

Typedefs

typedef std::vector< ArcArcVector
 Vector of Arc objects. More...
 
typedef boost::shared_ptr
< InstancePin
InstancePinSharedPtr
 Shared pointer encapsulation of an InstancePin. More...
 
typedef boost::weak_ptr
< InstancePin
InstancePinWeakPtr
 Weak pointer encapsulation of an InstancePin. More...
 
typedef std::vector
< InstancePinSharedPtr
InstancePinSharedPtrVector
 Vector of InstancePin shared pointers. More...
 
typedef Array< const PadPadArray
 Array of constant Pad objects. More...
 
typedef Array
< PrimitiveConnSharedPtr
PrimitiveConnSharedPtrArray
 Array of shared pointers to PrimitiveConn objects. More...
 
typedef Array< const
PrimitiveElement
PrimitiveElementArray
 Array of constant PrimitiveElement objects. More...
 
typedef boost::shared_ptr
< const PrimitiveConn
PrimitiveConnSharedPtr
 
typedef Array< const
PrimitiveElementPin
PrimitiveElementPinArray
 Array of constant PrimitiveElementPin objects. More...
 
typedef std::vector< const
PrimitiveElementPin * > 
PrimitiveElementPinPtrVector
 Vector of constant PrimitiveElementPin pointers. More...
 
typedef Array< const PrimitivePinPrimitivePinArray
 Array of constant PrimitivePin objects. More...
 
typedef std::vector< TilewireTilewireVector
 Vector of Tilewire objects. More...
 

Functions

std::size_t hash_value (const Arc &inArc)
 
 BOOST_AUTO_TEST_CASE (ArcUnitTest)
 Unit test for the Arc class. More...
 
 BOOST_AUTO_TEST_CASE (ArcUsageUnitTest)
 Unit test for the ArcUsage class. More...
 
 BOOST_AUTO_TEST_CASE (ArrayUnitTest)
 Unit test for the Array class. More...
 
std::ostream & operator<< (std::ostream &os, const DDB &ddb)
 
std::ostream & operator<< (std::ostream &os, const class DDB &ddb)
 Insertion operator to associate the given device database with the given stream. More...
 
 BOOST_AUTO_TEST_CASE (DDBStreamHelperUnitTest)
 Unit test for the DDBStreamHelper class. More...
 
void testDevice (const std::string &inDeviceName)
 
 BOOST_AUTO_TEST_CASE (DDBUnitTest)
 Unit test for the DDB class. More...
 
 BOOST_AUTO_TEST_CASE (DigestStreamUnitTest)
 Unit test for the DigestStream class. More...
 
 BOOST_AUTO_TEST_CASE (ExtendedWireInfoUnitTest)
 Unit test for the ExtendedWireInfo class. More...
 
 BOOST_AUTO_TEST_CASE (InstancePinUnitTest)
 Unit test for the InstancePin class. More...
 
std::ostream & operator<< (std::ostream &os, const Tilewire &rhs)
 Tilewire stream inserter. More...
 
std::ostream & operator<< (std::ostream &os, const ExtendedWireInfo &rhs)
 ExtendedWireInfo stream inserter. More...
 
std::ostream & operator<< (std::ostream &os, const Arc &rhs)
 Arc stream inserter. More...
 
 BOOST_AUTO_TEST_CASE (OutputStreamHelpersUnitTest)
 Unit test for the output stream helpers. More...
 
 BOOST_AUTO_TEST_CASE (PackageUnitTest)
 Unit test for the Package class. More...
 
 BOOST_AUTO_TEST_CASE (PadUnitTest)
 Unit test for the Pad class. More...
 
 BOOST_AUTO_TEST_CASE (PrimitiveConnUnitTest)
 Unit test for the PrimitiveConn class. More...
 
 BOOST_AUTO_TEST_CASE (PrimitiveDefUnitTest)
 Unit test for the PrimitiveDef class. More...
 
 BOOST_AUTO_TEST_CASE (PrimitiveElementPinUnitTest)
 Unit test for the PrimitiveElementPin class. More...
 
 BOOST_AUTO_TEST_CASE (PrimitiveElementUnitTest)
 Unit test for the Sites class. More...
 
 BOOST_AUTO_TEST_CASE (PrimitivePinUnitTest)
 Unit test for the PrimitivePin class. More...
 
 BOOST_AUTO_TEST_CASE (SegmentsRegressionTest)
 Regression test for the Segments class. More...
 
 BOOST_AUTO_TEST_CASE (SitesUnitTest)
 Unit test for the Sites class. More...
 
 BOOST_AUTO_TEST_CASE (iterate_configmaps)
 Unit test to iterate through the ConfigMaps of a XDL file. More...
 
bool findLUTbyCfg (const std::string isit)
 
bool findFFbyCfg (const std::string isit)
 
bool findINV (const std::string isit)
 
bool findROUTETHROUGH (const std::string isit)
 
bool findAND (const std::string isit)
 
bool findVCC (const std::string isit)
 
bool findGND (const std::string isit)
 
 BOOST_AUTO_TEST_CASE (classify_elements)
 Unit test to iterate through a database and classify all existing elements into pseudo-types. More...
 
 BOOST_AUTO_TEST_CASE (SiteTypesUnitTest)
 Unit test for the SiteTypes class. More...
 
 BOOST_AUTO_TEST_CASE (SiteUnitTest)
 Unit test for the Site class. More...
 
 BOOST_AUTO_TEST_CASE (TileInfoUnitTest)
 Unit test for the TileInfo class. More...
 
void testDeviceTiles (DDB &inDDB)
 
 BOOST_AUTO_TEST_CASE (TilesUnitTest)
 Unit test for the Tiles class. More...
 
std::size_t hash_value (const Tilewire &inTilewire)
 
 BOOST_AUTO_TEST_CASE (VersionsUnitTest)
 Unit test for the Versions class. More...
 
 BOOST_AUTO_TEST_CASE (GenerateVprRoutingGraph)
 Experimental VPR routing graph exporter. More...
 
 BOOST_AUTO_TEST_CASE (WireInfoUnitTest)
 Unit test for the WireInfo class. More...
 
 BOOST_AUTO_TEST_CASE (WireUsageUnitTest)
 Unit test for the WireUsage class. More...
 
 BOOST_AUTO_TEST_CASE (XdlImporterUnitTest)
 Unit test for the device-aware XdlImporter class. More...
 

Detailed Description

Namespace for the Torc architecture support, providing device logic and wiring information, and design usage tracking.

Typedef Documentation

typedef std::vector<Arc> torc::architecture::ArcVector

Vector of Arc objects.

Definition at line 78 of file Arc.hpp.

Shared pointer encapsulation of an InstancePin.

Definition at line 66 of file architecture/InstancePin.hpp.

Vector of InstancePin shared pointers.

Definition at line 72 of file architecture/InstancePin.hpp.

Weak pointer encapsulation of an InstancePin.

Definition at line 69 of file architecture/InstancePin.hpp.

Array of constant Pad objects.

Definition at line 70 of file Pad.hpp.

Definition at line 36 of file PrimitiveElementPin.hpp.

Array of shared pointers to PrimitiveConn objects.

Definition at line 53 of file PrimitiveConn.hpp.

Array of constant PrimitiveElement objects.

Definition at line 94 of file PrimitiveElement.hpp.

Vector of constant PrimitiveElementPin pointers.

Definition at line 91 of file PrimitiveElementPin.hpp.

Array of constant PrimitivePin objects.

Definition at line 81 of file architecture/PrimitivePin.hpp.

Vector of Tilewire objects.

Definition at line 101 of file Tilewire.hpp.

Function Documentation

torc::architecture::BOOST_AUTO_TEST_CASE ( ExtendedWireInfoUnitTest  )

Unit test for the ExtendedWireInfo class.

Definition at line 28 of file ExtendedWireInfoUnitTest.cpp.

28  {
29 }
torc::architecture::BOOST_AUTO_TEST_CASE ( PadUnitTest  )

Unit test for the Pad class.

Definition at line 28 of file PadUnitTest.cpp.

28  {
29  // members tested:
30  // SiteIndex mSiteIndex;
31  // string mName;
32  // SiteFlags mFlags;
33  // functions tested:
34  // Pad(SiteIndex inSiteIndex, const string& inName, SiteFlags inFlags);
35  // Pad(void);
36  // SiteIndex getSiteIndex(void) const;
37  // const string& getName(void) const;
38  // SiteFlags getFlags(void) const;
39  xilinx::SiteIndex siteIndex(15);
40  std::string name("name");
41  xilinx::SiteFlags flags(3);
42  Pad pad1(siteIndex, name, flags);
43  BOOST_CHECK_EQUAL(pad1.getSiteIndex(), siteIndex);
44  BOOST_CHECK_EQUAL(pad1.getName(), name);
45  BOOST_CHECK_EQUAL(pad1.getFlags(), flags);
46  Pad pad2;
47  BOOST_CHECK_EQUAL(pad2.getSiteIndex(), xilinx::SiteIndex());
48  BOOST_CHECK_EQUAL(pad2.getName(), "");
49  BOOST_CHECK_EQUAL(pad2.getFlags(), xilinx::SiteFlags());
50 }
std::string string

+ Here is the call graph for this function:

torc::architecture::BOOST_AUTO_TEST_CASE ( PrimitiveConnUnitTest  )

Unit test for the PrimitiveConn class.

Definition at line 28 of file PrimitiveConnUnitTest.cpp.

28  {
29  // members tested:
30  // const PrimitiveElementPin* mSourcePtr;
31  // PrimitiveElementPinPtrVector mSinks;
32  // functions tested:
33  // const PrimitiveElementPin* getSourcePtr(void) const
34  // const PrimitiveElementPinPtrVector& getSinks(void) const
35  PrimitiveElementPin pin1;
36  PrimitiveElementPin pin2;
37  PrimitiveElementPin pin3;
38  PrimitiveConn conn;
39  conn.mSourcePtr = &pin1;
40  conn.mSinks.push_back(&pin2);
41  conn.mSinks.push_back(&pin3);
42  BOOST_CHECK_EQUAL(conn.getSourcePtr(), &pin1);
43  const PrimitiveElementPinPtrVector& sinks = conn.getSinks();
44  PrimitiveElementPinPtrVector::const_iterator p = sinks.begin();
45  BOOST_CHECK_EQUAL(*p++, &pin2);
46  BOOST_CHECK_EQUAL(*p++, &pin3);
47  BOOST_CHECK(p == sinks.end());
48 }
std::vector< const PrimitiveElementPin * > PrimitiveElementPinPtrVector
Vector of constant PrimitiveElementPin pointers.

+ Here is the call graph for this function:

torc::architecture::BOOST_AUTO_TEST_CASE ( TileInfoUnitTest  )

Unit test for the TileInfo class.

Todo:
Write a unit test for torc::architecture::TileInfo.
Todo:
Write a unit test for torc::architecture::TileInfo.

Definition at line 28 of file TileInfoUnitTest.cpp.

28  {
29  // functions tested:
30  // friend uint32_t distance(const TileInfo& inA, const TileInfo& inB);
31  // create a few TileInfo objects
32  typedef xilinx::TileTypeIndex TileTypeIndex;
33  typedef xilinx::TileRow TileRow;
34  typedef xilinx::TileCol TileCol;
35  TileInfo tileInfo1; tileInfo1.set(TileTypeIndex(1), TileRow( 0), TileCol( 0), "tile1");
36  TileInfo tileInfo2; tileInfo2.set(TileTypeIndex(2), TileRow(10), TileCol(10), "tile2");
37  TileInfo tileInfo3; tileInfo3.set(TileTypeIndex(3), TileRow(30), TileCol( 0), "tile3");
38  BOOST_CHECK_EQUAL(manhattanDistance(tileInfo1, tileInfo2), uint32_t(20));
39  BOOST_CHECK_EQUAL(manhattanDistance(tileInfo1, tileInfo2),
40  manhattanDistance(tileInfo2, tileInfo1));
41  BOOST_CHECK_EQUAL(manhattanDistance(tileInfo1, tileInfo3), uint32_t(30));
42  BOOST_CHECK_EQUAL(manhattanDistance(tileInfo1, tileInfo3),
43  manhattanDistance(tileInfo3, tileInfo1));
44  BOOST_CHECK_EQUAL(manhattanDistance(tileInfo2, tileInfo3), uint32_t(30));
45  BOOST_CHECK_EQUAL(manhattanDistance(tileInfo2, tileInfo3),
46  manhattanDistance(tileInfo3, tileInfo2));
47 }

+ Here is the call graph for this function:

torc::architecture::BOOST_AUTO_TEST_CASE ( PrimitiveElementPinUnitTest  )

Unit test for the PrimitiveElementPin class.

Todo:
Test mPrimitiveConn and getPrimitiveConn. Do a better job testing mElementPtr and getElementPtr.

Definition at line 28 of file PrimitiveElementPinUnitTest.cpp.

28  {
29  /// \todo Test mPrimitiveConn and getPrimitiveConn. Do a better job testing mElementPtr and
30  /// getElementPtr.
31  // members not tested:
32  // const PrimitiveConnSharedPtr mPrimitiveConn;
33  // functions not tested:
34  // const PrimitiveConnSharedPtr getPrimitiveConn(void) const { return mPrimitiveConn; }
35 
36  // members tested:
37  // const PrimitiveElement* mElementPtr;
38  // string mName;
39  // PinFlags mFlags;
40  // functions tested:
41  // PrimitiveElementPin(const string& inName, PinFlags inFlags);
42  // const PrimitiveElement* getElementPtr(void) const;
43  // const string& getName(void) const;
44  // PinFlags getFlags(void) const;
45  // PrimitiveElementPin(void);
46  // bool isInput(void) const;
47  // bool isOutput(void) const;
48  std::string name = "name";
49  xilinx::PinFlags flags(PinDirection::ePinDirectionOutput);
50  PrimitiveElementPin pin1(0, name, flags);
51  BOOST_CHECK_EQUAL(pin1.getElementPtr(), static_cast<void*>(0));
52  BOOST_CHECK_EQUAL(pin1.getName(), name);
53  BOOST_CHECK_EQUAL(pin1.getFlags(), flags);
54  BOOST_CHECK(pin1.isInput() == false);
55  BOOST_CHECK(pin1.isOutput() == true);
56  PrimitiveElementPin pin2;
57  BOOST_CHECK_EQUAL(pin2.getElementPtr(), static_cast<void*>(0));
58  BOOST_CHECK_EQUAL(pin2.getName(), "");
59  BOOST_CHECK_EQUAL(pin2.getFlags(), xilinx::PinFlags(0));
60  BOOST_CHECK(pin2.isInput() == false);
61  BOOST_CHECK(pin2.isOutput() == false);
62 }
std::string string

+ Here is the call graph for this function:

torc::architecture::BOOST_AUTO_TEST_CASE ( PrimitivePinUnitTest  )

Unit test for the PrimitivePin class.

Definition at line 28 of file PrimitivePinUnitTest.cpp.

28  {
29  // members tested:
30  // string mName;
31  // PinFlags mFlags;
32  // functions tested:
33  // PrimitivePin(const string& inName, PinFlags inFlags);
34  // const string& getName(void) const;
35  // PinFlags getFlags(void) const;
36  // PrimitivePin(void);
37  // bool isInput(void) const;
38  // bool isOutput(void) const;
39  std::string name = "name";
40  xilinx::PinFlags flags(PinDirection::ePinDirectionOutput);
41  PrimitivePin pin1(name, flags);
42  BOOST_CHECK_EQUAL(pin1.getName(), name);
43  BOOST_CHECK_EQUAL(pin1.getFlags(), flags);
44  BOOST_CHECK(pin1.isInput() == false);
45  BOOST_CHECK(pin1.isOutput() == true);
46  PrimitivePin pin2;
47  BOOST_CHECK_EQUAL(pin2.getName(), "");
48  BOOST_CHECK_EQUAL(pin2.getFlags(), xilinx::PinFlags(0));
49  BOOST_CHECK(pin2.isInput() == false);
50  BOOST_CHECK(pin2.isOutput() == false);
51 }
std::string string

+ Here is the call graph for this function:

torc::architecture::BOOST_AUTO_TEST_CASE ( PackageUnitTest  )

Unit test for the Package class.

Definition at line 29 of file PackageUnitTest.cpp.

29  {
30  // members tested:
31  // string mName;
32  // PadArray mPads;
33  // PadNameToPadIndexMap mPadNameToPadIndex;
34  // functions tested:
35  // Package(const string& inName);
36  // PadArray& getPads(void);
37  // const string& getName(void) const;
38  // const PadArray& getPads(void) const;
39  // PadIndex findPadIndexByName(const string& inName) const;
40  int index = 0;
41  std::string name1("pad1");
42  std::string name2("pad2");
43  std::string name3("pad3");
44  Pad pad1(xilinx::SiteIndex(), name1, xilinx::SiteFlags());
45  Pad pad2(xilinx::SiteIndex(), name2, xilinx::SiteFlags());
46  Pad pad3(xilinx::SiteIndex(), name3, xilinx::SiteFlags());
47  std::string name("name");
48  Package package1(name);
49  PadArray& pads1 = package1.getPads();
50  pads1.setSize(3);
51  package1.mPadNameToPadIndex[name1] = xilinx::PadIndex(index);
52  const_cast<Pad&>(pads1[index++]) = pad1;
53  package1.mPadNameToPadIndex[name2] = xilinx::PadIndex(index);
54  const_cast<Pad&>(pads1[index++]) = pad2;
55  package1.mPadNameToPadIndex[name3] = xilinx::PadIndex(index);
56  const_cast<Pad&>(pads1[index++]) = pad3;
57  BOOST_CHECK_EQUAL(package1.getName(), name);
58  const PadArray& pads2 = package1.getPads();
59  index = 0;
60  BOOST_CHECK_EQUAL(pads2[index++].getName(), pad1.getName());
61  BOOST_CHECK_EQUAL(pads2[index++].getName(), pad2.getName());
62  BOOST_CHECK_EQUAL(pads2[index++].getName(), pad3.getName());
63  BOOST_CHECK_EQUAL(package1.findPadIndexByName(name1), xilinx::PadIndex(0));
64  BOOST_CHECK_EQUAL(package1.findPadIndexByName(name2), xilinx::PadIndex(1));
65  BOOST_CHECK_EQUAL(package1.findPadIndexByName(name3), xilinx::PadIndex(2));
66 
67  // functions tested:
68  // Package(void);
69  // PadArray& getPads(void);
70  Package package2;
71  BOOST_CHECK_EQUAL(package2.getName(), "");
72  BOOST_CHECK_EQUAL(package2.getPads().getSize(), 0u);
73 }
Array< const Pad > PadArray
Array of constant Pad objects.
Definition: Pad.hpp:70
std::string string
void setSize(uint32_t inSize)
Discards all contents and resizes the array.
Definition: Array.hpp:107

+ Here is the call graph for this function:

torc::architecture::BOOST_AUTO_TEST_CASE ( ArcUnitTest  )

Unit test for the Arc class.

Definition at line 29 of file ArcUnitTest.cpp.

29  {
30  // supporting variables
31  Tilewire tilewire1(xilinx::TileIndex(5), xilinx::WireIndex(3));
32  Tilewire tilewire2(xilinx::TileIndex(0), xilinx::WireIndex(9));
33 
34  // members tested:
35  // Tilewire mSourceTilewire;
36  // Tilewire mSinkTilewire;
37  // functions tested:
38  // Arc(void);
39  // Arc(const Tilewire& inSourceTilewire, const Tilewire& inSinkTilewire);
40  // bool operator ==(const Arc& rhs) const;
41  // bool operator <(const Arc& rhs) const;
42  // bool isUndefined(void) const;
43  Arc arc1;
44  Arc arc2;
45  Arc arc3(tilewire1, tilewire2);
46  Arc arc4(tilewire2, tilewire1);
47  BOOST_CHECK((arc1 == arc2) == true);
48  BOOST_CHECK((arc1 == arc3) == false);
49  BOOST_CHECK((arc3 < arc4) == true);
50  BOOST_CHECK((arc4 < arc3) == false);
51  BOOST_CHECK(arc1.isUndefined());
52 
53  // functions tested:
54  // const Tilewire& getSourceTilewire(void) const;
55  // const Tilewire& getSinkTilewire(void) const;
56  BOOST_CHECK(arc3.getSourceTilewire() == tilewire1);
57  BOOST_CHECK(arc3.getSinkTilewire() == tilewire2);
58 
59  // functions tested:
60  // friend std::size_t hash_value(const Arc& inArc);
61  BOOST_CHECK_EQUAL(hash_value(arc1), hash_value(arc2));
62 }
std::size_t hash_value(const Arc &inArc)
Definition: Arc.cpp:25

+ Here is the call graph for this function:

torc::architecture::BOOST_AUTO_TEST_CASE ( SiteUnitTest  )

Unit test for the Site class.

Todo:
Write a unit test for torc::architecture::Site.

Definition at line 29 of file SiteUnitTest.cpp.

29  {
30 
31  /// \todo Write a unit test for torc::architecture::Site.
32  BOOST_REQUIRE(false);
33 
34 }
torc::architecture::BOOST_AUTO_TEST_CASE ( OutputStreamHelpersUnitTest  )

Unit test for the output stream helpers.

Definition at line 29 of file architecture/OutputStreamHelpersUnitTest.cpp.

29  {
30 }
torc::architecture::BOOST_AUTO_TEST_CASE ( PrimitiveDefUnitTest  )

Unit test for the PrimitiveDef class.

Todo:
Write a unit test for torc::architecture::PrimitiveDef.

Definition at line 29 of file PrimitiveDefUnitTest.cpp.

29  {
30  // elements not tested:
31  // std::string mName;
32  // PrimitivePinArray mPins;
33  // PrimitiveElementArray mElements;
34  // PrimitiveConnSharedPtrArray mConnections;
35  // PinNameToPinIndexMap mPinNameToPinIndex;
36  // functions not tested:
37  // PrimitivePinArray& getPins(void);
38  // PrimitiveDef(void);
39  // PinIndex findPinIndexByName(const std::string& inName) const;
40  // const string& getName(void) const;
41  // const PrimitivePinArray& getPins(void) const;
42  // const PrimitiveElementArray& getElements(void) const;
43  // const PrimitiveConnSharedPtrArray& getConnections(void) const;
44  /// \todo Write a unit test for torc::architecture::PrimitiveDef.
45  BOOST_REQUIRE(false);
46 }
torc::architecture::BOOST_AUTO_TEST_CASE ( WireInfoUnitTest  )

Unit test for the WireInfo class.

Todo:
Write a unit test for torc::architecture::WireInfo.

Definition at line 29 of file WireInfoUnitTest.cpp.

29  {
30 
31  /// \todo Write a unit test for torc::architecture::WireInfo.
32  BOOST_REQUIRE(false);
33 
34 }
torc::architecture::BOOST_AUTO_TEST_CASE ( WireUsageUnitTest  )

Unit test for the WireUsage class.

Todo:
Write a unit test for torc::architecture::WireUsage.

Definition at line 29 of file WireUsageUnitTest.cpp.

29  {
30 
31  /// \todo Write a unit test for torc::architecture::WireUsage.
32  BOOST_REQUIRE(false);
33 
34 }
torc::architecture::BOOST_AUTO_TEST_CASE ( PrimitiveElementUnitTest  )

Unit test for the Sites class.

Todo:
Write a unit test for torc::architecture::PrimitiveElement.

Definition at line 29 of file PrimitiveElementUnitTest.cpp.

29  {
30  // members not tested:
31  // string mName;
32  // PrimitiveElementPinArray mPins;
33  // StringSet mCfgs;
34  // bool mIsBel;
35  // PinNameToPinIndexMap mPinNameToPinIndex;
36  // functions not tested:
37  // PrimitiveElementPinArray& getPins(void);
38  // PrimitiveElement(void);
39  // PinIndex findPinIndexByName(const string& inName) const;
40  // const string& getName(void) const;
41  // const PrimitiveElementPinArray& getPins(void) const;
42  // const StringSet& getCfgs(void) const;
43  // bool isBel(void) const;
44  /// \todo Write a unit test for torc::architecture::PrimitiveElement.
45  BOOST_REQUIRE(false);
46 }
torc::architecture::BOOST_AUTO_TEST_CASE ( GenerateVprRoutingGraph  )

Experimental VPR routing graph exporter.

Definition at line 30 of file VprExporterUnitTest.cpp.

30  {
31  DDB ddb("xc6vlx240t");
32  VprExporter vprExporter(ddb);
33  vprExporter();
34 }
torc::architecture::BOOST_AUTO_TEST_CASE ( VersionsUnitTest  )

Unit test for the Versions class.

Todo:
Write a unit test for torc::architecture::Versions.

Definition at line 31 of file VersionsUnitTest.cpp.

31  {
32 
33  /// \todo Write a unit test for torc::architecture::Versions.
34  BOOST_REQUIRE(false);
35 
36 }
torc::architecture::BOOST_AUTO_TEST_CASE ( ArcUsageUnitTest  )

Unit test for the ArcUsage class.

Definition at line 31 of file ArcUsageUnitTest.cpp.

31  {
32  // supporting variables
33  DDB ddb("xcv50");
34  const Tiles& tiles = ddb.getTiles();
35  Tilewire tilewire1 = ddb.lookupTilewire("R1C1", "S0_X");
36  Tilewire tilewire2 = ddb.lookupTilewire("R1C1", "OUT0");
37  Tilewire tilewire3(tilewire2.getTileIndex(), WireIndex(10000));
38  Arc arc1(tilewire1, tilewire2);
39  uint32_t virtexCenterArcCount = 1511u;
40 
41  // members tested:
42  // const Tiles& mTiles;
43  // Array<dynamic_bitset*> mBitsets;
44  // dynamic_bitset mTileDirty;
45  // functions tested:
46  // ArcUsage(const Tiles& inTiles);
47  // void autosize(void);
48  // uint32_t getArcUsageCount(void) const;
49  // TileCount getTileUsageCount(void) const;
50  // uint32_t getBitCount(void) const;
51  ArcUsage arcUsage(tiles);
52  arcUsage.autosize();
53  BOOST_CHECK(arcUsage.mBitsets.getSize() > 0);
54  BOOST_CHECK(arcUsage.getArcUsageCount() == 0);
55  BOOST_CHECK(arcUsage.getTileUsageCount() == TileCount(0));
56  BOOST_CHECK(arcUsage.getBitCount() == 0);
57 
58  // members tested:
59  // TileCount mTileUsageCount;
60  // uint32_t mBitCount;
61  // functions tested:
62  // inline bool isUsed(const Arc& inArc);
63  // bool isUsed(const Tilewire& inTilewire1, const Tilewire& inTilewire2) const;
64  // inline void use(const Arc& inArc) ;
65  // void use(const Tilewire& inTilewire1, const Tilewire& inTilewire2);
66  // inline void release(const Arc& inArc);
67  // void release(const Tilewire& inTilewire1, const Tilewire& inTilewire2);
68  // uint32_t getArcUsageCount(void) const;
69  // TileCount getTileUsageCount(void) const;
70  // uint32_t getBitCount(void) const;
71  BOOST_CHECK_EQUAL(arcUsage.isUsed(arc1), false);
72  arcUsage.use(arc1);
73  BOOST_CHECK_EQUAL(arcUsage.isUsed(arc1), true);
74  BOOST_CHECK_EQUAL(arcUsage.getArcUsageCount(), 1u);
75  BOOST_CHECK_EQUAL(arcUsage.getTileUsageCount(), TileCount(1));
76  BOOST_CHECK_EQUAL(arcUsage.getBitCount(), virtexCenterArcCount);
77  arcUsage.release(arc1);
78  BOOST_CHECK_EQUAL(arcUsage.isUsed(arc1), false);
79  BOOST_CHECK_EQUAL(arcUsage.getArcUsageCount(), 0u);
80  BOOST_CHECK_EQUAL(arcUsage.getTileUsageCount(), TileCount(1));
81  BOOST_CHECK_EQUAL(arcUsage.getBitCount(), virtexCenterArcCount);
82 
83  // exceptions tested:
84  // InvalidArcException;
85  // functions tested:
86  // uint32_t getArcOffset(const Tilewire& inTilewire1, const Tilewire& inTilewire2) const;
87  bool threwInvalidArcException = false;
88  try {
89  // this arc's tilewires are undefined
90  (void) arcUsage.getArcOffset(Tilewire(), Tilewire());
91  }
92  catch(InvalidArcException iae) {
93  threwInvalidArcException = true;
94  }
95  BOOST_CHECK_EQUAL(threwInvalidArcException, true);
96  threwInvalidArcException = false;
97  try {
98  // this arc is valid (and its tilewires are defined)
99  (void) arcUsage.getArcOffset(tilewire1, tilewire2);
100  }
101  catch(InvalidArcException iae) {
102  threwInvalidArcException = true;
103  }
104  BOOST_CHECK_EQUAL(threwInvalidArcException, false);
105  threwInvalidArcException = false;
106  try {
107  // this arc's tilewires are defined, but the are is invalid
108  (void) arcUsage.getArcOffset(tilewire1, tilewire3);
109  }
110  catch(InvalidArcException iae) {
111  threwInvalidArcException = true;
112  }
113  BOOST_CHECK_EQUAL(threwInvalidArcException, true);
114 
115  // functions tested:
116  // void clear(void);
117  arcUsage.use(arc1);
118  arcUsage.clear();
119  BOOST_CHECK_EQUAL(arcUsage.getArcUsageCount(), 0u);
120  BOOST_CHECK_EQUAL(arcUsage.getTileUsageCount(), TileCount(1));
121  BOOST_CHECK_EQUAL(arcUsage.getBitCount(), virtexCenterArcCount);
122 
123  // functions not tested:
124  // ~ArcUsage(void);
125  ArcUsage* arcUsagePtr = new ArcUsage(tiles);
126  arcUsagePtr->autosize();
127  arcUsagePtr->use(arc1);
128  arcUsagePtr->~ArcUsage();
129  uint32_t bitsetsAfterDestruction = 0;
130  for(uint32_t i = 0; i < arcUsagePtr->mBitsets.getSize(); i++) {
131  bitsetsAfterDestruction += (arcUsagePtr->mBitsets[i] != 0);
132  }
133  BOOST_CHECK_EQUAL(bitsetsAfterDestruction, 0u);
134 }

+ Here is the call graph for this function:

torc::architecture::BOOST_AUTO_TEST_CASE ( DigestStreamUnitTest  )

Unit test for the DigestStream class.

Definition at line 32 of file DigestStreamUnitTest.cpp.

32  {
33  // functions tested:
34  // DigestStream(const boost::filesystem::path& inPath);
35  DigestStream digestStream(torc::common::DirectoryTree::getDevicesPath() / "xc5vlx30.db");
36  Versions versions;
37 
38  // functions tested:
39  // std::istream& read(uint8_t& outValue);
40  // std::istream& read(uint16_t& outValue);
41  // std::istream& read(uint32_t& outValue);
42  // std::istream& read(char* s, std::streamsize n);
43  BOOST_CHECK(versions.readVersions(digestStream, true) > 0);
44  std::string header;
45 
46  // functions tested:
47  // void readSectionHeader(string& outHeader);
48  // std::istream& read(uint8_t& outValue);
49  // std::istream& read(uint16_t& outValue);
50  // std::istream& read(uint32_t& outValue);
51  // std::istream& read(char* s, std::streamsize n);
52  digestStream.readSectionHeader(header);
53  BOOST_CHECK_EQUAL(header, ">>>> Family >>>>");
54  boost::uint16_t familyNameLength;
55  digestStream.read(familyNameLength);
56  BOOST_CHECK_EQUAL(familyNameLength, 7u);
57  boost::scoped_ptr<char> familyNamePtr(new char[familyNameLength]);
58  digestStream.read(familyNamePtr.get(), familyNameLength);
59  BOOST_CHECK(memcmp(familyNamePtr.get(), "Virtex5", familyNameLength) == 0);
60  digestStream.readSectionHeader(header);
61  BOOST_CHECK_EQUAL(header, ">>>> Speeds >>>>");
62  uint16_t speedGradeCount;
63  digestStream.read(speedGradeCount);
64  BOOST_CHECK_EQUAL(speedGradeCount, 3);
65 
66  // members tested:
67  // size_t mBytesRead;
68  // functions tested:
69  // size_t getBytesRead(void) const;
70  BOOST_CHECK(digestStream.getBytesRead() > 0u);
71 }
static const boost::filesystem::path & getDevicesPath(void)
Returns the absolute path to the family and device database directory.
std::string string

+ Here is the call graph for this function:

torc::architecture::BOOST_AUTO_TEST_CASE ( InstancePinUnitTest  )

Unit test for the InstancePin class.

Definition at line 32 of file architecture/InstancePinUnitTest.cpp.

32  {
33  // create objects to work with
35  = torc::physical::Factory::newInstancePtr("name", "type", "tile", "site");
36  torc::physical::InstancePinSharedPtr physicalInstancePinPtr
37  = torc::physical::Factory::newInstancePinPtr(instancePtr, "pin");
38 
39  // features tested:
40  // sizeof(InstancePin);
41  BOOST_REQUIRE_EQUAL(sizeof(InstancePin), sizeof(torc::physical::InstancePin));
42 
43  // macros tested:
44  // INSTANCE_PIN_PHYSICAL_TO_ARCHITECTURE(x);
45  // INSTANCE_PIN_ARCHITECTURE_TO_PHYSICAL(x);
46  InstancePinSharedPtr& architectureInstancePinPtr
47  = INSTANCE_PIN_PHYSICAL_TO_ARCHITECTURE(physicalInstancePinPtr);
48  torc::physical::InstancePinSharedPtr& physicalInstancePin2Ptr
49  = INSTANCE_PIN_ARCHITECTURE_TO_PHYSICAL(architectureInstancePinPtr);
50  BOOST_CHECK_EQUAL(architectureInstancePinPtr->getTileIndex(), xilinx::TileIndex(0));
51  BOOST_CHECK_EQUAL(architectureInstancePinPtr->getWireIndex(), xilinx::WireIndex(0));
52 
53  // functions tested:
54  // Tilewire& getTilewire(void);
55  Tilewire& tilewire = architectureInstancePinPtr->getTilewire();
56  tilewire = Tilewire(xilinx::TileIndex(32), xilinx::WireIndex(16));
57  BOOST_CHECK_EQUAL(tilewire.getTileIndex(), xilinx::TileIndex(32));
58  BOOST_CHECK_EQUAL(tilewire.getWireIndex(), xilinx::WireIndex(16));
59  BOOST_REQUIRE_EQUAL(sizeof(*physicalInstancePin2Ptr), sizeof(*architectureInstancePinPtr));
60 }
boost::shared_ptr< class InstancePin > InstancePinSharedPtr
Shared pointer encapsulation of an InstancePin.
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.
#define INSTANCE_PIN_PHYSICAL_TO_ARCHITECTURE(x)
Reinterpret the given torc::physical::InstancePinSharedPtr as a torc::architecture::InstancePinShared...
static InstancePinSharedPtr newInstancePinPtr(InstanceSharedPtr inInstancePtr, const string &inPinName)
Construct and return a new InstancePin shared pointer.
#define INSTANCE_PIN_ARCHITECTURE_TO_PHYSICAL(x)
Reinterpret the given torc::architecture::InstancePinSharedPtr as a torc::physical::InstancePinShared...
boost::shared_ptr< InstancePin > InstancePinSharedPtr
Shared pointer encapsulation of an InstancePin.

+ Here is the call graph for this function:

torc::architecture::BOOST_AUTO_TEST_CASE ( ArrayUnitTest  )

Unit test for the Array class.

Definition at line 33 of file ArrayUnitTest.cpp.

33  {
34  // functions not tested:
35  // ~Array<T>(void);
36 
37  // functions tested:
38  // Array<T>(void);
39  // Array<T>(uint32_t inSize);
40  // void allocate(uint32_t inSize);
41  // void deallocate(void);
42  uint32_t size5 = 5;
43  uint32_t size3 = 3;
44  typedef Array<int> int_array_t;
45  typedef Array<Tilewire> tilewire_array_t;
46  int_array_t intArray;
47  tilewire_array_t tilewireArray(size3);
48 
49  // macros tested:
50  // enforceBounds(index)
51  bool boundsEnforced = false;
52  try {
53  // if bounds checking is enabled and correct, we won't be able to read index 3
54  Tilewire outOfRange = tilewireArray[size3];
55  (void) outOfRange;
56  } catch(std::out_of_range oor) {
57  std::cerr << "Bounds checking generated message \"" << oor.what() << "\"" << std::endl;
58  boundsEnforced = true;
59  }
60  BOOST_CHECK(boundsEnforced);
61 
62  // functions tested:
63  // inline int getSize(void) const;
64  // inline void setSize(uint32_t inSize);
65  BOOST_CHECK_EQUAL(intArray.getSize(), 0u);
66  BOOST_CHECK_EQUAL(tilewireArray.getSize(), size3);
67  intArray.setSize(size5);
68  BOOST_CHECK_EQUAL(intArray.getSize(), size5);
69 
70  // functions tested:
71  // T& operator [](uint32_t inIndex);
72  // T* begin(void);
73  // T* end(void);
74  intArray[0] = 0;
75  intArray[1] = 1;
76  intArray[2] = 2;
77  intArray[3] = 3;
78  intArray[4] = 4;
79  int_array_t::iterator ip = intArray.begin();
80  int_array_t::iterator ie = intArray.end();
81  BOOST_CHECK(*ip++ == 0);
82  BOOST_CHECK(*ip++ == 1);
83  BOOST_CHECK(*ip++ == 2);
84  BOOST_CHECK(*ip++ == 3);
85  BOOST_CHECK(*ip++ == 4);
86  BOOST_CHECK_EQUAL(ip, ie);
87 
88  // functions tested:
89  // const T& operator [](uint32_t inIndex) const;
90  // const T* begin(void) const;
91  // const T* end(void) const;
92  Tilewire tilewire1(TileIndex(1), WireIndex(1));
93  Tilewire tilewire2(TileIndex(1), WireIndex(2));
94  Tilewire tilewire3(TileIndex(4), WireIndex(9));
95  tilewireArray[0] = tilewire1;
96  tilewireArray[1] = tilewire2;
97  tilewireArray[2] = tilewire3;
98  tilewire_array_t::const_iterator tp = tilewireArray.begin();
99  tilewire_array_t::const_iterator te = tilewireArray.end();
100  BOOST_CHECK(*tp++ == tilewireArray[0]);
101  BOOST_CHECK(*tp++ == tilewireArray[1]);
102  BOOST_CHECK(*tp++ == tilewireArray[2]);
103  BOOST_CHECK_EQUAL(tp, te);
104 
105  // template tested:
106  // template <class T> class Array2D;
107  int i = 1;
108  typedef Array2D<int> int_array2d_t;
109  int_array2d_t intArray2d(2);
110  intArray2d[0].setSize(3);
111  intArray2d[1].setSize(1);
112  intArray2d[0][0] = i++;
113  intArray2d[0][1] = i++;
114  intArray2d[0][2] = i++;
115  intArray2d[1][0] = i++;
116  Array<Array<int> >::const_iterator l1p = intArray2d.begin();
117  int_array2d_t::const_iterator l1e = intArray2d.end();
118  i = 1;
119  while(l1p < l1e) {
120  int_array_t::const_iterator l2p = l1p->begin();
121  int_array_t::const_iterator l2e = l1p->end();
122  while(l2p < l2e) {
123  BOOST_CHECK_EQUAL(*l2p++, i++);
124  }
125  l1p++;
126  }
127 }
Encapsulation of a tile index in an unsigned 32-bit integer.
Encapsulation of a wire index in an unsigned 16-bit integer.

+ Here is the call graph for this function:

torc::architecture::BOOST_AUTO_TEST_CASE ( TilesUnitTest  )

Unit test for the Tiles class.

Definition at line 33 of file TilesUnitTest.cpp.

33  {
34 
35  // iterate over the devices
37  torc::common::DeviceVector::const_iterator dp = devices.begin();
38  torc::common::DeviceVector::const_iterator de = devices.end();
39  while(dp < de) {
40  const std::string& device = *dp++;
41  if(device.empty()) break;
42  DDB ddb(device);
43  testDeviceTiles(ddb);
44  }
45 
46 }
std::string string
std::vector< std::string > DeviceVector
Vector of device names.
Definition: Devices.hpp:119
static const DeviceVector & getUnitTestDevices(void)
Returns a subset of devices for unit tests.
Definition: Devices.hpp:209
void testDeviceTiles(DDB &inDDB)

+ Here is the call graph for this function:

torc::architecture::BOOST_AUTO_TEST_CASE ( DDBStreamHelperUnitTest  )

Unit test for the DDBStreamHelper class.

Definition at line 33 of file DDBStreamHelperUnitTest.cpp.

33  {
34  // functions tested:
35  // std::ostream& operator <<(std::ostream& os, const class DDB& ddb);
36  // static const class DDB* getDDBPtr(std::ostream& os);
37  DDB ddb("xc2vp2");
38  std::stringstream s;
39  s << ddb;
40  BOOST_CHECK(DDBStreamHelper::getDDBPtr(s) == &ddb);
41 
42  // functions tested:
43  // std::ostream& operator <<(std::ostream& os, const DDB& ddb);
44  // std::ostream& operator <<(std::ostream& os, const Tilewire& rhs);
45  s << ddb << Tilewire(TileIndex(1), WireIndex(0));
46  BOOST_CHECK_EQUAL(s.str(), "CNR_TBTERM_N6A1@[0,1] CNR_TTERM \"LIOITTERM\" (0@1)");
47 }
Encapsulation of a tile index in an unsigned 32-bit integer.
Encapsulation of a wire index in an unsigned 16-bit integer.

+ Here is the call graph for this function:

torc::architecture::BOOST_AUTO_TEST_CASE ( XdlImporterUnitTest  )

Unit test for the device-aware XdlImporter class.

Definition at line 34 of file architecture/XdlImporterUnitTest.cpp.

34  {
35  // create the appropriate file paths
37  / "torc" / "physical" / "DesignUnitTest.reference.xdl";
39  / "regression" / "DesignUnitTest.generated.xdl";
40 
41  // import the XDL design
42  std::fstream fileStream(referencePath.string().c_str());
43  BOOST_REQUIRE(fileStream.good());
44  XdlImporter importer;
45  importer(fileStream, referencePath.string());
46 
47  // look up the design (and do something with it ...)
48  torc::physical::DesignSharedPtr designPtr = importer.getDesignPtr();
49  BOOST_REQUIRE(designPtr.get() != 0);
50  BOOST_REQUIRE(false); // we haven't actually tested anything yet
51  BOOST_TEST_MESSAGE("Need to fix XdlImporter::bind(torc::physical::Pip& inPip, EPipType inPipType) and XDL design regression test files for directionality of pips.");
52 
53  // look up the device database (and do something with it ...)
54  DDB* ddbPtr = importer.releaseDDBPtr();
55  (void) ddbPtr;
56 }
boost::filesystem::path path
boost::shared_ptr< Design > DesignSharedPtr
Shared pointer encapsulation of a Design.
static const boost::filesystem::path & getExecutablePath(void)
Returns the absolute path to the executable directory.

+ Here is the call graph for this function:

torc::architecture::BOOST_AUTO_TEST_CASE ( SitesUnitTest  )

Unit test for the Sites class.

Todo:
Write a unit test for torc::architecture::Sites.

Definition at line 35 of file SitesUnitTest.cpp.

35  {
36 /*
37  typedef boost::bimap< boost::bimaps::multiset_of<std::string>, boost::bimaps::multiset_of<std::string> > bm_type;
38  bm_type bm;
39 
40  bm.insert( bm_type::value_type( "SLICEL", "SLICEL" ) );
41  bm.insert( bm_type::value_type( "SLICEL", "SLICEM" ) );
42  bm.insert( bm_type::value_type( "SLICEM", "SLICEM" ) );
43 
44  bm.insert( bm_type::value_type( "BUFG", "BUFGCTRL" ) );
45  bm.insert( bm_type::value_type( "BUFGCTRL", "BUFGCTRL" ) );
46 
47  bm.insert( bm_type::value_type( "IOBS", "IOBS" ) );
48  bm.insert( bm_type::value_type( "IOB", "IOBS" ) );
49  bm.insert( bm_type::value_type( "IOB", "IOBM" ) );
50  bm.insert( bm_type::value_type( "IOBM", "IOBM" ) );
51 
52  bm.upper_bound("IOBS");
53 
54  BOOST_CHECK(bm.size() == 9);
55  assert( bm.size() == 9 );
56 */
57  /// \todo Write a unit test for torc::architecture::Sites.
58  BOOST_REQUIRE(false);
59 
60 }
torc::architecture::BOOST_AUTO_TEST_CASE ( iterate_configmaps  )

Unit test to iterate through the ConfigMaps of a XDL file.

Definition at line 44 of file SiteTypesUnitTest.cpp.

44  {
45 
46  using namespace torc::physical;
47 
48  // create the appropriate file paths
50  / "torc" / "physical" / "DesignUnitTest.reference.xdl";
51 
52  // import the XDL design
53  std::fstream fileStream(referencePath.string().c_str());
54  BOOST_REQUIRE(fileStream.good());
55  XdlImporter importer;
56 
57  importer(fileStream, referencePath.string());
58 
59  // look up the design (and do something with it ...)
60  torc::physical::DesignSharedPtr designPtr = importer.getDesignPtr();
61  BOOST_REQUIRE(designPtr.get() != 0);
62 
63  Circuit::InstanceSharedPtrConstIterator p = designPtr->instancesBegin();
64  Circuit::InstanceSharedPtrConstIterator e = designPtr->instancesEnd();
65 
66  while(p < e) {
67  InstanceSharedPtr instancePtr = *p++;
68  std::cout << "Instance:" << instancePtr->getName() << std::endl;
69  ConfigMap::const_iterator cp = instancePtr->configBegin();
70  ConfigMap::const_iterator ce = instancePtr->configEnd();
71  while(cp != ce) {
72  std::cout << "\tConfig:" << cp->first << "---->" << cp->second.getName() << ":" << cp->second.getValue() << std::endl;
73  cp++;
74  }
75  }
76 }
DesignSharedPtr getDesignPtr(void)
Returns a shared pointer for the design.
InstanceSharedPtrVector::const_iterator InstanceSharedPtrConstIterator
Constant iterator to Instance shared pointers.
Definition: Circuit.hpp:72
const_iterator const_iterator
Constant iterator to {setting,Config} pairs.
Definition: ConfigMap.hpp:52
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.
Importer from XDL format into a physical design.
static const boost::filesystem::path & getExecutablePath(void)
Returns the absolute path to the executable directory.

+ Here is the call graph for this function:

torc::architecture::BOOST_AUTO_TEST_CASE ( DDBUnitTest  )

Unit test for the DDB class.

Definition at line 87 of file DDBUnitTest.cpp.

87  {
88  // iterate over the devices
90  torc::common::DeviceVector::const_iterator dp = devices.begin();
91  torc::common::DeviceVector::const_iterator de = devices.end();
92  while(dp < de) {
93  const std::string& device = *dp++;
94  if(device.empty()) break;
95  testDevice(device);
96  }
97 }
void testDevice(const std::string &inDeviceName)
Definition: DDBUnitTest.cpp:37
std::string string
std::vector< std::string > DeviceVector
Vector of device names.
Definition: Devices.hpp:119
static const DeviceVector & getUnitTestDevices(void)
Returns a subset of devices for unit tests.
Definition: Devices.hpp:209

+ Here is the call graph for this function:

torc::architecture::BOOST_AUTO_TEST_CASE ( classify_elements  )

Unit test to iterate through a database and classify all existing elements into pseudo-types.

Map of all elements.

Map of all terminals.

Map of all switches.

Map of all orphans.

Map of all muxes.

Map of all inverters.

Map of all luts.

Map of all flops.

Map of all main elements.

Map of all main elements.

Map of all main elements.

Map of all main elements.

Map of all elements.

Capture the 'main' elements.

Definition at line 128 of file SiteTypesUnitTest.cpp.

128  {
129 //xc6vhx380t xc5vlx30 xc4vfx60 xc6slx9l xc2vp40 xc2v40 xc3s250e
130 
131  // open and initialize a database
132  DDB ddb("xc5vlx30");
133  // look up the logic sites in the device
134  const Sites& sites = ddb.getSites();
135 
136  // look up the primitive def types
137  typedef const Array<const PrimitiveDef> PrimitiveDefArray;
138  PrimitiveDefArray& primitiveDefs = sites.getSiteTypes();
139  PrimitiveDefArray::const_iterator p = primitiveDefs.begin();
140  PrimitiveDefArray::const_iterator e = primitiveDefs.end();
141 
142  /// \brief Map of all elements.
143  typedef std::map<std::string, PrimitiveElement*> AllElements;
144  AllElements allElements;
145  /// \brief Map of all terminals.
146  typedef std::map<std::string, PrimitiveElement*> AllTerminals;
147  AllTerminals allTerminals;
148  /// \brief Map of all switches.
149  typedef std::map<std::string, PrimitiveElement*> AllSwitches;
150  AllSwitches allSwitches;
151  /// \brief Map of all orphans.
152  typedef std::map<std::string, PrimitiveElement*> AllOrphans;
153  AllOrphans allOrphans;
154  /// \brief Map of all muxes.
155  typedef std::map<std::string, PrimitiveElement*> AllMuxes;
156  AllMuxes allMuxes;
157  /// \brief Map of all inverters.
158  typedef std::map<std::string, PrimitiveElement*> AllInverters;
159  AllInverters allInverters;
160  /// \brief Map of all luts.
161  typedef std::map<std::string, PrimitiveElement*> AllLuts;
162  AllLuts allLuts;
163  /// \brief Map of all flops.
164  typedef std::map<std::string, PrimitiveElement*> AllFlops;
165  AllFlops allFlops;
166  /// \brief Map of all main elements.
167  typedef std::map<std::string, PrimitiveElement*> AllMains;
168  AllMains allMains;
169  /// \brief Map of all main elements.
170  typedef std::map<std::string, PrimitiveElement*> AllAnds;
171  AllAnds allAnds;
172  /// \brief Map of all main elements.
173  typedef std::map<std::string, PrimitiveElement*> AllVccs;
174  AllVccs allVccs;
175  /// \brief Map of all main elements.
176  typedef std::map<std::string, PrimitiveElement*> AllGnds;
177  AllGnds allGnds;
178 
179  //int i = 0;
180  // iterate over the primitive defs
181  while(p < e) {
182  // look up the current primitive def
183  const PrimitiveDef& primitiveDef = *p++;
184  //std::cout << "Inside Primitive Def:" << primitiveDef.getName() << std::endl << std::endl;
185  typedef const Array<const PrimitivePin> PrimitivePinArray;
186  // look up the primitive def pins
187  const PrimitivePinArray& primitivePins = primitiveDef.getPins();
188  PrimitivePinArray::const_iterator sp = primitivePins.begin();
189  PrimitivePinArray::const_iterator se = primitivePins.end();
190  const PrimitivePin primitivePin;
191  // keep a track of all the primitive pins (to find the main elements, we need to compare elements with site pins)
192  std::vector<std::string> primitivePinNames;
193  std::vector<std::string>::const_iterator spe = unique(primitivePinNames.begin(), primitivePinNames.end());
194  (void) spe;
195 
196  // iterate over the primitive def pins
197  if(primitivePins.getSize() > 0) {
198  //std::cout << " ";
199  while(sp < se) {
200  const PrimitivePin& primitivePin = *sp++;
201  primitivePinNames.push_back(primitivePin.getName());
202  }
203  //std::cout << std::endl;
204  }
205 
206  // look up the primitive def elements
207  const PrimitiveElementArray& elements = primitiveDef.getElements();
208  PrimitiveElementArray::const_iterator ep = elements.begin();
209  PrimitiveElementArray::const_iterator ee = elements.end();
210 
211 
212  // iterate over the primitive def elements
213  if(elements.getSize() > 0) {
214  while(ep < ee) {
215  const PrimitiveElement& element = *ep++;
216 
217  //std::cout << "Inside ELEMENT NAME:" << element.getName() << std::endl;
218  /// \brief Map of all elements.
219  allElements[element.getName()] = const_cast <PrimitiveElement*>(&element); //element.getName();
220 
221  /// \brief Capture the 'main' elements.
222  if(primitiveDef.getName() == element.getName()){
223  //std::cout << "\tMAIN element:" << element.getName() << std::endl;
224  allMains[element.getName()] = const_cast <PrimitiveElement*>(&element); //element.getName();
225  allElements.erase(element.getName());
226  }
227  //typedef const Array<const Sites::ElementPin> ElementPinArray;
228  const PrimitiveElementPinArray& elementPins = element.getPins();
229  PrimitiveElementPinArray::const_iterator pp = elementPins.begin();
230  PrimitiveElementPinArray::const_iterator pe = elementPins.end();
231 
232  //Count input pins of Muxes/Invs
233  int countPins = 0;
234  int isINV = 0;
235  std::string cfgValue;
236  int totalPinCount = 0;
237  int cfgSize = 0;
238  int notEmpty = 0;
239  int isLUT = 0;
240  int isFF = 0;
241  int isVCC = 0;
242  int isGND = 0;
243  int isAND = 0;
244 
245  std::vector<std::string> elementPinNames;
246  std::vector<std::string>::const_iterator ppe = unique(elementPinNames.begin(), elementPinNames.end());
247  (void) ppe;
248 
249  //Iterate through Element PINS
250  while(pp < pe) {
251  const PrimitiveElementPin& elementPin = *pp++;
252  //(void) elementPin;
253 
254  //Check if the pin is an Input pin
255  if(elementPin.isInput() == 1){
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();
260 
261  //Iterate through the Cfgs
262  while(cp != ce){
263 
264  const std::string& isit = *cp++;
265  //Check if the pin names and cfgs match
266  if(elementPin.getName() == isit){
267  if(findINV(isit) == 1){
268  elementPinNames.push_back(elementPin.getName());
269  isINV = 1;
270  countPins++;
271  }else{
272  elementPinNames.push_back(elementPin.getName());
273  countPins++;
274  }
275  break;
276  }
277  cfgValue = isit;
278  //trying to check if the # of cgfs and # of element pins match
279  cfgSize = elementCfgs.size();
280  if(!elementCfgs.empty()) notEmpty = 1;
281  if(findLUTbyCfg(isit) == 1){
282  isLUT = 1;
283  }else if(findFFbyCfg(isit) == 1){
284  isFF = 1;
285  }
286  }
287  }
288  if((findVCC(element.getName()) == 1) && (elementPin.getName() == "1")){
289  isVCC = 1;
290  }else if((findGND(element.getName()) == 1) && (elementPin.getName() == "0")){
291  isGND = 1;
292  }else if((findAND(element.getName()) == 1) && ((elementPin.getName() == "0") || (elementPin.getName() == "1"))){
293  isAND = 1;
294  }
295  totalPinCount++;
296  }
297 
298  if(countPins > 0) {
299  //If the pin names and cfgs match, it is a MUX (or INV)
300  if(countPins == 1){
301  //std::cout << "\tSWITCH: " << element.getName() << " "; //std::endl;
302  allMuxes[element.getName()] = const_cast <PrimitiveElement*>(&element); //element.getName();
303  allSwitches[element.getName()] = const_cast <PrimitiveElement*>(&element); //element.getName();
304  allElements.erase(element.getName());
305  }else if(isINV == 1){
306  //std::cout << "\tINV: " << element.getName() << " ";
307  allMuxes[element.getName()] = const_cast <PrimitiveElement*>(&element); //element.getName();
308  allInverters[element.getName()] = const_cast <PrimitiveElement*>(&element); //element.getName();
309  allElements.erase(element.getName());
310  }else if(isINV == 0){
311  //std::cout << "\tMUX: " << element.getName() << " ";
312  allMuxes[element.getName()] = const_cast <PrimitiveElement*>(&element); //element.getName();
313  allElements.erase(element.getName());
314  }
315  //std::cout << countPins << " "; // << std::endl;
316  //print the PINs that are matched with cfg within that element
317  for(std::vector<std::string>::const_iterator b = elementPinNames.begin(); b != elementPinNames.end(); b++) {
318  //std::cout << *b << " ";
319  }
320  // check if the number of pins is equal to the number of cfgs
321  if(notEmpty == 1){
322  if(countPins != cfgSize) throw 0;
323  }
324 
325  }else if(isLUT == 1){
326  //std::cout << "\tLUT: " << element.getName() << std::endl;//" ";
327  allLuts[element.getName()] = const_cast <PrimitiveElement*>(&element); //element.getName();
328  allElements.erase(element.getName());
329  }else if(isFF == 1){
330  //std::cout << "\tFLOP: " << element.getName() << std::endl;//" ";
331  allFlops[element.getName()] = const_cast <PrimitiveElement*>(&element); //element.getName();
332  allElements.erase(element.getName());
333  }
334  if(totalPinCount == 0){
335  //std::cout << "\tORPHAN:" << element.getName() <<std::endl;
336  allOrphans[element.getName()] = const_cast <PrimitiveElement*>(&element); //element.getName();
337  allElements.erase(element.getName());
338  }
339  if(findROUTETHROUGH(element.getName()) == 1){
340  //std::cout << "ROUTETHROUGH FOUND! ---- d e l e t i n g !" << std::endl;
341  allElements.erase(element.getName());
342  }
343  if(isAND == 1){//if(findAND(element.getName()) == 1){
344  allAnds[element.getName()] = const_cast <PrimitiveElement*>(&element); //element.getName();
345  allElements.erase(element.getName());
346  }
347  if(isVCC == 1){
348  allVccs[element.getName()] = const_cast <PrimitiveElement*>(&element); //element.getName();
349  allElements.erase(element.getName());
350  }
351  if(isGND == 1){
352  allGnds[element.getName()] = const_cast <PrimitiveElement*>(&element); //element.getName();
353  allElements.erase(element.getName());
354  }
355  for(std::vector<std::string>::const_iterator s = primitivePinNames.begin(); s != primitivePinNames.end(); s++) {
356  if(element.getName() == *s){
357  //std::cout << "\tTERMINAL:" << element.getName() << std::endl;
358  allTerminals[element.getName()] = const_cast <PrimitiveElement*>(&element); //element.getName();
359  allElements.erase(element.getName());
360  break;
361  }
362  }
363  }
364  }
365 
366  //std::cout << "-----------------------------------------------------------" <<std::endl;
367  //std::cout << std::endl;
368  }
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;// " ";
373  //std::cout << "Value:" << pos->second << std::endl;
374  }
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; //<< " ";
379  //std::cout << "Value:" << pos->second << std::endl;
380  }
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; //<< " ";
385  //std::cout << "Value:" << pos->second << std::endl;
386  }
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; //<< " ";
391  //std::cout << "Value:" << pos->second << std::endl;
392  }
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; //<< " ";
397  //std::cout << "Value:" << pos->second << std::endl;
398  }
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; //<< " ";
403  //std::cout << "Value:" << pos->second << std::endl;
404  }
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; //<< " ";
409  //std::cout << "Value:" << pos->second << std::endl;
410  }
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; //<< " ";
415  //std::cout << "Value:" << pos->second << std::endl;
416  }
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; //<< " ";
421  //std::cout << "Value:" << pos->second << std::endl;
422  }
423 
424 
425 }
bool findROUTETHROUGH(const std::string isit)
bool findAND(const std::string isit)
bool findFFbyCfg(const std::string isit)
bool findINV(const std::string isit)
std::string string
bool findGND(const std::string isit)
Array< const PrimitivePin > PrimitivePinArray
Array of constant PrimitivePin objects.
Array< const PrimitiveElementPin > PrimitiveElementPinArray
Array of constant PrimitiveElementPin objects.
const string & getName(void) const
Returns the object name.
Definition: Named.hpp:51
Array< const PrimitiveElement > PrimitiveElementArray
Array of constant PrimitiveElement objects.
bool findLUTbyCfg(const std::string isit)
Physical design primitive-pin.
T * begin(void)
Returns the non-constant begin iterator.
Definition: Array.hpp:95
bool findVCC(const std::string isit)

+ Here is the call graph for this function:

torc::architecture::BOOST_AUTO_TEST_CASE ( SegmentsRegressionTest  )

Regression test for the Segments class.

Definition at line 221 of file SegmentsRegressionTest.cpp.

221  {
222 
223  // iterate over the devices
225  torc::common::DeviceVector::const_iterator dp = devices.begin();
226  torc::common::DeviceVector::const_iterator de = devices.end();
227  while(dp < de) {
228  const std::string& device = *dp++;
229  if(device.empty()) break;
230  DDB ddb(device);
231  std::cerr << ddb;
232  segments_regression_test_helper segmentTester(ddb);
233  segmentTester();
234  }
235  segments_regression_test_helper::statistics();
236 
237 }
std::string string
static const DeviceVector & getSupportedDevices(void)
Returns all devices.
Definition: Devices.hpp:207
std::vector< std::string > DeviceVector
Vector of device names.
Definition: Devices.hpp:119

+ Here is the call graph for this function:

torc::architecture::BOOST_AUTO_TEST_CASE ( SiteTypesUnitTest  )

Unit test for the SiteTypes class.

Definition at line 436 of file SiteTypesUnitTest.cpp.

436  {
437 
438  // open and initialize a database
439  DDB ddb("xc5vlx30");
440  // look up the logic sites in the device
441  const Sites& sites = ddb.getSites();
442  // look up the primitive def types
443  typedef const Array<const PrimitiveDef> PrimitiveDefArray;
444  PrimitiveDefArray& primitiveDefs = sites.getSiteTypes();
445  PrimitiveDefArray::const_iterator p = primitiveDefs.begin();
446  PrimitiveDefArray::const_iterator e = primitiveDefs.end();
447  int i = 0;
448  // iterate over the primitive defs
449  while(p < e) {
450  // look up the current primitive def
451  const PrimitiveDef& primitiveDef = *p++;
452  std::cout << i << ": " << primitiveDef.getName() << std::endl;
453  typedef const Array<const PrimitivePin> PrimitivePinArray;
454  // look up the primitive def pins
455  const PrimitivePinArray& primitivePins = primitiveDef.getPins();
456  PrimitivePinArray::const_iterator sp = primitivePins.begin();
457  PrimitivePinArray::const_iterator se = primitivePins.end();
458  // iterate over the primitive def pins
459  if(false && primitivePins.getSize() > 0) {
460  std::cout << " ";
461  // output each of the pin names along with the flags (2-INPUT, 4-OUTPUT)
462  while(sp < se) {
463  const PrimitivePin& primitivePin = *sp++;
464  std::cout << primitivePin.getName() << " ";
465  std::cout << primitivePin.getFlags() << " ";
466  }
467  std::cout << std::endl;
468  }
469  // look up the primitive def elements
470 
471  const PrimitiveElementArray& elements = primitiveDef.getElements();
472  PrimitiveElementArray::const_iterator ep = elements.begin();
473  PrimitiveElementArray::const_iterator ee = elements.end();
474  // iterate over the primitive def elements
475  if(true && elements.getSize() > 0) {
476  // output each of the element names and if the pin is a basic element
477  while(ep < ee) {
478  const PrimitiveElement& element = *ep++;
479  std::cout << "ELEMENT NAME:" << element.getName() << " "<< std::endl;
480  //std::cout << " ";
481  //std::cout<< "ELEMENT IS Basic ELement:" << element.isBel() << " " << std::endl;
482 
483  const PrimitiveElementPinArray& elementPins = element.getPins();
484  PrimitiveElementPinArray::const_iterator pp = elementPins.begin();
485  PrimitiveElementPinArray::const_iterator pe = elementPins.end();
486  // iterate over the element pins
487  if(elementPins.getSize()> 0) {
488 
489  // output each of the element pin names along with the element flags (2-Input, 4-Output)
490  while(pp < pe) {
491  // std::cout << " ";
492  const PrimitiveElementPin& elementPin = *pp++;
493  std::cout << elementPin.getElementPtr()->getName() << "." << elementPin.getName() << " ";
494  //std::cout << ((elementPin.getElement()->getName() == element.getName())
495  //? "" : (elementPin.getElement()->getName() + " "));
496  //std::cout<< "ELEMENT PIN NAME:" << elementPin.getName() << " " << std::endl;
497  //std::cout << " ";
498  //std::cout<< "ELEMENT FLAG NAME:" << elementPin.getFlags() << " " << std::endl;
499  // typedef std::set<std::string> StringSet;
500  // const StringSet elementCfgs = element.getCfgs();
501  // StringSet::const_iterator cp = elementCfgs.begin();
502  // StringSet::const_iterator ce = elementCfgs.end();
503  // // iterate over the configs
504  // if(elementCfgs.size() != 0){
505  // // output each of the configs
506  // while(cp != ce){
507  // std::cout << " ";
508  // std::cout << "CONFIG NAME: " << *cp << " " << std::endl;
509  // *cp++;
510  // }
511  // }
512  }
513  std::cout << std::endl;
514  }
515  }
516  std::cout << std::endl;
517  }
518  const PrimitiveConnSharedPtrArray& connections = primitiveDef.getConnections();
519  PrimitiveConnSharedPtrArray::const_iterator ccp = connections.begin();
520  PrimitiveConnSharedPtrArray::const_iterator cce = connections.end();
521  // iterate over the primitive element connections
522  while(true && ccp < cce) {
523  const PrimitiveConn& connection = *(*ccp++);
524  const PrimitiveElementPin& source = *connection.getSourcePtr();
525  const PrimitiveElementPinPtrVector& sinks = connection.getSinks();
526  std::cout << source.getElementPtr()->getName() << "." << source.getName() << " ==> ";
527  PrimitiveElementPinPtrVector::const_iterator epp = sinks.begin();
528  PrimitiveElementPinPtrVector::const_iterator epe = sinks.end();
529  while(epp < epe) {
530  const PrimitiveElementPin& sink = **epp++;
531  std::cout << sink.getElementPtr()->getName() << "." << sink.getName() << " ";
532  }
533  std::cout << std::endl;
534  }
535  i++;
536  }
537  BOOST_REQUIRE(true);
538 
539 }
Array< PrimitiveConnSharedPtr > PrimitiveConnSharedPtrArray
Array of shared pointers to PrimitiveConn objects.
const string & getName(void) const
Returns the name of the element.
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.
Array< const PrimitiveElementPin > PrimitiveElementPinArray
Array of constant PrimitiveElementPin objects.
const string & getName(void) const
Returns the object name.
Definition: Named.hpp:51
Array< const PrimitiveElement > PrimitiveElementArray
Array of constant PrimitiveElement objects.
Physical design primitive-pin.
T * begin(void)
Returns the non-constant begin iterator.
Definition: Array.hpp:95
std::vector< const PrimitiveElementPin * > PrimitiveElementPinPtrVector
Vector of constant PrimitiveElementPin pointers.

+ Here is the call graph for this function:

bool torc::architecture::findAND ( const std::string  isit)

Definition at line 107 of file SiteTypesUnitTest.cpp.

108 {
109  static const boost::regex e("^.*AND.*");
110  return regex_match(isit, e);
111 }

+ Here is the caller graph for this function:

bool torc::architecture::findFFbyCfg ( const std::string  isit)

Definition at line 89 of file SiteTypesUnitTest.cpp.

90 {
91  static const boost::regex e("(^#(FF|LATCH)$)");
92  return regex_match(isit, e);
93 }

+ Here is the caller graph for this function:

bool torc::architecture::findGND ( const std::string  isit)

Definition at line 119 of file SiteTypesUnitTest.cpp.

120 {
121  static const boost::regex e("^.*GND$");
122  return regex_match(isit, e);
123 }

+ Here is the caller graph for this function:

bool torc::architecture::findINV ( const std::string  isit)

Definition at line 95 of file SiteTypesUnitTest.cpp.

96 {
97  static const boost::regex e("^.*_B$");
98  return regex_match(isit, e);
99 }

+ Here is the caller graph for this function:

bool torc::architecture::findLUTbyCfg ( const std::string  isit)

Definition at line 83 of file SiteTypesUnitTest.cpp.

84 {
85  static const boost::regex e("(^(<eqn>)|((#LUT:|#RAM:|#ROM:)<eqn>)$)");
86  return regex_match(isit, e);
87 }

+ Here is the caller graph for this function:

bool torc::architecture::findROUTETHROUGH ( const std::string  isit)

Definition at line 101 of file SiteTypesUnitTest.cpp.

102 {
103  static const boost::regex e("^_ROUTETHROUGH.*");
104  return regex_match(isit, e);
105 }

+ Here is the caller graph for this function:

bool torc::architecture::findVCC ( const std::string  isit)

Definition at line 113 of file SiteTypesUnitTest.cpp.

114 {
115  static const boost::regex e("^.*VCC$");
116  return regex_match(isit, e);
117 }

+ Here is the caller graph for this function:

std::size_t torc::architecture::hash_value ( const Arc &  inArc)

Definition at line 25 of file Arc.cpp.

25  {
26  std::size_t seed = 0;
27  boost::hash_combine(seed, inArc.getSourceTilewire());
28  boost::hash_combine(seed, inArc.getSinkTilewire());
29  return seed;
30  }

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::size_t torc::architecture::hash_value ( const Tilewire &  inTilewire)

Definition at line 27 of file Tilewire.cpp.

27  {
28  std::size_t seed = 0;
29  boost::hash_combine(seed, inTilewire.getTileIndex());
30  boost::hash_combine(seed, inTilewire.getWireIndex());
31  return seed;
32  }

+ Here is the call graph for this function:

std::ostream& torc::architecture::operator<< ( std::ostream &  os,
const DDB &  ddb 
)

Definition at line 27 of file DDBStreamHelper.cpp.

27  {
28  // check to see whether there is an existing database association for this stream
29  typedef std::map<std::ostream*, const class DDB*> OStreamToDDBMap;
30  OStreamToDDBMap::const_iterator p = DDBStreamHelper::sStreamToDatabase.find(&os);
31  if(p == DDBStreamHelper::sStreamToDatabase.end()) {
32  // if no association exists, create a new association between the stream and database
33  std::pair<OStreamToDDBMap::iterator, bool> inserted
34  = DDBStreamHelper::sStreamToDatabase.insert(std::make_pair(&os, &ddb));
35  p = inserted.first; // implicitly assuming that insertion always succeeds
36  }
37  return os;
38  }
std::ostream & torc::architecture::operator<< ( std::ostream &  os,
const Tilewire &  rhs 
)

Tilewire stream inserter.

Definition at line 31 of file architecture/OutputStreamHelpers.cpp.

31  {
32  const DDB* ddbPtr = DDBStreamHelper::getDDBPtr(os);
33  if(ddbPtr) {
34  // the database is available: look up the extended tilewire information
35  os << ExtendedWireInfo(*ddbPtr, rhs);
36  } else {
37  // the database is not available: write out the basic tilewire information
38  os << rhs.getWireIndex() << "@" << rhs.getTileIndex();
39  }
40  return os;
41  }

+ Here is the call graph for this function:

std::ostream & torc::architecture::operator<< ( std::ostream &  os,
const ExtendedWireInfo &  rhs 
)

ExtendedWireInfo stream inserter.

Definition at line 43 of file architecture/OutputStreamHelpers.cpp.

43  {
44  // handle uninitialized wire info
45  if(rhs.mTileIndex.isUndefined()) return os << "[UNINITIALIZED]";
46 
47  // handle regular wire info
48  return os << rhs.mWireName << "@[" << rhs.mTileRow << "," << rhs.mTileCol << "] "
49  << rhs.mTileTypeName << " \"" << rhs.mTileName << "\" (" << rhs.mWireIndex << "@"
50  << rhs.mTileIndex << ")"
51  << (WireInfo::isHidden(rhs.mWireFlags) ? " HIDDEN" : "")
52  << (WireInfo::isInput(rhs.mWireFlags) ? " INPUT" : "")
53  << (WireInfo::isOutput(rhs.mWireFlags) ? " OUTPUT" : "")
54  << (WireInfo::isRemote(rhs.mWireFlags) ? " REMOTE" : "")
55  << (WireInfo::isRemoteNodeCapable(rhs.mWireFlags) ? " REMOTE_NODE_CAPABLE" : "")
56  << (WireInfo::isRemoteArcCapable(rhs.mWireFlags) ? " REMOTE_ARC_CAPABLE" : "")
57  ;
58  }

+ Here is the call graph for this function:

std::ostream & torc::architecture::operator<< ( std::ostream &  os,
const Arc &  rhs 
)

Arc stream inserter.

Definition at line 60 of file architecture/OutputStreamHelpers.cpp.

60  {
61  return os << rhs.getSourceTilewire() << " >> " << rhs.getSinkTilewire();
62  }

+ Here is the call graph for this function:

std::ostream& torc::architecture::operator<< ( std::ostream &  os,
const class DDB &  ddb 
)

Insertion operator to associate the given device database with the given stream.

This operator does not generate any stream output, but instead associates the given device database with the stream. This allows lightweight objects such as tilewires to decorate their output with database information, without including a database reference.

void torc::architecture::testDevice ( const std::string &  inDeviceName)

Definition at line 37 of file DDBUnitTest.cpp.

37  {
38  // functions not tested:
39  // (note: some of these functions are tested in their respective classes)
40  // const string& getFamilyName(void) const;
41  // const Segments& getSegments(void) const;
42  // const WireUsage& getWireUsage(void) const;
43  // const ArcUsage& getArcUsage(void) const;
44  // void clearUsage(void);
45 
46  // functions tested:
47  // DDB(const string& inDeviceName);
48  DDB ddb(inDeviceName);
49 
50  // functions tested:
51  // const string& getDeviceName(void) const;
52  BOOST_CHECK_EQUAL(ddb.getDeviceName(), inDeviceName);
53 
54  // for now this test merely opens representative device databases; regression tests are
55  // performed elsewhere
56  if(true) return;
57 
58  // functions tested:
59  // const Tiles& getTiles(void) const;
60  std::map<TileTypeIndex, int> tileTypeMap;
61  const Tiles& tiles = ddb.getTiles();
62  TileCount tileCount = tiles.getTileCount();
63  for(TileIndex tileIndex; tileIndex < tileCount; tileIndex++) {
64  const TileInfo& tileInfo = tiles.getTileInfo(tileIndex);
65  TileTypeIndex tileTypeIndex = tileInfo.getTypeIndex();
66  const std::string& tileTypeName = tiles.getTileTypeName(tileTypeIndex);
67  tileTypeMap[tileTypeIndex] = 0;
68  (void) tileTypeName;
69  }
70  std::cout << tileTypeMap.size() << " tile types" << std::endl;
71 
72  // functions tested
73  // const Sites& getSites(void) const;
74  std::map<std::string, int> siteTypeMap;
75  const Sites& sites = ddb.getSites();
76  SiteCount siteCount = sites.getSiteCount();
77  for(SiteIndex siteIndex; siteIndex < siteCount; siteIndex++) {
78  const Site& site = sites.getSite(siteIndex);
79  const std::string& siteTypeName = site.getPrimitiveDefPtr()->getName();
80  siteTypeMap[siteTypeName] = 0;
81  }
82  std::cout << ddb;
83  std::cout << siteTypeMap.size() << " site types" << std::endl;
84 }
std::string string

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void torc::architecture::testDeviceTiles ( DDB &  inDDB)

Definition at line 48 of file TilesUnitTest.cpp.

48  {
49  // functions tested during database initialization and deletion:
50  // Tiles(void);
51  // ~Tiles(void);
52  // size_t readTileTypes(DigestStream& inStream);
53  // size_t readTileWireInfo(DigestStream& inStream);
54  // size_t readTileMap(DigestStream& inStream);
55  const Tiles& tiles = inDDB.getTiles();
56 
57  // functions tested:
58  // TileTypeCount getTileTypeCount(void) const;
59  // members tested:
60  // TileTypeCount mTileTypeCount;
61  xilinx::TileTypeCount tileTypeCount = tiles.getTileTypeCount();
62  if(tileTypeCount == xilinx::TileTypeCount(0)) // to reduce output
63  BOOST_CHECK(tileTypeCount != 0);
64 
65  // functions tested:
66  // const char* getTileTypeName(TileTypeIndex inTileTypeIndex) const;
67  // members tested:
68  // Array<const CharStringWrapper> mTileTypeNames;
69  for(xilinx::TileTypeIndex tileTypeIndex; tileTypeIndex < tileTypeCount; tileTypeIndex++) {
70  const char* tileTypeName = tiles.getTileTypeName(tileTypeIndex);
71  if(*tileTypeName == 0) // to reduce output
72  BOOST_CHECK(*tileTypeName != 0);
73  }
74 
75  // functions tested:
76  // TileCount getTileCount(void) const;
77  // TileRow getRowCount(void) const;
78  // TileCol getColCount(void) const;
79  // members tested:
80  // TileCount mTileCount;
81  // TileRow mRowCount;
82  // TileCol mColCount;
83  xilinx::TileCount tileCount = tiles.getTileCount();
84  xilinx::TileRow rowCount = tiles.getRowCount();
85  xilinx::TileCol colCount = tiles.getColCount();
86  if(tileCount == xilinx::TileCount(0)) // to reduce output
87  BOOST_CHECK(tileCount != 0);
88  if(rowCount == xilinx::TileRow(0)) // to reduce output
89  BOOST_CHECK(rowCount != 0);
90  if(colCount == xilinx::TileCol(0)) // to reduce output
91  BOOST_CHECK(colCount != 0);
92  if(static_cast<int>(tileCount) != rowCount * colCount) // to reduce output
93  BOOST_CHECK_EQUAL(static_cast<int>(tileCount), rowCount * colCount);
94 
95  // functions tested:
96  // const TileInfo& getTileInfo(TileIndex inTileIndex) const;
97  // TileIndex getTileIndex(TileRow inRow, TileCol inCol) const;
98  // TileIndex findTileIndex(const string& inName) const;
99  // static bool CompareTilePairByName(const TileNameIndexPair& inA,
100  // const TileNameIndexPair& inB);
101  // members tested:
102  // TileIndex** mTileMap;
103  // Array<const TileInfo> mTiles;
104  // Array<const TileNameIndexPair> mOrderedTileNames;
105  for(xilinx::TileIndex tileIndex; tileIndex < tileCount; tileIndex++) {
106  // look up the tile info
107  const TileInfo& tileInfo = tiles.getTileInfo(tileIndex);
108  // verify that tile indexes and coordinates are consistent
109  xilinx::TileRow tileRow = tileInfo.getRow();
110  xilinx::TileCol tileCol = tileInfo.getCol();
111  const char* tileName = tileInfo.getName();
112  if(*tileName == 0) // to reduce output
113  BOOST_CHECK(*tileName != 0);
114  xilinx::TileIndex rowColTileIndex = tiles.getTileIndex(tileRow, tileCol);
115  if(tileIndex != rowColTileIndex) // to reduce output
116  BOOST_CHECK_EQUAL(tileIndex, rowColTileIndex);
117  xilinx::TileIndex findTileIndex = tiles.findTileIndex(tileName);
118  if(tileIndex != findTileIndex) // to reduce output
119  BOOST_CHECK_EQUAL(tileIndex, findTileIndex);
120  }
121 
122  // functions tested:
123  // const Array<const WireInfo>& getWireInfo(TileTypeIndex inTileTypeIndex) const;
124  // const WireInfo& getWireInfo(TileTypeIndex inTileTypeIndex, WireIndex inWireIndex) const;
125  // static bool CompareWirePairByName(const WireNameIndexPair& inA,
126  // const WireNameIndexPair& inB);
127  // WireIndex findWireIndex(TileTypeIndex inTileTypeIndex, const string& inName) const;
128  // members tested:
129  // Array2D<const WireInfo> mWires;
130  // Array2D<const WireNameIndexPair> mOrderedWireNames;
131  for(xilinx::TileTypeIndex tileTypeIndex; tileTypeIndex < tileTypeCount; tileTypeIndex++) {
132  // verify that wire indexes are consistent
133  xilinx::WireCount wireCount = tiles.getWireCount(tileTypeIndex);
134  const Array<const WireInfo>& wireInfoArray = tiles.getWireInfo(tileTypeIndex);
135  for(xilinx::WireIndex wireIndex; wireIndex < wireCount; wireIndex++) {
136  const WireInfo& wireInfo = tiles.getWireInfo(tileTypeIndex, wireIndex);
137  if(&wireInfo != &wireInfoArray[wireIndex]) // to reduce output
138  BOOST_CHECK(&wireInfo == &wireInfoArray[wireIndex]);
139  const char* wireName = wireInfo.getName();
140  if(*wireName == 0) // to reduce output
141  BOOST_CHECK(*wireName != 0);
142  xilinx::WireIndex findWireIndex = tiles.findWireIndex(tileTypeIndex, wireName);
143  if(wireIndex != findWireIndex) // to reduce output
144  BOOST_CHECK_EQUAL(wireIndex, findWireIndex);
145  }
146  }
147 }

+ Here is the call graph for this function:

+ Here is the caller graph for this function: