Gzip the torc_info data
This commit is contained in:
parent
440802bf9d
commit
212b03999b
19
xc7/arch.cc
19
xc7/arch.cc
@ -33,13 +33,15 @@
|
|||||||
#include <boost/serialization/unordered_map.hpp>
|
#include <boost/serialization/unordered_map.hpp>
|
||||||
#include <boost/archive/binary_iarchive.hpp>
|
#include <boost/archive/binary_iarchive.hpp>
|
||||||
#include <boost/archive/binary_oarchive.hpp>
|
#include <boost/archive/binary_oarchive.hpp>
|
||||||
|
#include <boost/iostreams/filter/zlib.hpp>
|
||||||
|
#include <boost/iostreams/filtering_streambuf.hpp>
|
||||||
struct nextpnr_binary_iarchive : public boost::archive::binary_iarchive {
|
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;
|
NEXTPNR_NAMESPACE::BaseCtx *ctx;
|
||||||
std::string inDeviceName, inPackageName;
|
std::string inDeviceName, inPackageName;
|
||||||
};
|
};
|
||||||
struct nextpnr_binary_oarchive : public boost::archive::binary_oarchive {
|
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;
|
NEXTPNR_NAMESPACE::BaseCtx *ctx;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -312,9 +314,11 @@ Arch::Arch(ArchArgs args) : args(args)
|
|||||||
#ifdef TORC_INFO_DB
|
#ifdef TORC_INFO_DB
|
||||||
std::ifstream ifs(TORC_INFO_DB, std::ios::binary);
|
std::ifstream ifs(TORC_INFO_DB, std::ios::binary);
|
||||||
if (ifs) {
|
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;
|
ia >> torc_info;
|
||||||
std::cout << ifs.tellg() << std::endl;
|
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
@ -322,10 +326,11 @@ Arch::Arch(ArchArgs args) : args(args)
|
|||||||
#ifdef TORC_INFO_DB
|
#ifdef TORC_INFO_DB
|
||||||
std::ofstream ofs(TORC_INFO_DB, std::ios::binary);
|
std::ofstream ofs(TORC_INFO_DB, std::ios::binary);
|
||||||
if (ofs) {
|
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;
|
oa << torc_info;
|
||||||
ofs.flush();
|
|
||||||
std::cout << ofs.tellp() << std::endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
include_directories(/opt/torc/src)
|
include_directories(/opt/torc/src)
|
||||||
#include_directories(torc/externals/zlib)
|
#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(
|
target_link_libraries(
|
||||||
nextpnr-${family}
|
nextpnr-${family}
|
||||||
|
Loading…
Reference in New Issue
Block a user