Remove redundant methods from vhdl_arch
This commit is contained in:
parent
63b1887ff2
commit
e77bb0157e
|
|
@ -46,7 +46,7 @@ static vhdl_var_ref *translate_signal(ivl_expr_t e)
|
||||||
|
|
||||||
const char *renamed = get_renamed_signal(sig).c_str();
|
const char *renamed = get_renamed_signal(sig).c_str();
|
||||||
|
|
||||||
const vhdl_decl *decl = ent->get_arch()->get_decl(strip_var(renamed));
|
const vhdl_decl *decl = ent->get_arch()->get_scope()->get_decl(strip_var(renamed));
|
||||||
assert(decl);
|
assert(decl);
|
||||||
|
|
||||||
vhdl_type *type = new vhdl_type(*decl->get_type());
|
vhdl_type *type = new vhdl_type(*decl->get_type());
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,7 @@ static void declare_signals(vhdl_entity *ent, ivl_scope_t scope)
|
||||||
ivl_signal_port_t mode = ivl_signal_port(sig);
|
ivl_signal_port_t mode = ivl_signal_port(sig);
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case IVL_SIP_NONE:
|
case IVL_SIP_NONE:
|
||||||
ent->get_arch()->add_decl(new vhdl_signal_decl(name.c_str(), sig_type));
|
ent->get_arch()->get_scope()->add_decl(new vhdl_signal_decl(name.c_str(), sig_type));
|
||||||
break;
|
break;
|
||||||
case IVL_SIP_INPUT:
|
case IVL_SIP_INPUT:
|
||||||
ent->get_scope()->add_decl
|
ent->get_scope()->add_decl
|
||||||
|
|
@ -184,7 +184,7 @@ static void declare_signals(vhdl_entity *ent, ivl_scope_t scope)
|
||||||
rename_signal(sig, newname.c_str());
|
rename_signal(sig, newname.c_str());
|
||||||
|
|
||||||
vhdl_type *reg_type = new vhdl_type(*sig_type);
|
vhdl_type *reg_type = new vhdl_type(*sig_type);
|
||||||
ent->get_arch()->add_decl(new vhdl_signal_decl(newname.c_str(), reg_type));
|
ent->get_arch()->get_scope()->add_decl(new vhdl_signal_decl(newname.c_str(), reg_type));
|
||||||
|
|
||||||
// Create a concurrent assignment statement to
|
// Create a concurrent assignment statement to
|
||||||
// connect the register to the output
|
// connect the register to the output
|
||||||
|
|
@ -276,7 +276,7 @@ static void map_signal(ivl_signal_t to, vhdl_entity *parent,
|
||||||
// Don't map a signal to itself!
|
// Don't map a signal to itself!
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if ((decl = parent->get_arch()->get_decl(basename))) {
|
else if ((decl = parent->get_arch()->get_scope()->get_decl(basename))) {
|
||||||
// It's a signal declared in the parent
|
// It's a signal declared in the parent
|
||||||
// Pick this one (any one will do as they're all
|
// Pick this one (any one will do as they're all
|
||||||
// connected together if there's more than one)
|
// connected together if there's more than one)
|
||||||
|
|
@ -345,9 +345,9 @@ static int draw_module(ivl_scope_t scope, ivl_scope_t parent)
|
||||||
assert(parent_arch != NULL);
|
assert(parent_arch != NULL);
|
||||||
|
|
||||||
// Create a forward declaration for it
|
// Create a forward declaration for it
|
||||||
if (!parent_arch->have_declared(ent->get_name())) {
|
if (!parent_arch->get_scope()->have_declared(ent->get_name())) {
|
||||||
vhdl_decl *comp_decl = vhdl_component_decl::component_decl_for(ent);
|
vhdl_decl *comp_decl = vhdl_component_decl::component_decl_for(ent);
|
||||||
parent_arch->add_decl(comp_decl);
|
parent_arch->get_scope()->add_decl(comp_decl);
|
||||||
}
|
}
|
||||||
|
|
||||||
// And an instantiation statement
|
// And an instantiation statement
|
||||||
|
|
|
||||||
|
|
@ -128,11 +128,6 @@ void vhdl_arch::add_stmt(vhdl_conc_stmt *stmt)
|
||||||
stmts_.push_back(stmt);
|
stmts_.push_back(stmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void vhdl_arch::add_decl(vhdl_decl *decl)
|
|
||||||
{
|
|
||||||
scope_.add_decl(decl);
|
|
||||||
}
|
|
||||||
|
|
||||||
void vhdl_arch::emit(std::ofstream &of, int level) const
|
void vhdl_arch::emit(std::ofstream &of, int level) const
|
||||||
{
|
{
|
||||||
emit_comment(of, level);
|
emit_comment(of, level);
|
||||||
|
|
@ -145,21 +140,6 @@ void vhdl_arch::emit(std::ofstream &of, int level) const
|
||||||
blank_line(of, level); // Extra blank line after architectures;
|
blank_line(of, level); // Extra blank line after architectures;
|
||||||
}
|
}
|
||||||
|
|
||||||
vhdl_decl *vhdl_arch::get_decl(const std::string &name) const
|
|
||||||
{
|
|
||||||
return scope_.get_decl(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* True if any declaration of `name' has been added to the
|
|
||||||
* architecture.
|
|
||||||
*/
|
|
||||||
bool vhdl_arch::have_declared(const std::string &name) const
|
|
||||||
{
|
|
||||||
return scope_.have_declared(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
vhdl_process::vhdl_process(const char *name)
|
vhdl_process::vhdl_process(const char *name)
|
||||||
: name_(name), initial_(false)
|
: name_(name), initial_(false)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -565,9 +565,6 @@ public:
|
||||||
virtual ~vhdl_arch();
|
virtual ~vhdl_arch();
|
||||||
|
|
||||||
void emit(std::ofstream &of, int level=0) const;
|
void emit(std::ofstream &of, int level=0) const;
|
||||||
bool have_declared(const std::string &name) const;
|
|
||||||
vhdl_decl *get_decl(const std::string &name) const;
|
|
||||||
void add_decl(vhdl_decl *decl);
|
|
||||||
void add_stmt(vhdl_process *proc);
|
void add_stmt(vhdl_process *proc);
|
||||||
void add_stmt(vhdl_conc_stmt *stmt);
|
void add_stmt(vhdl_conc_stmt *stmt);
|
||||||
vhdl_scope *get_scope() { return &scope_; }
|
vhdl_scope *get_scope() { return &scope_; }
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue