OpenFPGA/openfpga/src/base/openfpga_spice_template.h

49 lines
1.7 KiB
C
Raw Normal View History

#ifndef OPENFPGA_SPICE_TEMPLATE_H
#define OPENFPGA_SPICE_TEMPLATE_H
#include "command.h"
#include "command_context.h"
2023-01-06 19:50:47 -06:00
#include "command_exit_codes.h"
2020-07-05 13:10:12 -05:00
#include "globals.h"
2023-01-06 19:50:47 -06:00
#include "spice_api.h"
#include "vtr_log.h"
#include "vtr_time.h"
2020-07-05 13:10:12 -05:00
/* begin namespace openfpga */
namespace openfpga {
/********************************************************************
* A wrapper function to call the fabric SPICE generator of FPGA-SPICE
*******************************************************************/
template <class T>
int write_fabric_spice_template(T& openfpga_ctx, const Command& cmd,
const CommandContext& cmd_context) {
2020-07-05 13:10:12 -05:00
CommandOptionId opt_output_dir = cmd.option("file");
CommandOptionId opt_explicit_port_mapping =
cmd.option("explicit_port_mapping");
2020-07-05 13:10:12 -05:00
CommandOptionId opt_verbose = cmd.option("verbose");
/* This is an intermediate data structure which is designed to modularize the
* FPGA-SPICE Keep it independent from any other outside data structures
2020-07-05 13:10:12 -05:00
*/
FabricSpiceOption options;
options.set_output_directory(cmd_context.option_value(cmd, opt_output_dir));
options.set_explicit_port_mapping(
cmd_context.option_enable(cmd, opt_explicit_port_mapping));
2020-07-05 13:10:12 -05:00
options.set_verbose_output(cmd_context.option_enable(cmd, opt_verbose));
options.set_compress_routing(openfpga_ctx.flow_manager().compress_routing());
2020-07-05 15:50:29 -05:00
int status = CMD_EXEC_SUCCESS;
status = fpga_fabric_spice(
openfpga_ctx.module_graph(), openfpga_ctx.mutable_spice_netlists(),
openfpga_ctx.arch(), openfpga_ctx.mux_lib(), g_vpr_ctx.device(),
openfpga_ctx.vpr_device_annotation(), openfpga_ctx.device_rr_gsb(),
options);
2020-07-05 13:10:12 -05:00
2020-07-05 15:50:29 -05:00
return status;
}
2020-07-05 13:10:12 -05:00
} /* end namespace openfpga */
#endif