initial commit

This commit is contained in:
Ethan Sifferman 2023-07-28 22:22:15 -07:00
parent 999bcb6935
commit eb104a727e
3 changed files with 18 additions and 5 deletions

View File

@ -765,13 +765,13 @@ The .ufunc statements define a call to a user defined function.
:: ::
<label> .ufunc/real <flabel>, <wid>, <label> .ufunc/real <flabel>, <wid>,
<isymbols> ( <psymbols> ) <ssymbol>; [<isymbols> ( <psymbols> )] <ssymbol>;
<label> .ufunc/vec4 <flabel>, <wid>, <label> .ufunc/vec4 <flabel>, <wid>,
<isymbols> ( <psymbols> ) <ssymbol>; [<isymbols> ( <psymbols> )] <ssymbol>;
<label> .ufunc/e <flabel>, <wid>, <trigger>, <label> .ufunc/e <flabel>, <wid>, <trigger>,
<isymbols> ( <psymbols> ) <ssymbol>; [<isymbols> ( <psymbols> )] <ssymbol>;
The first variant is used for functions that only need to be called The first variant is used for functions that only need to be called
when one of their inputs changes value. The second variant is used when one of their inputs changes value. The second variant is used

View File

@ -2077,11 +2077,14 @@ static void draw_lpm_ufunc(ivl_lpm_t net)
fprintf(vvp_out, "L_%p%s .ufunc%s TD_%s, %u", net, dly, type_string, fprintf(vvp_out, "L_%p%s .ufunc%s TD_%s, %u", net, dly, type_string,
vvp_mangle_id(ivl_scope_name(def)), vvp_mangle_id(ivl_scope_name(def)),
ivl_lpm_width(net)); ivl_lpm_width(net));
fprintf(vvp_out, ", ");
/* Print all the net signals that connect to the input of the /* Print all the net signals that connect to the input of the
function. */ function. */
for (idx = 0 ; idx < ninp ; idx += 1) { for (idx = 0 ; idx < ninp ; idx += 1) {
fprintf(vvp_out, ", %s", input_strings[idx]); fprintf(vvp_out, "%s", input_strings[idx]);
if (idx != ninp-1)
fprintf(vvp_out, ", ");
} }
free(input_strings); free(input_strings);
@ -2101,7 +2104,8 @@ static void draw_lpm_ufunc(ivl_lpm_t net)
fprintf(vvp_out, "v%p_0", psig); fprintf(vvp_out, "v%p_0", psig);
} }
fprintf(vvp_out, ")"); if (ninp > 0)
fprintf(vvp_out, ")");
#if 0 #if 0
/* Now print the reference to the signal from which the /* Now print the reference to the signal from which the
result is collected. */ result is collected. */

View File

@ -261,12 +261,21 @@ statement
| T_LABEL K_UFUNC_REAL T_SYMBOL ',' T_NUMBER ',' symbols '(' symbols ')' T_SYMBOL ';' | T_LABEL K_UFUNC_REAL T_SYMBOL ',' T_NUMBER ',' symbols '(' symbols ')' T_SYMBOL ';'
{ compile_ufunc_real($1, $3, $5, $7.cnt, $7.vect, $9.cnt, $9.vect, $11, 0); } { compile_ufunc_real($1, $3, $5, $7.cnt, $7.vect, $9.cnt, $9.vect, $11, 0); }
| T_LABEL K_UFUNC_REAL T_SYMBOL ',' T_NUMBER ',' T_SYMBOL ';'
{ compile_ufunc_real($1, $3, $5, 0, 0, 0, 0, $7, 0); }
| T_LABEL K_UFUNC_VEC4 T_SYMBOL ',' T_NUMBER ',' symbols '(' symbols ')' T_SYMBOL ';' | T_LABEL K_UFUNC_VEC4 T_SYMBOL ',' T_NUMBER ',' symbols '(' symbols ')' T_SYMBOL ';'
{ compile_ufunc_vec4($1, $3, $5, $7.cnt, $7.vect, $9.cnt, $9.vect, $11, 0); } { compile_ufunc_vec4($1, $3, $5, $7.cnt, $7.vect, $9.cnt, $9.vect, $11, 0); }
| T_LABEL K_UFUNC_VEC4 T_SYMBOL ',' T_NUMBER ',' T_SYMBOL ';'
{ compile_ufunc_vec4($1, $3, $5, 0, 0, 0, 0, $7, 0); }
| T_LABEL K_UFUNC_E T_SYMBOL ',' T_NUMBER ',' T_SYMBOL ',' symbols '(' symbols ')' T_SYMBOL ';' | T_LABEL K_UFUNC_E T_SYMBOL ',' T_NUMBER ',' T_SYMBOL ',' symbols '(' symbols ')' T_SYMBOL ';'
{ compile_ufunc_vec4($1, $3, $5, $9.cnt, $9.vect, $11.cnt, $11.vect, $13, $7); } { compile_ufunc_vec4($1, $3, $5, $9.cnt, $9.vect, $11.cnt, $11.vect, $13, $7); }
| T_LABEL K_UFUNC_E T_SYMBOL ',' T_NUMBER ',' T_SYMBOL ',' T_SYMBOL ';'
{ compile_ufunc_vec4($1, $3, $5, 0, 0, 0, 0, $7, 0); }
/* Resolver statements are very much like functors. They are /* Resolver statements are very much like functors. They are
compiled to functors of a different mode. */ compiled to functors of a different mode. */