Improve "read_verilog -dump_vlog[12]" handling of upto ranges

Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
Clifford Wolf 2019-03-21 22:20:16 +01:00
parent 9b0e7af6d7
commit da42f10765
1 changed files with 6 additions and 3 deletions

View File

@ -431,9 +431,12 @@ void AstNode::dumpVlog(FILE *f, std::string indent) const
break; break;
case AST_RANGE: case AST_RANGE:
if (range_valid) if (range_valid) {
fprintf(f, "[%d:%d]", range_left, range_right); if (range_swapped)
else { fprintf(f, "[%d:%d]", range_right, range_left);
else
fprintf(f, "[%d:%d]", range_left, range_right);
} else {
for (auto child : children) { for (auto child : children) {
fprintf(f, "%c", first ? '[' : ':'); fprintf(f, "%c", first ? '[' : ':');
child->dumpVlog(f, ""); child->dumpVlog(f, "");