00001 // Torc - Copyright 2011 University of Southern California. All Rights Reserved. 00002 // $HeadURL: https://torc-isi.svn.sourceforge.net/svnroot/torc-isi/branches/staging/0.9/src/torc/examples/ArchitectureExample.cpp $ 00003 // $Id: ArchitectureExample.cpp 10 2011-10-12 18:40:16Z nsteiner $ 00004 00005 // This program is free software: you can redistribute it and/or modify it under the terms of the 00006 // GNU General Public License as published by the Free Software Foundation, either version 3 of the 00007 // License, or (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 00010 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 00011 // the GNU General Public License for more details. 00012 // 00013 // You should have received a copy of the GNU General Public License along with this program. If 00014 // not, see <http://www.gnu.org/licenses/>. 00015 00016 /// \file 00017 /// \brief Example program to open a device database and do something with it. 00018 00019 #include "torc/Architecture.hpp" 00020 #include "torc/Common.hpp" 00021 #include <iostream> 00022 00023 using namespace torc::common; 00024 using namespace torc::architecture; 00025 using namespace torc::architecture::xilinx; 00026 00027 int main(int argc, char* argv[]) { 00028 00029 // construct and initialize the device database 00030 (void) argc; 00031 DirectoryTree directoryTree(argv[0]); 00032 DeviceDesignator designator("xc6vlx75tff484-1"); 00033 DDB ddb(designator); 00034 00035 // look up a site output and convert it to a tilewire 00036 const Sites& sites = ddb.getSites(); 00037 SiteIndex index = sites.findSiteIndex("SLICE_X0Y119"); 00038 const Site& site = sites.getSite(index); 00039 Tilewire pinTilewire = site.getPinTilewire("A"); 00040 std::cout << ddb << pinTilewire << std::endl; 00041 00042 // look up arcs that connect from this tilewire 00043 ArcVector sinks; 00044 ddb.expandSegmentSinks(pinTilewire, sinks); 00045 ArcVector::const_iterator pos = sinks.begin(); 00046 ArcVector::const_iterator end = sinks.end(); 00047 while(pos < end) 00048 std::cout << "\t" << *pos++ << std::endl; 00049 00050 return 0; 00051 }