OpenFPGA/openfpga/src/fpga_spice/spice_submodule.cpp

123 lines
4.0 KiB
C++
Raw Normal View History

2020-07-05 13:10:12 -05:00
/*********************************************************************
* This file includes top-level function to generate SPICE primitive modules
2020-07-05 13:10:12 -05:00
* and print them to files
********************************************************************/
/* Headers from vtrutil library */
#include "vtr_assert.h"
#include "vtr_log.h"
2020-07-05 15:50:29 -05:00
/* Headers from openfpgashell library */
#include "command_exit_codes.h"
#include "spice_transistor_wrapper.h"
2020-07-05 13:10:12 -05:00
#include "spice_essential_gates.h"
#include "spice_mux.h"
2020-09-20 12:58:11 -05:00
#include "spice_lut.h"
#include "spice_memory.h"
2020-07-05 13:10:12 -05:00
#include "spice_constants.h"
#include "spice_submodule.h"
/* begin namespace openfpga */
namespace openfpga {
/*********************************************************************
* Top-level function to generate primitive modules:
* 1. Transistor wrapper
* 2. Logic gates: AND/OR, inverter, buffer and transmission-gate/pass-transistor
2020-09-20 13:18:22 -05:00
* 3. Routing multiplexers
2020-07-05 13:10:12 -05:00
* 4. TODO: Local encoders for routing multiplexers
* 5. Wires
2020-09-20 13:18:22 -05:00
* 6. Configuration memory blocks
2020-07-05 13:10:12 -05:00
********************************************************************/
2020-07-05 15:50:29 -05:00
int print_spice_submodule(NetlistManager& netlist_manager,
const ModuleManager& module_manager,
const Arch& openfpga_arch,
const MuxLibrary& mux_lib,
2020-07-05 15:50:29 -05:00
const std::string& submodule_dir) {
int status = CMD_EXEC_SUCCESS;
/* Transistor wrapper */
2020-07-05 15:50:29 -05:00
status = print_spice_transistor_wrapper(netlist_manager,
openfpga_arch.tech_lib,
2020-07-05 15:50:29 -05:00
submodule_dir);
2020-07-05 13:10:12 -05:00
/* Error out if fatal errors have been reported */
if (CMD_EXEC_SUCCESS != status) {
return CMD_EXEC_FATAL_ERROR;
}
/* Constant modules: VDD and GND */
status = print_spice_supply_wrappers(netlist_manager,
module_manager,
submodule_dir);
/* Error out if fatal errors have been reported */
if (CMD_EXEC_SUCCESS != status) {
return CMD_EXEC_FATAL_ERROR;
}
/* Logic gates:
* - AND/OR,
* - inverter, buffer
* - transmission-gate/pass-transistor
* - wires
*/
status = print_spice_essential_gates(netlist_manager,
module_manager,
openfpga_arch.circuit_lib,
openfpga_arch.tech_lib,
openfpga_arch.circuit_tech_binding,
submodule_dir);
/* Error out if fatal errors have been reported */
if (CMD_EXEC_SUCCESS != status) {
return CMD_EXEC_FATAL_ERROR;
}
2020-09-20 13:18:22 -05:00
/* TODO: local decoders for routing multiplexers */
/* Routing multiplexers */
status = print_spice_submodule_muxes(netlist_manager,
module_manager,
mux_lib,
openfpga_arch.circuit_lib,
submodule_dir);
/* Error out if fatal errors have been reported */
if (CMD_EXEC_SUCCESS != status) {
return CMD_EXEC_FATAL_ERROR;
}
2020-09-20 12:58:11 -05:00
/* Look-Up Tables */
status = print_spice_submodule_luts(netlist_manager,
module_manager,
openfpga_arch.circuit_lib,
submodule_dir);
/* Error out if fatal errors have been reported */
if (CMD_EXEC_SUCCESS != status) {
return CMD_EXEC_FATAL_ERROR;
}
/* Memories */
status = print_spice_submodule_memories(netlist_manager,
module_manager,
mux_lib,
openfpga_arch.circuit_lib,
submodule_dir);
/* Error out if fatal errors have been reported */
if (CMD_EXEC_SUCCESS != status) {
return CMD_EXEC_FATAL_ERROR;
}
2020-09-20 13:18:22 -05:00
/* TODO: architecture decoders */
2020-07-05 15:50:29 -05:00
return status;
2020-07-05 13:10:12 -05:00
}
} /* end namespace openfpga */