mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-31 11:42:30 +00:00 
			
		
		
		
	Add date parameter to enable full date/time and version info
This commit is contained in:
		
							parent
							
								
									be32de1caa
								
							
						
					
					
						commit
						37de369ba7
					
				
					 1 changed files with 20 additions and 7 deletions
				
			
		|  | @ -89,6 +89,7 @@ struct SimShared | ||||||
| 	std::vector<std::unique_ptr<OutputWriter>> outputfiles; | 	std::vector<std::unique_ptr<OutputWriter>> outputfiles; | ||||||
| 	std::vector<std::pair<int,std::map<int,Const>>> output_data; | 	std::vector<std::pair<int,std::map<int,Const>>> output_data; | ||||||
| 	bool ignore_x = false; | 	bool ignore_x = false; | ||||||
|  | 	bool date = false; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| void zinit(State &v) | void zinit(State &v) | ||||||
|  | @ -1333,13 +1334,15 @@ struct VCDWriter : public OutputWriter | ||||||
| 	void write(std::map<int, bool> &use_signal) override | 	void write(std::map<int, bool> &use_signal) override | ||||||
| 	{ | 	{ | ||||||
| 		if (!vcdfile.is_open()) return; | 		if (!vcdfile.is_open()) return; | ||||||
| 		vcdfile << stringf("$version %s $end\n", yosys_version_str); | 		vcdfile << stringf("$version %s $end\n", worker->date ? yosys_version_str : "Yosys"); | ||||||
| 
 | 
 | ||||||
|  | 		if (worker->date) { | ||||||
| 			std::time_t t = std::time(nullptr); | 			std::time_t t = std::time(nullptr); | ||||||
| 			char mbstr[255]; | 			char mbstr[255]; | ||||||
| 			if (std::strftime(mbstr, sizeof(mbstr), "%c", std::localtime(&t))) { | 			if (std::strftime(mbstr, sizeof(mbstr), "%c", std::localtime(&t))) { | ||||||
| 				vcdfile << stringf("$date ") << mbstr << stringf(" $end\n"); | 				vcdfile << stringf("$date ") << mbstr << stringf(" $end\n"); | ||||||
| 			} | 			} | ||||||
|  | 		} | ||||||
| 
 | 
 | ||||||
| 		if (!worker->timescale.empty()) | 		if (!worker->timescale.empty()) | ||||||
| 			vcdfile << stringf("$timescale %s $end\n", worker->timescale.c_str()); | 			vcdfile << stringf("$timescale %s $end\n", worker->timescale.c_str()); | ||||||
|  | @ -1391,8 +1394,11 @@ struct FSTWriter : public OutputWriter | ||||||
| 	{ | 	{ | ||||||
| 		if (!fstfile) return; | 		if (!fstfile) return; | ||||||
| 		std::time_t t = std::time(nullptr); | 		std::time_t t = std::time(nullptr); | ||||||
|  | 		fstWriterSetVersion(fstfile, worker->date ? yosys_version_str : "Yosys"); | ||||||
|  | 		if (worker->date) | ||||||
| 			fstWriterSetDate(fstfile, asctime(std::localtime(&t))); | 			fstWriterSetDate(fstfile, asctime(std::localtime(&t))); | ||||||
| 		fstWriterSetVersion(fstfile, yosys_version_str); | 		else | ||||||
|  | 			fstWriterSetDate(fstfile, ""); | ||||||
| 		if (!worker->timescale.empty()) | 		if (!worker->timescale.empty()) | ||||||
| 			fstWriterSetTimescaleFromString(fstfile, worker->timescale.c_str()); | 			fstWriterSetTimescaleFromString(fstfile, worker->timescale.c_str()); | ||||||
| 
 | 
 | ||||||
|  | @ -1563,6 +1569,9 @@ struct SimPass : public Pass { | ||||||
| 		log("    -x\n"); | 		log("    -x\n"); | ||||||
| 		log("        ignore constant x outputs in simulation file.\n"); | 		log("        ignore constant x outputs in simulation file.\n"); | ||||||
| 		log("\n"); | 		log("\n"); | ||||||
|  | 		log("    -date\n"); | ||||||
|  | 		log("        include date and full version info in output.\n"); | ||||||
|  | 		log("\n"); | ||||||
| 		log("    -clock <portname>\n"); | 		log("    -clock <portname>\n"); | ||||||
| 		log("        name of top-level clock input\n"); | 		log("        name of top-level clock input\n"); | ||||||
| 		log("\n"); | 		log("\n"); | ||||||
|  | @ -1759,6 +1768,10 @@ struct SimPass : public Pass { | ||||||
| 				worker.ignore_x = true; | 				worker.ignore_x = true; | ||||||
| 				continue; | 				continue; | ||||||
| 			} | 			} | ||||||
|  | 			if (args[argidx] == "-date") { | ||||||
|  | 				worker.date = true; | ||||||
|  | 				continue; | ||||||
|  | 			} | ||||||
| 			break; | 			break; | ||||||
| 		} | 		} | ||||||
| 		extra_args(args, argidx, design); | 		extra_args(args, argidx, design); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue