diff --git a/xc7/arch.cc b/xc7/arch.cc index f9d56185..d95453e3 100644 --- a/xc7/arch.cc +++ b/xc7/arch.cc @@ -33,13 +33,15 @@ #include #include #include +#include +#include struct nextpnr_binary_iarchive : public boost::archive::binary_iarchive { - nextpnr_binary_iarchive(std::ifstream &ifs, NEXTPNR_NAMESPACE::BaseCtx* ctx, const std::string& inDeviceName, const std::string& inPackageName) : boost::archive::binary_iarchive(ifs), ctx(ctx), inDeviceName(inDeviceName), inPackageName(inPackageName) {} + nextpnr_binary_iarchive(boost::iostreams::filtering_istreambuf &ifs, NEXTPNR_NAMESPACE::BaseCtx* ctx, const std::string& inDeviceName, const std::string& inPackageName) : boost::archive::binary_iarchive(ifs), ctx(ctx), inDeviceName(inDeviceName), inPackageName(inPackageName) {} NEXTPNR_NAMESPACE::BaseCtx *ctx; std::string inDeviceName, inPackageName; }; struct nextpnr_binary_oarchive : public boost::archive::binary_oarchive { - nextpnr_binary_oarchive(std::ofstream &ofs, NEXTPNR_NAMESPACE::BaseCtx* ctx) : boost::archive::binary_oarchive(ofs), ctx(ctx) {} + nextpnr_binary_oarchive(boost::iostreams::filtering_ostreambuf &ofs, NEXTPNR_NAMESPACE::BaseCtx* ctx) : boost::archive::binary_oarchive(ofs), ctx(ctx) {} NEXTPNR_NAMESPACE::BaseCtx *ctx; }; @@ -312,9 +314,11 @@ Arch::Arch(ArchArgs args) : args(args) #ifdef TORC_INFO_DB std::ifstream ifs(TORC_INFO_DB, std::ios::binary); if (ifs) { - nextpnr_binary_iarchive ia(ifs, this, "xc7z020", args.package); + boost::iostreams::filtering_istreambuf fifs; + fifs.push(boost::iostreams::zlib_decompressor()); + fifs.push(ifs); + nextpnr_binary_iarchive ia(fifs, this, "xc7z020", args.package); ia >> torc_info; - std::cout << ifs.tellg() << std::endl; } else #endif { @@ -322,10 +326,11 @@ Arch::Arch(ArchArgs args) : args(args) #ifdef TORC_INFO_DB std::ofstream ofs(TORC_INFO_DB, std::ios::binary); if (ofs) { - nextpnr_binary_oarchive oa(ofs, this); + boost::iostreams::filtering_ostreambuf fofs; + fofs.push(boost::iostreams::zlib_compressor()); + fofs.push(ofs); + nextpnr_binary_oarchive oa(fofs, this); oa << torc_info; - ofs.flush(); - std::cout << ofs.tellp() << std::endl; } } #endif diff --git a/xc7/family.cmake b/xc7/family.cmake index c8e1c57f..4a350690 100644 --- a/xc7/family.cmake +++ b/xc7/family.cmake @@ -1,7 +1,7 @@ include_directories(/opt/torc/src) #include_directories(torc/externals/zlib) -find_package(Boost REQUIRED COMPONENTS serialization ${boost_libs}) +find_package(Boost REQUIRED COMPONENTS serialization iostreams ${boost_libs}) target_link_libraries( nextpnr-${family}