diff options
-rw-r--r-- | Makefile | 8 | ||||
-rw-r--r-- | kernel/yosys.cc | 50 | ||||
-rw-r--r-- | misc/create_vcxsrc.sh | 23 | ||||
-rw-r--r-- | passes/abc/abc.cc | 5 | ||||
-rw-r--r-- | passes/tests/test_cell.cc | 2 |
5 files changed, 66 insertions, 22 deletions
@@ -325,11 +325,12 @@ endif echo -en 'Documentation at http://www.clifford.at/yosys/.\r\n' >> yosys-win32-mxebin-$(YOSYS_VER)/readme.txt sed -e 's,^[^ ]*:,,; s, ,\n,g; s, *\\,,; s,/[^/]*/\.\./,/,g; s,'"$$PWD/"',,' \ $(addsuffix .d,$(basename $(OBJS))) | sort -u | grep '^[^/]' | grep -v kernel/version_ > srcfiles.txt - bash misc/create_vcxsrc.sh yosys-win32-vcxsrc-$(YOSYS_VER) - zip yosys-win32-vcxsrc-$(YOSYS_VER)/genfiles.zip $(GENFILES) + bash misc/create_vcxsrc.sh yosys-win32-vcxsrc $(YOSYS_VER) $(GIT_REV) + echo "namespace Yosys { extern const char *yosys_version_str; const char *yosys_version_str=\"Yosys (Version Information Unavailable)\"; }" > kernel/version.cc + zip yosys-win32-vcxsrc-$(YOSYS_VER)/genfiles.zip $(GENFILES) kernel/version.cc zip -r yosys-win32-mxebin-$(YOSYS_VER).zip yosys-win32-mxebin-$(YOSYS_VER)/ zip -r yosys-win32-vcxsrc-$(YOSYS_VER).zip yosys-win32-vcxsrc-$(YOSYS_VER)/ - rm -f srcfiles.txt + rm -f srcfiles.txt kernel/version.cc endif config-clean: clean @@ -355,6 +356,7 @@ config-mxe: clean echo 'CONFIG := mxe' > Makefile.conf echo 'ENABLE_TCL := 0' >> Makefile.conf echo 'ENABLE_PLUGINS := 0' >> Makefile.conf + echo 'ENABLE_READLINE := 0' >> Makefile.conf config-gprof: clean echo 'CONFIG := gcc' > Makefile.conf diff --git a/kernel/yosys.cc b/kernel/yosys.cc index e9b113dd2..ad0aa5a6d 100644 --- a/kernel/yosys.cc +++ b/kernel/yosys.cc @@ -48,10 +48,6 @@ YOSYS_NAMESPACE_BEGIN -#if defined(_WIN32) && !defined(__MINGW32__) -const char *yosys_version_str = "Yosys for Windows (Version Information Unavailable)"; -#endif - int autoidx = 1; RTLIL::Design *yosys_design = NULL; @@ -224,8 +220,10 @@ std::string make_temp_file(std::string template_str) log_error("GetTempPath() failed.\n"); if (!GetShortPathName(longpath, shortpath, MAX_PATH + 1)) log_error("GetShortPathName() failed.\n"); - log_assert(sizeof(TCHAR) == sizeof(char)); - template_str = stringf("%s\\%s", shortpath, template_str.c_str() + 5); + std::string path; + for (int i = 0; shortpath[i]; i++) + path += char(shortpath[i]); + template_str = stringf("%s\\%s", path.c_str(), template_str.c_str() + 5); } size_t pos = template_str.rfind("XXXXXX"); @@ -363,11 +361,19 @@ void yosys_shutdown() RTLIL::IdString new_id(std::string file, int line, std::string func) { - std::string str = "$auto$"; +#ifdef _WIN32 + size_t pos = file.find_last_of("/\\"); +#else size_t pos = file.find_last_of('/'); - str += pos != std::string::npos ? file.substr(pos+1) : file; - str += stringf(":%d:%s$%d", line, func.c_str(), autoidx++); - return str; +#endif + if (pos != std::string::npos) + file = file.substr(pos+1); + + pos = func.find_last_of(':'); + if (pos != std::string::npos) + func = func.substr(pos+1); + + return stringf("$auto$%s:%d:%s$%d", file.c_str(), line, func.c_str(), autoidx++); } RTLIL::Design *yosys_get_design() @@ -504,8 +510,10 @@ std::string proc_self_dirname() i++; while (i > 0 && shortpath[i-1] != '/' && shortpath[i-1] != '\\') shortpath[--i] = 0; - log_assert(sizeof(TCHAR) == sizeof(char)); - return std::string((char*)shortpath); + std::string path; + for (i = 0; shortpath[i]; i++) + path += char(shortpath[i]); + return path; } #elif defined(EMSCRIPTEN) std::string proc_self_dirname() @@ -519,12 +527,21 @@ std::string proc_self_dirname() std::string proc_share_dirname() { std::string proc_self_path = proc_self_dirname(); +#ifdef _WIN32 + std::string proc_share_path = proc_self_path + "share\\"; + if (check_file_exists(proc_share_path, true)) + return proc_share_path; + proc_share_path = proc_self_path + "..\\share\\"; + if (check_file_exists(proc_share_path, true)) + return proc_share_path; +#else std::string proc_share_path = proc_self_path + "share/"; if (check_file_exists(proc_share_path, true)) return proc_share_path; proc_share_path = proc_self_path + "../share/yosys/"; if (check_file_exists(proc_share_path, true)) return proc_share_path; +#endif log_error("proc_share_dirname: unable to determine share/ directory!\n"); } @@ -792,11 +809,16 @@ void shell(RTLIL::Design *design) char *command = NULL; #ifdef YOSYS_ENABLE_READLINE while ((command = readline(create_prompt(design, recursion_counter))) != NULL) + { #else char command_buffer[4096]; - while ((command = fgets(command_buffer, 4096, stdin)) != NULL) -#endif + while (1) { + fputs(create_prompt(design, recursion_counter), stdout); + fflush(stdout); + if ((command = fgets(command_buffer, 4096, stdin)) == NULL) + break; +#endif if (command[strspn(command, " \t\r\n")] == 0) continue; #ifdef YOSYS_ENABLE_READLINE diff --git a/misc/create_vcxsrc.sh b/misc/create_vcxsrc.sh index eb2239303..215e27c53 100644 --- a/misc/create_vcxsrc.sh +++ b/misc/create_vcxsrc.sh @@ -1,7 +1,9 @@ #!/bin/bash set -ex -vcxsrc="$1" +vcxsrc="$1-$2" +yosysver="$2" +gitsha="$3" rm -rf YosysVS-Tpl-v1.zip YosysVS wget http://www.clifford.at/yosys/nogit/YosysVS-Tpl-v1.zip @@ -15,6 +17,7 @@ mv YosysVS "$vcxsrc" head -n$n "$vcxsrc"/YosysVS/YosysVS.vcxproj egrep '\.(h|hh|hpp|inc)$' srcfiles.txt | sed 's,.*,<ClInclude Include="../yosys/&" />,' egrep -v '\.(h|hh|hpp|inc)$' srcfiles.txt | sed 's,.*,<ClCompile Include="../yosys/&" />,' + echo '<ClCompile Include="../yosys/kernel/version.cc" />' tail -n +$((n+1)) "$vcxsrc"/YosysVS/YosysVS.vcxproj } > "$vcxsrc"/YosysVS/YosysVS.vcxproj.new @@ -22,10 +25,13 @@ mv "$vcxsrc"/YosysVS/YosysVS.vcxproj.new "$vcxsrc"/YosysVS/YosysVS.vcxproj mkdir -p "$vcxsrc"/yosys tar -cf - -T srcfiles.txt | tar -xf - -C "$vcxsrc"/yosys +cp -r share "$vcxsrc"/ -cat > "$vcxsrc"/readme-git.txt << EOT -Using a git working copy for the yosys source code: +echo "namespace Yosys { extern const char *yosys_version_str; const char *yosys_version_str=\"Yosys" \ + "$yosysver (git sha1 $gitsha, Visual Studio)\"; }" > "$vcxsrc"/yosys/kernel/version.cc +cat > "$vcxsrc"/readme-git.txt << EOT +Want to use a git working copy for the yosys source code? Open "Git Bash" in this directory and run: mv yosys yosys.bak @@ -35,5 +41,14 @@ Open "Git Bash" in this directory and run: unzip ../genfiles.zip EOT -sed -i 's/$/\r/; s/\r\r*/\r/g;' "$vcxsrc"/YosysVS/YosysVS.vcxproj "$vcxsrc"/readme-git.txt +cat > "$vcxsrc"/readme-abc.txt << EOT +Yosys is using "ABC" for gate-level optimizations and technology +mapping. Download yosys-win32-mxebin-$yosysver.zip and copy the +following files from it into this directory: + + pthreadVC2.dll + yosys-abc.exe +EOT + +sed -i 's/$/\r/; s/\r\r*/\r/g;' "$vcxsrc"/YosysVS/YosysVS.vcxproj "$vcxsrc"/readme-git.txt "$vcxsrc"/readme-abc.txt diff --git a/passes/abc/abc.cc b/passes/abc/abc.cc index 79aa067d7..9d6d94579 100644 --- a/passes/abc/abc.cc +++ b/passes/abc/abc.cc @@ -1106,6 +1106,11 @@ struct AbcPass : public Pass { bool fast_mode = false, dff_mode = false, keepff = false, cleanup = true; int lut_mode = 0; +#ifdef _WIN32 + if (!check_file_exists(exe_file + ".exe") && check_file_exists(proc_self_dirname() + "..\\yosys-abc.exe")) + exe_file = proc_self_dirname() + "..\\yosys-abc"; +#endif + size_t argidx; char pwd [PATH_MAX]; if (!getcwd(pwd, sizeof(pwd))) { diff --git a/passes/tests/test_cell.cc b/passes/tests/test_cell.cc index 03fb31d28..3406d7e3e 100644 --- a/passes/tests/test_cell.cc +++ b/passes/tests/test_cell.cc @@ -522,7 +522,7 @@ struct TestCellPass : public Pass { log(" -map {filename}\n"); log(" pass this option to techmap.\n"); log("\n"); - log(" -simplib\n"); + log(" -simlib\n"); log(" use \"techmap -map +/simlib.v -max_iter 2 -autoproc\"\n"); log("\n"); log(" -script {script_file}\n"); |