Add helper function for creating variable declarations
Variables don't have a delay or strength and the NetNet::Type is known. Add a small wrapper around pform_makewire() that can be used to create variables. This will allow to reduce the boilerplate code for variable declarations. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
parent
6708c0f6df
commit
9da057ceb1
2
parse.y
2
parse.y
|
|
@ -1660,7 +1660,7 @@ loop_statement /* IEEE1800-2005: A.6.8 */
|
|||
decl_assignment_t*tmp_assign = new decl_assignment_t;
|
||||
tmp_assign->name = lex_strings.make($4);
|
||||
assign_list.push_back(tmp_assign);
|
||||
pform_makewire(@4, 0, str_strength, &assign_list, NetNet::REG, $3);
|
||||
pform_make_var(@4, &assign_list, $3);
|
||||
}
|
||||
statement_or_null
|
||||
{ pform_name_t tmp_hident;
|
||||
|
|
|
|||
13
pform.cc
13
pform.cc
|
|
@ -989,11 +989,18 @@ PCallTask* pform_make_call_task(const struct vlltype&loc,
|
|||
return tmp;
|
||||
}
|
||||
|
||||
void pform_make_foreach_declarations(const struct vlltype&loc,
|
||||
std::list<perm_string>*loop_vars)
|
||||
void pform_make_var(const struct vlltype&loc,
|
||||
std::list<decl_assignment_t*>*assign_list,
|
||||
data_type_t*data_type, std::list<named_pexpr_t>*attr)
|
||||
{
|
||||
static const struct str_pair_t str = { IVL_DR_STRONG, IVL_DR_STRONG };
|
||||
|
||||
pform_makewire(loc, 0, str, assign_list, NetNet::REG, data_type, attr);
|
||||
}
|
||||
|
||||
void pform_make_foreach_declarations(const struct vlltype&loc,
|
||||
std::list<perm_string>*loop_vars)
|
||||
{
|
||||
list<decl_assignment_t*>assign_list;
|
||||
for (list<perm_string>::const_iterator cur = loop_vars->begin()
|
||||
; cur != loop_vars->end() ; ++ cur) {
|
||||
|
|
@ -1002,7 +1009,7 @@ void pform_make_foreach_declarations(const struct vlltype&loc,
|
|||
assign_list.push_back(tmp_assign);
|
||||
}
|
||||
|
||||
pform_makewire(loc, 0, str, &assign_list, NetNet::REG, &size_type);
|
||||
pform_make_var(loc, &assign_list, &size_type);
|
||||
}
|
||||
|
||||
PForeach* pform_make_foreach(const struct vlltype&loc,
|
||||
|
|
|
|||
5
pform.h
5
pform.h
|
|
@ -363,6 +363,11 @@ extern void pform_makewire(const struct vlltype&li,
|
|||
data_type_t*data_type,
|
||||
std::list<named_pexpr_t>*attr = 0);
|
||||
|
||||
extern void pform_make_var(const struct vlltype&loc,
|
||||
std::list<decl_assignment_t*>*assign_list,
|
||||
data_type_t*data_type,
|
||||
std::list<named_pexpr_t>*attr = 0);
|
||||
|
||||
extern void pform_make_var_init(const struct vlltype&li,
|
||||
perm_string name, PExpr*expr);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue