From 647e53bcbb39aeef5890bccc88b332a6f83e2809 Mon Sep 17 00:00:00 2001 From: Cary R Date: Mon, 9 Jun 2008 18:06:28 -0700 Subject: [PATCH] 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. --- tgt-vvp/draw_vpi.c | 2 +- vvp/README.txt | 16 +++++++++++++++- vvp/array.cc | 14 +++----------- vvp/parse.y | 4 ++-- vvp/vpi_priv.h | 1 + 5 files changed, 22 insertions(+), 15 deletions(-) diff --git a/tgt-vvp/draw_vpi.c b/tgt-vvp/draw_vpi.c index 5ea34554f..b1b1928f9 100644 --- a/tgt-vvp/draw_vpi.c +++ b/tgt-vvp/draw_vpi.c @@ -289,7 +289,7 @@ static void draw_vpi_taskfunc_args(const char*call_string, struct vector_info av; av = draw_eval_expr(word_ex, STUFF_OK_XZ); snprintf(buffer, sizeof buffer, - "&A>", sig, av.base, av.wid); + "&A", sig, av.base, av.wid); args[idx].vec = av; args[idx].vec_flag = 1; } else { diff --git a/vvp/README.txt b/vvp/README.txt index 2577a9d17..41df92662 100644 --- a/vvp/README.txt +++ b/vvp/README.txt @@ -780,9 +780,23 @@ The &A<> argument is a reference to the word of a variable array. The syntax is: &A '<' , '>' + &A '<' , '>' The is the label for a variable array, and the 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 ( bits starting at ). + +* The &PV<> argument + +The &PV<> argument is a reference to part of a signal. The syntax is: + + &PV '<' , , '>' + &PV '<' , , '>' + +The is the label for a signal, the is the cannonical +starting bit of the part select and is the number of bits in +the select. The second form retreives the from thread space +using bits starting at . * The T<> argument diff --git a/vvp/array.cc b/vvp/array.cc index 8143f2c23..f78c4c988 100644 --- a/vvp/array.cc +++ b/vvp/array.cc @@ -1071,7 +1071,7 @@ vpiHandle vpip_make_vthr_A(char*label, unsigned addr) 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*) malloc(sizeof (struct __vpiArrayVthrA)); @@ -1082,16 +1082,8 @@ vpiHandle vpip_make_vthr_A(char*label, char*symbol) assert(obj->array); free(label); - unsigned base; - unsigned wid; - 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'); + obj->address = tbase; + obj->wid = twid; return &(obj->base); } diff --git a/vvp/parse.y b/vvp/parse.y index 8fb6e57e8..fea306277 100644 --- a/vvp/parse.y +++ b/vvp/parse.y @@ -817,8 +817,8 @@ argument } | K_A '<' T_SYMBOL ',' T_NUMBER '>' { $$ = vpip_make_vthr_A($3, $5); } - | K_A '<' T_SYMBOL ',' T_SYMBOL '>' - { $$ = vpip_make_vthr_A($3, $5); } + | K_A '<' T_SYMBOL ',' T_NUMBER T_NUMBER '>' + { $$ = vpip_make_vthr_A($3, $5, $6); } | K_PV '<' T_SYMBOL ',' T_NUMBER ',' T_NUMBER '>' { $$ = vpip_make_PV($3, $5, $7); } | K_PV '<' T_SYMBOL ',' '-' T_NUMBER ',' T_NUMBER '>' diff --git a/vvp/vpi_priv.h b/vvp/vpi_priv.h index 4d7b3791e..0f72d24b2 100644 --- a/vvp/vpi_priv.h +++ b/vvp/vpi_priv.h @@ -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, char*symbol); +vpiHandle vpip_make_vthr_A(char*symbol, unsigned tbase, unsigned twid); /* * This function is called before any compilation to load VPI