use constant module manager as much as possible in Verilog writer
This commit is contained in:
parent
11775c370b
commit
60f40a9657
|
@ -44,7 +44,7 @@ namespace openfpga {
|
||||||
***************************************************************************************/
|
***************************************************************************************/
|
||||||
static
|
static
|
||||||
void print_verilog_mux_local_decoder_module(std::fstream& fp,
|
void print_verilog_mux_local_decoder_module(std::fstream& fp,
|
||||||
ModuleManager& module_manager,
|
const ModuleManager& module_manager,
|
||||||
const DecoderLibrary& decoder_lib,
|
const DecoderLibrary& decoder_lib,
|
||||||
const DecoderId& decoder) {
|
const DecoderId& decoder) {
|
||||||
/* Get the number of inputs */
|
/* Get the number of inputs */
|
||||||
|
@ -161,7 +161,7 @@ void print_verilog_mux_local_decoder_module(std::fstream& fp,
|
||||||
* before running the back-end flow for FPGA fabric
|
* before running the back-end flow for FPGA fabric
|
||||||
* See more details in the function print_verilog_mux_local_decoder() for more details
|
* See more details in the function print_verilog_mux_local_decoder() for more details
|
||||||
***************************************************************************************/
|
***************************************************************************************/
|
||||||
void print_verilog_submodule_mux_local_decoders(ModuleManager& module_manager,
|
void print_verilog_submodule_mux_local_decoders(const ModuleManager& module_manager,
|
||||||
std::vector<std::string>& netlist_names,
|
std::vector<std::string>& netlist_names,
|
||||||
const MuxLibrary& mux_lib,
|
const MuxLibrary& mux_lib,
|
||||||
const CircuitLibrary& circuit_lib,
|
const CircuitLibrary& circuit_lib,
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
/* begin namespace openfpga */
|
/* begin namespace openfpga */
|
||||||
namespace openfpga {
|
namespace openfpga {
|
||||||
|
|
||||||
void print_verilog_submodule_mux_local_decoders(ModuleManager& module_manager,
|
void print_verilog_submodule_mux_local_decoders(const ModuleManager& module_manager,
|
||||||
std::vector<std::string>& netlist_names,
|
std::vector<std::string>& netlist_names,
|
||||||
const MuxLibrary& mux_lib,
|
const MuxLibrary& mux_lib,
|
||||||
const CircuitLibrary& circuit_lib,
|
const CircuitLibrary& circuit_lib,
|
||||||
|
|
|
@ -142,7 +142,7 @@ void print_verilog_invbuf_body(std::fstream& fp,
|
||||||
* or tapered buffer to a file
|
* or tapered buffer to a file
|
||||||
***********************************************/
|
***********************************************/
|
||||||
static
|
static
|
||||||
void print_verilog_invbuf_module(ModuleManager& module_manager,
|
void print_verilog_invbuf_module(const ModuleManager& module_manager,
|
||||||
std::fstream& fp,
|
std::fstream& fp,
|
||||||
const CircuitLibrary& circuit_lib,
|
const CircuitLibrary& circuit_lib,
|
||||||
const CircuitModelId& circuit_model) {
|
const CircuitModelId& circuit_model) {
|
||||||
|
@ -226,7 +226,7 @@ void print_verilog_invbuf_module(ModuleManager& module_manager,
|
||||||
* either transmission-gate or pass-transistor
|
* either transmission-gate or pass-transistor
|
||||||
***********************************************/
|
***********************************************/
|
||||||
static
|
static
|
||||||
void print_verilog_passgate_module(ModuleManager& module_manager,
|
void print_verilog_passgate_module(const ModuleManager& module_manager,
|
||||||
std::fstream& fp,
|
std::fstream& fp,
|
||||||
const CircuitLibrary& circuit_lib,
|
const CircuitLibrary& circuit_lib,
|
||||||
const CircuitModelId& circuit_model) {
|
const CircuitModelId& circuit_model) {
|
||||||
|
@ -438,7 +438,7 @@ void print_verilog_mux2_gate_body(std::fstream& fp,
|
||||||
* 3. 2-input MUX
|
* 3. 2-input MUX
|
||||||
***********************************************/
|
***********************************************/
|
||||||
static
|
static
|
||||||
void print_verilog_gate_module(ModuleManager& module_manager,
|
void print_verilog_gate_module(const ModuleManager& module_manager,
|
||||||
std::fstream& fp,
|
std::fstream& fp,
|
||||||
const CircuitLibrary& circuit_lib,
|
const CircuitLibrary& circuit_lib,
|
||||||
const CircuitModelId& circuit_model) {
|
const CircuitModelId& circuit_model) {
|
||||||
|
@ -525,7 +525,7 @@ void print_verilog_constant_generator_module(const ModuleManager& module_manager
|
||||||
* include inverters, buffers, transmission-gates,
|
* include inverters, buffers, transmission-gates,
|
||||||
* etc.
|
* etc.
|
||||||
***********************************************/
|
***********************************************/
|
||||||
void print_verilog_submodule_essentials(ModuleManager& module_manager,
|
void print_verilog_submodule_essentials(const ModuleManager& module_manager,
|
||||||
std::vector<std::string>& netlist_names,
|
std::vector<std::string>& netlist_names,
|
||||||
const std::string& verilog_dir,
|
const std::string& verilog_dir,
|
||||||
const std::string& submodule_dir,
|
const std::string& submodule_dir,
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
/* begin namespace openfpga */
|
/* begin namespace openfpga */
|
||||||
namespace openfpga {
|
namespace openfpga {
|
||||||
|
|
||||||
void print_verilog_submodule_essentials(ModuleManager& module_manager,
|
void print_verilog_submodule_essentials(const ModuleManager& module_manager,
|
||||||
std::vector<std::string>& netlist_names,
|
std::vector<std::string>& netlist_names,
|
||||||
const std::string& verilog_dir,
|
const std::string& verilog_dir,
|
||||||
const std::string& submodule_dir,
|
const std::string& submodule_dir,
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace openfpga {
|
||||||
* Print Verilog modules for the Look-Up Tables (LUTs)
|
* Print Verilog modules for the Look-Up Tables (LUTs)
|
||||||
* in the circuit library
|
* in the circuit library
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
void print_verilog_submodule_luts(ModuleManager& module_manager,
|
void print_verilog_submodule_luts(const ModuleManager& module_manager,
|
||||||
std::vector<std::string>& netlist_names,
|
std::vector<std::string>& netlist_names,
|
||||||
const CircuitLibrary& circuit_lib,
|
const CircuitLibrary& circuit_lib,
|
||||||
const std::string& verilog_dir,
|
const std::string& verilog_dir,
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
/* begin namespace openfpga */
|
/* begin namespace openfpga */
|
||||||
namespace openfpga {
|
namespace openfpga {
|
||||||
|
|
||||||
void print_verilog_submodule_luts(ModuleManager& module_manager,
|
void print_verilog_submodule_luts(const ModuleManager& module_manager,
|
||||||
std::vector<std::string>& netlist_names,
|
std::vector<std::string>& netlist_names,
|
||||||
const CircuitLibrary& circuit_lib,
|
const CircuitLibrary& circuit_lib,
|
||||||
const std::string& verilog_dir,
|
const std::string& verilog_dir,
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace openfpga {
|
||||||
* +---------------------+
|
* +---------------------+
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
static
|
static
|
||||||
void print_verilog_mux_memory_module(ModuleManager& module_manager,
|
void print_verilog_mux_memory_module(const ModuleManager& module_manager,
|
||||||
const CircuitLibrary& circuit_lib,
|
const CircuitLibrary& circuit_lib,
|
||||||
std::fstream& fp,
|
std::fstream& fp,
|
||||||
const CircuitModelId& mux_model,
|
const CircuitModelId& mux_model,
|
||||||
|
@ -96,7 +96,7 @@ void print_verilog_mux_memory_module(ModuleManager& module_manager,
|
||||||
* Take another example, the memory circuit can implement the scan-chain or
|
* Take another example, the memory circuit can implement the scan-chain or
|
||||||
* memory-bank organization for the memories.
|
* memory-bank organization for the memories.
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
void print_verilog_submodule_memories(ModuleManager& module_manager,
|
void print_verilog_submodule_memories(const ModuleManager& module_manager,
|
||||||
std::vector<std::string>& netlist_names,
|
std::vector<std::string>& netlist_names,
|
||||||
const MuxLibrary& mux_lib,
|
const MuxLibrary& mux_lib,
|
||||||
const CircuitLibrary& circuit_lib,
|
const CircuitLibrary& circuit_lib,
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
/* begin namespace openfpga */
|
/* begin namespace openfpga */
|
||||||
namespace openfpga {
|
namespace openfpga {
|
||||||
|
|
||||||
void print_verilog_submodule_memories(ModuleManager& module_manager,
|
void print_verilog_submodule_memories(const ModuleManager& module_manager,
|
||||||
std::vector<std::string>& netlist_names,
|
std::vector<std::string>& netlist_names,
|
||||||
const MuxLibrary& mux_lib,
|
const MuxLibrary& mux_lib,
|
||||||
const CircuitLibrary& circuit_lib,
|
const CircuitLibrary& circuit_lib,
|
||||||
|
|
|
@ -42,13 +42,13 @@ void print_verilog_submodule(ModuleManager& module_manager,
|
||||||
* This should be done prior to other steps in this function,
|
* This should be done prior to other steps in this function,
|
||||||
* because they will be instanciated by other primitive modules
|
* because they will be instanciated by other primitive modules
|
||||||
*/
|
*/
|
||||||
add_user_defined_verilog_modules(module_manager, circuit_lib);
|
//add_user_defined_verilog_modules(module_manager, circuit_lib);
|
||||||
|
|
||||||
/* Create a vector to contain all the Verilog netlist names that have been generated in this function */
|
/* Create a vector to contain all the Verilog netlist names that have been generated in this function */
|
||||||
std::vector<std::string> netlist_names;
|
std::vector<std::string> netlist_names;
|
||||||
|
|
||||||
|
|
||||||
print_verilog_submodule_essentials(module_manager,
|
print_verilog_submodule_essentials(const_cast<const ModuleManager&>(module_manager),
|
||||||
netlist_names,
|
netlist_names,
|
||||||
verilog_dir,
|
verilog_dir,
|
||||||
submodule_dir,
|
submodule_dir,
|
||||||
|
@ -58,7 +58,8 @@ void print_verilog_submodule(ModuleManager& module_manager,
|
||||||
/* NOTE: local decoders generation must go before the MUX generation!!!
|
/* NOTE: local decoders generation must go before the MUX generation!!!
|
||||||
* because local decoders modules will be instanciated in the MUX modules
|
* because local decoders modules will be instanciated in the MUX modules
|
||||||
*/
|
*/
|
||||||
print_verilog_submodule_mux_local_decoders(module_manager, netlist_names,
|
print_verilog_submodule_mux_local_decoders(const_cast<const ModuleManager&>(module_manager),
|
||||||
|
netlist_names,
|
||||||
mux_lib, circuit_lib,
|
mux_lib, circuit_lib,
|
||||||
verilog_dir, submodule_dir);
|
verilog_dir, submodule_dir);
|
||||||
print_verilog_submodule_muxes(module_manager, netlist_names, mux_lib, circuit_lib,
|
print_verilog_submodule_muxes(module_manager, netlist_names, mux_lib, circuit_lib,
|
||||||
|
@ -67,23 +68,27 @@ void print_verilog_submodule(ModuleManager& module_manager,
|
||||||
|
|
||||||
|
|
||||||
/* LUTes */
|
/* LUTes */
|
||||||
print_verilog_submodule_luts(module_manager, netlist_names, circuit_lib,
|
print_verilog_submodule_luts(const_cast<const ModuleManager&>(module_manager),
|
||||||
|
netlist_names, circuit_lib,
|
||||||
verilog_dir, submodule_dir,
|
verilog_dir, submodule_dir,
|
||||||
fpga_verilog_opts.explicit_port_mapping());
|
fpga_verilog_opts.explicit_port_mapping());
|
||||||
|
|
||||||
/* Hard wires */
|
/* Hard wires */
|
||||||
print_verilog_submodule_wires(module_manager, netlist_names, circuit_lib,
|
print_verilog_submodule_wires(const_cast<const ModuleManager&>(module_manager),
|
||||||
|
netlist_names, circuit_lib,
|
||||||
verilog_dir, submodule_dir);
|
verilog_dir, submodule_dir);
|
||||||
|
|
||||||
/* 4. Memories */
|
/* 4. Memories */
|
||||||
print_verilog_submodule_memories(module_manager, netlist_names,
|
print_verilog_submodule_memories(const_cast<const ModuleManager&>(module_manager),
|
||||||
|
netlist_names,
|
||||||
mux_lib, circuit_lib,
|
mux_lib, circuit_lib,
|
||||||
verilog_dir, submodule_dir,
|
verilog_dir, submodule_dir,
|
||||||
fpga_verilog_opts.explicit_port_mapping());
|
fpga_verilog_opts.explicit_port_mapping());
|
||||||
|
|
||||||
/* 5. Dump template for all the modules */
|
/* 5. Dump template for all the modules */
|
||||||
if (true == fpga_verilog_opts.print_user_defined_template()) {
|
if (true == fpga_verilog_opts.print_user_defined_template()) {
|
||||||
print_verilog_submodule_templates(module_manager, circuit_lib,
|
print_verilog_submodule_templates(const_cast<const ModuleManager&>(module_manager),
|
||||||
|
circuit_lib,
|
||||||
verilog_dir, submodule_dir);
|
verilog_dir, submodule_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace openfpga {
|
||||||
*
|
*
|
||||||
*******************************************************************/
|
*******************************************************************/
|
||||||
static
|
static
|
||||||
void print_verilog_wire_module(ModuleManager& module_manager,
|
void print_verilog_wire_module(const ModuleManager& module_manager,
|
||||||
const CircuitLibrary& circuit_lib,
|
const CircuitLibrary& circuit_lib,
|
||||||
std::fstream& fp,
|
std::fstream& fp,
|
||||||
const CircuitModelId& wire_model) {
|
const CircuitModelId& wire_model) {
|
||||||
|
@ -92,7 +92,7 @@ void print_verilog_wire_module(ModuleManager& module_manager,
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
* Top-level function to print wire modules
|
* Top-level function to print wire modules
|
||||||
*******************************************************************/
|
*******************************************************************/
|
||||||
void print_verilog_submodule_wires(ModuleManager& module_manager,
|
void print_verilog_submodule_wires(const ModuleManager& module_manager,
|
||||||
std::vector<std::string>& netlist_names,
|
std::vector<std::string>& netlist_names,
|
||||||
const CircuitLibrary& circuit_lib,
|
const CircuitLibrary& circuit_lib,
|
||||||
const std::string& verilog_dir,
|
const std::string& verilog_dir,
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
/* begin namespace openfpga */
|
/* begin namespace openfpga */
|
||||||
namespace openfpga {
|
namespace openfpga {
|
||||||
|
|
||||||
void print_verilog_submodule_wires(ModuleManager& module_manager,
|
void print_verilog_submodule_wires(const ModuleManager& module_manager,
|
||||||
std::vector<std::string>& netlist_names,
|
std::vector<std::string>& netlist_names,
|
||||||
const CircuitLibrary& circuit_lib,
|
const CircuitLibrary& circuit_lib,
|
||||||
const std::string& verilog_dir,
|
const std::string& verilog_dir,
|
||||||
|
|
Loading…
Reference in New Issue