Simplify blocking assignment
Now generates 'wait for 0 ns' after non-blocking assignment
This commit is contained in:
parent
f84f50842c
commit
d22c9a8b05
|
|
@ -163,7 +163,7 @@ static T *make_vhdl_assignment(vhdl_procedural *proc, stmt_container *container,
|
||||||
|
|
||||||
decl->set_initial(rhs);
|
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
|
// This signal may be used e.g. in a loop test so we need
|
||||||
// to make a variable as well
|
// to make a variable as well
|
||||||
blocking_assign_to(proc, sig);
|
blocking_assign_to(proc, sig);
|
||||||
|
|
@ -182,18 +182,18 @@ static T *make_vhdl_assignment(vhdl_procedural *proc, stmt_container *container,
|
||||||
|
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
else
|
else*/
|
||||||
return NULL; // No statement need be emitted
|
return NULL; // No statement need be emitted
|
||||||
}
|
}
|
||||||
else {
|
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
|
// Remember we need to write the variable back to the
|
||||||
// original signal
|
// original signal
|
||||||
blocking_assign_to(proc, sig);
|
blocking_assign_to(proc, sig);
|
||||||
|
|
||||||
// The signal may have been renamed by the above call
|
// The signal may have been renamed by the above call
|
||||||
signame = get_renamed_signal(sig);
|
signame = get_renamed_signal(sig);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
vhdl_type *ltype =
|
vhdl_type *ltype =
|
||||||
new vhdl_type(*proc->get_scope()->get_decl(signame)->get_type());
|
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,
|
static int draw_assign(vhdl_procedural *proc, stmt_container *container,
|
||||||
ivl_statement_t stmt)
|
ivl_statement_t stmt)
|
||||||
{
|
{
|
||||||
|
if (proc->get_scope()->allow_signal_assignment()) {
|
||||||
|
// TODO: Explain blocking assignment here
|
||||||
|
|
||||||
|
vhdl_nbassign_stmt *a =
|
||||||
|
make_assignment<vhdl_nbassign_stmt>(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<vhdl_assign_stmt>(proc, container, stmt, true);
|
make_assignment<vhdl_assign_stmt>(proc, container, stmt, true);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,7 @@ enum time_unit_t {
|
||||||
|
|
||||||
class vhdl_const_time : public vhdl_expr {
|
class vhdl_const_time : public vhdl_expr {
|
||||||
public:
|
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) {}
|
: vhdl_expr(vhdl_type::time(), true), value_(value), units_(units) {}
|
||||||
void emit(std::ostream &of, int level) const;
|
void emit(std::ostream &of, int level) const;
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue