mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-31 03:32:29 +00:00 
			
		
		
		
	Various win32 / vs build fixes
This commit is contained in:
		
							parent
							
								
									973d376733
								
							
						
					
					
						commit
						468ae92374
					
				
					 8 changed files with 28 additions and 23 deletions
				
			
		
							
								
								
									
										5
									
								
								Makefile
									
										
									
									
									
								
							
							
						
						
									
										5
									
								
								Makefile
									
										
									
									
									
								
							|  | @ -324,8 +324,11 @@ ifeq ($(ENABLE_ABC),1) | ||||||
| endif | endif | ||||||
| 	echo -en 'This is Yosys $(YOSYS_VER) for Win32.\r\n' > yosys-win32-$(YOSYS_VER)/readme.txt | 	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 | 	echo -en 'Documentation at http://www.clifford.at/yosys/.\r\n' >> yosys-win32-$(YOSYS_VER)/readme.txt | ||||||
| 	zip yosys-win32-$(YOSYS_VER)/genfiles.zip $(GENFILES) | 	find backends frontends kernel libs passes techlibs -name '*.d' | xargs sed -e 's,^[^ ]*:,,; s, ,\n,g; s, *\\,,;' \
 | ||||||
|  | 		-e 's,/[^/]*/\.\./,/,g; s,'"$PWD/"',,' | sort -u | sed '/^[^/]/ ! d; s,$,\r,;' > srcfiles.txt | ||||||
|  | 	zip yosys-win32-$(YOSYS_VER)/genfiles.zip $(GENFILES) srcfiles.txt | ||||||
| 	zip -r yosys-win32-$(YOSYS_VER).zip yosys-win32-$(YOSYS_VER)/ | 	zip -r yosys-win32-$(YOSYS_VER).zip yosys-win32-$(YOSYS_VER)/ | ||||||
|  | 	rm -f srcfiles.txt | ||||||
| endif | endif | ||||||
| 
 | 
 | ||||||
| config-clean: clean | config-clean: clean | ||||||
|  |  | ||||||
|  | @ -55,8 +55,8 @@ void logv_header(const char *format, va_list ap); | ||||||
| void logv_error(const char *format, va_list ap) __attribute__((noreturn)); | void logv_error(const char *format, va_list ap) __attribute__((noreturn)); | ||||||
| void log(const char *format, ...)  __attribute__((format(printf, 1, 2))); | void log(const char *format, ...)  __attribute__((format(printf, 1, 2))); | ||||||
| void log_header(const char *format, ...) __attribute__((format(printf, 1, 2))); | void log_header(const char *format, ...) __attribute__((format(printf, 1, 2))); | ||||||
| void log_error(const char *format, ...) __attribute__((format(printf, 1, 2))) __attribute__((noreturn)); | _NORETURN_ void log_error(const char *format, ...) __attribute__((format(printf, 1, 2))) __attribute__((noreturn)); | ||||||
| void log_cmd_error(const char *format, ...) __attribute__((format(printf, 1, 2))) __attribute__((noreturn)); | _NORETURN_ void log_cmd_error(const char *format, ...) __attribute__((format(printf, 1, 2))) __attribute__((noreturn)); | ||||||
| 
 | 
 | ||||||
| void log_spacer(); | void log_spacer(); | ||||||
| void log_push(); | void log_push(); | ||||||
|  |  | ||||||
|  | @ -2204,7 +2204,7 @@ void RTLIL::SigSpec::unpack() const | ||||||
| 	that->hash_ = 0; | 	that->hash_ = 0; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #define DJB2(_hash, _value) do { (_hash) = (((_hash) << 5) + (_hash)) + (_value); } while (0) | #define DJB2(_hash, _value) (_hash) = (((_hash) << 5) + (_hash)) + (_value) | ||||||
| 
 | 
 | ||||||
| void RTLIL::SigSpec::hash() const | void RTLIL::SigSpec::hash() const | ||||||
| { | { | ||||||
|  |  | ||||||
|  | @ -269,12 +269,12 @@ std::string make_temp_dir(std::string template_str) | ||||||
| #ifdef _WIN32 | #ifdef _WIN32 | ||||||
| bool check_file_exists(std::string filename, bool) | bool check_file_exists(std::string filename, bool) | ||||||
| { | { | ||||||
| 	return _access(filename.c_str(), 0); | 	return _access(filename.c_str(), 0) == 0; | ||||||
| } | } | ||||||
| #else | #else | ||||||
| bool check_file_exists(std::string filename, bool is_exec) | bool check_file_exists(std::string filename, bool is_exec) | ||||||
| { | { | ||||||
| 	return access(filename.c_str(), is_exec ? X_OK : F_OK); | 	return access(filename.c_str(), is_exec ? X_OK : F_OK) == 0; | ||||||
| } | } | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | @ -497,10 +497,10 @@ std::string proc_share_dirname() | ||||||
| { | { | ||||||
| 	std::string proc_self_path = proc_self_dirname(); | 	std::string proc_self_path = proc_self_dirname(); | ||||||
| 	std::string proc_share_path = proc_self_path + "share/"; | 	std::string proc_share_path = proc_self_path + "share/"; | ||||||
| 	if (check_file_exists(proc_share_path, true) == 0) | 	if (check_file_exists(proc_share_path, true)) | ||||||
| 		return proc_share_path; | 		return proc_share_path; | ||||||
| 	proc_share_path = proc_self_path + "../share/yosys/"; | 	proc_share_path = proc_self_path + "../share/yosys/"; | ||||||
| 	if (check_file_exists(proc_share_path, true) == 0) | 	if (check_file_exists(proc_share_path, true)) | ||||||
| 		return proc_share_path; | 		return proc_share_path; | ||||||
| 	log_error("proc_share_dirname: unable to determine share/ directory!\n"); | 	log_error("proc_share_dirname: unable to determine share/ directory!\n"); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -56,6 +56,7 @@ | ||||||
| #include <stdarg.h> | #include <stdarg.h> | ||||||
| #include <stdlib.h> | #include <stdlib.h> | ||||||
| #include <string.h> | #include <string.h> | ||||||
|  | #include <stdint.h> | ||||||
| #include <stdio.h> | #include <stdio.h> | ||||||
| 
 | 
 | ||||||
| #ifndef _YOSYS_ | #ifndef _YOSYS_ | ||||||
|  | @ -68,17 +69,18 @@ | ||||||
| #  include <tcl.h> | #  include <tcl.h> | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| // a few platform specific things
 |  | ||||||
| #ifdef _WIN32 | #ifdef _WIN32 | ||||||
| #  ifndef NOMINMAX | #  undef NOMINMAX | ||||||
| #    define NOMINMAX 1 | #  define NOMINMAX 1 | ||||||
| #  endif | #  undef YY_NO_UNISTD_H | ||||||
|  | #  define YY_NO_UNISTD_H 1 | ||||||
|  | #  undef _CRT_SECURE_NO_WARNINGS | ||||||
|  | #  define _CRT_SECURE_NO_WARNINGS 1 | ||||||
|  | 
 | ||||||
| #  include <windows.h> | #  include <windows.h> | ||||||
| #  include <stdint.h> // takes care of a number of typedefs
 |  | ||||||
| #  include <io.h> | #  include <io.h> | ||||||
| #  include <direct.h> | #  include <direct.h> | ||||||
| 
 | 
 | ||||||
| // these are always a bit dangerous :-)
 |  | ||||||
| #  define strtok_r strtok_s | #  define strtok_r strtok_s | ||||||
| #  define strdup _strdup | #  define strdup _strdup | ||||||
| #  define snprintf _snprintf | #  define snprintf _snprintf | ||||||
|  | @ -89,7 +91,6 @@ | ||||||
| #  define PATH_MAX MAX_PATH | #  define PATH_MAX MAX_PATH | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| #define PRIVATE_NAMESPACE_BEGIN  namespace { | #define PRIVATE_NAMESPACE_BEGIN  namespace { | ||||||
| #define PRIVATE_NAMESPACE_END    } | #define PRIVATE_NAMESPACE_END    } | ||||||
| #define YOSYS_NAMESPACE_BEGIN    namespace Yosys { | #define YOSYS_NAMESPACE_BEGIN    namespace Yosys { | ||||||
|  | @ -128,7 +129,7 @@ bool patmatch(const char *pattern, const char *string); | ||||||
| int run_command(const std::string &command, std::function<void(const std::string&)> process_line = std::function<void(const std::string&)>()); | int run_command(const std::string &command, std::function<void(const std::string&)> process_line = std::function<void(const std::string&)>()); | ||||||
| std::string make_temp_file(std::string template_str = "/tmp/yosys_XXXXXX"); | std::string make_temp_file(std::string template_str = "/tmp/yosys_XXXXXX"); | ||||||
| std::string make_temp_dir(std::string template_str = "/tmp/yosys_XXXXXX"); | std::string make_temp_dir(std::string template_str = "/tmp/yosys_XXXXXX"); | ||||||
| bool check_file(std::string filename, bool is_exec = false); | bool check_file_exists(std::string filename, bool is_exec = false); | ||||||
| void remove_directory(std::string dirname); | void remove_directory(std::string dirname); | ||||||
| 
 | 
 | ||||||
| template<typename T> int GetSize(const T &obj) { return obj.size(); } | template<typename T> int GetSize(const T &obj) { return obj.size(); } | ||||||
|  |  | ||||||
|  | @ -25,6 +25,7 @@ | ||||||
| #include <vector> | #include <vector> | ||||||
| #include <string> | #include <string> | ||||||
| #include <stdio.h> | #include <stdio.h> | ||||||
|  | #include <stdint.h> | ||||||
| 
 | 
 | ||||||
| class ezSAT | class ezSAT | ||||||
| { | { | ||||||
|  |  | ||||||
|  | @ -1142,7 +1142,7 @@ struct SelectPass : public Pass { | ||||||
| 
 | 
 | ||||||
| 		if (list_mode || count_mode || !write_file.empty()) | 		if (list_mode || count_mode || !write_file.empty()) | ||||||
| 		{ | 		{ | ||||||
| 		#define LOG_OBJECT(...) do { if (list_mode) log(__VA_ARGS__); if (f != NULL) fprintf(f, __VA_ARGS__); total_count++; } while (0) | 		#define LOG_OBJECT(...) { if (list_mode) log(__VA_ARGS__); if (f != NULL) fprintf(f, __VA_ARGS__); total_count++; } | ||||||
| 			int total_count = 0; | 			int total_count = 0; | ||||||
| 			FILE *f = NULL; | 			FILE *f = NULL; | ||||||
| 			if (!write_file.empty()) { | 			if (!write_file.empty()) { | ||||||
|  | @ -1161,16 +1161,16 @@ struct SelectPass : public Pass { | ||||||
| 				if (sel->selected_module(mod_it.first)) { | 				if (sel->selected_module(mod_it.first)) { | ||||||
| 					for (auto &it : mod_it.second->wires_) | 					for (auto &it : mod_it.second->wires_) | ||||||
| 						if (sel->selected_member(mod_it.first, it.first)) | 						if (sel->selected_member(mod_it.first, it.first)) | ||||||
| 							LOG_OBJECT("%s/%s\n", id2cstr(mod_it.first), id2cstr(it.first)); | 							LOG_OBJECT("%s/%s\n", id2cstr(mod_it.first), id2cstr(it.first)) | ||||||
| 					for (auto &it : mod_it.second->memories) | 					for (auto &it : mod_it.second->memories) | ||||||
| 						if (sel->selected_member(mod_it.first, it.first)) | 						if (sel->selected_member(mod_it.first, it.first)) | ||||||
| 							LOG_OBJECT("%s/%s\n", id2cstr(mod_it.first), id2cstr(it.first)); | 							LOG_OBJECT("%s/%s\n", id2cstr(mod_it.first), id2cstr(it.first)) | ||||||
| 					for (auto &it : mod_it.second->cells_) | 					for (auto &it : mod_it.second->cells_) | ||||||
| 						if (sel->selected_member(mod_it.first, it.first)) | 						if (sel->selected_member(mod_it.first, it.first)) | ||||||
| 							LOG_OBJECT("%s/%s\n", id2cstr(mod_it.first), id2cstr(it.first)); | 							LOG_OBJECT("%s/%s\n", id2cstr(mod_it.first), id2cstr(it.first)) | ||||||
| 					for (auto &it : mod_it.second->processes) | 					for (auto &it : mod_it.second->processes) | ||||||
| 						if (sel->selected_member(mod_it.first, it.first)) | 						if (sel->selected_member(mod_it.first, it.first)) | ||||||
| 							LOG_OBJECT("%s/%s\n", id2cstr(mod_it.first), id2cstr(it.first)); | 							LOG_OBJECT("%s/%s\n", id2cstr(mod_it.first), id2cstr(it.first)) | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 			if (count_mode) | 			if (count_mode) | ||||||
|  |  | ||||||
|  | @ -174,7 +174,7 @@ bool expand_module(RTLIL::Design *design, RTLIL::Module *module, bool flag_check | ||||||
| 			for (auto &dir : libdirs) | 			for (auto &dir : libdirs) | ||||||
| 			{ | 			{ | ||||||
| 				filename = dir + "/" + RTLIL::unescape_id(cell->type) + ".v"; | 				filename = dir + "/" + RTLIL::unescape_id(cell->type) + ".v"; | ||||||
| 				if (access(filename.c_str(), F_OK) == 0) { | 				if (check_file_exists(filename)) { | ||||||
| 					std::vector<std::string> args; | 					std::vector<std::string> args; | ||||||
| 					args.push_back(filename); | 					args.push_back(filename); | ||||||
| 					Frontend::frontend_call(design, NULL, filename, "verilog"); | 					Frontend::frontend_call(design, NULL, filename, "verilog"); | ||||||
|  | @ -182,7 +182,7 @@ bool expand_module(RTLIL::Design *design, RTLIL::Module *module, bool flag_check | ||||||
| 				} | 				} | ||||||
| 
 | 
 | ||||||
| 				filename = dir + "/" + RTLIL::unescape_id(cell->type) + ".il"; | 				filename = dir + "/" + RTLIL::unescape_id(cell->type) + ".il"; | ||||||
| 				if (access(filename.c_str(), F_OK) == 0) { | 				if (check_file_exists(filename)) { | ||||||
| 					std::vector<std::string> args; | 					std::vector<std::string> args; | ||||||
| 					args.push_back(filename); | 					args.push_back(filename); | ||||||
| 					Frontend::frontend_call(design, NULL, filename, "ilang"); | 					Frontend::frontend_call(design, NULL, filename, "ilang"); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue