Make &A<> use the same thread access syntax as &PV<>.

This patch makes &A<> use the same thread access syntax as
&PV<> this is two unsigned numbers separated by a space
instead of a single number.
This commit is contained in:
Cary R 2008-06-09 18:06:28 -07:00 committed by Stephen Williams
parent 8439fc6c19
commit 647e53bcbb
5 changed files with 22 additions and 15 deletions

View File

@ -289,7 +289,7 @@ static void draw_vpi_taskfunc_args(const char*call_string,
struct vector_info av; struct vector_info av;
av = draw_eval_expr(word_ex, STUFF_OK_XZ); av = draw_eval_expr(word_ex, STUFF_OK_XZ);
snprintf(buffer, sizeof buffer, snprintf(buffer, sizeof buffer,
"&A<v%p, T<%u,%u,u>>", sig, av.base, av.wid); "&A<v%p, %u %u>", sig, av.base, av.wid);
args[idx].vec = av; args[idx].vec = av;
args[idx].vec_flag = 1; args[idx].vec_flag = 1;
} else { } else {

View File

@ -780,9 +780,23 @@ The &A<> argument is a reference to the word of a variable array. The
syntax is: syntax is:
&A '<' <symbol> , <number> '>' &A '<' <symbol> , <number> '>'
&A '<' <symbol> , <base> <width> '>'
The <symbol> is the label for a variable array, and the <number> is The <symbol> is the label for a variable array, and the <number> is
the cannonical word index as an unsigned integer. the cannonical word index as an unsigned integer. The second form
retrives the index from thread space (<width> bits starting at <base>).
* The &PV<> argument
The &PV<> argument is a reference to part of a signal. The syntax is:
&PV '<' <symbol> , <base> , <width> '>'
&PV '<' <symbol> , <tbase> <twid> , <width> '>'
The <symbol> is the label for a signal, the <base> is the cannonical
starting bit of the part select and <width> is the number of bits in
the select. The second form retreives the <base> from thread space
using <twid> bits starting at <tbase>.
* The T<> argument * The T<> argument

View File

@ -1071,7 +1071,7 @@ vpiHandle vpip_make_vthr_A(char*label, unsigned addr)
return &(obj->base); return &(obj->base);
} }
vpiHandle vpip_make_vthr_A(char*label, char*symbol) vpiHandle vpip_make_vthr_A(char*label, unsigned tbase, unsigned twid)
{ {
struct __vpiArrayVthrA*obj = (struct __vpiArrayVthrA*) struct __vpiArrayVthrA*obj = (struct __vpiArrayVthrA*)
malloc(sizeof (struct __vpiArrayVthrA)); malloc(sizeof (struct __vpiArrayVthrA));
@ -1082,16 +1082,8 @@ vpiHandle vpip_make_vthr_A(char*label, char*symbol)
assert(obj->array); assert(obj->array);
free(label); free(label);
unsigned base; obj->address = tbase;
unsigned wid; obj->wid = twid;
char sflag;
int rc = sscanf(symbol, "T<%u,%u,%c>", &base, &wid, &sflag);
assert(rc == 3);
free(symbol);
obj->address = base;
obj->wid = wid;
assert(sflag == 'u');
return &(obj->base); return &(obj->base);
} }

View File

@ -817,8 +817,8 @@ argument
} }
| K_A '<' T_SYMBOL ',' T_NUMBER '>' | K_A '<' T_SYMBOL ',' T_NUMBER '>'
{ $$ = vpip_make_vthr_A($3, $5); } { $$ = vpip_make_vthr_A($3, $5); }
| K_A '<' T_SYMBOL ',' T_SYMBOL '>' | K_A '<' T_SYMBOL ',' T_NUMBER T_NUMBER '>'
{ $$ = vpip_make_vthr_A($3, $5); } { $$ = vpip_make_vthr_A($3, $5, $6); }
| K_PV '<' T_SYMBOL ',' T_NUMBER ',' T_NUMBER '>' | K_PV '<' T_SYMBOL ',' T_NUMBER ',' T_NUMBER '>'
{ $$ = vpip_make_PV($3, $5, $7); } { $$ = vpip_make_PV($3, $5, $7); }
| K_PV '<' T_SYMBOL ',' '-' T_NUMBER ',' T_NUMBER '>' | K_PV '<' T_SYMBOL ',' '-' T_NUMBER ',' T_NUMBER '>'

View File

@ -447,6 +447,7 @@ vpiHandle vpip_make_vthr_word(unsigned base, const char*type);
vpiHandle vpip_make_vthr_A(char*symbol, unsigned index); vpiHandle vpip_make_vthr_A(char*symbol, unsigned index);
vpiHandle vpip_make_vthr_A(char*symbol, char*symbol); vpiHandle vpip_make_vthr_A(char*symbol, char*symbol);
vpiHandle vpip_make_vthr_A(char*symbol, unsigned tbase, unsigned twid);
/* /*
* This function is called before any compilation to load VPI * This function is called before any compilation to load VPI