Skip to content

Commit b79ad0d

Browse files
authored
Merge pull request #168 from antmicro/while
Add support for vpiWhile
2 parents 4c54420 + 70b70ca commit b79ad0d

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

uhdm-plugin/UhdmAst.cc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3382,6 +3382,24 @@ void UhdmAst::process_immediate_cover()
33823382
});
33833383
}
33843384

3385+
void UhdmAst::process_while()
3386+
{
3387+
current_node = make_ast_node(AST::AST_WHILE);
3388+
visit_one_to_one({vpiCondition}, obj_h, [&](AST::AstNode *node) { current_node->children.push_back(node); });
3389+
visit_one_to_one({vpiStmt}, obj_h, [&](AST::AstNode *node) {
3390+
if (node->type != AST::AST_BLOCK) {
3391+
auto *statements = make_ast_node(AST::AST_BLOCK);
3392+
statements->str = current_node->str; // Needed in simplify step
3393+
statements->children.push_back(node);
3394+
current_node->children.push_back(statements);
3395+
} else {
3396+
if (node->str == "") {
3397+
node->str = current_node->str;
3398+
}
3399+
}
3400+
});
3401+
}
3402+
33853403
AST::AstNode *UhdmAst::process_object(vpiHandle obj_handle)
33863404
{
33873405
obj_h = obj_handle;
@@ -3597,6 +3615,9 @@ AST::AstNode *UhdmAst::process_object(vpiHandle obj_handle)
35973615
case vpiImmediateCover:
35983616
process_immediate_cover();
35993617
break;
3618+
case vpiWhile:
3619+
process_while();
3620+
break;
36003621
case vpiProgram:
36013622
default:
36023623
report_error("%s:%d: Encountered unhandled object '%s' of type '%s'\n", object->VpiFile().c_str(), object->VpiLineNo(),

uhdm-plugin/UhdmAst.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ class UhdmAst
131131
void process_byte_var();
132132
void process_long_int_var();
133133
void process_immediate_cover();
134+
void process_while();
134135
void simplify_parameter(AST::AstNode *parameter, AST::AstNode *module_node = nullptr);
135136
void process_nonsynthesizable(const UHDM::BaseClass *object);
136137
void visitEachDescendant(AST::AstNode *node, const std::function<void(AST::AstNode *)> &f);

0 commit comments

Comments
 (0)