[VPI] read and write values of register arrays ?

This is a discussion on [VPI] read and write values of register arrays ? within the verilog forums in Programming Languages category; Hi all ! I am wondering how to access (write and read) a register array passed as parameter to my vpi function. Here is the resume (dummy) code that I have. ------------------------------------ /* file cosimu.v */ reg [7:0] my_reg_array [0:3][0:3]; initial $c_random_fill(my_reg_array); ------------------------------------------ /* file vpi_func.c */ /* Write value to reg array */ int c_random_fill(char *userdata) { /* get handles ... */ vpiHandle systfref, // handle on current function args_iter, // handle to iterate on arguments argh, // handles on arguments var_name; // handles on variable names /* structures for input arguments */ struct t_vpi_value argval; /* Obtain a ...

Go Back   Application Development Forum > Programming Languages > verilog

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 09-05-2008, 11:28 AM
Nicolas Hervé
Guest
 
Default [VPI] read and write values of register arrays ?

Hi all !

I am wondering how to access (write and read) a register array passed
as parameter to my vpi function.
Here is the resume (dummy) code that I have.

------------------------------------
/* file cosimu.v */

reg [7:0] my_reg_array [0:3][0:3];

initial
$c_random_fill(my_reg_array);


------------------------------------------
/* file vpi_func.c */

/* Write value to reg array */
int c_random_fill(char *userdata)
{

/* get handles ... */
vpiHandle
systfref, // handle on current function
args_iter, // handle to iterate on arguments
argh, // handles on arguments
var_name; // handles on variable names

/* structures for input arguments */
struct t_vpi_value argval;

/* Obtain a handle to the argument list */
systfref = vpi_handle(vpiSysTfCall, NULL);

/* get first handle of function args */
args_iter = vpi_iterate(vpiArgument, systfref);

argh = vpi_scan(args_iter);

/* getting iterator on Verilog data to fill */
argval.format = vpiRegArray;

/* How can I continue here to iterate on the register values of
my_reg_array ? */

vpi_printf("\n Thank you ! \n);

return 0;
}
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 03:57 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.