gen = NULL;
/* if the current chip is a template then compile
a reference to a generic name as the expression
will be copied, so pointer references are not
valid */
if (current_chip)
{
/* make sure the generic exists locally */
gen = get_generic_ref (¤t_chip->generics, name);
}
if (!gen)
{ /* scope is local to known design? */
gen = get_generic_ref (&global_generics, name);
}
if (!gen)
{ /* scope is external not local */
gen = get_generic_ref (&partition_generics, name);
}
if (!gen)
{ /* undefined, so compile a reference */
$$ = compile_reference (name);
}
else
{
$$ = compile_variable (gen, name);
}
}