3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-06-06 14:13:23 +00:00

Fixed handling of parameters and const functions in casex/casez pattern

This commit is contained in:
Clifford Wolf 2016-04-21 15:31:54 +02:00
parent f38ca3e18f
commit 5a09fa4553
5 changed files with 37 additions and 8 deletions

View file

@ -146,6 +146,8 @@ std::string AST::type2str(AstNodeType type)
X(AST_ASSIGN_LE)
X(AST_CASE)
X(AST_COND)
X(AST_CONDX)
X(AST_CONDZ)
X(AST_DEFAULT)
X(AST_FOR)
X(AST_WHILE)
@ -501,7 +503,12 @@ void AstNode::dumpVlog(FILE *f, std::string indent)
break;
case AST_CASE:
fprintf(f, "%s" "case (", indent.c_str());
if (!children.empty() && children[0]->type == AST_CONDX)
fprintf(f, "%s" "casex (", indent.c_str());
else if (!children.empty() && children[0]->type == AST_CONDZ)
fprintf(f, "%s" "casez (", indent.c_str());
else
fprintf(f, "%s" "case (", indent.c_str());
children[0]->dumpVlog(f, "");
fprintf(f, ")\n");
for (size_t i = 1; i < children.size(); i++) {
@ -512,6 +519,8 @@ void AstNode::dumpVlog(FILE *f, std::string indent)
break;
case AST_COND:
case AST_CONDX:
case AST_CONDZ:
for (auto child : children) {
if (child->type == AST_BLOCK) {
fprintf(f, ":\n");