mirror of https://github.com/YosysHQ/yosys.git
More win32/abc fixes
This commit is contained in:
parent
2fdb3a4a91
commit
0913e968f5
8
Makefile
8
Makefile
|
@ -95,7 +95,7 @@ CXXFLAGS := $(filter-out -fPIC,$(CXXFLAGS))
|
|||
LDFLAGS := $(filter-out -rdynamic,$(LDFLAGS)) -s
|
||||
LDLIBS := $(filter-out -lrt,$(LDLIBS))
|
||||
ABCMKARGS += ARCHFLAGS="-DLIN -DSIZEOF_VOID_P=4 -DSIZEOF_LONG=4 -DSIZEOF_INT=4 -DWIN32_NO_DLL -x c++ -fpermissive -w -pthread"
|
||||
ABCMKARGS += LIBS="lib/x86/pthreadVC2.lib" READLINE=0
|
||||
ABCMKARGS += LIBS="lib/x86/pthreadVC2.lib -s" READLINE=0
|
||||
EXE = .exe
|
||||
|
||||
else ifneq ($(CONFIG),none)
|
||||
|
@ -220,7 +220,7 @@ yosys$(EXE): $(OBJS)
|
|||
|
||||
kernel/version_$(GIT_REV).cc: Makefile
|
||||
$(P) rm -f kernel/version_*.o kernel/version_*.d kernel/version_*.cc
|
||||
$(Q) echo "namespace Yosys { extern const char *yosys_version_str; const char *yosys_version_str=\"Yosys $(YOSYS_VER) (git sha1 $(GIT_REV), $(CXX) ` \
|
||||
$(Q) echo "namespace Yosys { extern const char *yosys_version_str; const char *yosys_version_str=\"Yosys $(YOSYS_VER) (git sha1 $(GIT_REV), $(notdir $(CXX)) ` \
|
||||
$(CXX) --version | tr ' ()' '\n' | grep '^[0-9]' | head -n1` $(filter -f% -m% -O% -DNDEBUG,$(CXXFLAGS)))\"; }" > kernel/version_$(GIT_REV).cc
|
||||
|
||||
yosys-config: yosys-config.in
|
||||
|
@ -315,8 +315,12 @@ qtcreator:
|
|||
ifeq ($(CONFIG),mxe)
|
||||
dist: $(TARGETS) $(EXTRA_TARGETS)
|
||||
rm -rf yosys-win32-$(YOSYS_VER)
|
||||
rm -rf yosys-win32-$(YOSYS_VER).zip
|
||||
mkdir -p yosys-win32-$(YOSYS_VER)
|
||||
cp -r yosys.exe share/ yosys-win32-$(YOSYS_VER)/
|
||||
ifeq ($(ENABLE_ABC),1)
|
||||
cp -r yosys-abc.exe abc/lib/x86/pthreadVC2.dll yosys-win32-$(YOSYS_VER)/
|
||||
endif
|
||||
echo -en 'This is Yosys $(YOSYS_VER) for Win32.\r\n' > yosys-win32-$(YOSYS_VER)/readme.txt
|
||||
echo -en 'Documentation at http://www.clifford.at/yosys/.\r\n' >> yosys-win32-$(YOSYS_VER)/readme.txt
|
||||
zip -r yosys-win32-$(YOSYS_VER).zip yosys-win32-$(YOSYS_VER)/
|
||||
|
|
|
@ -473,12 +473,14 @@ std::string proc_self_dirname()
|
|||
#elif defined(_WIN32)
|
||||
std::string proc_self_dirname()
|
||||
{
|
||||
char path[MAX_PATH+1];
|
||||
if (!GetModuleFileName(0, path, MAX_PATH+1))
|
||||
char longpath[MAX_PATH+1], shortpath[MAX_PATH+1];
|
||||
if (!GetModuleFileName(0, longpath, MAX_PATH+1))
|
||||
log_error("GetModuleFileName() failed.\n");
|
||||
for (int i = strlen(path)-1; i >= 0 && path[i] != '/' && path[i] != '\\' ; i--)
|
||||
path[i] = 0;
|
||||
return std::string(path);
|
||||
if (!GetShortPathName(longpath, shortpath, MAX_PATH+1))
|
||||
log_error("GetShortPathName() failed.\n");
|
||||
for (int i = strlen(shortpath)-1; i >= 0 && shortpath[i] != '/' && shortpath[i] != '\\' ; i--)
|
||||
shortpath[i] = 0;
|
||||
return std::string(shortpath);
|
||||
}
|
||||
#elif defined(EMSCRIPTEN)
|
||||
std::string proc_self_dirname()
|
||||
|
|
|
@ -559,39 +559,49 @@ void abc_module(RTLIL::Design *design, RTLIL::Module *current_module, std::strin
|
|||
tempdir_name = make_temp_dir(tempdir_name);
|
||||
log_header("Extracting gate netlist of module `%s' to `%s/input.blif'..\n", module->name.c_str(), tempdir_name.c_str());
|
||||
|
||||
std::string abc_command;
|
||||
std::string abc_script = stringf("read_blif %s/input.blif; ", tempdir_name.c_str());
|
||||
|
||||
if (!liberty_file.empty()) {
|
||||
abc_script += stringf("read_lib -w %s; ", liberty_file.c_str());
|
||||
if (!constr_file.empty())
|
||||
abc_script += stringf("read_constr -v %s; ", constr_file.c_str());
|
||||
} else
|
||||
if (lut_mode)
|
||||
abc_script += stringf("read_lut %s/lutdefs.txt; ", tempdir_name.c_str());
|
||||
else
|
||||
abc_script += stringf("read_library %s/stdcells.genlib; ", tempdir_name.c_str());
|
||||
|
||||
if (!script_file.empty()) {
|
||||
if (script_file[0] == '+') {
|
||||
for (size_t i = 1; i < script_file.size(); i++)
|
||||
if (script_file[i] == '\'')
|
||||
abc_command += "'\\''";
|
||||
abc_script += "'\\''";
|
||||
else if (script_file[i] == ',')
|
||||
abc_command += " ";
|
||||
abc_script += " ";
|
||||
else
|
||||
abc_command += script_file[i];
|
||||
abc_script += script_file[i];
|
||||
} else
|
||||
abc_command = stringf("source %s", script_file.c_str());
|
||||
abc_script += stringf("source %s", script_file.c_str());
|
||||
} else if (lut_mode)
|
||||
abc_command = fast_mode ? ABC_FAST_COMMAND_LUT : ABC_COMMAND_LUT;
|
||||
abc_script += fast_mode ? ABC_FAST_COMMAND_LUT : ABC_COMMAND_LUT;
|
||||
else if (!liberty_file.empty())
|
||||
abc_command = constr_file.empty() ? (fast_mode ? ABC_FAST_COMMAND_LIB : ABC_COMMAND_LIB) : (fast_mode ? ABC_FAST_COMMAND_CTR : ABC_COMMAND_CTR);
|
||||
abc_script += constr_file.empty() ? (fast_mode ? ABC_FAST_COMMAND_LIB : ABC_COMMAND_LIB) : (fast_mode ? ABC_FAST_COMMAND_CTR : ABC_COMMAND_CTR);
|
||||
else
|
||||
abc_command = fast_mode ? ABC_FAST_COMMAND_DFL : ABC_COMMAND_DFL;
|
||||
abc_script += fast_mode ? ABC_FAST_COMMAND_DFL : ABC_COMMAND_DFL;
|
||||
|
||||
for (size_t pos = abc_command.find("{D}"); pos != std::string::npos; pos = abc_command.find("{D}", pos))
|
||||
abc_command = abc_command.substr(0, pos) + delay_target + abc_command.substr(pos+3);
|
||||
for (size_t pos = abc_script.find("{D}"); pos != std::string::npos; pos = abc_script.find("{D}", pos))
|
||||
abc_script = abc_script.substr(0, pos) + delay_target + abc_script.substr(pos+3);
|
||||
|
||||
abc_command = add_echos_to_abc_cmd(abc_command);
|
||||
abc_script += stringf("; write_blif %s/output.blif", tempdir_name.c_str());
|
||||
abc_script = add_echos_to_abc_cmd(abc_script);
|
||||
|
||||
for (size_t i = 0; i+1 < abc_script.size(); i++)
|
||||
if (abc_script[i] == ';' && abc_script[i+1] == ' ')
|
||||
abc_script[i+1] = '\n';
|
||||
|
||||
if (abc_command.size() > 128) {
|
||||
for (size_t i = 0; i+1 < abc_command.size(); i++)
|
||||
if (abc_command[i] == ';' && abc_command[i+1] == ' ')
|
||||
abc_command[i+1] = '\n';
|
||||
FILE *f = fopen(stringf("%s/abc.script", tempdir_name.c_str()).c_str(), "wt");
|
||||
fprintf(f, "%s\n", abc_command.c_str());
|
||||
fprintf(f, "%s\n", abc_script.c_str());
|
||||
fclose(f);
|
||||
abc_command = stringf("source %s/abc.script", tempdir_name.c_str());
|
||||
}
|
||||
|
||||
if (clk_str.empty()) {
|
||||
if (clk_str[0] == '!') {
|
||||
|
@ -652,7 +662,7 @@ void abc_module(RTLIL::Design *design, RTLIL::Module *current_module, std::strin
|
|||
handle_loops();
|
||||
|
||||
std::string buffer = stringf("%s/input.blif", tempdir_name.c_str());
|
||||
FILE *f = fopen(buffer.c_str(), "wt");
|
||||
f = fopen(buffer.c_str(), "wt");
|
||||
if (f == NULL)
|
||||
log_error("Opening %s for writing failed: %s\n", buffer.c_str(), strerror(errno));
|
||||
|
||||
|
@ -793,23 +803,8 @@ void abc_module(RTLIL::Design *design, RTLIL::Module *current_module, std::strin
|
|||
fclose(f);
|
||||
}
|
||||
|
||||
buffer = stringf("%s -s -c '", exe_file.c_str());
|
||||
if (!liberty_file.empty()) {
|
||||
buffer += stringf("read_blif %s/input.blif; read_lib -w %s; ",
|
||||
tempdir_name.c_str(), liberty_file.c_str());
|
||||
if (!constr_file.empty())
|
||||
buffer += stringf("read_constr -v %s; ", constr_file.c_str());
|
||||
buffer += abc_command + "; ";
|
||||
} else
|
||||
if (lut_mode)
|
||||
buffer += stringf("read_blif %s/input.blif; read_lut %s/lutdefs.txt; %s; ",
|
||||
tempdir_name.c_str(), tempdir_name.c_str(), abc_command.c_str());
|
||||
else
|
||||
buffer += stringf("read_blif %s/input.blif; read_library %s/stdcells.genlib; %s; ",
|
||||
tempdir_name.c_str(), tempdir_name.c_str(), abc_command.c_str());
|
||||
buffer += stringf("write_blif %s/output.blif' 2>&1", tempdir_name.c_str());
|
||||
|
||||
log("%s\n", buffer.c_str());
|
||||
buffer = stringf("%s -s -f %s/abc.script 2>&1", exe_file.c_str(), tempdir_name.c_str());
|
||||
log("Running ABC command: %s\n", buffer.c_str());
|
||||
|
||||
abc_output_filter filt;
|
||||
int ret = run_command(buffer, std::bind(&abc_output_filter::next_line, filt, std::placeholders::_1));
|
||||
|
|
Loading…
Reference in New Issue