Skip to content

Commit

Permalink
Merge pull request #186 from Bo-Yuan-Huang/fix-ilator-const-bv
Browse files Browse the repository at this point in the history
Fix bug #179: miss constant bit_width in ILAtor Concat-op
  • Loading branch information
Bo-Yuan-Huang committed Jun 8, 2020
2 parents 06fe2d4 + 2917f78 commit c7d6f99
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/target-sc/dfs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,16 @@ void IlaSim::dfs_binary_op_non_mem(std::stringstream& dfs_simulator,
<< arg1_str << ");" << std::endl;
}
} else {
dfs_simulator << indent << out_str << " = (" << arg0_str << op_str
<< arg1_str << ");" << std::endl;
if (GetUidExprOp(expr) == AST_UID_EXPR_OP::CONCAT) {
auto arg0_width = expr->arg(0)->sort()->bit_width();
auto arg1_width = expr->arg(1)->sort()->bit_width();
dfs_simulator << indent << out_str << " = (sc_biguint<" << arg0_width
<< ">(" << arg0_str << ")" << op_str << "sc_biguint<"
<< arg1_width << ">(" << arg1_str << "));" << std::endl;
} else {
dfs_simulator << indent << out_str << " = (" << arg0_str << op_str
<< arg1_str << ");" << std::endl;
}
}
}

Expand Down Expand Up @@ -357,7 +365,6 @@ void IlaSim::dfs_binary_op_mem(std::stringstream& dfs_simulator,
? "0"
: (GetUidExpr(expr->arg(2)) == AST_UID_EXPR::CONST)
? arg2_str

: arg2_str + ".to_int()";
dfs_simulator << indent << "mem_update_map[" << arg1_str
<< "] = " << arg2_str << ";" << std::endl;
Expand Down

0 comments on commit c7d6f99

Please sign in to comment.