mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 13:29:12 +00:00 
			
		
		
		
	Added log_dump() support for dict<> and pool<> containers
This commit is contained in:
		
							parent
							
								
									e5dd5c0bcc
								
							
						
					
					
						commit
						6f1b6dc322
					
				
					 1 changed files with 26 additions and 0 deletions
				
			
		
							
								
								
									
										26
									
								
								kernel/log.h
									
										
									
									
									
								
							
							
						
						
									
										26
									
								
								kernel/log.h
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -230,6 +230,32 @@ static inline void log_dump_args_worker(const char *p YS_ATTRIBUTE(unused)) { lo
 | 
			
		|||
void log_dump_val_worker(RTLIL::IdString v);
 | 
			
		||||
void log_dump_val_worker(RTLIL::SigSpec v);
 | 
			
		||||
 | 
			
		||||
template<typename K, typename T, typename OPS>
 | 
			
		||||
static inline void log_dump_val_worker(dict<K, T, OPS> &v) {
 | 
			
		||||
	log("{");
 | 
			
		||||
	bool first = true;
 | 
			
		||||
	for (auto &it : v) {
 | 
			
		||||
		log(first ? " " : ", ");
 | 
			
		||||
		log_dump_val_worker(it.first);
 | 
			
		||||
		log(": ");
 | 
			
		||||
		log_dump_val_worker(it.second);
 | 
			
		||||
		first = false;
 | 
			
		||||
	}
 | 
			
		||||
	log(" }");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template<typename K, typename OPS>
 | 
			
		||||
static inline void log_dump_val_worker(pool<K, OPS> &v) {
 | 
			
		||||
	log("{");
 | 
			
		||||
	bool first = true;
 | 
			
		||||
	for (auto &it : v) {
 | 
			
		||||
		log(first ? " " : ", ");
 | 
			
		||||
		log_dump_val_worker(it);
 | 
			
		||||
		first = false;
 | 
			
		||||
	}
 | 
			
		||||
	log(" }");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template<typename T>
 | 
			
		||||
static inline void log_dump_val_worker(T *ptr) { log("%p", ptr); }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue