Simplify edge_detector() a bit

This commit is contained in:
Nick Gasson 2008-06-16 20:06:06 +01:00
parent ae0b09dd3a
commit 1debbc3100
2 changed files with 6 additions and 17 deletions

View File

@ -277,23 +277,11 @@ static int draw_delay(vhdl_process *proc, stmt_container *container,
static void edge_detector(ivl_nexus_t nexus, vhdl_process *proc,
vhdl_binop_expr *test, const char *type)
{
int nptrs = ivl_nexus_ptrs(nexus);
for (int j = 0; j < nptrs; j++) {
ivl_nexus_ptr_t nexus_ptr = ivl_nexus_ptr(nexus, j);
ivl_signal_t sig;
if ((sig = ivl_nexus_ptr_sig(nexus_ptr))) {
const char *signame = get_renamed_signal(sig).c_str();
vhdl_fcall *detect
= new vhdl_fcall(type, vhdl_type::boolean());
detect->add_expr
(new vhdl_var_ref(signame, vhdl_type::std_logic()));
test->add_expr(detect);
proc->add_sensitivity(signame);
break;
}
}
vhdl_var_ref *ref = nexus_to_var_ref(proc->get_parent(), nexus);
vhdl_fcall *detect = new vhdl_fcall(type, vhdl_type::boolean());
detect->add_expr(ref);
test->add_expr(detect);
proc->add_sensitivity(ref->get_name().c_str());
}
/*

View File

@ -48,6 +48,7 @@ public:
: vhdl_expr(type), name_(name) {}
void emit(std::ofstream &of, int level) const;
const std::string &get_name() const { return name_; }
private:
std::string name_;
};