mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-31 03:32:29 +00:00 
			
		
		
		
	Minor improvements to AstNode::dumpAst() and AstNode::dumpVlog()
This commit is contained in:
		
							parent
							
								
									a93fcec93f
								
							
						
					
					
						commit
						dbdd8927e7
					
				
					 1 changed files with 15 additions and 4 deletions
				
			
		|  | @ -309,6 +309,8 @@ void AstNode::dumpAst(FILE *f, std::string indent) | ||||||
| 
 | 
 | ||||||
| 	for (size_t i = 0; i < children.size(); i++) | 	for (size_t i = 0; i < children.size(); i++) | ||||||
| 		children[i]->dumpAst(f, indent + "  "); | 		children[i]->dumpAst(f, indent + "  "); | ||||||
|  | 
 | ||||||
|  | 	fflush(f); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // helper function for AstNode::dumpVlog()
 | // helper function for AstNode::dumpVlog()
 | ||||||
|  | @ -433,16 +435,15 @@ void AstNode::dumpVlog(FILE *f, std::string indent) | ||||||
| 		break; | 		break; | ||||||
| 
 | 
 | ||||||
| 	case AST_ALWAYS: | 	case AST_ALWAYS: | ||||||
| 		fprintf(f, "%s" "always @(", indent.c_str()); | 		fprintf(f, "%s" "always @", indent.c_str()); | ||||||
| 		for (auto child : children) { | 		for (auto child : children) { | ||||||
| 			if (child->type != AST_POSEDGE && child->type != AST_NEGEDGE && child->type != AST_EDGE) | 			if (child->type != AST_POSEDGE && child->type != AST_NEGEDGE && child->type != AST_EDGE) | ||||||
| 				continue; | 				continue; | ||||||
| 			if (!first) | 			fprintf(f, first ? "(" : ", "); | ||||||
| 				fprintf(f, ", "); |  | ||||||
| 			child->dumpVlog(f, ""); | 			child->dumpVlog(f, ""); | ||||||
| 			first = false; | 			first = false; | ||||||
| 		} | 		} | ||||||
| 		fprintf(f, ")\n"); | 		fprintf(f, first ? "*\n" : ")\n"); | ||||||
| 		for (auto child : children) { | 		for (auto child : children) { | ||||||
| 			if (child->type != AST_POSEDGE && child->type != AST_NEGEDGE && child->type != AST_EDGE) | 			if (child->type != AST_POSEDGE && child->type != AST_NEGEDGE && child->type != AST_EDGE) | ||||||
| 				child->dumpVlog(f, indent + "  "); | 				child->dumpVlog(f, indent + "  "); | ||||||
|  | @ -533,6 +534,14 @@ void AstNode::dumpVlog(FILE *f, std::string indent) | ||||||
| 		} | 		} | ||||||
| 		break; | 		break; | ||||||
| 
 | 
 | ||||||
|  | 	case AST_ASSIGN: | ||||||
|  | 		fprintf(f, "%sassign ", indent.c_str()); | ||||||
|  | 		children[0]->dumpVlog(f, ""); | ||||||
|  | 		fprintf(f, " = "); | ||||||
|  | 		children[1]->dumpVlog(f, ""); | ||||||
|  | 		fprintf(f, ";\n"); | ||||||
|  | 		break; | ||||||
|  | 
 | ||||||
| 	case AST_ASSIGN_EQ: | 	case AST_ASSIGN_EQ: | ||||||
| 	case AST_ASSIGN_LE: | 	case AST_ASSIGN_LE: | ||||||
| 		fprintf(f, "%s", indent.c_str()); | 		fprintf(f, "%s", indent.c_str()); | ||||||
|  | @ -621,6 +630,8 @@ void AstNode::dumpVlog(FILE *f, std::string indent) | ||||||
| 		fprintf(f, "%s" "/** %s **/%s", indent.c_str(), type_name.c_str(), indent.empty() ? "" : "\n"); | 		fprintf(f, "%s" "/** %s **/%s", indent.c_str(), type_name.c_str(), indent.empty() ? "" : "\n"); | ||||||
| 		// dumpAst(f, indent, NULL);
 | 		// dumpAst(f, indent, NULL);
 | ||||||
| 	} | 	} | ||||||
|  | 
 | ||||||
|  | 	fflush(f); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // check if two AST nodes are identical
 | // check if two AST nodes are identical
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue