Better handle some different function types in the .scope setup.

This commit is contained in:
Stephen Williams 2016-01-31 16:16:02 -08:00
parent 604a62379c
commit fac7de2133
2 changed files with 8 additions and 3 deletions

View File

@ -2053,8 +2053,8 @@ extern "C" ivl_variable_type_t ivl_scope_func_type(ivl_scope_t net)
extern "C" int ivl_scope_func_signed(ivl_scope_t net)
{
assert(net);
assert(net->type_ == IVL_SCT_FUNCTION);
assert(net->func_type == IVL_VT_LOGIC);
assert(net->type_==IVL_SCT_FUNCTION);
assert(net->func_type==IVL_VT_LOGIC || net->func_type==IVL_VT_BOOL);
return net->func_signed? !0 : 0;
}
@ -2062,7 +2062,7 @@ extern "C" unsigned ivl_scope_func_width(ivl_scope_t net)
{
assert(net);
assert(net->type_ == IVL_SCT_FUNCTION);
assert(net->func_type == IVL_VT_LOGIC);
assert(net->func_type==IVL_VT_LOGIC || net->func_type==IVL_VT_BOOL);
return net->func_width;
}

View File

@ -2254,6 +2254,7 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent)
if (ivl_scope_type(net)==IVL_SCT_FUNCTION) {
switch (ivl_scope_func_type(net)) {
case IVL_VT_LOGIC:
case IVL_VT_BOOL:
snprintf(suffix, sizeof suffix, ".vec4.%c%u",
ivl_scope_func_signed(net)? 'u' : 's',
ivl_scope_func_width(net));
@ -2265,8 +2266,12 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent)
snprintf(suffix, sizeof suffix, ".str");
break;
case IVL_VT_CLASS:
case IVL_VT_DARRAY:
case IVL_VT_QUEUE:
snprintf(suffix, sizeof suffix, ".obj");
break;
case IVL_VT_VOID:
assert(0);
default:
assert(0);
break;