add missing files and try to refactor submodule essential

This commit is contained in:
tangxifan 2019-08-20 16:12:01 -06:00
parent 66a3d97698
commit 60e8d2b29f
8 changed files with 77 additions and 21 deletions

View File

@ -1,5 +0,0 @@
XSym
0006
de6ba653dd63797278d7fa829999bf6c
run003

View File

@ -0,0 +1 @@
run002

View File

@ -228,6 +228,17 @@ char* chomp_file_name_postfix(char* file_name) {
return ret; return ret;
} }
void check_file_handler(std::fstream& fp) {
/* Make sure we have a valid file handler*/
/* Print out debugging information for if the file is not opened/created properly */
if (!fp.is_open() || !fp.good()) {
vpr_printf(TIO_MESSAGE_ERROR,
"(FILE:%s,LINE[%d])Failure in create file!\n",
__FILE__, __LINE__);
exit(1);
}
}
/* Print SRAM bits, typically in a comment line */ /* Print SRAM bits, typically in a comment line */
void fprint_commented_sram_bits(FILE* fp, void fprint_commented_sram_bits(FILE* fp,

View File

@ -1,9 +1,13 @@
#ifndef FPGA_X2P_UTILS_H #ifndef FPGA_X2P_UTILS_H
#define FPGA_X2P_UTILS_H #define FPGA_X2P_UTILS_H
#include <fstream>
#include "my_free_fwd.h" #include "my_free_fwd.h"
#include "rr_blocks_naming.h" #include "rr_blocks_naming.h"
void check_file_handler(std::fstream& fp);
char* my_gettime(); char* my_gettime();
char* format_dir_path(char* dir_path); char* format_dir_path(char* dir_path);

View File

@ -0,0 +1,41 @@
/************************************************
* Header file for verilog_submodule_essential.cpp
* Include function declaration on
* outputting Verilog netlists for essential gates
* which are inverters, buffers, transmission-gates
* logic gates etc.
***********************************************/
#include <fstream>
#include "vtr_assert.h"
/* Device-level header files */
#include "spice_types.h"
/* FPGA-X2P context header files */
#include "fpga_x2p_utils.h"
/* FPGA-Verilog context header files */
#include "verilog_global.h"
#include "verilog_submodule_essential.h"
void dump_verilog_submodule_essentials(const std::string& verilog_dir,
const std::string& submodule_dir,
const CircuitLibrary& circuit_lib) {
std::string verilog_fname = submodule_dir + essentials_verilog_file_name;
std::fstream fp;
/* Create the file stream */
fp.open(verilog_fname, std::fstream::out | std::fstream::trunc);
/* Check if the file stream if valid or not */
check_file_handler(fp);
/* Create file */
vpr_printf(TIO_MESSAGE_INFO,
"Generating Verilog netlist (%s) for essential gates...\n",
__FILE__, __LINE__, essentials_verilog_file_name);
/* Close file handler*/
fp.close();
return;
}

View File

@ -0,0 +1,19 @@
/************************************************
* Header file for verilog_submodule_essential.cpp
* Include function declaration on
* outputting Verilog netlists for essential gates
* which are inverters, buffers, transmission-gates
* logic gates etc.
***********************************************/
#ifndef VERILOG_SUBMODULE_ESSENTIAL_H
#define VERILOG_SUBMODULE_ESSENTIAL_H
#include <string>
#include "circuit_library.h"
void dump_verilog_submodule_essentials(const std::string& verilog_dir,
const std::string& submodule_dir,
const CircuitLibrary& circuit_lib);
#endif

View File

@ -18,10 +18,10 @@
/* FPGA-X2P context header files */ /* FPGA-X2P context header files */
#include "spice_types.h" #include "spice_types.h"
#include "fpga_x2p_naming.h" #include "fpga_x2p_naming.h"
#include "fpga_x2p_utils.h"
/* FPGA-Verilog context header files */ /* FPGA-Verilog context header files */
#include "verilog_global.h" #include "verilog_global.h"
#include "verilog_utils.h"
#include "verilog_writer_utils.h" #include "verilog_writer_utils.h"
#include "verilog_submodule_mux.h" #include "verilog_submodule_mux.h"

View File

@ -144,17 +144,6 @@ void dump_include_user_defined_verilog_netlists(FILE* fp,
return; return;
} }
void check_file_handler(std::fstream& fp) {
/* Make sure we have a valid file handler*/
/* Print out debugging information for if the file is not opened/created properly */
if (!fp.is_open() || !fp.good()) {
vpr_printf(TIO_MESSAGE_ERROR,
"(FILE:%s,LINE[%d])Failure in create file!\n",
__FILE__, __LINE__);
exit(1);
}
}
void dump_verilog_file_header(FILE* fp, void dump_verilog_file_header(FILE* fp,
char* usage) { char* usage) {
if (NULL == fp) { if (NULL == fp) {

View File

@ -1,8 +1,6 @@
#ifndef VERILOG_UTILS_H #ifndef VERILOG_UTILS_H
#define VERILOG_UTILS_H #define VERILOG_UTILS_H
#include <fstream>
void init_list_include_verilog_netlists(t_spice* spice); void init_list_include_verilog_netlists(t_spice* spice);
void init_include_user_defined_verilog_netlists(t_spice spice); void init_include_user_defined_verilog_netlists(t_spice spice);
@ -10,8 +8,6 @@ void init_include_user_defined_verilog_netlists(t_spice spice);
void dump_include_user_defined_verilog_netlists(FILE* fp, void dump_include_user_defined_verilog_netlists(FILE* fp,
t_spice spice); t_spice spice);
void check_file_handler(std::fstream& fp);
void dump_verilog_file_header(FILE* fp, void dump_verilog_file_header(FILE* fp,
char* usage); char* usage);