2023-01-06 19:23:01 -06:00
|
|
|
#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
|
|
|
|
*******************************************************************/
|
2023-01-06 19:23:01 -06:00
|
|
|
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");
|
2022-10-06 19:08:50 -05:00
|
|
|
CommandOptionId opt_explicit_port_mapping =
|
|
|
|
cmd.option("explicit_port_mapping");
|
2020-07-05 13:10:12 -05:00
|
|
|
CommandOptionId opt_verbose = cmd.option("verbose");
|
|
|
|
|
2022-10-06 19:08:50 -05:00
|
|
|
/* 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));
|
2022-10-06 19:08:50 -05:00
|
|
|
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());
|
2022-10-06 19:08:50 -05:00
|
|
|
|
2020-07-05 15:50:29 -05:00
|
|
|
int status = CMD_EXEC_SUCCESS;
|
2022-10-06 19:08:50 -05:00
|
|
|
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;
|
2022-10-06 19:08:50 -05:00
|
|
|
}
|
2020-07-05 13:10:12 -05:00
|
|
|
|
|
|
|
} /* end namespace openfpga */
|
2023-01-06 19:23:01 -06:00
|
|
|
|
|
|
|
#endif
|