deploy bitstream reader in openfpga shell
This commit is contained in:
parent
1e763515b3
commit
d526f08782
|
@ -12,8 +12,11 @@
|
||||||
#include "openfpga_digest.h"
|
#include "openfpga_digest.h"
|
||||||
#include "openfpga_reserved_words.h"
|
#include "openfpga_reserved_words.h"
|
||||||
|
|
||||||
#include "build_device_bitstream.h"
|
/* Headers from fpgabitstream library */
|
||||||
|
#include "read_xml_arch_bitstream.h"
|
||||||
#include "arch_bitstream_writer.h"
|
#include "arch_bitstream_writer.h"
|
||||||
|
|
||||||
|
#include "build_device_bitstream.h"
|
||||||
#include "fabric_bitstream_writer.h"
|
#include "fabric_bitstream_writer.h"
|
||||||
#include "build_fabric_bitstream.h"
|
#include "build_fabric_bitstream.h"
|
||||||
#include "openfpga_bitstream.h"
|
#include "openfpga_bitstream.h"
|
||||||
|
@ -31,21 +34,26 @@ int fpga_bitstream(OpenfpgaContext& openfpga_ctx,
|
||||||
const Command& cmd, const CommandContext& cmd_context) {
|
const Command& cmd, const CommandContext& cmd_context) {
|
||||||
|
|
||||||
CommandOptionId opt_verbose = cmd.option("verbose");
|
CommandOptionId opt_verbose = cmd.option("verbose");
|
||||||
CommandOptionId opt_file = cmd.option("file");
|
CommandOptionId opt_write_file = cmd.option("write_file");
|
||||||
|
CommandOptionId opt_read_file = cmd.option("read_file");
|
||||||
|
|
||||||
openfpga_ctx.mutable_bitstream_manager() = build_device_bitstream(g_vpr_ctx,
|
if (true == cmd_context.option_enable(cmd, opt_read_file)) {
|
||||||
openfpga_ctx,
|
openfpga_ctx.mutable_bitstream_manager() = read_xml_architecture_bitstream(cmd_context.option_value(cmd, opt_write_file).c_str());
|
||||||
cmd_context.option_enable(cmd, opt_verbose));
|
} else {
|
||||||
|
openfpga_ctx.mutable_bitstream_manager() = build_device_bitstream(g_vpr_ctx,
|
||||||
|
openfpga_ctx,
|
||||||
|
cmd_context.option_enable(cmd, opt_verbose));
|
||||||
|
}
|
||||||
|
|
||||||
if (true == cmd_context.option_enable(cmd, opt_file)) {
|
if (true == cmd_context.option_enable(cmd, opt_write_file)) {
|
||||||
std::string src_dir_path = find_path_dir_name(cmd_context.option_value(cmd, opt_file));
|
std::string src_dir_path = find_path_dir_name(cmd_context.option_value(cmd, opt_write_file));
|
||||||
|
|
||||||
/* Create directories */
|
/* Create directories */
|
||||||
create_directory(src_dir_path);
|
create_directory(src_dir_path);
|
||||||
|
|
||||||
write_arch_independent_bitstream_to_xml_file(openfpga_ctx.bitstream_manager(),
|
write_arch_independent_bitstream_to_xml_file(openfpga_ctx.bitstream_manager(),
|
||||||
std::string(FPGA_TOP_MODULE_NAME),
|
std::string(FPGA_TOP_MODULE_NAME),
|
||||||
cmd_context.option_value(cmd, opt_file));
|
cmd_context.option_value(cmd, opt_write_file));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: should identify the error code from internal function execution */
|
/* TODO: should identify the error code from internal function execution */
|
||||||
|
|
|
@ -46,10 +46,14 @@ ShellCommandId add_openfpga_arch_bitstream_command(openfpga::Shell<OpenfpgaConte
|
||||||
const std::vector<ShellCommandId>& dependent_cmds) {
|
const std::vector<ShellCommandId>& dependent_cmds) {
|
||||||
Command shell_cmd("build_architecture_bitstream");
|
Command shell_cmd("build_architecture_bitstream");
|
||||||
|
|
||||||
/* Add an option '--file' in short '-f'*/
|
/* Add an option '--write_file' */
|
||||||
CommandOptionId opt_file = shell_cmd.add_option("file", true, "file path to output the bitstream database");
|
CommandOptionId opt_write_file = shell_cmd.add_option("write_file", false, "file path to output the bitstream database");
|
||||||
shell_cmd.set_option_short_name(opt_file, "f");
|
shell_cmd.set_option_require_value(opt_write_file, openfpga::OPT_STRING);
|
||||||
shell_cmd.set_option_require_value(opt_file, openfpga::OPT_STRING);
|
|
||||||
|
/* Add an option '--read_file' */
|
||||||
|
CommandOptionId opt_read_file = shell_cmd.add_option("read_file", false, "file path to read the bitstream database");
|
||||||
|
shell_cmd.set_option_require_value(opt_read_file, openfpga::OPT_STRING);
|
||||||
|
|
||||||
|
|
||||||
/* Add an option '--verbose' */
|
/* Add an option '--verbose' */
|
||||||
shell_cmd.add_option("verbose", false, "Enable verbose output");
|
shell_cmd.add_option("verbose", false, "Enable verbose output");
|
||||||
|
|
|
@ -37,7 +37,7 @@ repack #--verbose
|
||||||
|
|
||||||
# Build the bitstream
|
# Build the bitstream
|
||||||
# - Output the fabric-independent bitstream to a file
|
# - Output the fabric-independent bitstream to a file
|
||||||
build_architecture_bitstream --verbose --file fabric_indepenent_bitstream.xml
|
build_architecture_bitstream --verbose --write_file fabric_indepenent_bitstream.xml
|
||||||
|
|
||||||
# Build fabric-dependent bitstream
|
# Build fabric-dependent bitstream
|
||||||
build_fabric_bitstream --verbose
|
build_fabric_bitstream --verbose
|
||||||
|
|
|
@ -37,7 +37,7 @@ repack #--verbose
|
||||||
|
|
||||||
# Build the bitstream
|
# Build the bitstream
|
||||||
# - Output the fabric-independent bitstream to a file
|
# - Output the fabric-independent bitstream to a file
|
||||||
build_architecture_bitstream --verbose --file fabric_indepenent_bitstream.xml
|
build_architecture_bitstream --verbose --write_file fabric_indepenent_bitstream.xml
|
||||||
|
|
||||||
# Build fabric-dependent bitstream
|
# Build fabric-dependent bitstream
|
||||||
build_fabric_bitstream --verbose
|
build_fabric_bitstream --verbose
|
||||||
|
|
|
@ -37,7 +37,7 @@ repack #--verbose
|
||||||
|
|
||||||
# Build the bitstream
|
# Build the bitstream
|
||||||
# - Output the fabric-independent bitstream to a file
|
# - Output the fabric-independent bitstream to a file
|
||||||
build_architecture_bitstream --verbose --file fabric_indepenent_bitstream.xml
|
build_architecture_bitstream --verbose --write_file fabric_indepenent_bitstream.xml
|
||||||
|
|
||||||
# Build fabric-dependent bitstream
|
# Build fabric-dependent bitstream
|
||||||
build_fabric_bitstream --verbose
|
build_fabric_bitstream --verbose
|
||||||
|
|
|
@ -37,7 +37,7 @@ repack #--verbose
|
||||||
|
|
||||||
# Build the bitstream
|
# Build the bitstream
|
||||||
# - Output the fabric-independent bitstream to a file
|
# - Output the fabric-independent bitstream to a file
|
||||||
build_architecture_bitstream --verbose --file fabric_indepenent_bitstream.xml
|
build_architecture_bitstream --verbose --write_file fabric_indepenent_bitstream.xml
|
||||||
|
|
||||||
# Build fabric-dependent bitstream
|
# Build fabric-dependent bitstream
|
||||||
build_fabric_bitstream --verbose
|
build_fabric_bitstream --verbose
|
||||||
|
|
|
@ -37,7 +37,7 @@ repack #--verbose
|
||||||
|
|
||||||
# Build the bitstream
|
# Build the bitstream
|
||||||
# - Output the fabric-independent bitstream to a file
|
# - Output the fabric-independent bitstream to a file
|
||||||
build_architecture_bitstream --verbose --file fabric_indepenent_bitstream.xml
|
build_architecture_bitstream --verbose --write_file fabric_indepenent_bitstream.xml
|
||||||
|
|
||||||
# Build fabric-dependent bitstream
|
# Build fabric-dependent bitstream
|
||||||
build_fabric_bitstream --verbose
|
build_fabric_bitstream --verbose
|
||||||
|
|
|
@ -37,7 +37,7 @@ repack #--verbose
|
||||||
|
|
||||||
# Build the bitstream
|
# Build the bitstream
|
||||||
# - Output the fabric-independent bitstream to a file
|
# - Output the fabric-independent bitstream to a file
|
||||||
build_architecture_bitstream --verbose --file fabric_indepenent_bitstream.xml
|
build_architecture_bitstream --verbose --write_file fabric_indepenent_bitstream.xml
|
||||||
|
|
||||||
# Build fabric-dependent bitstream
|
# Build fabric-dependent bitstream
|
||||||
build_fabric_bitstream --verbose
|
build_fabric_bitstream --verbose
|
||||||
|
|
|
@ -40,7 +40,7 @@ repack #--verbose
|
||||||
|
|
||||||
# Build the bitstream
|
# Build the bitstream
|
||||||
# - Output the fabric-independent bitstream to a file
|
# - Output the fabric-independent bitstream to a file
|
||||||
build_architecture_bitstream --verbose --file fabric_indepenent_bitstream.xml
|
build_architecture_bitstream --verbose --write_file fabric_indepenent_bitstream.xml
|
||||||
|
|
||||||
# Build fabric-dependent bitstream
|
# Build fabric-dependent bitstream
|
||||||
build_fabric_bitstream --verbose
|
build_fabric_bitstream --verbose
|
||||||
|
|
|
@ -40,7 +40,7 @@ repack #--verbose
|
||||||
|
|
||||||
# Build the bitstream
|
# Build the bitstream
|
||||||
# - Output the fabric-independent bitstream to a file
|
# - Output the fabric-independent bitstream to a file
|
||||||
build_architecture_bitstream --verbose --file fabric_indepenent_bitstream.xml
|
build_architecture_bitstream --verbose --write_file fabric_indepenent_bitstream.xml
|
||||||
|
|
||||||
# Build fabric-dependent bitstream
|
# Build fabric-dependent bitstream
|
||||||
build_fabric_bitstream --verbose
|
build_fabric_bitstream --verbose
|
||||||
|
|
|
@ -37,7 +37,7 @@ repack #--verbose
|
||||||
|
|
||||||
# Build the bitstream
|
# Build the bitstream
|
||||||
# - Output the fabric-independent bitstream to a file
|
# - Output the fabric-independent bitstream to a file
|
||||||
build_architecture_bitstream --verbose --file fabric_indepenent_bitstream.xml
|
build_architecture_bitstream --verbose --write_file fabric_indepenent_bitstream.xml
|
||||||
|
|
||||||
# Build fabric-dependent bitstream
|
# Build fabric-dependent bitstream
|
||||||
build_fabric_bitstream --verbose
|
build_fabric_bitstream --verbose
|
||||||
|
|
|
@ -37,7 +37,7 @@ repack #--verbose
|
||||||
|
|
||||||
# Build the bitstream
|
# Build the bitstream
|
||||||
# - Output the fabric-independent bitstream to a file
|
# - Output the fabric-independent bitstream to a file
|
||||||
build_architecture_bitstream --verbose --file fabric_indepenent_bitstream.xml
|
build_architecture_bitstream --verbose --write_file fabric_indepenent_bitstream.xml
|
||||||
|
|
||||||
# Build fabric-dependent bitstream
|
# Build fabric-dependent bitstream
|
||||||
build_fabric_bitstream --verbose
|
build_fabric_bitstream --verbose
|
||||||
|
|
|
@ -37,7 +37,7 @@ repack #--verbose
|
||||||
|
|
||||||
# Build the bitstream
|
# Build the bitstream
|
||||||
# - Output the fabric-independent bitstream to a file
|
# - Output the fabric-independent bitstream to a file
|
||||||
build_architecture_bitstream --verbose --file fabric_indepenent_bitstream.xml
|
build_architecture_bitstream --verbose --write_file fabric_indepenent_bitstream.xml
|
||||||
|
|
||||||
# Build fabric-dependent bitstream
|
# Build fabric-dependent bitstream
|
||||||
build_fabric_bitstream --verbose
|
build_fabric_bitstream --verbose
|
||||||
|
|
|
@ -37,7 +37,7 @@ repack #--verbose
|
||||||
|
|
||||||
# Build the bitstream
|
# Build the bitstream
|
||||||
# - Output the fabric-independent bitstream to a file
|
# - Output the fabric-independent bitstream to a file
|
||||||
build_architecture_bitstream --verbose --file fabric_indepenent_bitstream.xml
|
build_architecture_bitstream --verbose --write_file fabric_indepenent_bitstream.xml
|
||||||
|
|
||||||
# Build fabric-dependent bitstream
|
# Build fabric-dependent bitstream
|
||||||
build_fabric_bitstream --verbose
|
build_fabric_bitstream --verbose
|
||||||
|
|
Loading…
Reference in New Issue