mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-31 03:32:29 +00:00 
			
		
		
		
	Added log_cell()
This commit is contained in:
		
							parent
							
								
									15fd615da5
								
							
						
					
					
						commit
						a6174aaf5e
					
				
					 2 changed files with 17 additions and 0 deletions
				
			
		|  | @ -213,3 +213,18 @@ const char *log_id(std::string str) | ||||||
| 		string_buf.push_back(str); | 		string_buf.push_back(str); | ||||||
| 	return string_buf.back().c_str(); | 	return string_buf.back().c_str(); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | void log_cell(RTLIL::Cell *cell, std::string indent) | ||||||
|  | { | ||||||
|  | 	char *ptr; | ||||||
|  | 	size_t size; | ||||||
|  | 
 | ||||||
|  | 	FILE *f = open_memstream(&ptr, &size); | ||||||
|  | 	ILANG_BACKEND::dump_cell(f, indent, cell); | ||||||
|  | 	fputc(0, f); | ||||||
|  | 	fclose(f); | ||||||
|  | 
 | ||||||
|  | 	log("%s", ptr); | ||||||
|  | 	free(ptr); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  |  | ||||||
|  | @ -57,6 +57,8 @@ template<typename T> static inline const char *log_id(T *obj) { | ||||||
| 	return log_id(obj->name); | 	return log_id(obj->name); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void log_cell(RTLIL::Cell *cell, std::string indent = ""); | ||||||
|  | 
 | ||||||
| #define log_abort() log_error("Abort in %s:%d.\n", __FILE__, __LINE__) | #define log_abort() log_error("Abort in %s:%d.\n", __FILE__, __LINE__) | ||||||
| #define log_assert(_assert_expr_) do { if (_assert_expr_) break; log_error("Assert `%s' failed in %s:%d.\n", #_assert_expr_, __FILE__, __LINE__); } while (0) | #define log_assert(_assert_expr_) do { if (_assert_expr_) break; log_error("Assert `%s' failed in %s:%d.\n", #_assert_expr_, __FILE__, __LINE__); } while (0) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue