Add UFUNC LPM type

This commit is contained in:
Nick Gasson 2008-06-30 16:35:29 +01:00
parent b82ca28190
commit e08e29c8b4
1 changed files with 23 additions and 0 deletions

View File

@ -88,6 +88,27 @@ int draw_part_select_lpm(vhdl_arch *arch, ivl_lpm_t lpm)
return 0; return 0;
} }
int draw_ufunc_lpm(vhdl_arch *arch, ivl_lpm_t lpm)
{
vhdl_fcall *fcall = new vhdl_fcall(ivl_lpm_basename(lpm), NULL);
for (unsigned i = 0; i < ivl_lpm_size(lpm); i++) {
vhdl_var_ref *ref = nexus_to_var_ref(arch->get_scope(), ivl_lpm_data(lpm, i));
if (NULL == ref)
return 1;
fcall->add_expr(ref);
}
vhdl_var_ref *out = nexus_to_var_ref(arch->get_scope(), ivl_lpm_q(lpm, 0));
if (NULL == out)
return 1;
arch->add_stmt(new vhdl_cassign_stmt(out, fcall));
return 0;
}
int draw_lpm(vhdl_arch *arch, ivl_lpm_t lpm) int draw_lpm(vhdl_arch *arch, ivl_lpm_t lpm)
{ {
switch (ivl_lpm_type(lpm)) { switch (ivl_lpm_type(lpm)) {
@ -99,6 +120,8 @@ int draw_lpm(vhdl_arch *arch, ivl_lpm_t lpm)
return draw_binop_lpm(arch, lpm, VHDL_BINOP_MULT); return draw_binop_lpm(arch, lpm, VHDL_BINOP_MULT);
case IVL_LPM_PART_VP: case IVL_LPM_PART_VP:
return draw_part_select_lpm(arch, lpm); return draw_part_select_lpm(arch, lpm);
case IVL_LPM_UFUNC:
return draw_ufunc_lpm(arch, lpm);
default: default:
error("Unsupported LPM type: %d", ivl_lpm_type(lpm)); error("Unsupported LPM type: %d", ivl_lpm_type(lpm));
return 1; return 1;