diff --git a/tgt-vhdl/stmt.cc b/tgt-vhdl/stmt.cc index 302833b75..1f0240a05 100644 --- a/tgt-vhdl/stmt.cc +++ b/tgt-vhdl/stmt.cc @@ -163,7 +163,7 @@ static T *make_vhdl_assignment(vhdl_procedural *proc, stmt_container *container, decl->set_initial(rhs); - if (blocking && proc->get_scope()->allow_signal_assignment()) { + /*if (blocking && proc->get_scope()->allow_signal_assignment()) { // This signal may be used e.g. in a loop test so we need // to make a variable as well blocking_assign_to(proc, sig); @@ -182,18 +182,18 @@ static T *make_vhdl_assignment(vhdl_procedural *proc, stmt_container *container, return a; } - else + else*/ return NULL; // No statement need be emitted } else { - if (blocking && proc->get_scope()->allow_signal_assignment()) { + /*if (blocking && proc->get_scope()->allow_signal_assignment()) { // Remember we need to write the variable back to the // original signal blocking_assign_to(proc, sig); // The signal may have been renamed by the above call signame = get_renamed_signal(sig); - } + }*/ vhdl_type *ltype = new vhdl_type(*proc->get_scope()->get_decl(signame)->get_type()); @@ -292,7 +292,24 @@ static int draw_nbassign(vhdl_procedural *proc, stmt_container *container, static int draw_assign(vhdl_procedural *proc, stmt_container *container, ivl_statement_t stmt) { - make_assignment(proc, container, stmt, true); + if (proc->get_scope()->allow_signal_assignment()) { + // TODO: Explain blocking assignment here + + vhdl_nbassign_stmt *a = + make_assignment(proc, container, stmt, false); + + if (a != NULL) { + // Assignment is a statement and not moved into the initialisation + //if (after != NULL) + // a->set_after(after); + + container->add_stmt + (new vhdl_wait_stmt(VHDL_WAIT_FOR, new vhdl_const_time(0))); + } + } + else + make_assignment(proc, container, stmt, true); + return 0; } diff --git a/tgt-vhdl/vhdl_syntax.hh b/tgt-vhdl/vhdl_syntax.hh index 8d8527346..29e72266c 100644 --- a/tgt-vhdl/vhdl_syntax.hh +++ b/tgt-vhdl/vhdl_syntax.hh @@ -158,7 +158,7 @@ enum time_unit_t { class vhdl_const_time : public vhdl_expr { public: - vhdl_const_time(int64_t value, time_unit_t units) + vhdl_const_time(int64_t value, time_unit_t units = TIME_UNIT_NS) : vhdl_expr(vhdl_type::time(), true), value_(value), units_(units) {} void emit(std::ostream &of, int level) const; private: