mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-31 03:32:29 +00:00 
			
		
		
		
	driver: add --no-private-id-locs and NEWER_ID
This commit is contained in:
		
							parent
							
								
									85bcdee232
								
							
						
					
					
						commit
						e4d4de1020
					
				
					 3 changed files with 29 additions and 1 deletions
				
			
		|  | @ -292,6 +292,7 @@ int main(int argc, char **argv) | |||
| 			cxxopts::value<std::vector<std::string>>(), "<feature>") | ||||
| 		("g,debug", "globally enable debug log messages") | ||||
| 		("perffile", "write a JSON performance log to <perffile>", cxxopts::value<std::string>(), "<perffile>") | ||||
| 		("no-private-id-locs", "turn off putting source file locations into object IDs") | ||||
| 	; | ||||
| 
 | ||||
| 	options.parse_positional({"infile"}); | ||||
|  | @ -436,6 +437,7 @@ int main(int argc, char **argv) | |||
| 			log_experimentals_ignored.insert(ignores.begin(), ignores.end()); | ||||
| 		} | ||||
| 		if (result.count("perffile")) perffile = result["perffile"].as<std::string>(); | ||||
| 		if (result.count("no-private-id-locs")) yosys_private_id_locs = false; | ||||
| 		if (result.count("infile")) { | ||||
| 			frontend_files = result["infile"].as<std::vector<std::string>>(); | ||||
| 		} | ||||
|  |  | |||
|  | @ -82,6 +82,7 @@ YOSYS_NAMESPACE_BEGIN | |||
| int autoidx = 1; | ||||
| int yosys_xtrace = 0; | ||||
| bool yosys_write_versions = true; | ||||
| bool yosys_private_id_locs = true; | ||||
| const char* yosys_maybe_version() { | ||||
| 	if (yosys_write_versions) | ||||
| 		return yosys_version_str; | ||||
|  | @ -272,6 +273,16 @@ void yosys_shutdown() | |||
| } | ||||
| 
 | ||||
| RTLIL::IdString new_id(std::string file, int line, std::string func) | ||||
| { | ||||
| 	return newer_id(file, line, func); | ||||
| } | ||||
| 
 | ||||
| RTLIL::IdString new_id_suffix(std::string file, int line, std::string func, std::string suffix) | ||||
| { | ||||
| 	return newer_id_suffix(file, line, func, suffix); | ||||
| } | ||||
| 
 | ||||
| RTLIL::IdString newer_id(std::string file, int line, std::string func) | ||||
| { | ||||
| #ifdef _WIN32 | ||||
| 	size_t pos = file.find_last_of("/\\"); | ||||
|  | @ -288,7 +299,7 @@ RTLIL::IdString new_id(std::string file, int line, std::string func) | |||
| 	return stringf("$auto$%s:%d:%s$%d", file, line, func, autoidx++); | ||||
| } | ||||
| 
 | ||||
| RTLIL::IdString new_id_suffix(std::string file, int line, std::string func, std::string suffix) | ||||
| RTLIL::IdString newer_id_suffix(std::string file, int line, std::string func, std::string suffix) | ||||
| { | ||||
| #ifdef _WIN32 | ||||
| 	size_t pos = file.find_last_of("/\\"); | ||||
|  |  | |||
|  | @ -268,8 +268,13 @@ inline int GetSize(RTLIL::Wire *wire); | |||
| extern int autoidx; | ||||
| extern int yosys_xtrace; | ||||
| extern bool yosys_write_versions; | ||||
| extern bool yosys_private_id_locs; | ||||
| 
 | ||||
| RTLIL::IdString newer_id(std::string file, int line, std::string func); | ||||
| RTLIL::IdString newer_id_suffix(std::string file, int line, std::string func, std::string suffix); | ||||
| [[deprecated("Use NEWER_ID instead of NEW_ID")]] | ||||
| RTLIL::IdString new_id(std::string file, int line, std::string func); | ||||
| [[deprecated("Use NEWER_ID_SUFFIX instead of NEW_ID_SUFFIX")]] | ||||
| RTLIL::IdString new_id_suffix(std::string file, int line, std::string func, std::string suffix); | ||||
| 
 | ||||
| #define NEW_ID \ | ||||
|  | @ -277,6 +282,16 @@ RTLIL::IdString new_id_suffix(std::string file, int line, std::string func, std: | |||
| #define NEW_ID_SUFFIX(suffix) \ | ||||
| 	YOSYS_NAMESPACE_PREFIX new_id_suffix(__FILE__, __LINE__, __FUNCTION__, suffix) | ||||
| 
 | ||||
| #define NEWER_ID \ | ||||
| 	(YOSYS_NAMESPACE_PREFIX yosys_private_id_locs ? \ | ||||
| 	YOSYS_NAMESPACE_PREFIX newer_id(__FILE__, __LINE__, __FUNCTION__) : \ | ||||
| 	YOSYS_NAMESPACE_PREFIX newer_id("?", 0, "?")) | ||||
| 
 | ||||
| #define NEWER_ID_SUFFIX(suffix) \ | ||||
| 	(YOSYS_NAMESPACE_PREFIX yosys_private_id_locs ? \ | ||||
| 	YOSYS_NAMESPACE_PREFIX newer_id_suffix(__FILE__, __LINE__, __FUNCTION__, suffix) : \ | ||||
| 	YOSYS_NAMESPACE_PREFIX newer_id_suffix("?", 0, "?", suffix)) | ||||
| 
 | ||||
| namespace ID = RTLIL::ID; | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue