Merged branches/staging/0.9 -r9:11 into trunk.

This commit is contained in:
nsteiner 2011-10-13 15:44:09 +00:00
parent 088fbd5522
commit d6da608ad0
480 changed files with 41247 additions and 7945 deletions

48
Build
View File

@ -0,0 +1,48 @@
Code, Examples, and Tests
=========================
Building the default target compiles all of the source code, and links the example and unit test
executables.
cd src
make
The following examples are also available in the sandbox mentioned below, where they can safely be
modified. The examples demonstrate the basic operation of the main Torc APIs, and can be invoked
as follows:
./architecture_example
./bitstream_example regression/VirtexUnitTest.reference.bit
./generic_example regression/GenericExample.reference.edf
./physical_example regression/DesignUnitTest.reference.xdl
./edif_obfuscator regression/GenericExample.reference.edf
The unit and regression tests are available through the test executable. Individual test suites or
tests can be invoked by passing -t and one or more suites or test cases separated by commas.
./test
The test app can also be built with Xcode, by opening project xcode/torc.xcodeproj. The test app
can likewise be built with Eclipse, by importing the projects in src and sandbox. With recent
versions of Eclipse and CDT, the projects can be imported with utility scripts in the eclipse
directory.
Sandbox
=======
The sandbox is available for quick experimentation with Torc. The sandbox examples are identical
to the examples in src/torc/Examples, but may be modified the user. Note that building inside the
sandbox also compiles all of the source code in src.
cd sandbox
make
Doxygen Documentation
=====================
The Doxygen documentation can be built as follows:
cd src
doxygen Doxyfile
Doxygen is available from http://www.stack.nl/~dimitri/doxygen/.

37
Changes
View File

@ -0,0 +1,37 @@
Version 0.9 (released October 12, 2011, from branches/staging/0.9.x)
https://torc-isi.svn.sourceforge.net/svnroot/torc-isi/tags/0.9
* Added device packages to databases.
* Added device logic definitions to databases.
* Added Virtex/2/2P/4/6 and Spartan3E bitstream frame mapping.
* Added Virtex7/Kintex7 device databases and updated DDB to 32-bit segment anchor tile counts.
* Added family DeviceInfo files to initialize bitstreams without opening device databases.
* Added Annotated class and functionality for routing, placement, and user operations.
* Added "Development" architecture to the database build scripts.
* Added tile and site regular expression searching to device browser.
* Added PrimitiveStructure analysis code for unpacking.
* Added frame to tile mapping capability for XDL and bitstream coordinates.
* Added ModuleTransformer class to modularize or flatten XDL modules.
* Added simulated annealing placer.
* Added bitstream frame data access.
* Added support for writing full bitstreams from frame data.
* Added exhaustive EDIF 2.0.0 support for NETLIST view types.
* Added a sample sandbox for new users.
* Added a bitstream factory to create an object of the correct type for arbitrary bitstreams.
* Added device database routethrough support.
* Added ArcUsage support for routethrough and tied arcs.
* Added Eclipse directory and project files.
* Added build instructions.
* Removed automatic copying of device databases and debug bitstreams.
* Removed dependency upon GCC, Flex, and Bison.
* Changed unit test naming for standardization.
* Changed Sites.hpp by splitting it into constituent classes.
* Changed license and copyright blurbs.
* Changed Torc coding style guidelines.
* Fixed bug with DeviceDesignator not recognizing Virtex5 "t" devices.
* Fixed code that generated warnings with newer version of GCC, including 4.6.1.
* Fixed bug in XDL parser to allow instances with no cfg strings.
* Fixed usage of Boost.Filesystem replace_extension() to accomodate V3 semantics.
Version 0.8 (released February 25, 2011)
https://torc-isi.svn.sourceforge.net/svnroot/torc-isi/tags/0.8.0
* Initial release.

View File

@ -20,7 +20,7 @@ EDIF development (generic):
Other contributors, developers, and early adopters:
Jacob Couch, Virginia Tech
Tony Frangieh, Virginia Tech
Tannous "Tony" Frangieh, Virginia Tech
Chris Lavin, Brigham Young University
Andrew Love, Virginia Tech
Wenwei Zha, Virginia Tech

23
eclipse/README Executable file
View File

@ -0,0 +1,23 @@
Getting Eclipse CDT:
====================
If you do not have Eclipse with CDT installed, please install them before invoking the scripts in
this directory.
Eclipse is available at http://www.eclipse.org.
CDT (C/C++ Development Tooling) is available at http://www.eclipse.org/cdt.
Importing Torc projects from the command line:
==============================================
Be sure to add Eclipse to your PATH environment variable. You can then import the Torc projects
into eclipse on a one-time basis with import-projects.sh. After the projects have been imported,
you can reopen Eclipse with open-eclipse.sh.
Importing Torc projects from inside Eclipse:
============================================
If you prefer to import the Torc projects manually, you may do so as follows:
File -> Import... -> General -> Existing Projects into Workspace
Select torc/trunk as the root directory, and click the Finish button.

49
eclipse/import-projects.sh Executable file
View File

@ -0,0 +1,49 @@
#!/bin/sh
# Torc - Copyright 2011 University of Southern California. All Rights Reserved.
# $HeadURL$
# $Id$
# This program is free software: you can redistribute it and/or modify it under the terms of the
# GNU General Public License as published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
# the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with this program. If
# not, see <http://www.gnu.org/licenses/>.
# Imports Torc projects into Eclipse from the command line.
#
# Inspired by http://lugendal.wordpress.com/2009/07/22/eclipse-ctd-new-project-fast/ and
# http://stackoverflow.com/questions/1087573/open-a-specific-eclipse-project-from-command-line/6777801#6777801
ECLIPSE_EXECUTABLE=eclipse
WORKSPACE_PATH=`pwd`
PROJECTS_PATH=`pwd`/..
# make sure we know where to find eclipse
if ! command -v ${ECLIPSE_EXECUTABLE} &> /dev/null; then
echo "Eclipse is not present in PATH."
exit 1
fi
# this script will not work if Eclipse is already running
if ps ax | grep eclipse | grep -v grep | grep -v $0 > /dev/null; then
echo "Please quit Eclipse before invoking this script."
exit 1
fi
# import the projects in the parent path
if ! ${ECLIPSE_EXECUTABLE} \
-data ${WORKSPACE_PATH} \
-application org.eclipse.cdt.managedbuilder.core.headlessbuild \
-importAll ${PROJECTS_PATH}; then
echo "Failed to import projects. Have you installed http://www.eclipse.org/cdt?"
exit 1
fi
# open Eclipse in this workspace
${ECLIPSE_EXECUTABLE} \
-data ${WORKSPACE_PATH} &

40
eclipse/open-eclipse.sh Executable file
View File

@ -0,0 +1,40 @@
#!/bin/sh
# Torc - Copyright 2011 University of Southern California. All Rights Reserved.
# $HeadURL$
# $Id$
# This program is free software: you can redistribute it and/or modify it under the terms of the
# GNU General Public License as published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
# the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with this program. If
# not, see <http://www.gnu.org/licenses/>.
# Opens Eclipse from the command line.
#
# Inspired by http://lugendal.wordpress.com/2009/07/22/eclipse-ctd-new-project-fast/ and
# http://stackoverflow.com/questions/1087573/open-a-specific-eclipse-project-from-command-line/6777801#6777801
ECLIPSE_EXECUTABLE=eclipse
WORKSPACE_PATH=`pwd`
PROJECTS_PATH=`pwd`/..
# make sure we know where to find eclipse
if ! command -v ${ECLIPSE_EXECUTABLE} &> /dev/null; then
echo "Eclipse is not present in PATH."
exit 1
fi
# this script will not work if Eclipse is already running
if ps ax | grep eclipse | grep -v grep | grep -v $0 > /dev/null; then
echo "Please quit Eclipse before invoking this script."
exit 1
fi
# open Eclipse in this workspace
${ECLIPSE_EXECUTABLE} \
-data ${WORKSPACE_PATH} &

61
sandbox/.cproject Normal file
View File

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?>
<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="0.393126630">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.393126630" moduleId="org.eclipse.cdt.core.settings" name="Default">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="sandbox" buildProperties="" description="" id="0.393126630" name="Default" parent="org.eclipse.cdt.build.core.prefbase.cfg">
<folderInfo id="0.393126630." name="/" resourcePath="">
<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.565003018" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
<targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.565003018.1525849324" name=""/>
<builder id="org.eclipse.cdt.build.core.settings.default.builder.850785978" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.libs.1727366293" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.85015039" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.symbols.1448798967" name="Symbols" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols"/>
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.824351029" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
<tool id="org.eclipse.cdt.build.core.settings.holder.499703267" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.symbols.568796084" name="Symbols" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols"/>
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.829317486" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
<tool id="org.eclipse.cdt.build.core.settings.holder.517526456" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.symbols.100078934" name="Symbols" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols"/>
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1210958917" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="sandbox.null.1112910773" name="sandbox"/>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
<scannerConfigBuildInfo instanceId="0.393126630">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="refreshScope" versionNumber="1">
<resource resourceType="PROJECT" workspacePath="/sandbox"/>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings">
<doc-comment-owner id="org.eclipse.cdt.ui.doxygen">
<path value=""/>
</doc-comment-owner>
</storageModule>
</cproject>

79
sandbox/.project Normal file
View File

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>torc-trunk-sandbox</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
<dictionary>
<key>?name?</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.append_environment</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildCommand</key>
<value>make</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
<value>clean</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.contents</key>
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
<value>false</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.stopOnError</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
<value>true</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,51 @@
// Torc - Copyright 2011 University of Southern California. All Rights Reserved.
// $HeadURL$
// $Id$
// This program is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with this program. If
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Example program to open a device database and do something with it.
#include "torc/Architecture.hpp"
#include "torc/Common.hpp"
#include <iostream>
using namespace torc::common;
using namespace torc::architecture;
using namespace torc::architecture::xilinx;
int main(int argc, char* argv[]) {
// construct and initialize the device database
(void) argc;
DirectoryTree directoryTree(argv[0]);
DeviceDesignator designator("xc6vlx75tff484-1");
DDB ddb(designator);
// look up a site output and convert it to a tilewire
const Sites& sites = ddb.getSites();
SiteIndex index = sites.findSiteIndex("SLICE_X0Y119");
const Site& site = sites.getSite(index);
Tilewire pinTilewire = site.getPinTilewire("A");
std::cout << ddb << pinTilewire << std::endl;
// look up arcs that connect from this tilewire
ArcVector sinks;
ddb.expandSegmentSinks(pinTilewire, sinks);
ArcVector::const_iterator pos = sinks.begin();
ArcVector::const_iterator end = sinks.end();
while(pos < end)
std::cout << "\t" << *pos++ << std::endl;
return 0;
}

View File

@ -0,0 +1,42 @@
// Torc - Copyright 2011 University of Southern California. All Rights Reserved.
// $HeadURL$
// $Id$
// This program is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with this program. If
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Example program to open a device bitstream and display its packets.
#include "torc/Bitstream.hpp"
#include "torc/Common.hpp"
#include <fstream>
#include <iostream>
using namespace torc::common;
using namespace torc::bitstream;
int main(int argc, char* argv[]) {
// we need an input bitstream
if(argc != 2) {
std::cout << "Usage: " << argv[0] << " bitstream.bit" << std::endl;
exit(-1);
}
// read the bitstream
boost::filesystem::path bitstreamPath = argv[1];
BitstreamSharedPtr bitstreamPtr = Factory::newBitstreamPtr(bitstreamPath);
// write the bitstream digest to the console
std::cout << *bitstreamPtr << std::endl;
return 0;
}

View File

@ -0,0 +1,63 @@
// Torc - Copyright 2011 University of Southern California. All Rights Reserved.
// $HeadURL$
// $Id$
// This program is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with this program. If
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Example program to read in an EDIF file, do something with it, and write it back out.
#include "torc/Generic.hpp"
#include "torc/Common.hpp"
#include <fstream>
#include <boost/regex.hpp>
using namespace std;
using namespace torc::generic;
int main(int argc, char* argv[]) {
// build the file paths
(void) argc;
torc::common::DirectoryTree directoryTree(argv[0]);
boost::filesystem::path referencePath = torc::common::DirectoryTree::getExecutablePath()
/ "regression" / "GenericExample.reference.edf";
boost::filesystem::path generatedPath = torc::common::DirectoryTree::getExecutablePath()
/ "regression" / "GenericExample.generated.edf";
// import the EDIF design
string inFileName = referencePath.string();
fstream fileStream(inFileName.c_str());
ObjectFactorySharedPtr factoryPtr(new ObjectFactory());
EdifImporter importer(factoryPtr);
importer(fileStream, inFileName);
// look up an instance of interest
RootSharedPtr rootPtr = importer.getRootPtr();
InstanceSharedPtr instancePtr = rootPtr->findLibrary("work")->findCell("and")
->findView("verilog")->findInstance("oZ0");
// change the INIT property (LUT mask) to XOR
PropertySharedPtr initPropertyPtr = instancePtr->getProperty("INIT");
string originalMask = initPropertyPtr->getValue().get<Value::String>();
std::cout << "The original LUT mask was \"" << originalMask << "\"." << std::endl;
Value xorMask(Value::eValueTypeString, string("6"));
initPropertyPtr->setValue(xorMask);
// export the EDIF design
string outFileName = generatedPath.string();
fstream edifExport(outFileName.c_str(), ios_base::out);
EdifExporter exporter(edifExport);
exporter(rootPtr);
return 0;
}

108
sandbox/Makefile Normal file
View File

@ -0,0 +1,108 @@
# Torc - Copyright 2011 University of Southern California. All Rights Reserved.
# $HeadURL$
# $Id$
# This program is free software: you can redistribute it and/or modify it under the terms of the
# GNU General Public License as published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
# the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with this program. If
# not, see <http://www.gnu.org/licenses/>.
THIS_DIR = sandbox
SRC_DIR = .
BOOST_INCLUDE_DIR = /usr/local/include/boost-1_42
# C++ flags
CCFLAGS = \
-x c++ \
-g \
-Wall \
-I$(SRC_DIR) \
-I$(BOOST_INCLUDE_DIR) \
$
# object files
OBJS = \
ArchitectureExample.o \
BitstreamExample.o \
GenericExample.o \
PhysicalExample.o \
$
# dependencies
DEPS = $(OBJS:.o=.d)
# not all targets are real
.PHONY: all code clean
sandbox: architecture_sandbox bitstream_sandbox generic_sandbox physical_sandbox
# make the architecture example executable
architecture_sandbox: torc code references
$(CC) \
$(REAL_OBJECTS) \
ArchitectureExample.o \
$(LDFLAGS) \
-o $@ \
$
# make the example example executable
bitstream_sandbox: torc code references
$(CC) \
$(REAL_OBJECTS) \
BitstreamExample.o \
$(LDFLAGS) \
-o $@ \
$
# make the generic example executable
generic_sandbox: torc code references
$(CC) \
$(REAL_OBJECTS) \
GenericExample.o \
$(LDFLAGS) \
-o $@ \
$
# make the XDL example executable
physical_sandbox: torc code references
$(CC) \
$(REAL_OBJECTS) \
PhysicalExample.o \
$(LDFLAGS) \
-o $@ \
$
# Include automatically generated dependencies or silently make them.
-include $(DEPS)
# build the code
code: $(OBJS)
# compile c++ sources
%.o: %.cpp
$(CC) $(CCFLAGS) -c -o $@ $<
# build dependency files
%.d: %.cpp
@set -e; rm -f $@; \
$(CC) -MM $(CCFLAGS) $< | \
sed -e '/boost/d' -e 's,\($*\)\.o[ :]*,\1.o $@ : ,g' > $@;
# compile c sources
%.o: %.c
$(CC) $(CCFLAGS) -c -o $@ $<
# build dependency files
%.d: %.c
@set -e; rm -f $@; \
$(CC) -MM $(CCFLAGS) $< | \
sed -e '/boost/d' -e 's,\($*\)\.o[ :]*,\1.o $@ : ,g' > $@;
# include the main Torc Makefile
include Makefile.src

1
sandbox/Makefile.src Symbolic link
View File

@ -0,0 +1 @@
../src/Makefile

View File

@ -0,0 +1,44 @@
// Torc - Copyright 2011 University of Southern California. All Rights Reserved.
// $HeadURL$
// $Id$
// This program is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with this program. If
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Example program to read in an XDL file, do something with it, and write it back out.
#include "torc/Physical.hpp"
#include <fstream>
/// \brief Standard main() function.
int main(int argc, char* argv[]) {
// import the XDL design
if(argc < 2) return 0;
std::string inFileName(argv[1]);
std::fstream fileStream(inFileName.c_str());
if(!fileStream.good()) return -1;
torc::physical::XdlImporter importer;
importer(fileStream, inFileName);
// look up the design (and do something with it ...)
torc::physical::DesignSharedPtr designPtr = importer.getDesignPtr();
// export the XDL design
std::string outFileName = boost::filesystem::path(inFileName).replace_extension().string()
+ ".mod.xdl";
std::fstream xdlExport(outFileName.c_str(), std::ios_base::out);
torc::physical::XdlExporter fileExporter(xdlExport);
fileExporter(designPtr);
return 0;
}

7
sandbox/README Normal file
View File

@ -0,0 +1,7 @@
The source files in this directory were taken directly from trunk/src/torc/examples, and may be
modified at will. To build the executables, invoke the following:
make sandbox
If the remainder of the Torc code has not yet been built, it will be compiled before the sandbox
code.

1
sandbox/torc Symbolic link
View File

@ -0,0 +1 @@
../src/torc

View File

@ -1,7 +1,21 @@
// TORC - Copyright 2010 University of Southern California. All Rights Reserved.
// TORC - Copyright 2011 University of Southern California. All Rights Reserved.
// $HeadURL$
// $Id$
// This program is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with this program. If
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Source for the CodingStyle class.
#include "CodingStyle.hpp"
namespace torc {

Binary file not shown.

View File

@ -1,9 +1,23 @@
// TORC - Copyright 2010 University of Southern California. All Rights Reserved.
// TORC - Copyright 2011 University of Southern California. All Rights Reserved.
// $HeadURL$
// $Id$
#ifndef TORC_CODING_STYLE_HPP
#define TORC_CODING_STYLE_HPP
// This program is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with this program. If
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Header for the CodingStyle class.
#ifndef TORC_CODINGSTYLE_HPP
#define TORC_CODINGSTYLE_HPP
#include <stdint.h>
#include <string>
@ -96,4 +110,4 @@ private:
} // namespace torc
#endif // TORC_CODING_STYLE_HPP
#endif // TORC_CODINGSTYLE_HPP

Binary file not shown.

70
src/.cproject Normal file
View File

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?>
<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="0.1020229351">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.1020229351" moduleId="org.eclipse.cdt.core.settings" name="Default">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="src" buildProperties="" description="" id="0.1020229351" name="Default" parent="org.eclipse.cdt.build.core.prefbase.cfg">
<folderInfo id="0.1020229351." name="/" resourcePath="">
<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.1011859856" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
<targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.1011859856.1811319000" name=""/>
<builder id="org.eclipse.cdt.build.core.settings.default.builder.123981651" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.libs.1356939403" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.1584219547" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.symbols.48488335" name="Symbols" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols"/>
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1796838175" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
<tool id="org.eclipse.cdt.build.core.settings.holder.1818079994" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.symbols.1164659057" name="Symbols" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols"/>
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.2121703055" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
<tool id="org.eclipse.cdt.build.core.settings.holder.1610736031" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.symbols.2027449577" name="Symbols" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols"/>
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1578665579" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="src.null.899476945" name="src"/>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<scannerConfigBuildInfo instanceId="0.1501333092">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="0.1020229351">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="refreshScope" versionNumber="1">
<resource resourceType="PROJECT" workspacePath="/src"/>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
</cproject>

78
src/.project Normal file
View File

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>torc-trunk-src</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
<dictionary>
<key>?name?</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.append_environment</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildCommand</key>
<value>make</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
<value>clean</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.contents</key>
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
<value>false</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.stopOnError</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
<value>true</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
</projectDescription>

View File

@ -1,18 +1,3 @@
# Torc - Copyright 2011 University of Southern California. All Rights Reserved.
# $HeadURL: https://svn.east.isi.edu/torc/trunk/src/torc/devices/build/xdlrc.pl $
# $Id: xdlrc.pl 380 2011-02-23 04:05:26Z nsteiner $
# This program is free software: you can redistribute it and/or modify it under the terms of the
# GNU General Public License as published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
# the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with this program. If
# not, see <http://www.gnu.org/licenses/>.
# Doxyfile 1.6.3
# This file describes the settings to be used by the documentation system
@ -46,7 +31,7 @@ PROJECT_NAME = TORC
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = 0.8
PROJECT_NUMBER = 0.9
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.

View File

