summaryrefslogtreecommitdiff
path: root/frontends/ast
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2013-03-31 11:19:11 +0200
committerClifford Wolf <clifford@clifford.at>2013-03-31 11:19:11 +0200
commit161565be104fd0c7b7c4224bd23e9502625e041a (patch)
treef0c54a731d73dc7b334579acb56950497a9e1cb6 /frontends/ast
parent5640b7d6078a681e33e85f06920394204f41c875 (diff)
Added AST_INITIAL (before verilog "initial" was mapped to AST_ALWAYS)
Diffstat (limited to 'frontends/ast')
-rw-r--r--frontends/ast/ast.cc9
-rw-r--r--frontends/ast/ast.h1
-rw-r--r--frontends/ast/genrtlil.cc4
-rw-r--r--frontends/ast/simplify.cc2
4 files changed, 14 insertions, 2 deletions
diff --git a/frontends/ast/ast.cc b/frontends/ast/ast.cc
index 091b196e..391e0a44 100644
--- a/frontends/ast/ast.cc
+++ b/frontends/ast/ast.cc
@@ -122,6 +122,7 @@ std::string AST::type2str(AstNodeType type)
X(AST_CELL)
X(AST_PRIMITIVE)
X(AST_ALWAYS)
+ X(AST_INITIAL)
X(AST_BLOCK)
X(AST_ASSIGN_EQ)
X(AST_ASSIGN_LE)
@@ -417,6 +418,14 @@ void AstNode::dumpVlog(FILE *f, std::string indent)
}
break;
+ case AST_INITIAL:
+ fprintf(f, "%s" "initial\n", indent.c_str());
+ for (auto child : children) {
+ if (child->type != AST_POSEDGE && child->type != AST_NEGEDGE && child->type != AST_EDGE)
+ child->dumpVlog(f, indent + " ");
+ }
+ break;
+
case AST_POSEDGE:
case AST_NEGEDGE:
case AST_EDGE:
diff --git a/frontends/ast/ast.h b/frontends/ast/ast.h
index 05b9a95c..918f12c1 100644
--- a/frontends/ast/ast.h
+++ b/frontends/ast/ast.h
@@ -103,6 +103,7 @@ namespace AST
AST_CELL,
AST_PRIMITIVE,
AST_ALWAYS,
+ AST_INITIAL,
AST_BLOCK,
AST_ASSIGN_EQ,
AST_ASSIGN_LE,
diff --git a/frontends/ast/genrtlil.cc b/frontends/ast/genrtlil.cc
index 47ca37bd..2f5370fe 100644
--- a/frontends/ast/genrtlil.cc
+++ b/frontends/ast/genrtlil.cc
@@ -310,6 +310,7 @@ struct AST_INTERNAL::ProcessGenerator
case AST_COND:
case AST_ALWAYS:
+ case AST_INITIAL:
for (auto child : ast->children)
if (child->type == AST_BLOCK)
collect_lvalues(reg, child, type_eq, type_le, false);
@@ -1013,7 +1014,8 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint)
break;
// use ProcessGenerator for always blocks
- case AST_ALWAYS: {
+ case AST_ALWAYS:
+ case AST_INITIAL: {
AstNode *always = this->clone();
ProcessGenerator generator(always);
delete always;
diff --git a/frontends/ast/simplify.cc b/frontends/ast/simplify.cc
index a03cd0be..fbbe66ed 100644
--- a/frontends/ast/simplify.cc
+++ b/frontends/ast/simplify.cc
@@ -196,7 +196,7 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage)
current_block = this;
current_block_child = children[i];
}
- if (type == AST_ALWAYS && children[i]->type == AST_BLOCK)
+ if ((type == AST_ALWAYS || type == AST_INITIAL) && children[i]->type == AST_BLOCK)
current_top_block = children[i];
did_something_here = children[i]->simplify(const_fold_here, at_zero, in_lvalue_here, stage);
if (did_something_here)