Skip to content

Commit

Permalink
Rewrite rule for for_loop
Browse files Browse the repository at this point in the history
  • Loading branch information
alaindargelas committed Nov 5, 2023
1 parent 2c7748a commit 8442bc5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions templates/SynthSubset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,11 +373,16 @@ void SynthSubset::leaveFor_stmt(const for_stmt* object, vpiHandle handle) {
any* lhs = operands->at(0);
any* rhs = operands->at(1);
((for_stmt*)object)->VpiCondition((expr*)lhs);

VectorOfany* stlist = nullptr;
if (const any* stmt = object->VpiStmt()) {
if (stmt->UhdmType() == uhdmbegin) {
begin* st = (begin*) stmt;
VectorOfany* stlist = st->Stmts();
stlist = st->Stmts();
} else if (stmt->UhdmType() == uhdmnamed_begin) {
named_begin* st = (named_begin*) stmt;
stlist = st->Stmts();
}
if (stlist) {
if_stmt* ifstmt = serializer_->MakeIf_stmt();
stlist->insert(stlist->begin(), ifstmt);
ifstmt->VpiCondition((expr*)rhs);
Expand Down

0 comments on commit 8442bc5

Please sign in to comment.