torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ArchitectureExample.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 Example program to open a device database and do something with it.
18 
19 #include "torc/Architecture.hpp"
20 #include "torc/Common.hpp"
21 #include <iostream>
22 
23 using namespace torc::common;
24 using namespace torc::architecture;
25 using namespace torc::architecture::xilinx;
26 
27 int main(int argc, char* argv[]) {
28 
29  // construct and initialize the device database
30  (void) argc;
31  DirectoryTree directoryTree(argv[0]);
32  DeviceDesignator designator("xc6vlx75tff484-1");
33  DDB ddb(designator);
34 
35  // look up a site output and convert it to a tilewire
36  const Sites& sites = ddb.getSites();
37  SiteIndex index = sites.findSiteIndex("SLICE_X0Y119");
38  const Site& site = sites.getSite(index);
39  Tilewire pinTilewire = site.getPinTilewire("A");
40  std::cout << ddb << pinTilewire << std::endl;
41 
42  // look up arcs that connect from this tilewire
43  ArcVector sinks;
44  ddb.expandSegmentSinks(pinTilewire, sinks);
45  ArcVector::const_iterator pos = sinks.begin();
46  ArcVector::const_iterator end = sinks.end();
47  while(pos < end)
48  std::cout << "\t" << *pos++ << std::endl;
49 
50  return 0;
51 }
Main torc::architecture namespace header.
Encapsulation of a device designator and its constituent elements.
Device database, including complete wiring and logic support.
Definition: DDB.hpp:42
const Tilewire getPinTilewire(const std::string &inName) const
Returns the Tilewire associated with the specified pin name.
Definition: Site.hpp:70
void expandSegmentSinks(const Tilewire &inTilewire, ArcVector &outSinks, EExpandDirection inExpandDirection=eExpandDirectionNone, bool inUseTied=true, bool inUseRegular=true, bool inUseIrregular=true, bool inUseRoutethrough=true)
Expands all sink arcs for the given tilewire's segment.
Definition: DDB.cpp:314
const Sites & getSites(void) const
Returns a constant reference to the family and device site data.
Definition: DDB.hpp:144
std::vector< Arc > ArcVector
Vector of Arc objects.
Definition: Arc.hpp:78
int main(int argc, char *argv[])
Encapsulation of a device logic site.
Definition: Site.hpp:30
Site type and population data for the family and the device.
Definition: Sites.hpp:45
Encapsulation of a device tile and wire pair.
Definition: Tilewire.hpp:39
Encapsulation of filesystem paths that are used by the library.
SiteIndex findSiteIndex(const string &inName) const
Returns the site index for the given site name.
Definition: Sites.hpp:134
const Site & getSite(SiteIndex inSiteIndex) const
Returns the site for the specified index.
Definition: Sites.hpp:129
Encapsulation of a site index in an unsigned 32-bit integer.
Main torc::common namespace header.