@ -13,10 +13,24 @@
# You should have received a copy of the GNU General Public License along with this program. If
# not, see <http://www.gnu.org/licenses/>.
ifdef ILOG_LICENSE_FILE
# CPLEXDIR and CONCERTDIR should be defined as environment variables
#CPLEX_CPLEXDIR = /usr/local/IBM/ILOG/CPLEX_Studio_AcademicResearch122/cplex
#CPLEX_CONCERTDIR = /usr/local/IBM/ILOG/CPLEX_Studio_AcademicResearch122/concert
# link options
CPLEX_LIBFORMAT = static_pic
CPLEX_SYSTEM = x86-64_sles10_4.1
CPLEX_CPLEXLIBDIR = $(CPLEX_CPLEXDIR)/lib/$(CPLEX_SYSTEM)/$(CPLEX_LIBFORMAT)
CPLEX_CONCERTLIBDIR = $(CPLEX_CONCERTDIR)/lib/$(CPLEX_SYSTEM)/$(CPLEX_LIBFORMAT)
CPLEX_CCLNFLAGS = -L$(CPLEX_CPLEXLIBDIR) -lilocplex -lcplex -L$(CPLEX_CONCERTLIBDIR) \
-lconcert -lm -pthread
endif
ifneq ($(TORC_X), 1)
LDFLAGS = \
-L/usr/local/lib64 \
-L/usr/local/lib \
$(CPLEX_CCLNFLAGS) \
-dead_strip \
-lboost_filesystem \
-lboost_regex \
@ -30,8 +44,9 @@ LDTESTFLAGS = \
$
else
LDFLAGS = \
-arch x86_64 \
-m64 \
-L/usr/local/lib \
$(CPLEX_CCLNFLAGS) \
-dead_strip \
-lboost_filesystem \
-lboost_regex \
@ -47,6 +62,7 @@ endif
REAL_OBJECTS = \
@torc/RealObjectFileList \
@torc/architecture/RealObjectFileList \
@torc/bitstream/RealObjectFileList \
@torc/bitstream/build/RealObjectFileList \
@ -66,6 +82,7 @@ REAL_OBJECTS = \
$
TEST_OBJECTS = \
@torc/TestObjectFileList \
@torc/architecture/TestObjectFileList \
@torc/bitstream/TestObjectFileList \
@torc/bitstream/build/TestObjectFileList \
@ -108,6 +125,9 @@ PHYSICAL_REFERENCES = \
DesignUnitTest.reference.xdl \
$
PLACER_REFERENCES = \
$
ROUTER_REFERENCES = \
TraceRegressionTest.Virtex5.xdl \
TraceRegressionTest.VirtexTbuf.xdl \
@ -141,6 +161,14 @@ architecture_example: torc references
-o $@ \
$
#gr_example: torc references
# $(CC) \
# $(REAL_OBJECTS) \
# torc/router/GlobalRouter/GlobalRouterExample.o \
# $(LDFLAGS) \
# -o gr_example \
# $
# make the example example executable
bitstream_example: torc references
$(CC) \
@ -215,6 +243,7 @@ references: \
${BITSTREAM_REFERENCES:%=regression/%} \
${EXAMPLE_REFERENCES:%=regression/%} \
${PHYSICAL_REFERENCES:%=regression/%} \
${PLACER_REFERENCES:%=regression/%} \
${ROUTER_REFERENCES:%=regression/%} \
$

View File

@ -33,7 +33,7 @@
#include "torc/architecture/Array.hpp"
#include "torc/architecture/DDB.hpp"
#include "torc/architecture/DDBStreamHelper.hpp"
#include "torc/architecture/DeviceDesignator.hpp"
#include "torc/common/DeviceDesignator.hpp"
#include "torc/architecture/DigestStream.hpp"
#include "torc/architecture/ExtendedWireInfo.hpp"
#include "torc/architecture/InstancePin.hpp"

View File

@ -24,6 +24,7 @@
#define TORC_BITSTREAM_HPP
#include "torc/bitstream/Bitstream.hpp"
#include "torc/bitstream/Factory.hpp"
#include "torc/bitstream/DeviceInfo.hpp"
#include "torc/bitstream/OutputStreamHelpers.hpp"
#include "torc/bitstream/Spartan6Bitstream.hpp"

View File

@ -19,6 +19,8 @@
#ifndef TORC_COMMON_HPP
#define TORC_COMMON_HPP
#include "torc/common/Annotated.hpp"
#include "torc/common/DeviceDesignator.hpp"
#include "torc/common/Devices.hpp"
#include "torc/common/DirectoryTree.hpp"
#include "torc/common/DottedVersion.hpp"

View File

@ -24,33 +24,44 @@
#include "torc/generic/decompiler/Decompiler.hpp"
#include "torc/generic/decompiler/ObjectVisitor.hpp"
#include "torc/generic/om/Apply.hpp"
#include "torc/generic/om/Bundle.hpp"
#include "torc/generic/om/BundleFlattener.hpp"
#include "torc/generic/om/Cell.hpp"
#include "torc/generic/om/Cloneable.hpp"
// why does this cause a linker errror for GenericExample?
// #include "torc/generic/om/Cloning.hpp"
#include "torc/generic/om/Cloning.hpp"
#include "torc/generic/om/Commentable.hpp"
#include "torc/generic/om/Composite.hpp"
#include "torc/generic/om/CompositionType.hpp"
#include "torc/generic/om/Connectable.hpp"
#include "torc/generic/om/ConnectionHandler.hpp"
#include "torc/generic/om/Derivation.hpp"
#include "torc/generic/om/Design.hpp"
#include "torc/generic/om/DumpRestoreConfig.hpp"
#include "torc/generic/om/DumpRestoreData.hpp"
#include "torc/generic/om/EdifLevel.hpp"
#include "torc/generic/om/EdifVersion.hpp"
#include "torc/generic/om/Event.hpp"
#include "torc/generic/om/Extern.hpp"
#include "torc/generic/om/FactoryType.hpp"
#include "torc/generic/om/Flattening.hpp"
#include "torc/generic/om/ForbiddenEvent.hpp"
#include "torc/generic/om/Instance.hpp"
#include "torc/generic/om/InstanceArray.hpp"
#include "torc/generic/om/InstanceArrayMember.hpp"
#include "torc/generic/om/InterfaceAttributes.hpp"
#include "torc/generic/om/InterfaceJoinedInfo.hpp"
#include "torc/generic/om/InternalUtilityFunctions.hpp"
#include "torc/generic/om/Library.hpp"
#include "torc/generic/om/LogicElement.hpp"
#include "torc/generic/om/LogicValue.hpp"
#include "torc/generic/om/LogicValueAttributes.hpp"
#include "torc/generic/om/LogicalResponse.hpp"
#include "torc/generic/om/Nameable.hpp"
#include "torc/generic/om/Net.hpp"
#include "torc/generic/om/NetAttributes.hpp"
#include "torc/generic/om/NetBundle.hpp"
#include "torc/generic/om/NetDelay.hpp"
#include "torc/generic/om/ObjectFactory.hpp"
#include "torc/generic/om/Parameter.hpp"
#include "torc/generic/om/ParameterArray.hpp"
@ -58,6 +69,8 @@
#include "torc/generic/om/ParameterContext.hpp"
#include "torc/generic/om/ParameterMap.hpp"
#include "torc/generic/om/ParentedObject.hpp"
#include "torc/generic/om/PathDelay.hpp"
#include "torc/generic/om/Permutable.hpp"
#include "torc/generic/om/PointerTypes.hpp"
#include "torc/generic/om/Port.hpp"
#include "torc/generic/om/PortAttributes.hpp"
@ -65,7 +78,9 @@
#include "torc/generic/om/PortBundleReference.hpp"
#include "torc/generic/om/PortDelay.hpp"
#include "torc/generic/om/PortDirection.hpp"
#include "torc/generic/om/PortElement.hpp"
#include "torc/generic/om/PortList.hpp"
#include "torc/generic/om/PortListAlias.hpp"
#include "torc/generic/om/PortRefCreator.hpp"
#include "torc/generic/om/PortReference.hpp"
#include "torc/generic/om/Property.hpp"
@ -78,10 +93,17 @@
#include "torc/generic/om/ScalarPortReference.hpp"
#include "torc/generic/om/ScaleFactor.hpp"
#include "torc/generic/om/SelfReferencing.hpp"
#include "torc/generic/om/Simulate.hpp"
#include "torc/generic/om/SimulationInfo.hpp"
#include "torc/generic/om/SingleInstance.hpp"
#include "torc/generic/om/SingleParameter.hpp"
#include "torc/generic/om/Status.hpp"
#include "torc/generic/om/StatusContainer.hpp"
#include "torc/generic/om/SymTab.hpp"
#include "torc/generic/om/TimeStamp.hpp"
#include "torc/generic/om/Timing.hpp"
#include "torc/generic/om/Unit.hpp"
#include "torc/generic/om/UserDataContainer.hpp"
#include "torc/generic/om/Value.hpp"
#include "torc/generic/om/Vector.hpp"
#include "torc/generic/om/VectorBit.hpp"
@ -95,6 +117,8 @@
#include "torc/generic/om/Visitable.hpp"
#include "torc/generic/om/VisitorApplier.hpp"
#include "torc/generic/om/VisitorType.hpp"
#include "torc/generic/om/WaveValue.hpp"
#include "torc/generic/om/Written.hpp"
#include "torc/generic/parser/Driver.hpp"
#include "torc/generic/parser/EdifContext.hpp"
#include "torc/generic/parser/EdifParser.hpp"

View File

@ -29,6 +29,7 @@ CCFLAGS = \
# object files
OBJS = \
Version.o \
$
# dependencies
@ -46,8 +47,8 @@ TEST_OBJS = $(filter %UnitTest.o %RegressionTest.o, $(OBJS))
all: code
# build the code
code: architecture bitstream common examples externals generic physical packer placer \
router utils $(OBJS) RealObjectFileList TestObjectFileList
code: $(OBJS) architecture bitstream common examples externals generic physical packer placer \
router utils RealObjectFileList TestObjectFileList
# build the subdirectories
architecture:

View File

@ -19,20 +19,18 @@
#ifndef TORC_ROUTER_HPP
#define TORC_ROUTER_HPP
#include "torc/router/NetRouter.hpp"
#include "torc/router/NetRouterBase.hpp"
#include "torc/router/NetRouterHeuristic.hpp"
#include "torc/router/NetRouterHeuristicBase.hpp"
#include "torc/router/NetVectorRouterBase.hpp"
#include "torc/router/NetVectorRouterHeuristicBase.hpp"
#include "torc/router/PathFinder.hpp"
#include "torc/router/PathFinderHeuristic.hpp"
#include "torc/router/PathFinderNetRouterHeuristic.hpp"
#include "torc/router/RouteNet.hpp"
#include "torc/router/RouterHeuristicBase.hpp"
#include "torc/router/AStarRouter.hpp"
#include "torc/router/PathFinderRouter.hpp"
#include "torc/router/RouteNode.hpp"
#include "torc/router/RouteTreeNode.hpp"
#include "torc/router/RouteUtilities.hpp"
#include "torc/router/RouterHeuristicBase.hpp"
#include "torc/router/RouterStatistics.hpp"
#include "torc/router/Trace.hpp"
#include "torc/router/TraceNode.hpp"

27
src/torc/Version.cpp Normal file
View File

@ -0,0 +1,27 @@
// Torc - Copyright 2011 University of Southern California. All Rights Reserved.
// $HeadURL$
// $Id$
// This program is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with this program. If
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Source for the Torc version data.
#include "torc/Version.hpp"
namespace torc {
const torc::common::DottedVersion cTorcVersion(0, 9, 0);
const std::string cTorcVersionString = "0.9.0";
} // namespace torc

35
src/torc/Version.hpp Normal file
View File

@ -0,0 +1,35 @@
// Torc - Copyright 2011 University of Southern California. All Rights Reserved.
// $HeadURL$
// $Id$
// This program is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with this program. If
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Header for the Torc version data.
#ifndef TORC_VERSION_HPP
#define TORC_VERSION_HPP
#include "torc/common/DottedVersion.hpp"
#include <string>
namespace torc {
/// \brief The current Torc version as a DottedVersion object.
extern const torc::common::DottedVersion cTorcVersion;
/// \brief The current Torc version as a constant string.
extern const std::string cTorcVersionString;
} // namespace torc
#endif // TORC_VERSION_HPP

View File

@ -17,9 +17,18 @@
/// \brief Source for the Arc class.
#include "torc/architecture/Arc.hpp"
#include <boost/functional/hash.hpp>
namespace torc {
namespace architecture {
std::size_t hash_value(const Arc& inArc) {
std::size_t seed = 0;
boost::hash_combine(seed, inArc.getSourceTilewire().getTileIndex());
boost::hash_combine(seed, inArc.getSourceTilewire().getWireIndex());
boost::hash_combine(seed, inArc.getSinkTilewire().getTileIndex());
boost::hash_combine(seed, inArc.getSinkTilewire().getWireIndex());
return seed;
}
} // namespace architecture
} // namespace torc

View File

@ -54,6 +54,9 @@ namespace architecture {
bool isUndefined(void) const {
return mSourceTilewire.isUndefined() || mSinkTilewire.isUndefined();
}
// friends
/// \brief Return a hash value for the specified arc.
friend std::size_t hash_value(const Arc& inArc);
};
class InvalidArcException {

View File

@ -14,7 +14,7 @@
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Source for the Arc unit test.
/// \brief Unit test for the Arc class.
#include <boost/test/unit_test.hpp>
#include "torc/architecture/Arc.hpp"
@ -27,6 +27,34 @@ BOOST_AUTO_TEST_SUITE(architecture)
/// \brief Unit test for the Arc class.
BOOST_AUTO_TEST_CASE(ArcUnitTest) {
// supporting variables
Tilewire tilewire1(xilinx::TileIndex(5), xilinx::WireIndex(3));
Tilewire tilewire2(xilinx::TileIndex(0), xilinx::WireIndex(9));
// members tested:
// Tilewire mSourceTilewire;
// Tilewire mSinkTilewire;
// functions tested:
// Arc(void);
// Arc(const Tilewire& inSourceTilewire, const Tilewire& inSinkTilewire);
// bool operator ==(const Arc& rhs) const;
// bool isUndefined(void) const;
Arc arc1;
Arc arc2;
Arc arc3(tilewire1, tilewire2);
BOOST_CHECK((arc1 == arc2) == true);
BOOST_CHECK((arc1 == arc3) == false);
BOOST_CHECK(arc1.isUndefined());
// functions tested:
// const Tilewire& getSourceTilewire(void) const;
// const Tilewire& getSinkTilewire(void) const;
BOOST_CHECK(arc3.getSourceTilewire() == tilewire1);
BOOST_CHECK(arc3.getSinkTilewire() == tilewire2);
// functions tested:
// friend std::size_t hash_value(const Arc& inArc);
BOOST_CHECK_EQUAL(hash_value(arc1), hash_value(arc2));
}
BOOST_AUTO_TEST_SUITE_END()

View File

@ -16,8 +16,8 @@
/// \file
/// \brief Header for the ArcUsage class.
#ifndef TORC_ARCHITECTURE_ARC_USAGE_HPP
#define TORC_ARCHITECTURE_ARC_USAGE_HPP
#ifndef TORC_ARCHITECTURE_ARCUSAGE_HPP
#define TORC_ARCHITECTURE_ARCUSAGE_HPP
#include "torc/architecture/Array.hpp"
#include "torc/architecture/Arc.hpp"
@ -28,12 +28,16 @@
namespace torc {
namespace architecture {
namespace architecture { class ArcUsageUnitTest; }
/// \brief Encapsulation the design arc usage.
/// \details This class uses a compact bitset representation to very efficiently track the arc
/// usage of a design in an entire device. Internal bitset objects are maintained on a
/// per-tile basis, and are not allocated until at least one arc in the tile has been
/// marked used.
class ArcUsage {
/// \brief Our unit test class has access to our internals.
friend class torc::architecture::architecture::ArcUsageUnitTest;
protected:
// types
typedef boost::dynamic_bitset<> dynamic_bitset; ///< \brief Imported type name.
@ -54,11 +58,18 @@ namespace architecture {
dynamic_bitset mTileDirty;
// functions
/// \brief Returns the offset into the bitset for the specified arc.
uint32_t getArcOffset(const Tilewire& inTilewire1, const Tilewire& inTilewire2) const {
/// \note The ordering of regular, irregular, routethrough, and tied sinks does not matter
/// as long as it is consistent. The only impact comes from the likelihood of access
/// for the different types, where more common ones ought to be visited first.
uint32_t getArcOffset(const Tilewire& inTilewire1, const Tilewire& inTilewire2) const {
// first make sure the arc is defined
if(inTilewire1.isUndefined() || inTilewire2.isUndefined())
throw InvalidArcException(Arc(inTilewire1, inTilewire2));
// look up the relevant tile and wire indexes
TileIndex tile1 = inTilewire1.getTileIndex();
WireIndex wire1 = inTilewire1.getWireIndex();
WireIndex wire2 = inTilewire2.getWireIndex();
// begin by figuring out the tile type
// determine the tile type
const TileInfo& tileInfo = mTiles.getTileInfo(tile1);
TileTypeIndex type = tileInfo.getTypeIndex();
// next get the wire's base arc offset
@ -76,6 +87,18 @@ namespace architecture {
if(irregularSinks[i] == wire2) return offset;
offset++;
}
// look for a routethrough sink
const WireArray& routethroughSinks = wireInfo.getRoutethroughSinks();
for(WireIndex i; i < routethroughSinks.getSize(); i++) {
if(routethroughSinks[i] == wire2) return offset;
offset++;
}
// look for a tied sink
const WireArray& tiedSinks = wireInfo.getTiedSinks();
for(WireIndex i; i < tiedSinks.getSize(); i++) {
if(tiedSinks[i] == wire2) return offset;
offset++;
}
// if we didn't find the sink in the regular or irregular arcs, the call failed
/// \todo Throw a meaningful exception.
throw InvalidArcException(Arc(inTilewire1, inTilewire2));
@ -129,7 +152,9 @@ namespace architecture {
const WireInfo& wireInfo = mTiles.getWireInfo(type, WireIndex(wires.getSize() - 1));
// caution: we have to add the regular and irregular sink count from the last wire
size_t size = wireInfo.getArcOffset() + wireInfo.getSinks().getSize()
+ wireInfo.getIrregularSinks().getSize();
+ wireInfo.getIrregularSinks().getSize()
+ wireInfo.getRoutethroughSinks().getSize()
+ wireInfo.getTiedSinks().getSize();
bitset = mBitsets[tileIndex1] = new dynamic_bitset(size);
// track the statistics
mTileUsageCount++;
@ -226,4 +251,4 @@ namespace architecture {
} // namespace architecture
} // namespace torc
#endif // TORC_ARCHITECTURE_ARC_USAGE_HPP
#endif // TORC_ARCHITECTURE_ARCUSAGE_HPP

View File

@ -14,9 +14,10 @@
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Source for the ArcUsage unit test.
/// \brief Unit test for the ArcUsage class.
#include <boost/test/unit_test.hpp>
#include "torc/architecture/DDB.hpp"
#include "torc/architecture/ArcUsage.hpp"
namespace torc {
@ -28,6 +29,108 @@ using namespace torc::architecture::xilinx;
/// \brief Unit test for the ArcUsage class.
BOOST_AUTO_TEST_CASE(ArcUsageUnitTest) {
// supporting variables
DDB ddb("xcv50");
const Tiles& tiles = ddb.getTiles();
Tilewire tilewire1 = ddb.lookupTilewire("R1C1", "S0_X");
Tilewire tilewire2 = ddb.lookupTilewire("R1C1", "OUT0");
Tilewire tilewire3(tilewire2.getTileIndex(), WireIndex(10000));
Arc arc1(tilewire1, tilewire2);
uint32_t virtexCenterArcCount = 1511u;
// members tested:
// const Tiles& mTiles;
// Array<dynamic_bitset*> mBitsets;
// dynamic_bitset mTileDirty;
// functions tested:
// ArcUsage(const Tiles& inTiles);
// void autosize(void);
// uint32_t getArcUsageCount(void) const;
// TileCount getTileUsageCount(void) const;
// uint32_t getBitCount(void) const;
ArcUsage arcUsage(tiles);
arcUsage.autosize();
BOOST_CHECK(arcUsage.mBitsets.getSize() > 0);
BOOST_CHECK(arcUsage.getArcUsageCount() == 0);
BOOST_CHECK(arcUsage.getTileUsageCount() == TileCount(0));
BOOST_CHECK(arcUsage.getBitCount() == 0);
// members tested:
// TileCount mTileUsageCount;
// uint32_t mBitCount;
// functions tested:
// inline bool isUsed(const Arc& inArc);
// bool isUsed(const Tilewire& inTilewire1, const Tilewire& inTilewire2) const;
// inline void use(const Arc& inArc) ;
// void use(const Tilewire& inTilewire1, const Tilewire& inTilewire2);
// inline void release(const Arc& inArc);
// void release(const Tilewire& inTilewire1, const Tilewire& inTilewire2);
// uint32_t getArcUsageCount(void) const;
// TileCount getTileUsageCount(void) const;
// uint32_t getBitCount(void) const;
BOOST_CHECK_EQUAL(arcUsage.isUsed(arc1), false);
arcUsage.use(arc1);
BOOST_CHECK_EQUAL(arcUsage.isUsed(arc1), true);
BOOST_CHECK_EQUAL(arcUsage.getArcUsageCount(), 1u);
BOOST_CHECK_EQUAL(arcUsage.getTileUsageCount(), TileCount(1));
BOOST_CHECK_EQUAL(arcUsage.getBitCount(), virtexCenterArcCount);
arcUsage.release(arc1);
BOOST_CHECK_EQUAL(arcUsage.isUsed(arc1), false);
BOOST_CHECK_EQUAL(arcUsage.getArcUsageCount(), 0u);
BOOST_CHECK_EQUAL(arcUsage.getTileUsageCount(), TileCount(1));
BOOST_CHECK_EQUAL(arcUsage.getBitCount(), virtexCenterArcCount);
// exceptions tested:
// InvalidArcException;
// functions tested:
// uint32_t getArcOffset(const Tilewire& inTilewire1, const Tilewire& inTilewire2) const;
bool threwInvalidArcException = false;
try {
// this arc's tilewires are undefined
(void) arcUsage.getArcOffset(Tilewire(), Tilewire());
}
catch(InvalidArcException iae) {
threwInvalidArcException = true;
}
BOOST_CHECK_EQUAL(threwInvalidArcException, true);
threwInvalidArcException = false;
try {
// this arc is valid (and its tilewires are defined)
(void) arcUsage.getArcOffset(tilewire1, tilewire2);
}
catch(InvalidArcException iae) {
threwInvalidArcException = true;
}
BOOST_CHECK_EQUAL(threwInvalidArcException, false);
threwInvalidArcException = false;
try {
// this arc's tilewires are defined, but the are is invalid
(void) arcUsage.getArcOffset(tilewire1, tilewire3);
}
catch(InvalidArcException iae) {
threwInvalidArcException = true;
}
BOOST_CHECK_EQUAL(threwInvalidArcException, true);
// functions tested:
// void clear(void);
arcUsage.use(arc1);
arcUsage.clear();
BOOST_CHECK_EQUAL(arcUsage.getArcUsageCount(), 0u);
BOOST_CHECK_EQUAL(arcUsage.getTileUsageCount(), TileCount(1));
BOOST_CHECK_EQUAL(arcUsage.getBitCount(), virtexCenterArcCount);
// functions not tested:
// ~ArcUsage(void);
ArcUsage* arcUsagePtr = new ArcUsage(tiles);
arcUsagePtr->autosize();
arcUsagePtr->use(arc1);
arcUsagePtr->~ArcUsage();
uint32_t bitsetsAfterDestruction = 0;
for(uint32_t i = 0; i < arcUsagePtr->mBitsets.getSize(); i++) {
bitsetsAfterDestruction += (arcUsagePtr->mBitsets[i] != 0);
}
BOOST_CHECK_EQUAL(bitsetsAfterDestruction, 0u);
}
BOOST_AUTO_TEST_SUITE_END()

View File

@ -14,7 +14,7 @@
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Source for the Array unit test.
/// \brief Unit test for the Array class.
#include <boost/test/unit_test.hpp>
#define DEBUG // test the debug functionality as well
@ -52,6 +52,7 @@ BOOST_AUTO_TEST_CASE(ArrayUnitTest) {
try {
// if bounds checking is enabled and correct, we won't be able to read index 3
Tilewire outOfRange = tilewireArray[size3];
(void) outOfRange;
} catch(std::out_of_range oor) {
std::cerr << "Bounds checking generated message \"" << oor.what() << "\"" << std::endl;
boundsEnforced = true;

View File

@ -73,11 +73,11 @@ namespace architecture {
deviceDatabaseBytesRead += mSegments.readTilewireSegments(deviceDatabaseStream);
bool extendedAnchorTileCount
= mDeviceVersion.getFormat() == torc::common::DottedVersion(1, 0, 1);
deviceDatabaseBytesRead += mSegments.readSegments(deviceDatabaseStream,
extendedAnchorTileCount);
deviceDatabaseBytesRead
+= mSegments.readSegments(deviceDatabaseStream, extendedAnchorTileCount);
deviceDatabaseBytesRead += mSegments.readIrregularArcs(deviceDatabaseStream);
familyDatabaseBytesRead += mSites.readSiteTypes(familyDatabaseStream);
familyDatabaseBytesRead += mSites.readSitePinMaps(familyDatabaseStream);
familyDatabaseBytesRead += mSites.readPrimitiveTypes(familyDatabaseStream);
familyDatabaseBytesRead += mSites.readPrimitivePinMaps(familyDatabaseStream);
deviceDatabaseBytesRead += mSites.readSites(deviceDatabaseStream);
cout << "Read " << familyDatabaseBytesRead << " bytes from " << mFamilyName << endl;
cout << "Read " << deviceDatabaseBytesRead << " bytes from " << mDeviceName << endl;

View File

@ -27,8 +27,8 @@
#include "torc/architecture/ArcUsage.hpp"
#include "torc/architecture/WireUsage.hpp"
#include "torc/architecture/ExtendedWireInfo.hpp"
#include "torc/architecture/DeviceDesignator.hpp"
#include "torc/architecture/DDBStreamHelper.hpp"
#include "torc/common/DeviceDesignator.hpp"
#include <string>
#include <map>
@ -95,7 +95,8 @@ namespace architecture {
DDB(const string& inDeviceName, const string& inPackageName = "") : mArcUsage(mTiles),
mWireUsage(mTiles) { initialize(inDeviceName, inPackageName); }
/// \brief Public constructor.
DDB(const DeviceDesignator& inDeviceDesignator) : mArcUsage(mTiles), mWireUsage(mTiles) {
DDB(const torc::common::DeviceDesignator& inDeviceDesignator) : mArcUsage(mTiles),
mWireUsage(mTiles) {
initialize(inDeviceDesignator.getDeviceName(), inDeviceDesignator.getDevicePackage());
}
// iterators

View File

@ -16,8 +16,8 @@
/// \file
/// \brief Header for the DDBStreamHelper class.
#ifndef TORC_ARCHITECTURE_DDB_STREAM_HELPER_HPP
#define TORC_ARCHITECTURE_DDB_STREAM_HELPER_HPP
#ifndef TORC_ARCHITECTURE_DDBSTREAMHELPER_HPP
#define TORC_ARCHITECTURE_DDBSTREAMHELPER_HPP
#include "torc/common/EncapsulatedInteger.hpp"
#include <ostream>
@ -73,4 +73,4 @@ namespace architecture {
} // namespace architecture
} // namespace torc
#endif // TORC_ARCHITECTURE_DDB_STREAM_HELPER_HPP
#endif // TORC_ARCHITECTURE_DDBSTREAMHELPER_HPP

View File

@ -14,7 +14,7 @@
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Source for the DDBStreamHelper unit test.
/// \brief Unit test for the DDBStreamHelper class.
#include <boost/test/unit_test.hpp>
#include "torc/architecture/DDB.hpp"

View File

@ -14,7 +14,7 @@
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Source for the DDB unit test.
/// \brief Unit test for the DDB class.
#include <boost/test/unit_test.hpp>
#include "torc/architecture/DDB.hpp"
@ -32,25 +32,11 @@ namespace architecture {
BOOST_AUTO_TEST_SUITE(architecture)
using namespace torc::architecture::xilinx;
void testDevice(const std::string& inDeviceName);
/// \brief Unit test for the DDB class.
BOOST_AUTO_TEST_CASE(DDBUnitTest) {
// iterate over the devices
const torc::common::DeviceVector& devices = torc::common::Devices::getSupportedDevices();
torc::common::DeviceVector::const_iterator dp = devices.begin();
torc::common::DeviceVector::const_iterator de = devices.end();
while(dp < de) {
const std::string& device = *dp++;
if(device.empty()) break;
testDevice(device);
//break;
}
}
void testDevice(const std::string& inDeviceName) {
// functions not tested:
// (note: some of these functions are tested in their respective classes)
// const string& getFamilyName(void) const;
// const Segments& getSegments(void) const;
// const WireUsage& getWireUsage(void) const;
@ -65,147 +51,49 @@ void testDevice(const std::string& inDeviceName) {
// const string& getDeviceName(void) const;
BOOST_CHECK_EQUAL(ddb.getDeviceName(), inDeviceName);
std::map<TileTypeIndex, int> tileTypeMap;
// for now this test merely opens representative device databases; regression tests are
// performed elsewhere
if(true) return;
// functions tested:
// const Tiles& getTiles(void) const;
std::map<TileTypeIndex, int> tileTypeMap;
const Tiles& tiles = ddb.getTiles();
TileCount tileCount = tiles.getTileCount();
for(TileIndex tileIndex; tileIndex < tileCount; tileIndex++) {
const TileInfo& tileInfo = tiles.getTileInfo(tileIndex);
TileTypeIndex tileTypeIndex = tileInfo.getTypeIndex();
const std::string& tileTypeName = tiles.getTileTypeName(tileTypeIndex);
tileTypeMap[tileTypeIndex] = 0;
// std::cout << "\t" << tileIndex << ": " << tileInfo.getName() << " (" << tileTypeName
// << ") [" << tileInfo.getRow() << "," << tileInfo.getCol() << "] ";
// const Array<const WireInfo>& wires = tiles.getWireInfo(tileTypeIndex);
// WireCount wireCount(wires.getSize());
// for(WireIndex wireIndex; wireIndex < wireCount; wireIndex++) {
// std::cout << ".";
// const WireInfo& wireInfo = wires[wireIndex];
// std::cout << "\t\t" << wireIndex << ": " << wireInfo.getName()
// << std::endl;
// }
// std::cout << std::endl;
(void) tileTypeName;
// TileIndex tileIndex = tiles.findTileIndex(tileInfo.getName());
// std::cout << "\t" << tileInfo.getName() << ": " << tileIndex << std::endl;
tileTypeMap[tileTypeIndex] = 0;
(void) tileTypeName;
}
std::cout << tileTypeMap.size() << " tile types" << std::endl;
std::cout << tileTypeMap.size() << " tile types" << std::endl;
std::map<std::string, int> siteTypeMap;
// functions tested
// const Sites& getSites(void) const;
std::map<std::string, int> siteTypeMap;
const Sites& sites = ddb.getSites();
SiteCount siteCount = sites.getSiteCount();
for(SiteIndex siteIndex; siteIndex < siteCount; siteIndex++) {
// std::cout << "\t" << siteIndex << std::endl;
const Sites::Site& site = sites.getSite(siteIndex);
const Site& site = sites.getSite(siteIndex);
const std::string& siteTypeName = site.getPrimitiveDefPtr()->getName();
siteTypeMap[siteTypeName] = 0;
}
std::cout << ddb;
std::cout << siteTypeMap.size() << " site types" << std::endl;
// const Array<const Sites::Site>& siteArray = sites.getSites();
// Array<const Sites::Site>::const_iterator ssp = siteArray.begin();
// Array<const Sites::Site>::const_iterator sse = siteArray.end();
// while(ssp < sse) {
// const Sites::Site& site = *ssp++;
// std::cout << site.getName() << " (" << site.getSiteDefinitionPtr()->getName() << ")" << std::endl;
// const Array<const Sites::SitePin>& sitePinArray = site.getSiteDefinitionPtr()->getPins();
// Array<const Sites::SitePin>::const_iterator spp = sitePinArray.begin();
// Array<const Sites::SitePin>::const_iterator spe = sitePinArray.end();
// while(spp < spe) {
// std::string pinName = spp++->getName();
// std::cout << "\t" << pinName << ": " << site.getPinTilewire(pinName) << std::endl;
// }
// }
return;
xilinx::SiteIndex siteIndex = sites.findSiteIndex("TBUF_X38Y26");
const Sites::Site& site = sites.getSite(siteIndex);
std::cout << "Found site " << site.getName() << std::endl;
Tilewire pinTilewire1 = site.getPinTilewire("T");
std::cout << "Found " << site.getName() << ".T" << " tilewire: " << pinTilewire1 << std::endl;
Tilewire pinTilewire2 = ddb.sitePinToTilewire("TBUF_X38Y26", "T");
std::cout << "Found TBUF_X38Y26.T tilewire: " << pinTilewire2 << std::endl;
std::cout << siteTypeMap.size() << " site types" << std::endl;
}
TilewireVector segment;
Tilewire tilewire(TileIndex(14), WireIndex(1));
ddb.expandSegment(tilewire, segment, DDB::eExpandDirectionSinkward);
BOOST_CHECK_EQUAL(segment.size(), 23u);
// std::cerr << ddb << tilewire << std::endl;
// TilewireVector::const_iterator sep = segment.begin();
// TilewireVector::const_iterator see = segment.end();
// while(sep < see) {
// const Tilewire& tw = *sep++;
// //std::cerr << "\t" << tw << std::endl;
// TilewireVector sinks;
// ddb.expandTilewireSinks(tw, sinks);
// TilewireVector::const_iterator sip = sinks.begin();
// TilewireVector::const_iterator sie = sinks.end();
// while(sip < sie) std::cerr << "\t\t" << *sip++ << std::endl;
// }
// std::cerr << ddb << tilewire << std::endl;
// TilewireVector::const_iterator sep = segment.begin();
// TilewireVector::const_iterator see = segment.end();
// while(sep < see) {
// const Tilewire& tw = *sep++;
// std::cerr << "\t" << tw << std::endl;
// TilewireVector sources;
// ddb.expandTilewireSources(tw, sources);
// TilewireVector::const_iterator sop = sources.begin();
// TilewireVector::const_iterator soe = sources.end();
// while(sop < soe) std::cerr << "\t\t" << *sop++ << std::endl;
// }
// std::cerr << ddb << tilewire << std::endl;
// ArcVector sinks;
// ddb.expandSegmentSinks(tilewire, sinks);
// ArcVector::const_iterator sip = sinks.begin();
// ArcVector::const_iterator sie = sinks.end();
// while(sip < sie) {
// const Tilewire& source = sip->getSourceTilewire();
// const Tilewire& sink = sip->getSinkTilewire();
// std::cerr << "\t" << source << " >> " << sink << std::endl;
// sip++;
// }
// std::cerr << ddb << tilewire << std::endl;
// ArcVector sources;
// ddb.expandSegmentSources(tilewire, sources);
// ArcVector::const_iterator sip = sources.begin();
// ArcVector::const_iterator sie = sources.end();
// while(sip < sie) {
// const Tilewire& source = sip->getSourceTilewire();
// const Tilewire& sink = sip->getSinkTilewire();
// std::cerr << "\t" << sink << " << " << source << std::endl;
// sip++;
// }
// ExtendedWireInfo ewi(ddb, tilewire);
// std::cerr << ddb;
// std::cerr << ewi << std::endl;
// std::cerr << tilewire << std::endl;
ArcVector sinks;
ddb.expandSegmentSinks(tilewire, sinks);
ArcVector::const_iterator sip = sinks.begin();
const Tilewire& source1 = sip->getSourceTilewire();
const Tilewire& sink1 = sip->getSinkTilewire();
sip++;
const Tilewire& source2 = sip->getSourceTilewire();
const Tilewire& sink2 = sip->getSinkTilewire();
ArcUsage& arcUsage = ddb.getArcUsage();
WireUsage& wireUsage = ddb.getWireUsage();
BOOST_CHECK_EQUAL(arcUsage.isUsed(source1, sink1), false);
arcUsage.use(source1, sink1);
arcUsage.release(source2, sink2);
BOOST_CHECK_EQUAL(arcUsage.isUsed(source1, sink1), true);
BOOST_CHECK_EQUAL(arcUsage.isUsed(source2, sink2), false);
ddb.useArc(Arc(source2,sink2));
BOOST_CHECK_EQUAL(wireUsage.isUsed(source2), true);
BOOST_CHECK_EQUAL(wireUsage.isUsed(sink2), true);
arcUsage.clear();
BOOST_CHECK_EQUAL(arcUsage.isUsed(source1, sink1), false);
BOOST_CHECK_EQUAL(arcUsage.isUsed(source2, sink2), false);
/// \brief Unit test for the DDB class.
BOOST_AUTO_TEST_CASE(DDBUnitTest) {
// iterate over the devices
const torc::common::DeviceVector& devices = torc::common::Devices::getUnitTestDevices();
torc::common::DeviceVector::const_iterator dp = devices.begin();
torc::common::DeviceVector::const_iterator de = devices.end();
while(dp < de) {
const std::string& device = *dp++;
if(device.empty()) break;
testDevice(device);
}
}
BOOST_AUTO_TEST_SUITE_END()

View File

@ -14,87 +14,20 @@
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Header for the DeviceDesignator class.
/// \deprecated
/// \brief Compatibility header for the DeviceDesignator class.
#ifndef TORC_ARCHITECTURE_DEVICE_DESIGNATOR_HPP
#define TORC_ARCHITECTURE_DEVICE_DESIGNATOR_HPP
#ifndef TORC_ARCHITECTURE_DEVICEDESIGNATOR_HPP
#define TORC_ARCHITECTURE_DEVICEDESIGNATOR_HPP
#include <boost/regex.hpp>
#include <string>
#include "torc/common/DeviceDesignator.hpp"
namespace torc {
namespace architecture {
/// \brief Encapsulation of a device designator and its constituent elements.
class DeviceDesignator {
public:
// enums
enum EFamily {
// unknown families
eFamilyUnknown = 0,
// Spartan families
eFamilySpartan2, eFamilySpartan2E, eFamilySpartan3, eFamilySpartan3A, eFamilySpartan3E,
eFamilySpartan6, eFamilySpartan6L,
// Virtex families
eFamilyVirtex, eFamilyVirtexE, eFamilyVirtex2, eFamilyVirtex2P, eFamilyVirtex4,
eFamilyVirtex5, eFamilyVirtex6, eFamilyVirtex6L, eFamilyVirtex7, eFamilyVirtex7L,
eFamilyKintex7, eFamilyKintex7L
};
protected:
// typedefs
typedef std::string string; ///< \brief Imported type name.
// members
/// \brief The full device designator.
string mDeviceDesignator;
/// \brief The family type.
EFamily mFamily;
/// \brief The device name.
string mDeviceName;
/// \brief The device package.
string mDevicePackage;
/// \brief The device speed grade.
string mDeviceSpeedGrade;
// functions
/// \brief Parses the device name into constituent device, package, and speed components.
bool parse(const string& inDeviceDesignator, const boost::regex& inRegEx);
// statics
static boost::regex sSpartan2RegEx; ///< \brief Regular expression for Spartan2 devices.
static boost::regex sSpartan2ERegEx; ///< \brief Regular expression for Spartan2E devices.
static boost::regex sSpartan3RegEx; ///< \brief Regular expression for Spartan3 devices.
static boost::regex sSpartan3ARegEx; ///< \brief Regular expression for Spartan3A devices.
static boost::regex sSpartan3ERegEx; ///< \brief Regular expression for Spartan3E devices.
static boost::regex sSpartan6RegEx; ///< \brief Regular expression for Spartan3E devices.
static boost::regex sSpartan6LRegEx; ///< \brief Regular expression for Spartan3E devices.
static boost::regex sVirtexRegEx; ///< \brief Regular expression for Virtex devices.
static boost::regex sVirtexERegEx; ///< \brief Regular expression for VirtexE devices.
static boost::regex sVirtex2RegEx; ///< \brief Regular expression for Virtex2 devices.
static boost::regex sVirtex2PRegEx; ///< \brief Regular expression for Virtex2P devices.
static boost::regex sVirtex4RegEx; ///< \brief Regular expression for Virtex4 devices.
static boost::regex sVirtex5RegEx; ///< \brief Regular expression for Virtex5 devices.
static boost::regex sVirtex6RegEx; ///< \brief Regular expression for Virtex6 devices.
static boost::regex sVirtex6LRegEx; ///< \brief Regular expression for Virtex6L devices.
static boost::regex sVirtex7RegEx; ///< \brief Regular expression for Virtex7 devices.
static boost::regex sVirtex7LRegEx; ///< \brief Regular expression for Virtex7L devices.
static boost::regex sKintex7RegEx; ///< \brief Regular expression for Kintex7 devices.
static boost::regex sKintex7LRegEx; ///< \brief Regular expression for Kintex7L devices.
public:
// constructors
/// \brief Basic constructor.
DeviceDesignator(const string& inDeviceDesignator);
// accessors
/// \brief Returns the device designator.
const string& getDeviceDesignator(void) const { return mDeviceDesignator; }
/// \brief Returns the device family.
const EFamily& getFamily(void) const { return mFamily; }
/// \brief Returns the device name.
const string& getDeviceName(void) const { return mDeviceName; }
/// \brief Returns the device package.
const string& getDevicePackage(void) const { return mDevicePackage; }
/// \brief Returns the device speed grade.
const string& getDeviceSpeedGrade(void) const { return mDeviceSpeedGrade; }
};
// typedef torc::common::DeviceDesignator DeviceDesignator;
} // namespace architecture
} // namespace torc
#endif // TORC_ARCHITECTURE_DEVICE_DESIGNATOR_HPP
#endif // TORC_ARCHITECTURE_DEVICEDESIGNATOR_HPP

View File

@ -16,8 +16,8 @@
/// \file
/// \brief Header for the DigestStream class.
#ifndef TORC_ARCHITECTURE_DIGEST_STREAM_HPP
#define TORC_ARCHITECTURE_DIGEST_STREAM_HPP
#ifndef TORC_ARCHITECTURE_DIGESTSTREAM_HPP
#define TORC_ARCHITECTURE_DIGESTSTREAM_HPP
#include "torc/common/Endian.hpp"
#include <boost/filesystem/convenience.hpp>
@ -98,4 +98,4 @@ namespace architecture {
} // namespace architecture
} // namespace torc
#endif // TORC_ARCHITECTURE_DIGEST_STREAM_HPP
#endif // TORC_ARCHITECTURE_DIGESTSTREAM_HPP

View File

@ -14,7 +14,7 @@
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Source for the DigestStream unit test.
/// \brief Unit test for the DigestStream class.
#include <boost/test/unit_test.hpp>
#include <boost/smart_ptr.hpp>
@ -30,10 +30,25 @@ BOOST_AUTO_TEST_SUITE(architecture)
/// \brief Unit test for the DigestStream class.
BOOST_AUTO_TEST_CASE(DigestStreamUnitTest) {
// functions tested:
// DigestStream(const boost::filesystem::path& inPath);
DigestStream digestStream(torc::common::DirectoryTree::getDevicesPath() / "xc5vlx30.db");
Versions versions;
// functions tested:
// std::istream& read(uint8_t& outValue);
// std::istream& read(uint16_t& outValue);
// std::istream& read(uint32_t& outValue);
// std::istream& read(char* s, std::streamsize n);
BOOST_CHECK(versions.readVersions(digestStream, true) > 0);
std::string header;
// functions tested:
// void readSectionHeader(string& outHeader);
// std::istream& read(uint8_t& outValue);
// std::istream& read(uint16_t& outValue);
// std::istream& read(uint32_t& outValue);
// std::istream& read(char* s, std::streamsize n);
digestStream.readSectionHeader(header);
BOOST_CHECK_EQUAL(header, ">>>> Family >>>>");
boost::uint16_t familyNameLength;
@ -47,6 +62,12 @@ BOOST_AUTO_TEST_CASE(DigestStreamUnitTest) {
uint16_t speedGradeCount;
digestStream.read(speedGradeCount);
BOOST_CHECK_EQUAL(speedGradeCount, 3);
// members tested:
// size_t mBytesRead;
// functions tested:
// size_t getBytesRead(void) const;
BOOST_CHECK(digestStream.getBytesRead() > 0u);
}
BOOST_AUTO_TEST_SUITE_END()

View File

@ -16,8 +16,8 @@
/// \file
/// \brief Header for the ExtendedWireInfo class.
#ifndef TORC_ARCHITECTURE_EXTENDED_WIRE_INFO_HPP
#define TORC_ARCHITECTURE_EXTENDED_WIRE_INFO_HPP
#ifndef TORC_ARCHITECTURE_EXTENDEDWIREINFO_HPP
#define TORC_ARCHITECTURE_EXTENDEDWIREINFO_HPP
#include "torc/architecture/XilinxDatabaseTypes.hpp"
#include "torc/architecture/Tilewire.hpp"
@ -25,7 +25,7 @@
namespace torc {
namespace architecture {
class DDB;
class DDB;
/// \brief Verbose encapsulation of a wire's information.
class ExtendedWireInfo {
@ -82,4 +82,4 @@ namespace architecture {
} // namespace architecture
} // namespace torc
#endif // TORC_ARCHITECTURE_EXTENDED_WIRE_INFO_HPP
#endif // TORC_ARCHITECTURE_EXTENDEDWIREINFO_HPP

View File

@ -14,7 +14,7 @@
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Source for the ExtendedWireInfo unit test.
/// \brief Unit test for the ExtendedWireInfo class.
#include <boost/test/unit_test.hpp>
#include "torc/architecture/ExtendedWireInfo.hpp"

View File

@ -16,8 +16,8 @@
/// \file
/// \brief Header for the InstancePin class.
#ifndef TORC_ARCHITECTURE_INSTANCE_PIN_HPP
#define TORC_ARCHITECTURE_INSTANCE_PIN_HPP
#ifndef TORC_ARCHITECTURE_INSTANCEPIN_HPP
#define TORC_ARCHITECTURE_INSTANCEPIN_HPP
#include "torc/physical/InstancePin.hpp"
#include "torc/architecture/Tilewire.hpp"
@ -84,4 +84,4 @@ namespace architecture {
} // namespace architecture
} // namespace torc
#endif // TORC_ARCHITECTURE_INSTANCE_PIN_HPP
#endif // TORC_ARCHITECTURE_INSTANCEPIN_HPP

View File

@ -14,7 +14,7 @@
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Source for the InstancePin unit test.
/// \brief Unit test for the InstancePin class.
#include <boost/test/unit_test.hpp>
#include "torc/architecture/InstancePin.hpp"
@ -29,7 +29,7 @@ namespace architecture {
BOOST_AUTO_TEST_SUITE(architecture)
/// \brief Unit test for the InstancePin class.
BOOST_AUTO_TEST_CASE(InstanceUnitTest) {
BOOST_AUTO_TEST_CASE(InstancePinUnitTest) {
// create objects to work with
torc::physical::InstanceSharedPtr instancePtr
= torc::physical::Factory::newInstancePtr("name", "type", "tile", "site");

View File

@ -41,8 +41,6 @@ OBJS = \
DDBUnitTest.o \
DDBStreamHelper.o \
DDBStreamHelperUnitTest.o \
DeviceDesignator.o \
DeviceDesignatorUnitTest.o \
DigestStream.o \
DigestStreamUnitTest.o \
ExtendedWireInfo.o \
@ -51,9 +49,25 @@ OBJS = \
InstancePinUnitTest.o \
OutputStreamHelpers.o \
OutputStreamHelpersUnitTest.o \
Package.o \
PackageUnitTest.o \
Pad.o \
PadUnitTest.o \
PrimitiveConn.o \
PrimitiveConnUnitTest.o \
PrimitiveDef.o \
PrimitiveDefUnitTest.o \
PrimitiveElement.o \
PrimitiveElementUnitTest.o \
PrimitiveElementPin.o \
PrimitiveElementPinUnitTest.o \
PrimitivePin.o \
PrimitivePinUnitTest.o \
Segments.o \
SegmentsRegressionTest.o \
SegmentsUnitTest.o \
Site.o \
SiteUnitTest.o \
Sites.o \
SitesUnitTest.o \
SiteTypesUnitTest.o \

View File

@ -18,8 +18,8 @@
/// \details The coverage and support of classes is quite limited at present, but may be expanded
/// upon request.
#ifndef TORC_ARCHITECTURE_OUTPUT_STREAM_HELPERS_HPP
#define TORC_ARCHITECTURE_OUTPUT_STREAM_HELPERS_HPP
#ifndef TORC_ARCHITECTURE_OUTPUTSTREAMHELPERS_HPP
#define TORC_ARCHITECTURE_OUTPUTSTREAMHELPERS_HPP
#include <iosfwd>
@ -40,4 +40,4 @@ namespace architecture {
} // namespace architecture
} // namespace torc
#endif // TORC_ARCHITECTURE_OUTPUT_STREAM_HELPERS_HPP
#endif // TORC_ARCHITECTURE_OUTPUTSTREAMHELPERS_HPP

View File

@ -0,0 +1,25 @@
// Torc - Copyright 2011 University of Southern California. All Rights Reserved.
// $HeadURL$
// $Id$
// This program is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with this program. If
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Source for the Package class.
#include "torc/architecture/Package.hpp"
namespace torc {
namespace architecture {
} // namespace architecture
} // namespace torc

View File

@ -0,0 +1,78 @@
// Torc - Copyright 2011 University of Southern California. All Rights Reserved.
// $HeadURL$
// $Id$
// This program is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with this program. If
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Header for the Package class.
#ifndef TORC_ARCHITECTURE_PACKAGE_HPP
#define TORC_ARCHITECTURE_PACKAGE_HPP
#include "torc/architecture/XilinxDatabaseTypes.hpp"
#include "torc/architecture/Array.hpp"
#include "torc/architecture/Pad.hpp"
#include <map>
namespace torc {
namespace architecture {
namespace architecture { class PackageUnitTest; }
/// \brief Encapsulation of a physical device package and its pins.
class Package {
protected:
// friends
/// \brief The Sites class has access to our internals.
friend class Sites;
/// \brief Our unit test class has access to our internals.
friend class torc::architecture::architecture::PackageUnitTest;
// types
typedef std::string string; ///< \brief Imported type name.
typedef xilinx::PadIndex PadIndex; ///< \brief Imported type name.
/// \brief A map from pad names to pad indexes.
typedef std::map<std::string, PadIndex> PadNameToPadIndexMap;
// members
/// \brief The package name.
string mName;
/// \brief The array of pads for this package.
PadArray mPads;
/// \brief The map from pad names to corresponding map indexes.
PadNameToPadIndexMap mPadNameToPadIndex;
// constructors
/// \brief Protected constructor
Package(const string& inName) : mName(inName), mPads() {}
// accessors
/// \brief Returns a non-constant array of package pads
PadArray& getPads(void) { return mPads; }
public:
// constructors
/// \brief Null constructor.
Package(void) : mName(), mPads() {}
// accessors
/// \brief Returns the package name.
const string& getName(void) const { return mName; }
/// \brief Returns a constant array of package pads
const PadArray& getPads(void) const { return mPads; }
// functions
/// \brief Returns the pad index corresponding to the given pad name.
PadIndex findPadIndexByName(const string& inName) const {
PadNameToPadIndexMap::const_iterator p = mPadNameToPadIndex.find(inName);
return (p == mPadNameToPadIndex.end()) ? PadIndex(-1) : p->second;
}
};
} // namespace architecture
} // namespace torc
#endif // TORC_ARCHITECTURE_PACKAGE_HPP

View File

@ -0,0 +1,78 @@
// Torc - Copyright 2011 University of Southern California. All Rights Reserved.
// $HeadURL$
// $Id$
// This program is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with this program. If
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Unit test for the Package class.
#include <boost/test/unit_test.hpp>
#include "torc/architecture/Package.hpp"
#include "torc/architecture/DDB.hpp"
namespace torc {
namespace architecture {
BOOST_AUTO_TEST_SUITE(architecture)
/// \brief Unit test for the Package class.
BOOST_AUTO_TEST_CASE(PackageUnitTest) {
// members tested:
// string mName;
// PadArray mPads;
// PadNameToPadIndexMap mPadNameToPadIndex;
// functions tested:
// Package(const string& inName);
// PadArray& getPads(void);
// const string& getName(void) const;
// const PadArray& getPads(void) const;
// PadIndex findPadIndexByName(const string& inName) const;
int index = 0;
std::string name1("pad1");
std::string name2("pad2");
std::string name3("pad3");
Pad pad1(xilinx::SiteIndex(), name1, xilinx::SiteFlags());
Pad pad2(xilinx::SiteIndex(), name2, xilinx::SiteFlags());
Pad pad3(xilinx::SiteIndex(), name3, xilinx::SiteFlags());
std::string name("name");
Package package1(name);
PadArray& pads1 = package1.getPads();
pads1.setSize(3);
package1.mPadNameToPadIndex[name1] = xilinx::PadIndex(index);
const_cast<Pad&>(pads1[index++]) = pad1;
package1.mPadNameToPadIndex[name2] = xilinx::PadIndex(index);
const_cast<Pad&>(pads1[index++]) = pad2;
package1.mPadNameToPadIndex[name3] = xilinx::PadIndex(index);
const_cast<Pad&>(pads1[index++]) = pad3;
BOOST_CHECK_EQUAL(package1.getName(), name);
const PadArray& pads2 = package1.getPads();
index = 0;
BOOST_CHECK_EQUAL(pads2[index++].getName(), pad1.getName());
BOOST_CHECK_EQUAL(pads2[index++].getName(), pad2.getName());
BOOST_CHECK_EQUAL(pads2[index++].getName(), pad3.getName());
BOOST_CHECK_EQUAL(package1.findPadIndexByName(name1), xilinx::PadIndex(0));
BOOST_CHECK_EQUAL(package1.findPadIndexByName(name2), xilinx::PadIndex(1));
BOOST_CHECK_EQUAL(package1.findPadIndexByName(name3), xilinx::PadIndex(2));
// functions tested:
// Package(void);
// PadArray& getPads(void);
Package package2;
BOOST_CHECK_EQUAL(package2.getName(), "");
BOOST_CHECK_EQUAL(package2.getPads().getSize(), 0u);
}
BOOST_AUTO_TEST_SUITE_END()
} // namespace architecture
} // namespace torc

View File

@ -0,0 +1,25 @@
// Torc - Copyright 2011 University of Southern California. All Rights Reserved.
// $HeadURL$
// $Id$
// This program is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with this program. If
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Source for the Pad class.
#include "torc/architecture/Pad.hpp"
namespace torc {
namespace architecture {
} // namespace architecture
} // namespace torc

View File

@ -0,0 +1,75 @@
// Torc - Copyright 2011 University of Southern California. All Rights Reserved.
// $HeadURL$
// $Id$
// This program is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with this program. If
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Header for the Pad class.
#ifndef TORC_ARCHITECTURE_PAD_HPP
#define TORC_ARCHITECTURE_PAD_HPP
#include "torc/architecture/XilinxDatabaseTypes.hpp"
#include "torc/architecture/Array.hpp"
#include <string>
namespace torc {
namespace architecture {
namespace architecture { class PadUnitTest; }
namespace architecture { class PackageUnitTest; }
/// \brief Encapsulation of the site index, pin name, and pin flags for a package.
class Pad {
protected:
/// \brief The Sites class has access to our internals.
friend class Sites;
/// \brief Our unit test class has access to our internals.
friend class torc::architecture::architecture::PadUnitTest;
/// \brief The Package unit test class has access to our internals.
friend class torc::architecture::architecture::PackageUnitTest;
// types
typedef std::string string; ///< \brief Imported type name.
typedef xilinx::SiteIndex SiteIndex; ///< \brief Imported type name.
typedef xilinx::SiteFlags SiteFlags; ///< \brief Imported type name.
// members
/// \brief The index of the site corresponding to this pad.
SiteIndex mSiteIndex;
/// \brief The name of the pad in its physical package.
string mName;
/// \brief The site flags for this pad, specifically including bonding.
SiteFlags mFlags;
// constructors
/// \brief Protected constructor.
Pad(SiteIndex inSiteIndex, const string& inName, SiteFlags inFlags)
: mSiteIndex(inSiteIndex), mName(inName), mFlags(inFlags) {}
public:
// constructors
/// \brief Null constructor.
Pad(void) : mSiteIndex(), mName(), mFlags() {};
// accessors
/// \brief Returns the index of the site corresponding to this pad.
SiteIndex getSiteIndex(void) const { return mSiteIndex; }
/// \brief Returns the name of the pad in its physical package.
const string& getName(void) const { return mName; }
/// \brief Returns the site flags for this pad, specifically including bonding.
SiteFlags getFlags(void) const { return mFlags; }
};
/// \brief Array of constant Pad objects.
typedef Array<const Pad> PadArray;
} // namespace architecture
} // namespace torc
#endif // TORC_ARCHITECTURE_PAD_HPP

View File

@ -0,0 +1,55 @@
// Torc - Copyright 2011 University of Southern California. All Rights Reserved.
// $HeadURL$
// $Id$
// This program is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with this program. If
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Unit test for the Pad class.
#include <boost/test/unit_test.hpp>
#include "torc/architecture/Pad.hpp"
namespace torc {
namespace architecture {
BOOST_AUTO_TEST_SUITE(architecture)
/// \brief Unit test for the Pad class.
BOOST_AUTO_TEST_CASE(PadUnitTest) {
// members tested:
// SiteIndex mSiteIndex;
// string mName;
// SiteFlags mFlags;
// functions tested:
// Pad(SiteIndex inSiteIndex, const string& inName, SiteFlags inFlags);
// Pad(void);
// SiteIndex getSiteIndex(void) const;
// const string& getName(void) const;
// SiteFlags getFlags(void) const;
xilinx::SiteIndex siteIndex(15);
std::string name("name");
xilinx::SiteFlags flags(3);
Pad pad1(siteIndex, name, flags);
BOOST_CHECK_EQUAL(pad1.getSiteIndex(), siteIndex);
BOOST_CHECK_EQUAL(pad1.getName(), name);
BOOST_CHECK_EQUAL(pad1.getFlags(), flags);
Pad pad2;
BOOST_CHECK_EQUAL(pad2.getSiteIndex(), xilinx::SiteIndex());
BOOST_CHECK_EQUAL(pad2.getName(), "");
BOOST_CHECK_EQUAL(pad2.getFlags(), xilinx::SiteFlags());
}
BOOST_AUTO_TEST_SUITE_END()
} // namespace architecture
} // namespace torc

View File

@ -0,0 +1,25 @@
// Torc - Copyright 2011 University of Southern California. All Rights Reserved.
// $HeadURL$
// $Id$
// This program is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with this program. If
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Source for the PrimitiveConn class.
#include "torc/architecture/PrimitiveConn.hpp"
namespace torc {
namespace architecture {
} // namespace architecture
} // namespace torc

View File

@ -0,0 +1,58 @@
// Torc - Copyright 2011 University of Southern California. All Rights Reserved.
// $HeadURL$
// $Id$
// This program is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with this program. If
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Header for the PrimitiveConn class.
#ifndef TORC_ARCHITECTURE_PRIMITIVECONN_HPP
#define TORC_ARCHITECTURE_PRIMITIVECONN_HPP
#include "torc/architecture/PrimitiveElementPin.hpp"
namespace torc {
namespace architecture {
namespace architecture { class PrimitiveConnUnitTest; }
/// \brief Encapsulation of a PrimitiveDef internal connection.
/// \detail 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.
class PrimitiveConn {
protected:
// friends
/// \brief The Sites class has access to our internals.
friend class Sites;
/// \brief Our unit test class has access to our internals.
friend class torc::architecture::architecture::PrimitiveConnUnitTest;
// members
/// \brief Pointer to the source primitive element pin.
const PrimitiveElementPin* mSourcePtr;
/// \brief Vector of pointers to the sink primitive element pins.
PrimitiveElementPinPtrVector mSinks;
public:
// accessors
/// \brief Returns a pointer to the source primitive element pin.
const PrimitiveElementPin* getSourcePtr(void) const { return mSourcePtr; }
/// \brief Returns a vector of pointers to the sink primitive element pins.
const PrimitiveElementPinPtrVector& getSinks(void) const { return mSinks; }
};
/// \brief Array of shared pointers to PrimitiveConn objects.
typedef Array<PrimitiveConnSharedPtr> PrimitiveConnSharedPtrArray;
} // namespace architecture
} // namespace torc
#endif // TORC_ARCHITECTURE_PRIMITIVECONN_HPP

View File

@ -0,0 +1,53 @@
// Torc - Copyright 2011 University of Southern California. All Rights Reserved.
// $HeadURL$
// $Id$
// This program is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with this program. If
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Unit test for the PrimitiveConn class.
#include <boost/test/unit_test.hpp>
#include "torc/architecture/PrimitiveConn.hpp"
namespace torc {
namespace architecture {
BOOST_AUTO_TEST_SUITE(architecture)
/// \brief Unit test for the PrimitiveConn class.
BOOST_AUTO_TEST_CASE(PrimitiveConnUnitTest) {
// members tested:
// const PrimitiveElementPin* mSourcePtr;
// PrimitiveElementPinPtrVector mSinks;
// functions tested:
// const PrimitiveElementPin* getSourcePtr(void) const
// const PrimitiveElementPinPtrVector& getSinks(void) const
PrimitiveElementPin pin1;
PrimitiveElementPin pin2;
PrimitiveElementPin pin3;
PrimitiveConn conn;
conn.mSourcePtr = &pin1;
conn.mSinks.push_back(&pin2);
conn.mSinks.push_back(&pin3);
BOOST_CHECK_EQUAL(conn.getSourcePtr(), &pin1);
const PrimitiveElementPinPtrVector& sinks = conn.getSinks();
PrimitiveElementPinPtrVector::const_iterator p = sinks.begin();
BOOST_CHECK_EQUAL(*p++, &pin2);
BOOST_CHECK_EQUAL(*p++, &pin3);
BOOST_CHECK(p == sinks.end());
}
BOOST_AUTO_TEST_SUITE_END()
} // namespace architecture
} // namespace torc

View File

@ -0,0 +1,25 @@
// Torc - Copyright 2011 University of Southern California. All Rights Reserved.
// $HeadURL$
// $Id$
// This program is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with this program. If
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Source for the PrimitiveDef class.
#include "torc/architecture/PrimitiveDef.hpp"
namespace torc {
namespace architecture {
} // namespace architecture
} // namespace torc

View File

@ -0,0 +1,83 @@
// Torc - Copyright 2011 University of Southern California. All Rights Reserved.
// $HeadURL$
// $Id$
// This program is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with this program. If
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Header for the PrimitiveDef class.
#ifndef TORC_ARCHITECTURE_PRIMITIVEDEF_HPP
#define TORC_ARCHITECTURE_PRIMITIVEDEF_HPP
#include "torc/architecture/PrimitiveConn.hpp"
#include "torc/architecture/PrimitiveElement.hpp"
namespace torc {
namespace architecture {
/// \brief Encapsulation of primitive site definition, with associated connections, elements,
/// and pins.
class PrimitiveDef {
protected:
// friends
friend class Sites;
// types
typedef xilinx::PinIndex PinIndex; ///< \brief Imported type name.
typedef std::string string; ///< \brief Imported type name.
/// \brief Map of pin names to pin indexes for a primitive element.
typedef std::map<std::string, PinIndex> PinNameToPinIndexMap;
// elements
/// \brief The primitive name.
std::string mName;
/// \brief The primitive pins.
PrimitivePinArray mPins;
/// \brief The primitive elements.
PrimitiveElementArray mElements;
/// \brief The primitive internal connections.
PrimitiveConnSharedPtrArray mConnections;
/// \brief The map of pin names to pin indexes.
PinNameToPinIndexMap mPinNameToPinIndex;
// functions
/// \brief Returns a non-constant array of element pins.
/// \detail This function should only be used by the Sites class during database
/// iniialization.
PrimitivePinArray& getPins(void) { return mPins; }
public:
// constructors
/// \brief Null constructor.
/// \detail This constructor should only be used by containers.
PrimitiveDef(void) : mName(), mPins(), mPinNameToPinIndex() {}
// functions
/// \brief Returns the pin index corresponding to the given pin name, or
/// PinIndex::undefined() if the pin name does not exist.
/// \parameter inName The pin name to find.
PinIndex findPinIndexByName(const std::string& inName) const {
PinNameToPinIndexMap::const_iterator p = mPinNameToPinIndex.find(inName);
return (p == mPinNameToPinIndex.end())
? PinIndex(PinIndex::undefined()) : p->second;
}
// accessors
/// \brief Returns the name of the primitive.
const string& getName(void) const { return mName; }
/// \brief Returns a constant array of primitive pins.
const PrimitivePinArray& getPins(void) const { return mPins; }
/// \brief Returns a constant array of primitive elements.
const PrimitiveElementArray& getElements(void) const { return mElements; }
/// \brief Returns a constant array of primitive connection shared pointers.
const PrimitiveConnSharedPtrArray& getConnections(void) const { return mConnections; }
};
} // namespace architecture
} // namespace torc
#endif // TORC_ARCHITECTURE_PRIMITIVEDEF_HPP

View File

@ -0,0 +1,50 @@
// Torc - Copyright 2011 University of Southern California. All Rights Reserved.
// $HeadURL$
// $Id$
// This program is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with this program. If
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Unit test for the PrimitiveDef class.
#include <boost/test/unit_test.hpp>
#include "torc/architecture/PrimitiveDef.hpp"
namespace torc {
namespace architecture {
BOOST_AUTO_TEST_SUITE(architecture)
/// \brief Unit test for the PrimitiveDef class.
BOOST_AUTO_TEST_CASE(PrimitiveDefUnitTest) {
// elements not tested:
// std::string mName;
// PrimitivePinArray mPins;
// PrimitiveElementArray mElements;
// PrimitiveConnSharedPtrArray mConnections;
// PinNameToPinIndexMap mPinNameToPinIndex;
// functions not tested:
// PrimitivePinArray& getPins(void);
// PrimitiveDef(void);
// PinIndex findPinIndexByName(const std::string& inName) const;
// const string& getName(void) const;
// const PrimitivePinArray& getPins(void) const;
// const PrimitiveElementArray& getElements(void) const;
// const PrimitiveConnSharedPtrArray& getConnections(void) const;
/// \todo Write a unit test for torc::architecture::PrimitiveDef.
BOOST_REQUIRE(false);
}
BOOST_AUTO_TEST_SUITE_END()
} // namespace architecture
} // namespace torc

View File

@ -0,0 +1,25 @@
// Torc - Copyright 2011 University of Southern California. All Rights Reserved.
// $HeadURL$
// $Id$
// This program is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with this program. If
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Source for the PrimitiveElement class.
#include "torc/architecture/PrimitiveElement.hpp"
namespace torc {
namespace architecture {
} // namespace architecture
} // namespace torc

View File

@ -0,0 +1,99 @@
// Torc - Copyright 2011 University of Southern California. All Rights Reserved.
// $HeadURL$
// $Id$
// This program is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with this program. If
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Header for the PrimitiveElement class.
#ifndef TORC_ARCHITECTURE_PRIMITIVEELEMENT_HPP
#define TORC_ARCHITECTURE_PRIMITIVEELEMENT_HPP
#include "torc/architecture/XilinxDatabaseTypes.hpp"
#include "torc/architecture/PrimitiveElementPin.hpp"
#include "torc/architecture/Array.hpp"
#include <boost/cstdint.hpp>
#include <map>
#include <set>
namespace torc {
namespace architecture {
namespace architecture { class PrimitiveElementUnitTest; }
/// \brief Encapsulation of a primitive site element.
/// \detail Primitive elements are subcomponents of logic primitive sites.
class PrimitiveElement {
public:
// types
/// \brief A set of configuration values.
typedef std::set<std::string> StringSet;
protected:
// friends
/// \brief The Sites class has access to our internals.
friend class Sites;
/// \brief Our unit test class has access to our internals.
friend class torc::architecture::architecture::PrimitiveElementUnitTest;
// types
typedef xilinx::PinIndex PinIndex; ///< \brief Imported type name.
typedef std::string string; ///< \brief Imported type name.
/// \brief Map of pin names to pin indexes for a primitive element.
typedef std::map<std::string, PinIndex> PinNameToPinIndexMap;
// members
/// \brief The element name.
string mName;
/// \brief The array of pins.
PrimitiveElementPinArray mPins;
/// \brief The set of allowable configuration values.
StringSet mCfgs;
/// \brief A flag indicating whether or not this element is a BEL (Basic ELement).
bool mIsBel;
/// \brief The map of pin names to pin indexes.
PinNameToPinIndexMap mPinNameToPinIndex;
// accessors
/// \brief Returns a non-constant array of element pins.
/// \detail This function should only be used by the Sites class during database
/// iniialization.
PrimitiveElementPinArray& getPins(void) { return mPins; }
public:
// constructors
/// \brief Null constructor.
/// \detail This constructor should only be used by containers.
PrimitiveElement(void) : mName(), mPins(), mCfgs(), mPinNameToPinIndex() {};
// functions
/// \brief Returns the pin index corresponding to the given pin name, or
/// PinIndex::undefined() if the pin name does not exist.
/// \parameter inName The pin name to find.
PinIndex findPinIndexByName(const string& inName) const {
PinNameToPinIndexMap::const_iterator p = mPinNameToPinIndex.find(inName);
return (p == mPinNameToPinIndex.end())
? PinIndex(PinIndex::undefined()) : p->second;
}
// accessors
/// \brief Returns the name of the element.
const string& getName(void) const { return mName; }
/// \brief Returns a constant array of element pins.
const PrimitiveElementPinArray& getPins(void) const { return mPins; }
/// \brief Returns the set of allowable configuration values.
const StringSet& getCfgs(void) const { return mCfgs; }
/// \brief Returns true if this element is a BEL (Basic ELement).
bool isBel(void) const { return mIsBel; }
};
/// \brief Array of constant PrimitiveElement objects.
typedef Array<const PrimitiveElement> PrimitiveElementArray;
} // namespace architecture
} // namespace torc
#endif // TORC_ARCHITECTURE_PRIMITIVEELEMENT_HPP

View File

@ -0,0 +1,25 @@
// Torc - Copyright 2011 University of Southern California. All Rights Reserved.
// $HeadURL$
// $Id$
// This program is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with this program. If
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Source for the PrimitiveElementPin class.
#include "torc/architecture/PrimitiveElementPin.hpp"
namespace torc {
namespace architecture {
} // namespace architecture
} // namespace torc

View File

@ -0,0 +1,96 @@
// Torc - Copyright 2011 University of Southern California. All Rights Reserved.
// $HeadURL$
// $Id$
// This program is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with this program. If
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Header for the PrimitiveElementPin class.
#ifndef TORC_ARCHITECTURE_PRIMITIVEELEMENTPIN_HPP
#define TORC_ARCHITECTURE_PRIMITIVEELEMENTPIN_HPP
#include "torc/architecture/XilinxDatabaseTypes.hpp"
#include "torc/architecture/PrimitivePin.hpp"
#include "torc/architecture/Array.hpp"
#include <boost/shared_ptr.hpp>
#include <string>
#include <vector>
namespace torc {
namespace architecture {
namespace architecture { class PrimitiveElementPinUnitTest; }
// forward declarations
class PrimitiveElement;
class PrimitiveConn;
typedef boost::shared_ptr<const PrimitiveConn> PrimitiveConnSharedPtr;
/// \brief Encapsulation of a primitive element pin's name, flags, and element pointer.
/// \detail Primitive element pins are sub-site inputs or outputs.
class PrimitiveElementPin : public PinDirection {
protected:
// friends
/// \brief The Sites class has access to our internals.
friend class Sites;
/// \brief Our unit test class has access to our internals.
friend class torc::architecture::architecture::PrimitiveElementPinUnitTest;
// types
typedef xilinx::PinFlags PinFlags; ///< \brief Imported type name.
typedef std::string string; ///< \brief Imported type name.
// members
/// \brief The primitive element that owns this pin.
const PrimitiveElement* mElementPtr;
/// \brief The pin name.
string mName;
/// \brief The pin direction flags.
/// \see PinDirection.
PinFlags mFlags;
/// \brief The primitive connection that includes this pin.
const PrimitiveConnSharedPtr mPrimitiveConn;
// constructors
/// \brief Protected constructor.
/// \parameter inElementPtr The primitive element that owns this pin.
/// \parameter inName The pin name.
/// \parameter inFlags The pin direction flags.
PrimitiveElementPin(const PrimitiveElement* inElementPtr, const std::string& inName,
PinFlags inFlags) : mElementPtr(inElementPtr), mName(inName), mFlags(inFlags) {}
public:
// accessors
/// \brief Returns a pointer to the primitive element that owns this pin.
const PrimitiveElement* getElementPtr(void) const { return mElementPtr; }
/// \brief Returns the pin name.
const string& getName(void) const { return mName; }
/// \brief Returns the pin direction flags.
PinFlags getFlags(void) const { return mFlags; }
/// \brief Returns the primitive connection that includes this pin.
const PrimitiveConnSharedPtr getPrimitiveConn(void) const { return mPrimitiveConn; }
/// \brief Null constructor.
/// \detail This constructor should only be used by containers.
PrimitiveElementPin(void) : mElementPtr(0), mName(), mFlags() {};
/// \brief Returns true if this pin is a primitive input.
bool isInput(void) const { return (mFlags & ePinDirectionInput) != 0; }
/// \brief Returns true if this pin is a primitive output.
bool isOutput(void) const { return (mFlags & ePinDirectionOutput) != 0; }
};
/// \brief Array of constant PrimitiveElementPin objects.
typedef Array<const PrimitiveElementPin> PrimitiveElementPinArray;
/// \brief Vector of constant PrimitiveElementPin pointers.
typedef std::vector<const PrimitiveElementPin*> PrimitiveElementPinPtrVector;
} // namespace architecture
} // namespace torc
#endif // TORC_ARCHITECTURE_PRIMITIVEELEMENTPIN_HPP

View File

@ -0,0 +1,67 @@
// Torc - Copyright 2011 University of Southern California. All Rights Reserved.
// $HeadURL$
// $Id$
// This program is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with this program. If
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Unit test for the PrimitiveElementPin class.
#include <boost/test/unit_test.hpp>
#include "torc/architecture/PrimitiveElementPin.hpp"
namespace torc {
namespace architecture {
BOOST_AUTO_TEST_SUITE(architecture)
/// \brief Unit test for the PrimitiveElementPin class.
BOOST_AUTO_TEST_CASE(PrimitiveElementPinUnitTest) {
/// \todo Test mPrimitiveConn and getPrimitiveConn. Do a better job testing mElementPtr and
/// getElementPtr.
// members not tested:
// const PrimitiveConnSharedPtr mPrimitiveConn;
// functions not tested:
// const PrimitiveConnSharedPtr getPrimitiveConn(void) const { return mPrimitiveConn; }
// members tested:
// const PrimitiveElement* mElementPtr;
// string mName;
// PinFlags mFlags;
// functions tested:
// PrimitiveElementPin(const string& inName, PinFlags inFlags);
// const PrimitiveElement* getElementPtr(void) const;
// const string& getName(void) const;
// PinFlags getFlags(void) const;
// PrimitiveElementPin(void);
// bool isInput(void) const;
// bool isOutput(void) const;
std::string name = "name";
xilinx::PinFlags flags(PinDirection::ePinDirectionOutput);
PrimitiveElementPin pin1(0, name, flags);
BOOST_CHECK_EQUAL(pin1.getElementPtr(), static_cast<void*>(0));
BOOST_CHECK_EQUAL(pin1.getName(), name);
BOOST_CHECK_EQUAL(pin1.getFlags(), flags);
BOOST_CHECK(pin1.isInput() == false);
BOOST_CHECK(pin1.isOutput() == true);
PrimitiveElementPin pin2;
BOOST_CHECK_EQUAL(pin2.getElementPtr(), static_cast<void*>(0));
BOOST_CHECK_EQUAL(pin2.getName(), "");
BOOST_CHECK_EQUAL(pin2.getFlags(), xilinx::PinFlags(0));
BOOST_CHECK(pin2.isInput() == false);
BOOST_CHECK(pin2.isOutput() == false);
}
BOOST_AUTO_TEST_SUITE_END()
} // namespace architecture
} // namespace torc

View File

@ -0,0 +1,50 @@
// Torc - Copyright 2011 University of Southern California. All Rights Reserved.
// $HeadURL$
// $Id$
// This program is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with this program. If
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Unit test for the PrimitiveElement class.
#include <boost/test/unit_test.hpp>
#include "torc/architecture/PrimitiveElement.hpp"
namespace torc {
namespace architecture {
BOOST_AUTO_TEST_SUITE(architecture)
/// \brief Unit test for the Sites class.
BOOST_AUTO_TEST_CASE(PrimitiveElementUnitTest) {
// members not tested:
// string mName;
// PrimitiveElementPinArray mPins;
// StringSet mCfgs;
// bool mIsBel;
// PinNameToPinIndexMap mPinNameToPinIndex;
// functions not tested:
// PrimitiveElementPinArray& getPins(void);
// PrimitiveElement(void);
// PinIndex findPinIndexByName(const string& inName) const;
// const string& getName(void) const;
// const PrimitiveElementPinArray& getPins(void) const;
// const StringSet& getCfgs(void) const;
// bool isBel(void) const;
/// \todo Write a unit test for torc::architecture::PrimitiveElement.
BOOST_REQUIRE(false);
}
BOOST_AUTO_TEST_SUITE_END()
} // namespace architecture
} // namespace torc

View File

@ -0,0 +1,25 @@
// Torc - Copyright 2011 University of Southern California. All Rights Reserved.
// $HeadURL$
// $Id$
// This program is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with this program. If
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Source for the PrimitivePin class.
#include "torc/architecture/PrimitivePin.hpp"
namespace torc {
namespace architecture {
} // namespace architecture
} // namespace torc

View File

@ -0,0 +1,86 @@
// Torc - Copyright 2011 University of Southern California. All Rights Reserved.
// $HeadURL$
// $Id$
// This program is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with this program. If
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Header for the PrimitivePin class.
#ifndef TORC_ARCHITECTURE_PRIMITIVEPIN_HPP
#define TORC_ARCHITECTURE_PRIMITIVEPIN_HPP
#include "torc/architecture/XilinxDatabaseTypes.hpp"
#include "torc/architecture/Array.hpp"
#include <string>
namespace torc {
namespace architecture {
namespace architecture { class PrimitivePinUnitTest; }
/// \bried Encapsulation of pin directionality.
/// \detail These direction enumerations are obtained from the database build code, and are
/// used by the PrimitivePin and PrimitivElementPin classes.
class PinDirection {
public:
// enumerations
enum EPinDirection { ePinDirectionNone = 0, ePinDirectionInput = 2,
ePinDirectionOutput = 4 };
};
/// \brief Encapsulation of a primitive pin's name and flags.
/// \detail Primitive pins are logic site inputs or outputs.
class PrimitivePin : public PinDirection {
protected:
// friends
/// \brief The Sites class has access to our internals.
friend class Sites;
/// \brief Our unit test class has access to our internals.
friend class torc::architecture::architecture::PrimitivePinUnitTest;
// types
typedef xilinx::PinFlags PinFlags; ///< \brief Imported type name.
typedef std::string string; ///< \brief Imported type name.
// members
/// \brief The pin name.
string mName;
/// \brief The pin direction flags.
/// \see PinDirection.
PinFlags mFlags;
// constructors
/// \brief Protected constructor.
/// \parameter inName The pin name.
/// \parameter inFlags The pin direction flags.
PrimitivePin(const string& inName, PinFlags inFlags) : mName(inName), mFlags(inFlags)
{}
public:
// accessors
/// \brief Returns the pin name.
const string& getName(void) const { return mName; }
/// \brief Returns the pin direction flags.
PinFlags getFlags(void) const { return mFlags; }
/// \brief Null constructor.
/// \detail This constructor should only be used by containers.
PrimitivePin(void) : mName(), mFlags() {};
/// \brief Returns true if this pin is a primitive input.
bool isInput(void) const { return (mFlags & ePinDirectionInput) != 0; }
/// \brief Returns true if this pin is a primitive output.
bool isOutput(void) const { return (mFlags & ePinDirectionOutput) != 0; }
};
/// \brief Array of constant PrimitivePin objects.
typedef Array<const PrimitivePin> PrimitivePinArray;
} // namespace architecture
} // namespace torc
#endif // TORC_ARCHITECTURE_PRIMITIVEPIN_HPP

View File

@ -0,0 +1,56 @@
// Torc - Copyright 2011 University of Southern California. All Rights Reserved.
// $HeadURL$
// $Id$
// This program is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with this program. If
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Unit test for the PrimitivePin class.
#include <boost/test/unit_test.hpp>
#include "torc/architecture/PrimitivePin.hpp"
namespace torc {
namespace architecture {
BOOST_AUTO_TEST_SUITE(architecture)
/// \brief Unit test for the PrimitivePin class.
BOOST_AUTO_TEST_CASE(PrimitivePinUnitTest) {
// members tested:
// string mName;
// PinFlags mFlags;
// functions tested:
// PrimitivePin(const string& inName, PinFlags inFlags);
// const string& getName(void) const;
// PinFlags getFlags(void) const;
// PrimitivePin(void);
// bool isInput(void) const;
// bool isOutput(void) const;
std::string name = "name";
xilinx::PinFlags flags(PinDirection::ePinDirectionOutput);
PrimitivePin pin1(name, flags);
BOOST_CHECK_EQUAL(pin1.getName(), name);
BOOST_CHECK_EQUAL(pin1.getFlags(), flags);
BOOST_CHECK(pin1.isInput() == false);
BOOST_CHECK(pin1.isOutput() == true);
PrimitivePin pin2;
BOOST_CHECK_EQUAL(pin2.getName(), "");
BOOST_CHECK_EQUAL(pin2.getFlags(), xilinx::PinFlags(0));
BOOST_CHECK(pin2.isInput() == false);
BOOST_CHECK(pin2.isOutput() == false);
}
BOOST_AUTO_TEST_SUITE_END()
} // namespace architecture
} // namespace torc

View File

@ -14,7 +14,7 @@
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Source for the Segments regression test.
/// \brief Regression test for the Segments class.
#include <boost/test/unit_test.hpp>
#include "torc/architecture/Segments.hpp"
@ -183,6 +183,7 @@ public:
const SegmentReference& segmentReference = tilewireSegments[wireIndex];
CompactSegmentIndex compactSegmentIndex = segmentReference.getCompactSegmentIndex();
TileIndex anchorTileIndex = segmentReference.getAnchorTileIndex();
(void) anchorTileIndex;
// look up the current tilewire membership
CompactSegmentIndex usageCompactSegmentIndex = mUsage[inTilewire];
if(compactSegmentIndex == usageCompactSegmentIndex) {
@ -230,7 +231,6 @@ BOOST_AUTO_TEST_CASE(SegmentsRegressionTest) {
std::cerr << ddb;
segments_regression_test_helper segmentTester(ddb);
segmentTester();
break;
}
segments_regression_test_helper::statistics();

View File

@ -14,7 +14,7 @@
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Source for the Segments unit test.
/// \brief Unit test for the Segments class.
#include <boost/test/unit_test.hpp>
#include "torc/architecture/Segments.hpp"
@ -192,6 +192,7 @@ public:
const SegmentReference& segmentReference = tilewireSegments[wireIndex];
CompactSegmentIndex compactSegmentIndex = segmentReference.getCompactSegmentIndex();
TileIndex anchorTileIndex = segmentReference.getAnchorTileIndex();
(void) anchorTileIndex;
// look up the current tilewire membership
CompactSegmentIndex usageCompactSegmentIndex = mUsage[inTilewire];
if(compactSegmentIndex == usageCompactSegmentIndex) {
@ -222,11 +223,14 @@ uint64_t segments_unit_test_helper::sTotalTilewiresPruned = 0;
/// \brief Total number of tilewires never defined (sanity check).
uint64_t segments_unit_test_helper::sTotalTilewiresUndefined = 0;
// this test is disabled because of its length and because it adds nothing to SegmentsRegressionTest
#if 0
/// \brief Unit test for the Segments class.
/// \todo Combine and separate SegmentsUnitTest, SegmentsRegressionTest, and DDBUnitTest
BOOST_AUTO_TEST_CASE(SegmentsUnitTest) {
// iterate over the devices
const torc::common::DeviceVector& devices = torc::common::Devices::getSupportedDevices();
const torc::common::DeviceVector& devices = torc::common::Devices::getUnitTestDevices();
torc::common::DeviceVector::const_iterator dp = devices.begin();
torc::common::DeviceVector::const_iterator de = devices.end();
// defer to regression test for now
@ -241,6 +245,7 @@ BOOST_AUTO_TEST_CASE(SegmentsUnitTest) {
}
}
#endif
BOOST_AUTO_TEST_SUITE_END()

View File

@ -0,0 +1,26 @@
// Torc - Copyright 2011 University of Southern California. All Rights Reserved.
// $HeadURL$
// $Id$
// This program is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with this program. If
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Source for the Site class.
#include "torc/architecture/Site.hpp"
#include <iostream>
namespace torc {
namespace architecture {
} // namespace architecture
} // namespace torc

View File

@ -0,0 +1,93 @@
// Torc - Copyright 2011 University of Southern California. All Rights Reserved.
// $HeadURL$
// $Id$
// This program is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with this program. If
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Header for the Site class.
#ifndef TORC_ARCHITECTURE_SITE_HPP
#define TORC_ARCHITECTURE_SITE_HPP
#include "torc/architecture/XilinxDatabaseTypes.hpp"
#include "torc/architecture/PrimitiveDef.hpp"
#include "torc/architecture/Tilewire.hpp"
namespace torc {
namespace architecture {
/// \brief Encapsulation of a device logic site.
class Site {
protected:
// friends
/// \brief The Sites class has access to our internals.
friend class Sites;
// types
typedef std::string string; ///< \brief Imported type name.
typedef xilinx::PinIndex PinIndex; ///< \brief Imported type name.
typedef xilinx::TileIndex TileIndex; ///< \brief Imported type name.
typedef xilinx::WireIndex WireIndex; ///< \brief Imported type name.
typedef xilinx::SiteFlags SiteFlags; ///< \brief Imported type name.
public:
// types
/// \brief Array of constant wire indexes.
typedef Array<const WireIndex> WireIndexArray;
protected:
// members
/// \brief The logic site name.
string mName;
/// \brief Pointer to the associated primitive definition.
const PrimitiveDef* mPrimitiveDefPtr;
/// \brief The index of the containing tile.
TileIndex mTileIndex;
/// \brief The flags associated with this site.
SiteFlags mFlags;
/// \brief The pin to wire map for this site.
const WireIndexArray* mPinMapPtr;
// constructors
/// \brief Protected constructor.
Site(const string& inName, const PrimitiveDef& inPrimitiveDef,
TileIndex inTileIndex, SiteFlags inFlags, const WireIndexArray& inPinMap)
: mName(inName), mPrimitiveDefPtr(&inPrimitiveDef), mTileIndex(inTileIndex),
mFlags(inFlags), mPinMapPtr(&inPinMap) {
}
public:
// constructors
/// \brief Null constructor (for use in containers only).
Site(void) : mName(), mPrimitiveDefPtr(0), mTileIndex(), mFlags(), mPinMapPtr(0) {}
// functions
/// \brief Returns the Tilewire associated with the specified pin name.
const Tilewire getPinTilewire(const std::string& inName) const {
if(mPrimitiveDefPtr == 0) return Tilewire::sInvalid;
PinIndex pinIndex = mPrimitiveDefPtr->findPinIndexByName(inName);
if(pinIndex.isUndefined()) return Tilewire::sInvalid;
if(mPinMapPtr == 0) return Tilewire::sInvalid;
return Tilewire(mTileIndex, (*mPinMapPtr)[pinIndex]);
}
// accessors
/// \brief Returns the site name.
const string& getName(void) const { return mName; }
/// \brief Returns a pointer to the associated primitive definition.
const PrimitiveDef* getPrimitiveDefPtr(void) const { return mPrimitiveDefPtr; }
/// \brief Returns the index of the containing tile.
TileIndex getTileIndex(void) const { return mTileIndex; }
/// \brief Returns the flags associated with this site.
SiteFlags getFlags(void) const { return mFlags; }
/// \brief Returns the pin to wire map for this site.
const WireIndexArray* getPinMapPtr(void) const { return mPinMapPtr; }
};
} // namespace architecture
} // namespace torc
#endif // TORC_ARCHITECTURE_SITE_HPP

View File

@ -0,0 +1,349 @@
// Torc - Copyright 2011 University of Southern California. All Rights Reserved.
// $HeadURL$
// $Id$
// This program is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with this program. If
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Source for the Sites class.
#include "torc/architecture/Sites.hpp"
#include <iostream>
namespace torc {
namespace architecture {
size_t Sites::readPackages(DigestStream& inStream) {
// prepare to read from the stream
size_t bytesReadOffset = inStream.getBytesRead();
char scratch[1 << 10]; // scratch read buffer
uint16_t nameLength = 0; // length of tile type name
PackageCount packageCount; // number of packages
PadCount padCount; // number of pads
SiteFlags siteFlags; // site attribute flags
SiteIndex siteIndex; // pad site index
// read the section header
string sectionName;
inStream.readSectionHeader(sectionName);
/// \todo Throw a proper exception.
if(sectionName != ">>>>Packages>>>>") throw -1;
// initialize the package array
inStream.read(packageCount);
mPackages.setSize(packageCount);
std::cout << "\tReading " << packageCount << " package" << (packageCount != 1 ? "s" : "")
<< " (";
// loop through each package
for(PackageIndex i; i < packageCount; i++) {
// look up the current package
Package& package = const_cast<Package&>(mPackages[i]);
// read the package name
inStream.read(nameLength);
/// \todo Throw a proper exception.
if(nameLength > sizeof(scratch)) throw -1;
inStream.read(scratch, nameLength);
scratch[nameLength] = 0;
// update the package
package.mName = scratch;
mPackageNameToPackageIndex[scratch] = i;
std::cout << scratch << (i + 1 < packageCount ? ", " : "");
// read the pad count
inStream.read(padCount);
package.mPads.setSize(padCount);
// loop through each pad
for(PadCount j; j < padCount; j++) {
// look up the current pad
Pad& pad = const_cast<Pad&>(package.mPads[j]);
// read the site index
inStream.read(siteIndex);
// read the site flags
inStream.read(siteFlags);
// read the pad name
inStream.read(nameLength);
/// \todo Throw a proper exception.
if(nameLength > sizeof(scratch)) throw -1;
inStream.read(scratch, nameLength);
scratch[nameLength] = 0;
// update the package pad
pad.mSiteIndex = siteIndex;
pad.mFlags = siteFlags;
pad.mName = scratch;
package.mPadNameToPadIndex[scratch] = xilinx::PadIndex(j);
}
}
std::cout << ") ..." << std::endl;
// return the number of bytes read
return inStream.getBytesRead() - bytesReadOffset;
}
size_t Sites::readSiteTypes(DigestStream& inStream) {
// prepare to read from the stream
size_t bytesReadOffset = inStream.getBytesRead();
char scratch[1 << 10]; // scratch read buffer
uint16_t nameLength = 0; // length of site type name
SiteTypeCount siteTypeCount; // number of site types
uint32_t elementCount; // number of site elements
PinCount pinCount; // number of pins
PinFlags pinFlags; // pin attribute flags
uint32_t elementIndex; // connection element index
uint32_t pinIndex; // connection pin index
// read the section header
string sectionName;
inStream.readSectionHeader(sectionName);
/// \todo Throw a proper exception.
if(sectionName != ">>>>PrimDefs>>>>") throw -1;
// initialize the tile type array
inStream.read(siteTypeCount);
mSiteTypes.setSize(siteTypeCount);
std::cout << "\tReading " << siteTypeCount << " site types..." << std::endl;
// loop through each site type
for(SiteTypeIndex i; i < siteTypeCount; i++) {
// look up the current site definition
PrimitiveDef& primitiveDef = const_cast<PrimitiveDef&>(mSiteTypes[i]);
// read the site type name
inStream.read(nameLength);
/// \todo Throw a proper exception.
if(nameLength > sizeof(scratch)) throw -1;
inStream.read(scratch, nameLength);
scratch[nameLength] = 0;
//std::cout << "\t\t" << i << ": " << scratch << std::endl;
//std::cout.flush();
// read the pin count
inStream.read(pinCount);
// update the site definition
primitiveDef.mName = scratch;
primitiveDef.mPins.setSize(pinCount);
// loop through each pin
for(PinCount j; j < pinCount; j++) {
// look up the current pin
SitePin& sitePin = const_cast<SitePin&>(primitiveDef.mPins[j]);
// read the pin flags
inStream.read(pinFlags);
// read the pin name
inStream.read(nameLength);
/// \todo Throw a proper exception.
if(nameLength > sizeof(scratch)) throw -1;
inStream.read(scratch, nameLength);
scratch[nameLength] = 0;
// update the site pin
sitePin.mFlags = pinFlags;
sitePin.mName = scratch;
primitiveDef.mPinNameToPinIndex[scratch] = xilinx::PinIndex(j);
}
// read the number of site elements
inStream.read(elementCount);
// update the site definition
primitiveDef.mElements.setSize(elementCount);
// loop through each element
for(uint32_t j = 0; j < elementCount; j++) {
// look up the current element
PrimitiveElement& element
= const_cast<PrimitiveElement&>(primitiveDef.mElements[j]);
// read the element name
inStream.read(nameLength);
/// \todo Throw a proper exception.
if(nameLength > sizeof(scratch)) throw -1;
inStream.read(scratch, nameLength);
scratch[nameLength] = 0;
// update the element name
element.mName = scratch;
//std::cout << primitiveDef.getName() << " - " << element.getName() << ":" << std::endl;
//std::cout << " ";
// read the BEL flag
uint16_t isBel;
inStream.read(isBel);
// read the pin count
inStream.read(pinCount);
// update the element
element.mIsBel = isBel != 0;
element.mPins.setSize(pinCount);
// loop through each pin
for(PinCount k; k < pinCount; k++) {
// look up the current pin
ElementPin& elementPin = const_cast<ElementPin&>(element.mPins[k]);
// read the pin flags
inStream.read(pinFlags);
// read the pin name
inStream.read(nameLength);
/// \todo Throw a proper exception.
if(nameLength > sizeof(scratch)) throw -1;
inStream.read(scratch, nameLength);
scratch[nameLength] = 0;
// update the site pin
elementPin.mElementPtr = &element;
//std::cout << elementPin.mElementPtr->getName() << "." << scratch << " ";
//if(elementPin.mElementPtr == 0) {
// std::cout << "Element pin " << scratch << " has NULL element" << std::endl;
// std::cout.flush();
//}
elementPin.mFlags = pinFlags;
elementPin.mName = scratch;
element.mPinNameToPinIndex[scratch] = xilinx::PinIndex(k);
}
//std::cout << std::endl;
// read the config count
uint32_t cfgCount;
inStream.read(cfgCount);
// loop through each cfg value
//bool debug = cfgCount > 0;
//if(debug) std::cout << "\t\t\t" << j << " \"" << scratch << "\": ";
for(uint32_t k = 0; k < cfgCount; k++) {
// read the cfg value
inStream.read(nameLength);
/// \todo Throw a proper exception.
if(nameLength > sizeof(scratch)) throw -1;
inStream.read(scratch, nameLength);
scratch[nameLength] = 0;
//if(debug) std::cout << scratch << " ";
// update the cfg values
element.mCfg.insert(scratch);
}
//if(debug) std::cout << std::endl;
}
// read the conn count
uint32_t connCount;
inStream.read(connCount);
//std::cout << primitiveDef.mName << ": " << connCount << std::endl;
// update the site definition
primitiveDef.mConnections.setSize(connCount);
// loop through each conn
const Sites::PrimitiveDef::PrimitiveElementArray& elements = primitiveDef.getElements();
for(uint32_t j = 0; j < connCount; j++) {
// look up the current connection
PrimitiveConnSharedPtr& connectionPtr = primitiveDef.mConnections[j];
connectionPtr = boost::shared_ptr<PrimitiveConn>(new Sites::PrimitiveConn());
PrimitiveConn& connection = const_cast<PrimitiveConn&>(*connectionPtr);
// read the source count
uint16_t sourceCount;
inStream.read(sourceCount);
/// \todo Throw a proper exception
if(sourceCount != 1) throw -1;
// read the source element and pin
inStream.read(elementIndex);
inStream.read(pinIndex);
const PrimitiveElement* elementPtr = elements.begin() + elementIndex;
PrimitiveElement& element = const_cast<PrimitiveElement&>(*elementPtr);
const Sites::PrimitiveElement::ElementPinArray& pins = element.getPins();
Sites::ElementPin& pin = const_cast<Sites::ElementPin&>(pins[pinIndex]);
connection.mSourcePtr = &pin;
const_cast<PrimitiveConnSharedPtr&>(pin.mPrimitiveConn) = connectionPtr;
// read the sink count
uint16_t sinkCount;
inStream.read(sinkCount);
// loop through each sink
for(uint32_t k = 0; k < sinkCount; k++) {
// read the sink element and pin
inStream.read(elementIndex);
inStream.read(pinIndex);
elementPtr = elements.begin() + elementIndex;
PrimitiveElement& element = const_cast<PrimitiveElement&>(*elementPtr);
const Sites::PrimitiveElement::ElementPinArray& pins = element.getPins();
Sites::ElementPin& pin = const_cast<Sites::ElementPin&>(pins[pinIndex]);
connection.mSinks.push_back(&pin);
const_cast<PrimitiveConnSharedPtr&>(pin.mPrimitiveConn) = connectionPtr;
}
}
//std::cout << primitiveDef.getName() << " - " << element.getName() << ":" << std::endl;
}
// return the number of bytes read
return inStream.getBytesRead() - bytesReadOffset;
}
size_t Sites::readSitePinMaps(DigestStream& inStream) {
// prepare to read from the stream
size_t bytesReadOffset = inStream.getBytesRead();
uint16_t sitePinMapCount = 0; // number of pin maps
PinCount pinCount; // number of pins
WireIndex wireIndex; // pin index
// read the section header
string sectionName;
inStream.readSectionHeader(sectionName);
/// \todo Throw a proper exception.
if(sectionName != ">>>>Pin Maps>>>>") throw -1;
// initialize the site pin map array
inStream.read(sitePinMapCount);
mSitePinMaps.setSize(sitePinMapCount);
std::cout << "\tReading " << sitePinMapCount << " site pin maps..." << std::endl;
// loop through each pin map
for(uint16_t i = 0; i < sitePinMapCount; i++) {
// read the pin count
inStream.read(pinCount);
mSitePinMaps[i].setSize(pinCount);
// get a reference to this map's pin array
Array<const WireIndex>& pins = mSitePinMaps[i];
// loop through each pin
for(PinCount j; j < pinCount; j++) {
// look up a reference to the pin and discard the const trait
WireIndex& pin = const_cast<WireIndex&>(pins[j]);
// read the pin
inStream.read(wireIndex);
pin = wireIndex;
}
}
// return the number of bytes read
return inStream.getBytesRead() - bytesReadOffset;
}
size_t Sites::readSites(DigestStream& inStream) {
// prepare to read from the stream
size_t bytesReadOffset = inStream.getBytesRead();
char scratch[1 << 10]; // scratch read buffer
uint16_t nameLength = 0; // length of tile type name
SiteCount siteCount; // number of sites
SiteTypeIndex siteTypeIndex; // site type index
TileIndex tileIndex; // site tile index
SiteFlags flags; // site flags
uint16_t pinMap = 0; // site pin map
// read the section header
string sectionName;
inStream.readSectionHeader(sectionName);
/// \todo Throw a proper exception.
if(sectionName != ">>>> Sites >>>>") throw -1;
// initialize the site array
inStream.read(siteCount);
mSites.setSize(siteCount);
std::cout << "\tReading " << siteCount << " sites..." << std::endl;
// loop through each site
for(SiteIndex i; i < siteCount; i++) {
// read the site name
inStream.read(nameLength);
/// \todo Throw a proper exception.
if(nameLength > sizeof(scratch)) throw -1;
inStream.read(scratch, nameLength);
scratch[nameLength] = 0;
// read the site type index, tile index, flags, and pin map
inStream.read(siteTypeIndex);
inStream.read(tileIndex);
inStream.read(flags);
inStream.read(pinMap);
// look up a reference for the site, and discard the const trait
Site& site = const_cast<Site&>(mSites[i]);
site = Site(scratch, mSiteTypes[siteTypeIndex], tileIndex, flags, mSitePinMaps[pinMap]);
mSiteNameToSiteIndex[scratch] = i;
}
// return the number of bytes read
return inStream.getBytesRead() - bytesReadOffset;
}
} // namespace architecture
} // namespace torc

View File

@ -0,0 +1,60 @@
// Torc - Copyright 2011 University of Southern California. All Rights Reserved.
// $HeadURL$
// $Id$
// This program is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with this program. If
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Header for the SitePin class.
#ifndef TORC_ARCHITECTURE_SITEPIN_HPP
#define TORC_ARCHITECTURE_SITEPIN_HPP
#include "torc/architecture/XilinxDatabaseTypes.hpp"
namespace torc {
namespace architecture {
/// \bried Encapsulation of pin directionality.
/// \detail These directions are generated by the database build code, and are used by the
/// SitePin and PrimitivePin clases.
class PinDirection {
public:
// enumerations
enum EPinDirection { ePinDirectionNone = 0, ePinDirectionInput = 2,
ePinDirectionOutput = 4 };
};
/// \brief Site type and population data for the family and the device.
/// \details Each device has a collection of logic sites. Those sites are instantiations of
/// family defined site types, with each instance also including a mapping from site pin
/// to Tilewire.
/// \brief Encapsulation of a site pin's name and flags.
class SitePin : public PinDirection {
friend class Sites;
std::string mName;
PinFlags mFlags;
SitePin(const std::string& inName, PinFlags inFlags) : mName(inName), mFlags(inFlags) {}
public:
const std::string& getName(void) const { return mName; }
PinFlags getFlags(void) const { return mFlags; }
SitePin(void) : mName(), mFlags() {};
bool isInput(void) const { return (mFlags & ePinDirectionInput) != 0; }
bool isOutput(void) const { return (mFlags & ePinDirectionOutput) != 0; }
};
} // namespace architecture
} // namespace torc
#endif // TORC_ARCHITECTURE_SITEPIN_HPP

View File

@ -0,0 +1,39 @@
// Torc - Copyright 2011 University of Southern California. All Rights Reserved.
// $HeadURL$
// $Id$
// This program is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with this program. If
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Source for the Sites unit test.
#include <boost/test/unit_test.hpp>
#include "torc/architecture/Sites.hpp"
#include "torc/architecture/DDB.hpp"
namespace torc {
namespace architecture {
BOOST_AUTO_TEST_SUITE(architecture)
/// \brief Unit test for the Sites class.
BOOST_AUTO_TEST_CASE(SitesUnitTest) {
/// \todo Write a unit test for torc::architecture::Sites.
BOOST_REQUIRE(false);
}
BOOST_AUTO_TEST_SUITE_END()
} // namespace architecture
} // namespace torc

View File

@ -14,11 +14,23 @@
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Source for the SiteTypes unit test.
/// \brief Unit test for the SiteTypes class.
#include <boost/test/unit_test.hpp>
#include "torc/architecture/Sites.hpp"
#include "torc/architecture/DDB.hpp"
#include "torc/architecture/XdlImporter.hpp"
#include "torc/physical/Design.hpp"
#include "torc/common/DirectoryTree.hpp"
#include "torc/physical/ConfigMap.hpp"
#include "torc/physical/Circuit.hpp"
#include "torc/physical/Instance.hpp"
#include "torc/physical/Named.hpp"
#include <boost/regex.hpp>
#include <string>
#include <map>
#include <fstream>
#include <iostream>
namespace torc {
@ -26,6 +38,402 @@ namespace architecture {
BOOST_AUTO_TEST_SUITE(architecture)
/// \brief Unit test to iterate through the ConfigMaps of a XDL file.
BOOST_AUTO_TEST_CASE(iterate_configmaps) {
using namespace torc::physical;
// create the appropriate file paths
boost::filesystem::path regressionPath
= torc::common::DirectoryTree::getExecutablePath() / "regression";
boost::filesystem::path generatedPath = regressionPath / "DesignUnitTest.generated.xdl";
boost::filesystem::path referencePath = regressionPath / "DesignUnitTest.reference.xdl";
// import the XDL design
std::fstream fileStream(referencePath.string().c_str());
BOOST_REQUIRE(fileStream.good());
XdlImporter importer;
importer(fileStream, referencePath.string());
// look up the design (and do something with it ...)
torc::physical::DesignSharedPtr designPtr = importer.getDesignPtr();
BOOST_REQUIRE(designPtr.get() != 0);
Circuit::InstanceSharedPtrConstIterator p = designPtr->instancesBegin();
Circuit::InstanceSharedPtrConstIterator e = designPtr->instancesEnd();
while(p < e){
InstanceSharedPtr instancePtr = *p++;
std::cout << "Instance:" << instancePtr->getName() << std::endl;
ConfigMap::const_iterator cp = instancePtr->configBegin();
ConfigMap::const_iterator ce = instancePtr->configEnd();
while (cp != ce){
std::cout << "\tConfig:" << cp->first << "---->" << cp->second.getName() << ":" << cp->second.getValue() << std::endl;
cp++;
}
}
}
bool findLUTbyCfg(const std::string isit);
bool findLUTbyCfg(const std::string isit)
{
static const boost::regex e("(^(<eqn>)|((#LUT:|#RAM:|#ROM:)<eqn>)$)");
return regex_match(isit, e);
}
bool findFFbyCfg(const std::string isit);
bool findFFbyCfg(const std::string isit)
{
static const boost::regex e("(^#(FF|LATCH)$)");
return regex_match(isit, e);
}
bool findINV(const std::string isit);
bool findINV(const std::string isit)
{
static const boost::regex e("^.*_B$");
return regex_match(isit, e);
}
bool findROUTETHROUGH(const std::string isit);
bool findROUTETHROUGH(const std::string isit)
{
static const boost::regex e("^_ROUTETHROUGH.*");
return regex_match(isit, e);
}
bool findAND(const std::string isit);
bool findAND(const std::string isit)
{
static const boost::regex e("^.*AND.*");
return regex_match(isit, e);
}
bool findVCC(const std::string isit);
bool findVCC(const std::string isit)
{
static const boost::regex e("^.*VCC$");
return regex_match(isit, e);
}
bool findGND(const std::string isit);
bool findGND(const std::string isit)
{
static const boost::regex e("^.*GND$");
return regex_match(isit, e);
}
///\brief Unit test to iterate through a database and classify all existing elements into pseudo-types
BOOST_AUTO_TEST_CASE(classify_elements){
//xc6vhx380t xc5vlx30 xc4vfx60 xc6slx9l xc2vp40 xc2v40 xc3s250e
// open and initialize a database
DDB ddb("xc5vlx30");
// look up the logic sites in the device
const Sites& sites = ddb.getSites();
// look up the primitive def types
typedef const Array<const PrimitiveDef> PrimitiveDefArray;
PrimitiveDefArray& primitiveDefs = sites.getSiteTypes();
PrimitiveDefArray::const_iterator p = primitiveDefs.begin();
PrimitiveDefArray::const_iterator e = primitiveDefs.end();
/// \brief Map of all elements.
typedef std::map<std::string, PrimitiveElement*> AllElements;
AllElements allElements;
/// \brief Map of all terminals.
typedef std::map<std::string, PrimitiveElement*> AllTerminals;
AllTerminals allTerminals;
/// \brief Map of all switches.
typedef std::map<std::string, PrimitiveElement*> AllSwitches;
AllSwitches allSwitches;
/// \brief Map of all orphans.
typedef std::map<std::string, PrimitiveElement*> AllOrphans;
AllOrphans allOrphans;
/// \brief Map of all muxes.
typedef std::map<std::string, PrimitiveElement*> AllMuxes;
AllMuxes allMuxes;
/// \brief Map of all inverters.
typedef std::map<std::string, PrimitiveElement*> AllInverters;
AllInverters allInverters;
/// \brief Map of all luts.
typedef std::map<std::string, PrimitiveElement*> AllLuts;
AllLuts allLuts;
/// \brief Map of all flops.
typedef std::map<std::string, PrimitiveElement*> AllFlops;
AllFlops allFlops;
/// \brief Map of all main elements.
typedef std::map<std::string, PrimitiveElement*> AllMains;
AllMains allMains;
/// \brief Map of all main elements.
typedef std::map<std::string, PrimitiveElement*> AllAnds;
AllAnds allAnds;
/// \brief Map of all main elements.
typedef std::map<std::string, PrimitiveElement*> AllVccs;
AllVccs allVccs;
/// \brief Map of all main elements.
typedef std::map<std::string, PrimitiveElement*> AllGnds;
AllGnds allGnds;
//int i = 0;
// iterate over the primitive defs
while(p < e) {
// look up the current primitive def
const PrimitiveDef& primitiveDef = *p++;
//std::cout << "Inside Primitive Def:" << primitiveDef.getName() << std::endl << std::endl;
typedef const Array<const PrimitivePin> PrimitivePinArray;
// look up the primitive def pins
const PrimitivePinArray& primitivePins = primitiveDef.getPins();
PrimitivePinArray::const_iterator sp = primitivePins.begin();
PrimitivePinArray::const_iterator se = primitivePins.end();
const PrimitivePin primitivePin;
// keep a track of all the primitive pins (to find the main elements, we need to compare elements with site pins)
std::vector<std::string> primitivePinNames;
std::vector<std::string>::const_iterator spe = unique(primitivePinNames.begin(), primitivePinNames.end());
(void) spe;
// iterate over the primitive def pins
if(primitivePins.getSize() > 0) {
//std::cout << " ";
while(sp < se) {
const PrimitivePin& primitivePin = *sp++;
primitivePinNames.push_back(primitivePin.getName());
}
//std::cout << std::endl;
}
// look up the primitive def elements
const PrimitiveElementArray& elements = primitiveDef.getElements();
PrimitiveElementArray::const_iterator ep = elements.begin();
PrimitiveElementArray::const_iterator ee = elements.end();
// iterate over the primitive def elements
if(elements.getSize() > 0) {
while(ep < ee) {
const PrimitiveElement& element = *ep++;
//std::cout << "Inside ELEMENT NAME:" << element.getName() << std::endl;
/// \brief Map of all elements.
allElements[element.getName()] = const_cast <PrimitiveElement*>(&element); //element.getName();
/// \brief Capture the 'main' elements.
if(primitiveDef.getName() == element.getName()){
//std::cout << "\tMAIN element:" << element.getName() << std::endl;
allMains[element.getName()] = const_cast <PrimitiveElement*>(&element); //element.getName();
allElements.erase(element.getName());
}
//typedef const Array<const Sites::ElementPin> ElementPinArray;
const PrimitiveElementPinArray& elementPins = element.getPins();
PrimitiveElementPinArray::const_iterator pp = elementPins.begin();
PrimitiveElementPinArray::const_iterator pe = elementPins.end();
//Count input pins of Muxes/Invs
int countPins = 0;
int isINV = 0;
std::string cfgValue;
int totalPinCount = 0;
int cfgSize = 0;
int notEmpty = 0;
int isLUT = 0;
int isFF = 0;
int isVCC = 0;
int isGND = 0;
int isAND = 0;
std::vector<std::string> elementPinNames;
std::vector<std::string>::const_iterator ppe = unique(elementPinNames.begin(), elementPinNames.end());
(void) ppe;
//Iterate through Element PINS
while(pp < pe) {
const PrimitiveElementPin& elementPin = *pp++;
//(void) elementPin;
//Check if the pin is an Input pin
if(elementPin.isInput() == 1){
typedef std::set<std::string> StringSet;
const StringSet elementCfgs = element.getCfgs();
StringSet::const_iterator cp = elementCfgs.begin();
StringSet::const_iterator ce = elementCfgs.end();
//Iterate through the Cfgs
while(cp != ce){
const std::string& isit = *cp++;
//Check if the pin names and cfgs match
if(elementPin.getName() == isit){
if (findINV(isit) == 1){
elementPinNames.push_back(elementPin.getName());
isINV = 1;
countPins++;
}else{
elementPinNames.push_back(elementPin.getName());
countPins++;
}
break;
}
cfgValue = isit;
//trying to check if the # of cgfs and # of element pins match
cfgSize = elementCfgs.size();
if(!elementCfgs.empty()) notEmpty = 1;
if(findLUTbyCfg(isit) == 1){
isLUT = 1;
}else if(findFFbyCfg(isit) == 1){
isFF = 1;
}
}
}
if((findVCC(element.getName()) == 1) && (elementPin.getName() == "1")){
isVCC = 1;
}else if((findGND(element.getName()) == 1) && (elementPin.getName() == "0")){
isGND = 1;
}else if((findAND(element.getName()) == 1) && ((elementPin.getName() == "0") || (elementPin.getName() == "1"))){
isAND = 1;
}
totalPinCount++;
}
if(countPins > 0) {
//If the pin names and cfgs match, it is a MUX (or INV)
if(countPins == 1){
//std::cout << "\tSWITCH: " << element.getName() << " "; //std::endl;
allMuxes[element.getName()] = const_cast <PrimitiveElement*>(&element); //element.getName();
allSwitches[element.getName()] = const_cast <PrimitiveElement*>(&element); //element.getName();
allElements.erase(element.getName());
}else if(isINV == 1){
//std::cout << "\tINV: " << element.getName() << " ";
allMuxes[element.getName()] = const_cast <PrimitiveElement*>(&element); //element.getName();
allInverters[element.getName()] = const_cast <PrimitiveElement*>(&element); //element.getName();
allElements.erase(element.getName());
}else if(isINV == 0){
//std::cout << "\tMUX: " << element.getName() << " ";
allMuxes[element.getName()] = const_cast <PrimitiveElement*>(&element); //element.getName();
allElements.erase(element.getName());
}
//std::cout << countPins << " "; // << std::endl;
//print the PINs that are matched with cfg within that element
for (std::vector<std::string>::const_iterator b = elementPinNames.begin(); b != elementPinNames.end(); b++) {
//std::cout << *b << " ";
}
// check if the number of pins is equal to the number of cfgs
if(notEmpty == 1){
if(countPins != cfgSize) throw 0;
}
}else if(isLUT == 1){
//std::cout << "\tLUT: " << element.getName() << std::endl;//" ";
allLuts[element.getName()] = const_cast <PrimitiveElement*>(&element); //element.getName();
allElements.erase(element.getName());
}else if(isFF == 1){
//std::cout << "\tFLOP: " << element.getName() << std::endl;//" ";
allFlops[element.getName()] = const_cast <PrimitiveElement*>(&element); //element.getName();
allElements.erase(element.getName());
}
if(totalPinCount == 0){
//std::cout << "\tORPHAN:" << element.getName() <<std::endl;
allOrphans[element.getName()] = const_cast <PrimitiveElement*>(&element); //element.getName();
allElements.erase(element.getName());
}
if(findROUTETHROUGH(element.getName()) == 1){
//std::cout << "ROUTETHROUGH FOUND! ---- d e l e t i n g !" << std::endl;
allElements.erase(element.getName());
}
if(isAND == 1){//if(findAND(element.getName()) == 1){
allAnds[element.getName()] = const_cast <PrimitiveElement*>(&element); //element.getName();
allElements.erase(element.getName());
}
if(isVCC == 1){
allVccs[element.getName()] = const_cast <PrimitiveElement*>(&element); //element.getName();
allElements.erase(element.getName());
}
if(isGND == 1){
allGnds[element.getName()] = const_cast <PrimitiveElement*>(&element); //element.getName();
allElements.erase(element.getName());
}
for (std::vector<std::string>::const_iterator s = primitivePinNames.begin(); s != primitivePinNames.end(); s++) {
if(element.getName() == *s){
//std::cout << "\tTERMINAL:" << element.getName() << std::endl;
allTerminals[element.getName()] = const_cast <PrimitiveElement*>(&element); //element.getName();
allElements.erase(element.getName());
break;
}
}
}
}
//std::cout << "-----------------------------------------------------------" <<std::endl;
//std::cout << std::endl;
}
std::map<std::string, PrimitiveElement*>::const_iterator pos;
std::cout << "------ UNCLASSIFIED ELEMENTS -------" <<std::endl;
for(pos = allElements.begin(); pos != allElements.end(); ++pos) {
std::cout << "Element: " << pos->first << std::endl;// " ";
//std::cout << "Value:" << pos->second << std::endl;
}
std::cout << std::endl;
std::cout << "------ MUXES -------" <<std::endl;
for(pos = allMuxes.begin(); pos != allMuxes.end(); ++pos) {
std::cout << "Element: " << pos->first << std::endl; //<< " ";
//std::cout << "Value:" << pos->second << std::endl;
}
std::cout << std::endl;
std::cout << "------ LUTS -------" <<std::endl;
for(pos = allLuts.begin(); pos != allLuts.end(); ++pos) {
std::cout << "Element: " << pos->first << std::endl; //<< " ";
//std::cout << "Value:" << pos->second << std::endl;
}
std::cout << std::endl;
std::cout << "------ FLOPS -------" <<std::endl;
for(pos = allFlops.begin(); pos != allFlops.end(); ++pos) {
std::cout << "Element: " << pos->first << std::endl; //<< " ";
//std::cout << "Value:" << pos->second << std::endl;
}
std::cout << std::endl;
std::cout << "------ TERMINALS -------" <<std::endl;
for(pos = allTerminals.begin(); pos != allTerminals.end(); ++pos) {
std::cout << "Element: " << pos->first << std::endl; //<< " ";
//std::cout << "Value:" << pos->second << std::endl;
}
std::cout << std::endl;
std::cout << "------ SWITCHES -------" <<std::endl;
for(pos = allSwitches.begin(); pos != allSwitches.end(); ++pos) {
std::cout << "Element: " << pos->first << std::endl; //<< " ";
//std::cout << "Value:" << pos->second << std::endl;
}
std::cout << std::endl;
std::cout << "------ ANDS -------" <<std::endl;
for(pos = allAnds.begin(); pos != allAnds.end(); ++pos) {
std::cout << "Element: " << pos->first << std::endl; //<< " ";
//std::cout << "Value:" << pos->second << std::endl;
}
std::cout << std::endl;
std::cout << "------ VCCS -------" <<std::endl;
for(pos = allVccs.begin(); pos != allVccs.end(); ++pos) {
std::cout << "Element: " << pos->first << std::endl; //<< " ";
//std::cout << "Value:" << pos->second << std::endl;
}
std::cout << std::endl;
std::cout << "------ GNDS -------" <<std::endl;
for(pos = allGnds.begin(); pos != allGnds.end(); ++pos) {
std::cout << "Element: " << pos->first << std::endl; //<< " ";
//std::cout << "Value:" << pos->second << std::endl;
}
}
/// \brief Unit test for the SiteTypes class.
BOOST_AUTO_TEST_CASE(SiteTypesUnitTest) {
@ -34,7 +442,7 @@ BOOST_AUTO_TEST_CASE(SiteTypesUnitTest) {
// look up the logic sites in the device
const Sites& sites = ddb.getSites();
// look up the primitive def types
typedef const Array<const Sites::PrimitiveDef> PrimitiveDefArray;
typedef const Array<const PrimitiveDef> PrimitiveDefArray;
PrimitiveDefArray& primitiveDefs = sites.getSiteTypes();
PrimitiveDefArray::const_iterator p = primitiveDefs.begin();
PrimitiveDefArray::const_iterator e = primitiveDefs.end();
@ -42,26 +450,26 @@ BOOST_AUTO_TEST_CASE(SiteTypesUnitTest) {
// iterate over the primitive defs
while(p < e) {
// look up the current primitive def
const Sites::PrimitiveDef& primitiveDef = *p++;
const PrimitiveDef& primitiveDef = *p++;
std::cout << i << ": " << primitiveDef.getName() << std::endl;
typedef const Array<const Sites::SitePin> SitePinArray;
typedef const Array<const PrimitivePin> PrimitivePinArray;
// look up the primitive def pins
const SitePinArray& sitePins = primitiveDef.getPins();
SitePinArray::const_iterator sp = sitePins.begin();
SitePinArray::const_iterator se = sitePins.end();
const PrimitivePinArray& primitivePins = primitiveDef.getPins();
PrimitivePinArray::const_iterator sp = primitivePins.begin();
PrimitivePinArray::const_iterator se = primitivePins.end();
// iterate over the primitive def pins
if(false && sitePins.getSize() > 0) {
if(false && primitivePins.getSize() > 0) {
std::cout << " ";
// output each of the pin names along with the flags (2-INPUT, 4-OUTPUT)
while(sp < se) {
const Sites::SitePin& sitePin = *sp++;
std::cout << sitePin.getName() << " ";
std::cout << sitePin.getFlags() << " ";
const PrimitivePin& primitivePin = *sp++;
std::cout << primitivePin.getName() << " ";
std::cout << primitivePin.getFlags() << " ";
}
std::cout << std::endl;
}
// look up the primitive def elements
typedef Array<const Sites::PrimitiveElement> PrimitiveElementArray;
const PrimitiveElementArray& elements = primitiveDef.getElements();
PrimitiveElementArray::const_iterator ep = elements.begin();
PrimitiveElementArray::const_iterator ee = elements.end();
@ -69,59 +477,59 @@ BOOST_AUTO_TEST_CASE(SiteTypesUnitTest) {
if(true && elements.getSize() > 0) {
// output each of the element names and if the pin is a basic element
while(ep < ee) {
const Sites::PrimitiveElement& element = *ep++;
const PrimitiveElement& element = *ep++;
std::cout << "ELEMENT NAME:" << element.getName() << " "<< std::endl;
// std::cout << " ";
// std::cout<< "ELEMENT IS Basic ELement:" << element.isBel() << " " << std::endl;
typedef const Array<const Sites::ElementPin> ElementPinArray;
const ElementPinArray& elementPins = element.getPins();
ElementPinArray::const_iterator pp = elementPins.begin();
ElementPinArray::const_iterator pe = elementPins.end();
//std::cout << " ";
//std::cout<< "ELEMENT IS Basic ELement:" << element.isBel() << " " << std::endl;
const PrimitiveElementPinArray& elementPins = element.getPins();
PrimitiveElementPinArray::const_iterator pp = elementPins.begin();
PrimitiveElementPinArray::const_iterator pe = elementPins.end();
// iterate over the element pins
if(elementPins.getSize()> 0) {
// output each of the element pin names along with the element flags (2-Input, 4-Output)
while(pp < pe) {
// std::cout << " ";
const Sites::ElementPin& elementPin = *pp++;
const PrimitiveElementPin& elementPin = *pp++;
std::cout << elementPin.getElementPtr()->getName() << "." << elementPin.getName() << " ";
// std::cout << ((elementPin.getElement()->getName() == element.getName()) ? "" : (elementPin.getElement()->getName() + " "));
// std::cout<< "ELEMENT PIN NAME:" << elementPin.getName() << " " << std::endl;
// std::cout << " ";
// std::cout<< "ELEMENT FLAG NAME:" << elementPin.getFlags() << " " << std::endl;
// typedef std::set<std::string> StringSet;
// const StringSet elementCfgs = element.getCfgs();
// StringSet::const_iterator cp = elementCfgs.begin();
// StringSet::const_iterator ce = elementCfgs.end();
// // iterate over the configs
// if(elementCfgs.size() != 0){
// // output each of the configs
// while(cp != ce){
// // std::cout << " ";
// // std::cout << "CONFIG NAME: " << *cp << " " << std::endl;
// *cp++;
// }
// }
//std::cout << ((elementPin.getElement()->getName() == element.getName())
//? "" : (elementPin.getElement()->getName() + " "));
//std::cout<< "ELEMENT PIN NAME:" << elementPin.getName() << " " << std::endl;
//std::cout << " ";
//std::cout<< "ELEMENT FLAG NAME:" << elementPin.getFlags() << " " << std::endl;
// typedef std::set<std::string> StringSet;
// const StringSet elementCfgs = element.getCfgs();
// StringSet::const_iterator cp = elementCfgs.begin();
// StringSet::const_iterator ce = elementCfgs.end();
// // iterate over the configs
// if(elementCfgs.size() != 0){
// // output each of the configs
// while(cp != ce){
// std::cout << " ";
// std::cout << "CONFIG NAME: " << *cp << " " << std::endl;
// *cp++;
// }
// }
}
std::cout << std::endl;
}
}
std::cout << std::endl;
}
const Sites::PrimitiveDef::PrimitiveConnArray& connections = primitiveDef.getConnections();
Sites::PrimitiveDef::PrimitiveConnArray::const_iterator cp = connections.begin();
Sites::PrimitiveDef::PrimitiveConnArray::const_iterator ce = connections.end();
const PrimitiveConnSharedPtrArray& connections = primitiveDef.getConnections();
PrimitiveConnSharedPtrArray::const_iterator ccp = connections.begin();
PrimitiveConnSharedPtrArray::const_iterator cce = connections.end();
// iterate over the primitive element connections
while(true && cp < ce) {
typedef std::vector<const Sites::ElementPin*> ElementPinPtrVector;
const Sites::PrimitiveConn& connection = *cp++;
const Sites::ElementPin& source = *connection.getSourcePtr();
const ElementPinPtrVector& sinks = connection.getSinks();
while(true && ccp < cce) {
const PrimitiveConn& connection = *(*ccp++);
const PrimitiveElementPin& source = *connection.getSourcePtr();
const PrimitiveElementPinPtrVector& sinks = connection.getSinks();
std::cout << source.getElementPtr()->getName() << "." << source.getName() << " ==> ";
ElementPinPtrVector::const_iterator pp = sinks.begin();
ElementPinPtrVector::const_iterator pe = sinks.end();
while(pp < pe) {
const Sites::ElementPin& sink = **pp++;
PrimitiveElementPinPtrVector::const_iterator epp = sinks.begin();
PrimitiveElementPinPtrVector::const_iterator epe = sinks.end();
while(epp < epe) {
const PrimitiveElementPin& sink = **epp++;
std::cout << sink.getElementPtr()->getName() << "." << sink.getName() << " ";
}
std::cout << std::endl;

View File

@ -0,0 +1,38 @@
// Torc - Copyright 2011 University of Southern California. All Rights Reserved.
// $HeadURL$
// $Id$
// This program is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with this program. If
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Unit test for the Site class.
#include <boost/test/unit_test.hpp>
#include "torc/architecture/Site.hpp"
namespace torc {
namespace architecture {
BOOST_AUTO_TEST_SUITE(architecture)
/// \brief Unit test for the Site class.
BOOST_AUTO_TEST_CASE(SiteUnitTest) {
/// \todo Write a unit test for torc::architecture::Site.
BOOST_REQUIRE(false);
}
BOOST_AUTO_TEST_SUITE_END()
} // namespace architecture
} // namespace torc

View File

@ -87,7 +87,7 @@ namespace architecture {
return inStream.getBytesRead() - bytesReadOffset;
}
size_t Sites::readSiteTypes(DigestStream& inStream) {
size_t Sites::readPrimitiveTypes(DigestStream& inStream) {
// prepare to read from the stream
size_t bytesReadOffset = inStream.getBytesRead();
char scratch[1 << 10]; // scratch read buffer
@ -129,7 +129,7 @@ namespace architecture {
// loop through each pin
for(PinCount j; j < pinCount; j++) {
// look up the current pin
SitePin& sitePin = const_cast<SitePin&>(primitiveDef.mPins[j]);
PrimitivePin& primitivePin = const_cast<PrimitivePin&>(primitiveDef.mPins[j]);
// read the pin flags
inStream.read(pinFlags);
// read the pin name
@ -139,8 +139,8 @@ namespace architecture {
inStream.read(scratch, nameLength);
scratch[nameLength] = 0;
// update the site pin
sitePin.mFlags = pinFlags;
sitePin.mName = scratch;
primitivePin.mFlags = pinFlags;
primitivePin.mName = scratch;
primitiveDef.mPinNameToPinIndex[scratch] = xilinx::PinIndex(j);
}
// read the number of site elements
@ -173,7 +173,8 @@ namespace architecture {
// loop through each pin
for(PinCount k; k < pinCount; k++) {
// look up the current pin
ElementPin& elementPin = const_cast<ElementPin&>(element.mPins[k]);
PrimitiveElementPin& elementPin =
const_cast<PrimitiveElementPin&>(element.mPins[k]);
// read the pin flags
inStream.read(pinFlags);
// read the pin name
@ -209,7 +210,7 @@ namespace architecture {
scratch[nameLength] = 0;
//if(debug) std::cout << scratch << " ";
// update the cfg values
element.mCfg.insert(scratch);
element.mCfgs.insert(scratch);
}
//if(debug) std::cout << std::endl;
}
@ -220,10 +221,12 @@ namespace architecture {
// update the site definition
primitiveDef.mConnections.setSize(connCount);
// loop through each conn
const Sites::PrimitiveDef::PrimitiveElementArray& elements = primitiveDef.getElements();
const PrimitiveElementArray& elements = primitiveDef.getElements();
for(uint32_t j = 0; j < connCount; j++) {
// look up the current connection
PrimitiveConn& connection = const_cast<PrimitiveConn&>(primitiveDef.mConnections[j]);
PrimitiveConnSharedPtr& connectionPtr = primitiveDef.mConnections[j];
connectionPtr = boost::shared_ptr<PrimitiveConn>(new PrimitiveConn());
PrimitiveConn& connection = const_cast<PrimitiveConn&>(*connectionPtr);
// read the source count
uint16_t sourceCount;
inStream.read(sourceCount);
@ -234,9 +237,10 @@ namespace architecture {
inStream.read(pinIndex);
const PrimitiveElement* elementPtr = elements.begin() + elementIndex;
PrimitiveElement& element = const_cast<PrimitiveElement&>(*elementPtr);
const Sites::PrimitiveElement::ElementPinArray& pins = element.getPins();
const Sites::ElementPin& pin = pins[pinIndex];
const PrimitiveElementPinArray& pins = element.getPins();
PrimitiveElementPin& pin = const_cast<PrimitiveElementPin&>(pins[pinIndex]);
connection.mSourcePtr = &pin;
const_cast<PrimitiveConnSharedPtr&>(pin.mPrimitiveConn) = connectionPtr;
// read the sink count
uint16_t sinkCount;
inStream.read(sinkCount);
@ -247,9 +251,10 @@ namespace architecture {
inStream.read(pinIndex);
elementPtr = elements.begin() + elementIndex;
PrimitiveElement& element = const_cast<PrimitiveElement&>(*elementPtr);
const Sites::PrimitiveElement::ElementPinArray& pins = element.getPins();
const Sites::ElementPin& pin = pins[pinIndex];
const PrimitiveElementPinArray& pins = element.getPins();
PrimitiveElementPin& pin = const_cast<PrimitiveElementPin&>(pins[pinIndex]);
connection.mSinks.push_back(&pin);
const_cast<PrimitiveConnSharedPtr&>(pin.mPrimitiveConn) = connectionPtr;
}
}
//std::cout << primitiveDef.getName() << " - " << element.getName() << ":" << std::endl;
@ -259,10 +264,10 @@ namespace architecture {
return inStream.getBytesRead() - bytesReadOffset;
}
size_t Sites::readSitePinMaps(DigestStream& inStream) {
size_t Sites::readPrimitivePinMaps(DigestStream& inStream) {
// prepare to read from the stream
size_t bytesReadOffset = inStream.getBytesRead();
uint16_t sitePinMapCount = 0; // number of pin maps
uint16_t primitivePinMapCount = 0; // number of pin maps
PinCount pinCount; // number of pins
WireIndex wireIndex; // pin index
@ -273,16 +278,16 @@ namespace architecture {
if(sectionName != ">>>>Pin Maps>>>>") throw -1;
// initialize the site pin map array
inStream.read(sitePinMapCount);
mSitePinMaps.setSize(sitePinMapCount);
std::cout << "\tReading " << sitePinMapCount << " site pin maps..." << std::endl;
inStream.read(primitivePinMapCount);
mPrimitivePinMaps.setSize(primitivePinMapCount);
std::cout << "\tReading " << primitivePinMapCount << " primitive pin maps..." << std::endl;
// loop through each pin map
for(uint16_t i = 0; i < sitePinMapCount; i++) {
for(uint16_t i = 0; i < primitivePinMapCount; i++) {
// read the pin count
inStream.read(pinCount);
mSitePinMaps[i].setSize(pinCount);
mPrimitivePinMaps[i].setSize(pinCount);
// get a reference to this map's pin array
Array<const WireIndex>& pins = mSitePinMaps[i];
Array<const WireIndex>& pins = mPrimitivePinMaps[i];
// loop through each pin
for(PinCount j; j < pinCount; j++) {
// look up a reference to the pin and discard the const trait
@ -333,7 +338,8 @@ namespace architecture {
inStream.read(pinMap);
// look up a reference for the site, and discard the const trait
Site& site = const_cast<Site&>(mSites[i]);
site = Site(scratch, mSiteTypes[siteTypeIndex], tileIndex, flags, mSitePinMaps[pinMap]);
site = Site(scratch, mSiteTypes[siteTypeIndex], tileIndex, flags,
mPrimitivePinMaps[pinMap]);
mSiteNameToSiteIndex[scratch] = i;
}

View File

@ -23,13 +23,17 @@
#include "torc/architecture/DigestStream.hpp"
#include "torc/architecture/Array.hpp"
#include "torc/architecture/Tilewire.hpp"
#include "torc/architecture/Package.hpp"
#include "torc/architecture/PrimitivePin.hpp"
#include "torc/architecture/PrimitiveElementPin.hpp"
#include "torc/architecture/PrimitiveElement.hpp"
#include "torc/architecture/PrimitiveConn.hpp"
#include "torc/architecture/PrimitiveDef.hpp"
#include "torc/architecture/Site.hpp"
#include <boost/cstdint.hpp>
#include <map>
#include <set>
/// \todo remove this #include
#include <iostream>
namespace torc {
namespace architecture {
@ -58,183 +62,14 @@ namespace architecture {
typedef xilinx::PadCount PadCount; ///< \brief Imported type name.
typedef xilinx::PadIndex PadIndex; ///< \brief Imported type name.
/// \brief Map from site name to site index.
typedef std::map<std::string, SiteIndex> SiteNameToSiteIndexMap;
typedef std::map<string, SiteIndex> SiteNameToSiteIndexMap;
/// \brief Map from package name to package index.
typedef std::map<std::string, PackageIndex> PackageNameToPackageIndexMap;
// nested classes
public:
/// \brief Encapsulation of the site index, pin name, and pin flags for a package.
class Pad {
friend class Sites;
SiteIndex mSiteIndex;
std::string mName;
SiteFlags mFlags;
Pad(SiteIndex inSiteIndex, const std::string& inName, SiteFlags inFlags)
: mSiteIndex(inSiteIndex), mName(inName), mFlags(inFlags) {}
public:
SiteIndex getSiteIndex(void) const { return mSiteIndex; }
const std::string& getName(void) const { return mName; }
SiteFlags getFlags(void) const { return mFlags; }
Pad(void) : mSiteIndex(), mName(), mFlags() {};
};
/// \brief Encapsulation of the packages for a device.
class Package {
friend class Sites;
typedef std::map<std::string, PadIndex> PadNameToPadIndexMap;
std::string mName;
Array<const Pad> mPads;
PadNameToPadIndexMap mPadNameToPadIndex;
Package(const std::string& inName) : mName(inName), mPads() {}
Array<const Pad>& getPads(void) { return mPads; }
public:
const std::string& getName(void) const { return mName; }
const Array<const Pad>& getPads(void) const { return mPads; }
PadIndex findPadIndexByName(const std::string& inName) const {
PadNameToPadIndexMap::const_iterator p = mPadNameToPadIndex.find(inName);
return (p == mPadNameToPadIndex.end())
? PadIndex(PadIndex::undefined()) : p->second;
}
Package(void) : mName(), mPads() {}
};
/// \bried Encapsulation of pin directionality
class PinDirection {
public:
enum { ePinDirectionNone = 0, ePinDirectionInput = 2, ePinDirectionOutput = 4 };
};
/// \brief Encapsulation of a site pin's name and flags.
class SitePin : public PinDirection {
friend class Sites;
std::string mName;
PinFlags mFlags;
SitePin(const std::string& inName, PinFlags inFlags) : mName(inName), mFlags(inFlags) {}
public:
const std::string& getName(void) const { return mName; }
PinFlags getFlags(void) const { return mFlags; }
SitePin(void) : mName(), mFlags() {};
bool isInput(void) const { return (mFlags & ePinDirectionInput) != 0; }
bool isOutput(void) const { return (mFlags & ePinDirectionOutput) != 0; }
};
/// \brief Encapsulation of an element pin's name and flags.
class PrimitiveElement;
class ElementPin : public PinDirection {
friend class Sites;
const PrimitiveElement* mElementPtr;
std::string mName;
PinFlags mFlags;
ElementPin(const PrimitiveElement* inElementPtr, const std::string& inName,
PinFlags inFlags) : mElementPtr(inElementPtr), mName(inName), mFlags(inFlags) {}
public:
const PrimitiveElement* getElementPtr(void) const { return mElementPtr; }
const std::string& getName(void) const { return mName; }
PinFlags getFlags(void) const { return mFlags; }
ElementPin(void) : mElementPtr(0), mName(), mFlags() {};
bool isInput(void) const { return (mFlags & ePinDirectionInput) != 0; }
bool isOutput(void) const { return (mFlags & ePinDirectionOutput) != 0; }
};
/// \brief Encapsulation of a PrimitiveDef element.
class PrimitiveElement {
public:
typedef Array<const ElementPin> ElementPinArray;
typedef std::set<std::string> StringSet;
protected:
friend class Sites;
typedef xilinx::PinIndex PinIndex;
typedef std::map<std::string, PinIndex> PinNameToPinIndexMap;
std::string mName;
ElementPinArray mPins;
StringSet mCfg;
bool mIsBel;
PinNameToPinIndexMap mPinNameToPinIndex;
Array<const ElementPin>& getPins(void) { return mPins; }
public:
const std::string& getName(void) const { return mName; }
const ElementPinArray& getPins(void) const { return mPins; }
const StringSet& getCfgs(void) const { return mCfg; }
bool isBel(void) const { return mIsBel; }
PinIndex findPinIndexByName(const std::string& inName) const {
PinNameToPinIndexMap::const_iterator p = mPinNameToPinIndex.find(inName);
return (p == mPinNameToPinIndex.end())
? PinIndex(PinIndex::undefined()) : p->second;
}
PrimitiveElement(void) : mName(), mPins(), mPinNameToPinIndex() {}
};
/// \brief Encapsulation of a PrimitiveDef internal connection.
class PrimitiveConn {
protected:
friend class Sites;
typedef std::vector<const ElementPin*> ElementPinPtrVector;
const ElementPin* mSourcePtr;
ElementPinPtrVector mSinks;
public:
const ElementPin* getSourcePtr(void) const { return mSourcePtr; }
const ElementPinPtrVector& getSinks(void) const { return mSinks; }
};
/// \brief Encapsulation of a site type's name and pins.
class PrimitiveDef {
public:
typedef Array<const SitePin> SitePinArray;
typedef Array<const PrimitiveElement> PrimitiveElementArray;
typedef Array<const PrimitiveConn> PrimitiveConnArray;
protected:
friend class Sites;
typedef xilinx::PinIndex PinIndex;
typedef std::map<std::string, PinIndex> PinNameToPinIndexMap;
std::string mName;
SitePinArray mPins;
PrimitiveElementArray mElements;
PrimitiveConnArray mConnections;
PinNameToPinIndexMap mPinNameToPinIndex;
Array<const SitePin>& getPins(void) { return mPins; }
public:
const std::string& getName(void) const { return mName; }
const SitePinArray& getPins(void) const { return mPins; }
const PrimitiveElementArray& getElements(void) const { return mElements; }
const PrimitiveConnArray& getConnections(void) const { return mConnections; }
PinIndex findPinIndexByName(const std::string& inName) const {
PinNameToPinIndexMap::const_iterator p = mPinNameToPinIndex.find(inName);
return (p == mPinNameToPinIndex.end())
? PinIndex(PinIndex::undefined()) : p->second;
}
PrimitiveDef(void) : mName(), mPins(), mPinNameToPinIndex() {}
};
/// \brief Encapsulation of a logic site.
class Site {
friend class Sites;
public:
typedef Array<const WireIndex> WireIndexArray;
protected:
typedef xilinx::PinIndex PinIndex;
std::string mName;
const PrimitiveDef* mPrimitiveDefPtr;
TileIndex mTileIndex;
SiteFlags mFlags;
const WireIndexArray* mPinMapPtr;
Site(const std::string& inName, const PrimitiveDef& inPrimitiveDef,
TileIndex inTileIndex, SiteFlags inFlags, const WireIndexArray& inPinMap)
: mName(inName), mPrimitiveDefPtr(&inPrimitiveDef), mTileIndex(inTileIndex),
mFlags(inFlags), mPinMapPtr(&inPinMap) {
}
public:
const std::string& getName(void) const { return mName; }
const PrimitiveDef* getPrimitiveDefPtr(void) const { return mPrimitiveDefPtr; }
TileIndex getTileIndex(void) const { return mTileIndex; }
SiteFlags getFlags(void) const { return mFlags; }
const WireIndexArray* getPinMapPtr(void) const { return mPinMapPtr; }
Site(void) : mName(), mPrimitiveDefPtr(0), mTileIndex(), mFlags(), mPinMapPtr(0) {}
const Tilewire getPinTilewire(const std::string& inName) const {
if(mPrimitiveDefPtr == 0) return Tilewire::sInvalid;
PinIndex pinIndex = mPrimitiveDefPtr->findPinIndexByName(inName);
if(pinIndex.isUndefined()) return Tilewire::sInvalid;
if(mPinMapPtr == 0) return Tilewire::sInvalid;
return Tilewire(mTileIndex, (*mPinMapPtr)[pinIndex]);
}
};
protected:
typedef std::map<string, PackageIndex> PackageNameToPackageIndexMap;
// members
/// \brief The site types for this family.
Array<const PrimitiveDef> mSiteTypes;
/// \brief The site pin maps for this family.
Array2D<const WireIndex> mSitePinMaps;
Array2D<const WireIndex> mPrimitivePinMaps;
/// \brief The logic sites for this device.
Array<const Site> mSites;
/// \brief The mapping from site name to site index for this device.
@ -244,16 +79,16 @@ namespace architecture {
/// \brief The mapping from package name to package index for this device.
PackageNameToPackageIndexMap mPackageNameToPackageIndex;
// functions
/// \brief Read the site types for the family.
size_t readSiteTypes(DigestStream& inStream);
/// \brief Read the primitive types for the family.
size_t readPrimitiveTypes(DigestStream& inStream);
/// \brief Read the site pin mappings for the family.
size_t readSitePinMaps(DigestStream& inStream);
size_t readPrimitivePinMaps(DigestStream& inStream);
/// \brief Read the sites for the device.
size_t readSites(DigestStream& inStream);
/// \brief Read the packages for the device.
size_t readPackages(DigestStream& inStream);
/// \brief Activate the specified device package.
void activatePackage(const std::string& inName) {
void activatePackage(const string& inName) {
activatePackage(findPackageIndex(inName));
}
/// \brief Activate the specified device package.
@ -295,13 +130,13 @@ namespace architecture {
const Array<const Package>& getPackages(void) const { return mPackages; }
// functions
/// \brief Returns the site index for the given site name.
SiteIndex findSiteIndex(const std::string& inName) const {
SiteIndex findSiteIndex(const string& inName) const {
SiteNameToSiteIndexMap::const_iterator p = mSiteNameToSiteIndex.find(inName);
return (p == mSiteNameToSiteIndex.end())
? SiteIndex(SiteIndex::undefined()) : p->second;
}
/// \brief Returns the package index for the given package name.
PackageIndex findPackageIndex(const std::string& inName) const {
PackageIndex findPackageIndex(const string& inName) const {
PackageNameToPackageIndexMap::const_iterator p
= mPackageNameToPackageIndex.find(inName);
return (p == mPackageNameToPackageIndex.end())

View File

@ -14,7 +14,7 @@
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Source for the Sites unit test.
/// \brief Unit test for the Sites class.
#include <boost/test/unit_test.hpp>
#include "torc/architecture/Sites.hpp"

View File

@ -16,8 +16,8 @@
/// \file
/// \brief Header for the TileInfo class.
#ifndef TORC_ARCHITECTURE_TILE_INFO_HPP
#define TORC_ARCHITECTURE_TILE_INFO_HPP
#ifndef TORC_ARCHITECTURE_TILEINFO_HPP
#define TORC_ARCHITECTURE_TILEINFO_HPP
#include "torc/architecture/XilinxDatabaseTypes.hpp"
#include <cstring>
@ -89,4 +89,4 @@ namespace architecture {
} // namespace architecture
} // namespace torc
#endif // TORC_ARCHITECTURE_TILE_INFO_HPP
#endif // TORC_ARCHITECTURE_TILEINFO_HPP

View File

@ -14,7 +14,7 @@
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Source for the TileInfo unit test.
/// \brief Unit test for the TileInfo class.
#include <boost/test/unit_test.hpp>
#include "torc/architecture/TileInfo.hpp"

View File

@ -14,7 +14,7 @@
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Source for the Tiles unit test.
/// \brief Unit test for the Tiles class.
#include <boost/test/unit_test.hpp>
#include "torc/architecture/Tiles.hpp"
@ -33,7 +33,7 @@ void testDeviceTiles(DDB& inDDB);
BOOST_AUTO_TEST_CASE(TilesUnitTest) {
// iterate over the devices
const torc::common::DeviceVector& devices = torc::common::Devices::getSupportedDevices();
const torc::common::DeviceVector& devices = torc::common::Devices::getUnitTestDevices();
torc::common::DeviceVector::const_iterator dp = devices.begin();
torc::common::DeviceVector::const_iterator de = devices.end();
while(dp < de) {

View File

@ -22,8 +22,7 @@
namespace torc {
namespace architecture {
const Tilewire Tilewire::sInvalid = Tilewire(TileIndex(TileIndex::undefined()),
WireIndex(WireIndex::undefined()));
const Tilewire Tilewire::sInvalid = Tilewire(TileIndex(-1), WireIndex(-1));
std::size_t hash_value(const Tilewire& inTilewire) {
std::size_t seed = 0;

View File

@ -14,7 +14,7 @@
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Source for the Tilewire unit test.
/// \brief Unit test for the Tilewire class.
#include <boost/test/unit_test.hpp>
#include "torc/architecture/Tilewire.hpp"

View File

@ -14,7 +14,7 @@
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Source for the Versions unit test.
/// \brief Unit test for the Versions class.
#include <boost/test/unit_test.hpp>
#include "torc/architecture/Versions.hpp"

View File

@ -16,8 +16,8 @@
/// \file
/// \brief Header for the WireInfo class.
#ifndef TORC_ARCHITECTURE_WIRE_INFO_HPP
#define TORC_ARCHITECTURE_WIRE_INFO_HPP
#ifndef TORC_ARCHITECTURE_WIREINFO_HPP
#define TORC_ARCHITECTURE_WIREINFO_HPP
#include "torc/architecture/XilinxDatabaseTypes.hpp"
#include "torc/architecture/Array.hpp"
@ -165,4 +165,4 @@ namespace architecture {
} // namespace architecture
} // namespace torc
#endif // TORC_ARCHITECTURE_WIRE_INFO_HPP
#endif // TORC_ARCHITECTURE_WIREINFO_HPP

View File

@ -14,7 +14,7 @@
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Source for the WireInfo unit test.
/// \brief Unit test for the WireInfo class.
#include <boost/test/unit_test.hpp>
#include "torc/architecture/WireInfo.hpp"

View File

@ -16,8 +16,8 @@
/// \file
/// \brief Header for the WireUsage class.
#ifndef TORC_ARCHITECTURE_WIRE_USAGE_HPP
#define TORC_ARCHITECTURE_WIRE_USAGE_HPP
#ifndef TORC_ARCHITECTURE_WIREUSAGE_HPP
#define TORC_ARCHITECTURE_WIREUSAGE_HPP
#include "torc/architecture/Array.hpp"
#include "torc/architecture/Tiles.hpp"
@ -174,4 +174,4 @@ namespace architecture {
} // namespace architecture
} // namespace torc
#endif // TORC_ARCHITECTURE_WIRE_USAGE_HPP
#endif // TORC_ARCHITECTURE_WIREUSAGE_HPP

View File

@ -14,7 +14,7 @@
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Source for the WireUsage unit test.
/// \brief Unit test for the WireUsage class.
#include <boost/test/unit_test.hpp>
#include "torc/architecture/WireUsage.hpp"

View File

@ -17,13 +17,14 @@
/// \brief Source for the XdlImporter class.
#include "torc/architecture/XdlImporter.hpp"
#include "torc/architecture/DeviceDesignator.hpp"
#include "torc/common/DeviceDesignator.hpp"
namespace torc {
namespace architecture {
void XdlImporter::initializeDatabase(void) {
DeviceDesignator deviceDesignator(mDesignDevice + mDesignPackage + mDesignSpeedGrade);
torc::common::DeviceDesignator deviceDesignator(mDesignDevice + mDesignPackage
+ mDesignSpeedGrade);
mDDBPtr = new DDB(deviceDesignator);
}

View File

@ -16,8 +16,8 @@
/// \file
/// \brief Header for the XdlImporter class.
#ifndef TORC_ARCHITECTURE_XDL_IMPORTER_HPP
#define TORC_ARCHITECTURE_XDL_IMPORTER_HPP
#ifndef TORC_ARCHITECTURE_XDLIMPORTER_HPP
#define TORC_ARCHITECTURE_XDLIMPORTER_HPP
#include "torc/physical/XdlImporter.hpp"
#include "torc/architecture/DDB.hpp"
@ -65,4 +65,4 @@ namespace architecture {
} // namespace architecture
} // namespace torc
#endif // TORC_ARCHITECTURE_XDL_IMPORTER_HPP
#endif // TORC_ARCHITECTURE_XDLIMPORTER_HPP

View File

@ -14,7 +14,7 @@
// not, see <http://www.gnu.org/licenses/>.
/// \file
/// \brief Source for the XdlImporter unit test.
/// \brief Unit test for the XdlImporter class.
#include <boost/test/unit_test.hpp>
#include "torc/architecture/XdlImporter.hpp"
@ -41,9 +41,7 @@ BOOST_AUTO_TEST_CASE(XdlImporterUnitTest) {
std::fstream fileStream(referencePath.string().c_str());
BOOST_REQUIRE(fileStream.good());
XdlImporter importer;
std::cerr << "importer invocation" << std::endl;
importer(fileStream, referencePath.string());
std::cerr << "importer finished" << std::endl;
// look up the design (and do something with it ...)
torc::physical::DesignSharedPtr designPtr = importer.getDesignPtr();

View File

@ -16,8 +16,8 @@
/// \file
/// \brief Device database types for Xilinx architectures.
#ifndef TORC_ARCHITECTURE_XILINX_XILINX_DATABASE_TYPES_HPP
#define TORC_ARCHITECTURE_XILINX_XILINX_DATABASE_TYPES_HPP
#ifndef TORC_ARCHITECTURE_XILINXDATABASETYPES_HPP
#define TORC_ARCHITECTURE_XILINXDATABASETYPES_HPP
#include "torc/common/EncapsulatedInteger.hpp"
#include <boost/cstdint.hpp>
@ -261,4 +261,4 @@ namespace xilinx {
} // namespace architecture
} // namespace torc
#endif // TORC_ARCHITECTURE_XILINX_XILINX_DATABASE_TYPES_HPP
#endif // TORC_ARCHITECTURE_XILINXDATABASETYPES_HPP

View File

@ -34,11 +34,11 @@
namespace torc {
namespace bitstream {
namespace bitstream { class bitstream_bitstream; }
namespace bitstream { class BitstreamUnitTest; }
/// \brief Xilinx bitstream base class.
class Bitstream {
friend class torc::bitstream::bitstream::bitstream_bitstream;
friend class torc::bitstream::bitstream::BitstreamUnitTest;
/// \todo Bitstream access needs to be changed from public back to protected.
// protected: changed to run tests
public:
@ -197,6 +197,9 @@ namespace bitstream { class bitstream_bitstream; }
/// \detail This is generally only useful for internal purposes.
/// \todo This function should be made pure virtual.
virtual void initializeDeviceInfo(const std::string& inDeviceName) {}
/// \brief Initialize the maps between frame indexes and frame addresses.
/// \detail This is generally only useful for internal purposes.
virtual void initializeFrameMaps(void) {}
/// \brief Output static device information to a stream.
/// \details This is used to generate the static column maps for bitstream frame mapping.
virtual void writeDeviceInfo(std::ostream& inStream, const std::string& inDeviceName);

Some files were not shown because too many files have changed in this diff Show More