Output blocking assignments in the right place

This commit is contained in:
Nick Gasson 2008-06-23 12:30:48 +01:00
parent d06f5c7c54
commit 469036990a
3 changed files with 5 additions and 7 deletions

View File

@ -104,7 +104,7 @@ void blocking_assign_to(vhdl_process *proc, ivl_signal_t sig)
* the new values visible outside the current process. This should be
* called before any `wait' statement or the end of the process.
*/
void draw_blocking_assigns(vhdl_process *proc)
void draw_blocking_assigns(vhdl_process *proc, stmt_container *container)
{
var_temp_set_t::const_iterator it;
for (it = g_assign_vars.begin(); it != g_assign_vars.end(); ++it) {
@ -117,9 +117,7 @@ void draw_blocking_assigns(vhdl_process *proc)
vhdl_var_ref *lhs = new vhdl_var_ref(stripped.c_str(), NULL);
vhdl_expr *rhs = new vhdl_var_ref((*it).first.c_str(), type);
// TODO: I'm not sure this will work properly if, e.g., the delay
// is inside a `if' statement
proc->get_container()->add_stmt(new vhdl_nbassign_stmt(lhs, rhs));
container->add_stmt(new vhdl_nbassign_stmt(lhs, rhs));
// Undo the renaming (since the temporary is no longer needed)
rename_signal((*it).second, stripped);
@ -164,7 +162,7 @@ static int generate_vhdl_process(vhdl_entity *ent, ivl_process_t proc)
return rc;
// Output any remaning blocking assignments
draw_blocking_assigns(vhdl_proc);
draw_blocking_assigns(vhdl_proc, vhdl_proc->get_container());
// Initial processes are translated to VHDL processes with
// no sensitivity list and and indefinite wait statement at

View File

@ -252,7 +252,7 @@ static int draw_delay(vhdl_process *proc, stmt_container *container,
else {
// All blocking assignments need to be made visible
// at this point
draw_blocking_assigns(proc);
draw_blocking_assigns(proc, container);
vhdl_wait_stmt *wait =
new vhdl_wait_stmt(VHDL_WAIT_FOR, time);

View File

@ -33,7 +33,7 @@ const std::string &get_renamed_signal(ivl_signal_t sig);
void blocking_assign_to(vhdl_process *proc, ivl_signal_t sig);
std::string strip_var(const std::string &str);
void draw_blocking_assigns(vhdl_process *proc);
void draw_blocking_assigns(vhdl_process *proc, stmt_container *container);
int draw_stask_display(vhdl_process *proc, stmt_container *container,
ivl_statement_t stmt, bool newline = true);