00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "torc/Generic.hpp"
00020 #include "torc/Common.hpp"
00021 #include <fstream>
00022 #include <boost/regex.hpp>
00023
00024 using namespace std;
00025 using namespace torc::generic;
00026
00027 int main(int argc, char* argv[]) {
00028
00029
00030 (void) argc;
00031 torc::common::DirectoryTree directoryTree(argv[0]);
00032 boost::filesystem::path referencePath = torc::common::DirectoryTree::getExecutablePath()
00033 / "regression" / "GenericExample.reference.edf";
00034 boost::filesystem::path generatedPath = torc::common::DirectoryTree::getExecutablePath()
00035 / "regression" / "GenericExample.generated.edf";
00036
00037
00038 string inFileName = referencePath.string();
00039 fstream fileStream(inFileName.c_str());
00040 ObjectFactorySharedPtr factoryPtr(new ObjectFactory());
00041 EdifImporter importer(factoryPtr);
00042 importer(fileStream, inFileName);
00043
00044
00045 RootSharedPtr rootPtr = importer.getRootPtr();
00046 InstanceSharedPtr instancePtr = rootPtr->findLibrary("work")->findCell("and")
00047 ->findView("verilog")->findInstance("oZ0");
00048
00049
00050 PropertySharedPtr initPropertyPtr = instancePtr->getProperty("INIT");
00051 string originalMask = initPropertyPtr->getValue().get<Value::String>();
00052 std::cout << "The original LUT mask was \"" << originalMask << "\"." << std::endl;
00053 Value xorMask(Value::eValueTypeString, string("6"));
00054 initPropertyPtr->setValue(xorMask);
00055
00056
00057 string outFileName = generatedPath.string();
00058 fstream edifExport(outFileName.c_str(), ios_base::out);
00059 EdifExporter exporter(edifExport);
00060 exporter(rootPtr);
00061
00062 return 0;
00063 }