mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 13:29:12 +00:00 
			
		
		
		
	Precision fix
This commit is contained in:
		
							parent
							
								
									f65d98a00d
								
							
						
					
					
						commit
						fe684f5fd2
					
				
					 1 changed files with 5 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -28,6 +28,8 @@
 | 
			
		|||
#include "kernel/fmt.h"
 | 
			
		||||
 | 
			
		||||
#include <ctime>
 | 
			
		||||
#include <sstream>
 | 
			
		||||
#include <iomanip>
 | 
			
		||||
 | 
			
		||||
USING_YOSYS_NAMESPACE
 | 
			
		||||
PRIVATE_NAMESPACE_BEGIN
 | 
			
		||||
| 
						 | 
				
			
			@ -2542,8 +2544,9 @@ struct AnnotateActivity : public OutputWriter {
 | 
			
		|||
		double frequency = 1.0 / clk_period;
 | 
			
		||||
		worker->top->module->set_string_attribute("$FREQUENCY", std::to_string(frequency));
 | 
			
		||||
		worker->top->module->set_string_attribute("$DURATION", std::to_string(max_time));
 | 
			
		||||
		// Timescale is scaled by 1e12 so it can be retrieved (not 0) in Python due to precision limitation during conversion
 | 
			
		||||
		worker->top->module->set_string_attribute("$TIMESCALE", std::to_string(real_timescale * 1e12));
 | 
			
		||||
		std::stringstream ss;
 | 
			
		||||
		ss << std::setprecision(4) << real_timescale;
 | 
			
		||||
		worker->top->module->set_string_attribute("$TIMESCALE", ss.str());
 | 
			
		||||
		if (debug) {
 | 
			
		||||
			std::cout << "Clock toggle count: " << clktoggleCounts[0] << "\n";
 | 
			
		||||
			std::cout << "Max time: " << max_time << "\n";
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue