Start adding infrastructure for reading bitstream
This commit is contained in:
parent
7f98c33d6b
commit
de2d551035
@ -148,4 +148,12 @@ void GateMateImpl::write_bitstream(const std::string &device, const std::string
|
|||||||
be.write_bitstream();
|
be.write_bitstream();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GateMateImpl::read_bitstream(const std::string &device, const std::string &filename)
|
||||||
|
{
|
||||||
|
std::ifstream in(filename);
|
||||||
|
if (!in)
|
||||||
|
log_error("failed to open file %s for reading (%s)\n", filename.c_str(), strerror(errno));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_END
|
NEXTPNR_NAMESPACE_END
|
||||||
|
@ -56,6 +56,15 @@ void GateMateImpl::postRoute()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GateMateImpl::setupArchContext()
|
||||||
|
{
|
||||||
|
const ArchArgs &args = ctx->args;
|
||||||
|
if (args.options.count("read")) {
|
||||||
|
if (!read_bitstream(args.device, args.options.at("read")))
|
||||||
|
log_error("Loading bitstream failed.\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct GateMateArch : HimbaechelArch
|
struct GateMateArch : HimbaechelArch
|
||||||
{
|
{
|
||||||
GateMateArch() : HimbaechelArch("gatemate") {};
|
GateMateArch() : HimbaechelArch("gatemate") {};
|
||||||
|
@ -36,6 +36,7 @@ struct GateMateImpl : HimbaechelAPI
|
|||||||
void init_database(Arch *arch) override;
|
void init_database(Arch *arch) override;
|
||||||
|
|
||||||
void init(Context *ctx) override;
|
void init(Context *ctx) override;
|
||||||
|
void setupArchContext() override;
|
||||||
|
|
||||||
void pack() override;
|
void pack() override;
|
||||||
|
|
||||||
@ -46,6 +47,8 @@ struct GateMateImpl : HimbaechelAPI
|
|||||||
void drawBel(std::vector<GraphicElement> &g, GraphicElement::style_t style, IdString bel_type, Loc loc) override;
|
void drawBel(std::vector<GraphicElement> &g, GraphicElement::style_t style, IdString bel_type, Loc loc) override;
|
||||||
|
|
||||||
void write_bitstream(const std::string &device, const std::string &filename);
|
void write_bitstream(const std::string &device, const std::string &filename);
|
||||||
|
bool read_bitstream(const std::string &device, const std::string &filename);
|
||||||
|
|
||||||
void parse_ccf(const std::string &filename);
|
void parse_ccf(const std::string &filename);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user