torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
architecture/InstancePinUnitTest.cpp
Go to the documentation of this file.
1 // Torc - Copyright 2011-2013 University of Southern California. All Rights Reserved.
2 // $HeadURL$
3 // $Id$
4 
5 // This program is free software: you can redistribute it and/or modify it under the terms of the
6 // GNU General Public License as published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
11 // the GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License along with this program. If
14 // not, see <http://www.gnu.org/licenses/>.
15 
16 /// \file
17 /// \brief Unit test for the InstancePin class.
18 
19 #include <boost/test/unit_test.hpp>
24 #include <boost/pointer_cast.hpp>
25 
26 namespace torc {
27 namespace architecture {
28 
29 BOOST_AUTO_TEST_SUITE(architecture)
30 
31 /// \brief Unit test for the InstancePin class.
32 BOOST_AUTO_TEST_CASE(InstancePinUnitTest) {
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 }
61 
62 BOOST_AUTO_TEST_SUITE_END()
63 
64 } // namespace architecture
65 } // namespace torc
Encapsulation of a tile index in an unsigned 32-bit integer.
BOOST_AUTO_TEST_CASE(ArcUnitTest)
Unit test for the Arc class.
Definition: ArcUnitTest.cpp:29
Encapsulation of a wire index in an unsigned 16-bit integer.
boost::shared_ptr< class InstancePin > InstancePinSharedPtr
Shared pointer encapsulation of an InstancePin.
Encapsulation of a device tile and wire pair.
Definition: Tilewire.hpp:39
Header for the InstancePin class.
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...
Physical design instance-pin pair, suitable for specifying a net endpoint.
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...
Header for the Factory class.
Header for the InstancePin class.
boost::shared_ptr< InstancePin > InstancePinSharedPtr
Shared pointer encapsulation of an InstancePin.
Device database types for Xilinx architectures.