From 83574177878cbf755d2cec0c0bc640e36fbd9c9d Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Sat, 11 Aug 2018 15:53:55 -0700 Subject: [PATCH] Load Torc DDB --- xc7/arch.cc | 15 +++++++++------ xc7/arch.h | 7 ++++++- xc7/family.cmake | 46 ++++++++++++++++++++++++++++++++++++++++++++++ xc7/main.cc | 6 +++--- xc7/project.cc | 4 ++-- 5 files changed, 66 insertions(+), 12 deletions(-) diff --git a/xc7/arch.cc b/xc7/arch.cc index 9b739ba4..5d14fac8 100644 --- a/xc7/arch.cc +++ b/xc7/arch.cc @@ -28,6 +28,8 @@ #include "router1.h" #include "util.h" +#include "torc/common/DirectoryTree.hpp" + NEXTPNR_NAMESPACE_BEGIN // ----------------------------------------------------------------------- @@ -43,8 +45,9 @@ void IdString::initialize_arch(const BaseCtx *ctx) Arch::Arch(ArchArgs args) : args(args) { - if (args.type == ArchArgs::XC7Z020) { - //chip_info = get_chip_info(reinterpret_cast *>(chipdb_blob_1k)); + torc::common::DirectoryTree directoryTree("../../torc/src/torc"); + if (args.type == ArchArgs::Z020) { + ddb = new DDB("xc7z020", "clg484"); } else { log_error("Unsupported XC7 chip type.\n"); } @@ -64,8 +67,8 @@ Arch::Arch(ArchArgs args) : args(args) std::string Arch::getChipName() const { - if (args.type == ArchArgs::XC7Z020) { - return "XC7Z020"; + if (args.type == ArchArgs::Z020) { + return "z020"; } else { log_error("Unsupported XC7 chip type.\n"); } @@ -75,8 +78,8 @@ std::string Arch::getChipName() const IdString Arch::archArgsToId(ArchArgs args) const { - if (args.type == ArchArgs::XC7Z020) - return id("xc7z020"); + if (args.type == ArchArgs::Z020) + return id("z020"); return IdString(); } diff --git a/xc7/arch.h b/xc7/arch.h index d92ff0c1..411be954 100644 --- a/xc7/arch.h +++ b/xc7/arch.h @@ -21,6 +21,10 @@ #error Include "arch.h" via "nextpnr.h" only. #endif +#include "torc/Architecture.hpp" +#include "torc/Common.hpp" +using namespace torc::architecture; + NEXTPNR_NAMESPACE_BEGIN /**** Everything in this section must be kept in sync with chipdb.py ****/ @@ -378,7 +382,7 @@ struct ArchArgs enum ArchArgsTypes { NONE, - XC7Z020 + Z020 } type = NONE; std::string package; }; @@ -387,6 +391,7 @@ struct Arch : BaseCtx { bool fast_part; const ChipInfoPOD *chip_info; + const DDB *ddb; const PackageInfoPOD *package_info; mutable std::unordered_map bel_by_name; diff --git a/xc7/family.cmake b/xc7/family.cmake index e69de29b..a92fd44b 100644 --- a/xc7/family.cmake +++ b/xc7/family.cmake @@ -0,0 +1,46 @@ +include_directories(.) +#include_directories(torc/externals/zlib) + +target_link_libraries( + nextpnr-${family} + PRIVATE ${CMAKE_SOURCE_DIR}/torc/architecture/Arc.o + PRIVATE ${CMAKE_SOURCE_DIR}/torc/architecture/ArcUsage.o + PRIVATE ${CMAKE_SOURCE_DIR}/torc/architecture/Array.o + PRIVATE ${CMAKE_SOURCE_DIR}/torc/architecture/DDB.o + PRIVATE ${CMAKE_SOURCE_DIR}/torc/architecture/DDBConsoleStreams.o + PRIVATE ${CMAKE_SOURCE_DIR}/torc/architecture/DDBStreamHelper.o + PRIVATE ${CMAKE_SOURCE_DIR}/torc/architecture/DigestStream.o + PRIVATE ${CMAKE_SOURCE_DIR}/torc/architecture/ExtendedWireInfo.o + PRIVATE ${CMAKE_SOURCE_DIR}/torc/architecture/InstancePin.o + PRIVATE ${CMAKE_SOURCE_DIR}/torc/architecture/OutputStreamHelpers.o + PRIVATE ${CMAKE_SOURCE_DIR}/torc/architecture/Package.o + PRIVATE ${CMAKE_SOURCE_DIR}/torc/architecture/Pad.o + PRIVATE ${CMAKE_SOURCE_DIR}/torc/architecture/PrimitiveConn.o + PRIVATE ${CMAKE_SOURCE_DIR}/torc/architecture/PrimitiveDef.o + PRIVATE ${CMAKE_SOURCE_DIR}/torc/architecture/PrimitiveElement.o + PRIVATE ${CMAKE_SOURCE_DIR}/torc/architecture/PrimitiveElementPin.o + PRIVATE ${CMAKE_SOURCE_DIR}/torc/architecture/PrimitivePin.o + PRIVATE ${CMAKE_SOURCE_DIR}/torc/architecture/Segments.o + PRIVATE ${CMAKE_SOURCE_DIR}/torc/architecture/Site.o + PRIVATE ${CMAKE_SOURCE_DIR}/torc/architecture/Sites.o + PRIVATE ${CMAKE_SOURCE_DIR}/torc/architecture/Tiles.o + PRIVATE ${CMAKE_SOURCE_DIR}/torc/architecture/TileInfo.o + PRIVATE ${CMAKE_SOURCE_DIR}/torc/architecture/Tilewire.o + PRIVATE ${CMAKE_SOURCE_DIR}/torc/architecture/Versions.o + PRIVATE ${CMAKE_SOURCE_DIR}/torc/architecture/VprExporter.o + PRIVATE ${CMAKE_SOURCE_DIR}/torc/architecture/WireInfo.o + PRIVATE ${CMAKE_SOURCE_DIR}/torc/architecture/WireUsage.o + PRIVATE ${CMAKE_SOURCE_DIR}/torc/architecture/XdlImporter.o + PRIVATE ${CMAKE_SOURCE_DIR}/torc/architecture/XilinxDatabaseTypes.o + + PRIVATE ${CMAKE_SOURCE_DIR}/torc/common/Annotated.o + PRIVATE ${CMAKE_SOURCE_DIR}/torc/common/DeviceDesignator.o + PRIVATE ${CMAKE_SOURCE_DIR}/torc/common/Devices.o + PRIVATE ${CMAKE_SOURCE_DIR}/torc/common/DirectoryTree.o + PRIVATE ${CMAKE_SOURCE_DIR}/torc/common/DottedVersion.o + PRIVATE ${CMAKE_SOURCE_DIR}/torc/common/NullOutputStream.o + PRIVATE boost_regex + + PRIVATE ${CMAKE_SOURCE_DIR}/torc/externals/zlib/zfstream.o + PRIVATE z +) diff --git a/xc7/main.cc b/xc7/main.cc index 440a26d0..79f40add 100644 --- a/xc7/main.cc +++ b/xc7/main.cc @@ -82,13 +82,13 @@ void Xc7CommandHandler::setupArchContext(Context *ctx) std::unique_ptr Xc7CommandHandler::createContext() { - if (vm.count("xc7z020")) { - chipArgs.type = ArchArgs::XC7Z020; + if (vm.count("z020")) { + chipArgs.type = ArchArgs::Z020; chipArgs.package = "clg484"; } if (chipArgs.type == ArchArgs::NONE) { - chipArgs.type = ArchArgs::XC7Z020; + chipArgs.type = ArchArgs::Z020; chipArgs.package = "clg484"; } diff --git a/xc7/project.cc b/xc7/project.cc index af0a775b..5c8def1f 100644 --- a/xc7/project.cc +++ b/xc7/project.cc @@ -38,8 +38,8 @@ std::unique_ptr ProjectHandler::createContext(pt::ptree &root) { ArchArgs chipArgs; std::string arch_type = root.get("project.arch.type"); - if (arch_type == "xc7z020") { - chipArgs.type = ArchArgs::XC7Z020; + if (arch_type == "z020") { + chipArgs.type = ArchArgs::Z020; } chipArgs.package = root.get("project.arch.package");