P
priya
Guest
Hi all,
I am doing some project in verilog vpi .Here i am pasting both
verilog and corresponding Verilog VPi code.
Verilog Code is
module Sendoutput(out,in);
input in;
output out;
wire [0:7] in;
reg out,out1;
initial
begin
out=1;
out1=0;
$Sendoutputs_to_VerilogPLI(top.se1);
end
endmodule
Verilog VPI Code
#include <stdlib.h>
#include <stdio.h>
#include "vpi_user.h"
#include "veriuser.h"
int PLIbook_ShowNets_calltf1();
void PLIbook_ShowNets_register(void)
{
p_vpi_systf_data systask_ptr;
s_vpi_systf_data systasks[] =
{
{ vpiSysTask, 0, "$Sendoutputs_to_VerilogPLI",PLIbook_ShowNets_calltf1
, NULL, NULL, NULL },
0
};
systask_ptr = &(systasks[0]);
while (systask_ptr->type)
vpi_register_systf(systask_ptr++);
}
int PLIbook_ShowNets_calltf1(char *user_data)
{
char *a,*b;
vpiHandle systf_handle, arg_iterator, module_handle,
net_iterator, net_handle,net_handle1;
s_vpi_time current_time;
s_vpi_value current_value;
systf_handle = vpi_handle(vpiSysTfCall, NULL);
arg_iterator = vpi_iterate(vpiArgument, systf_handle);
current_value.format = vpiBinStrVal;
current_value.format == vpiBinStrVal
if (net_iterator == NULL)
vpi_printf(" no nets found in this module\n");
else
{
module_handle = vpi_scan(arg_iterator);
vpi_free_object(arg_iterator);
net_iterator = vpi_iterate(vpiReg, module_handle);
net_handle = vpi_scan(net_iterator);
vpi_get_value(net_handle,&current_value);
a=current_value.value.str;
printf("the first reg value is %s",a);
net_handle1 = vpi_scan(net_iterator);
vpi_get_value(net_handle1,&current_value);
b=current_value.value.str;
printf("the second reg value is %s",b);
printf("the verilog values is %s %s",a,b);
}
}
Output of the program
the first reg value is 0
the second reg value is 1
the verilog values is 1 1
In this Verilog Vpi Code, I am getting two register value from verilog
Code.The third printf statement print the same value for both register
values.
actually it will print the value like 0 1
Here i am getting the reg value is 1 1.
Here i Coludnt findout the error...where did i do the mistake..
could someone plz help me out from this error.
regards
priya
I am doing some project in verilog vpi .Here i am pasting both
verilog and corresponding Verilog VPi code.
Verilog Code is
module Sendoutput(out,in);
input in;
output out;
wire [0:7] in;
reg out,out1;
initial
begin
out=1;
out1=0;
$Sendoutputs_to_VerilogPLI(top.se1);
end
endmodule
Verilog VPI Code
#include <stdlib.h>
#include <stdio.h>
#include "vpi_user.h"
#include "veriuser.h"
int PLIbook_ShowNets_calltf1();
void PLIbook_ShowNets_register(void)
{
p_vpi_systf_data systask_ptr;
s_vpi_systf_data systasks[] =
{
{ vpiSysTask, 0, "$Sendoutputs_to_VerilogPLI",PLIbook_ShowNets_calltf1
, NULL, NULL, NULL },
0
};
systask_ptr = &(systasks[0]);
while (systask_ptr->type)
vpi_register_systf(systask_ptr++);
}
int PLIbook_ShowNets_calltf1(char *user_data)
{
char *a,*b;
vpiHandle systf_handle, arg_iterator, module_handle,
net_iterator, net_handle,net_handle1;
s_vpi_time current_time;
s_vpi_value current_value;
systf_handle = vpi_handle(vpiSysTfCall, NULL);
arg_iterator = vpi_iterate(vpiArgument, systf_handle);
current_value.format = vpiBinStrVal;
current_value.format == vpiBinStrVal
if (net_iterator == NULL)
vpi_printf(" no nets found in this module\n");
else
{
module_handle = vpi_scan(arg_iterator);
vpi_free_object(arg_iterator);
net_iterator = vpi_iterate(vpiReg, module_handle);
net_handle = vpi_scan(net_iterator);
vpi_get_value(net_handle,&current_value);
a=current_value.value.str;
printf("the first reg value is %s",a);
net_handle1 = vpi_scan(net_iterator);
vpi_get_value(net_handle1,&current_value);
b=current_value.value.str;
printf("the second reg value is %s",b);
printf("the verilog values is %s %s",a,b);
}
}
Output of the program
the first reg value is 0
the second reg value is 1
the verilog values is 1 1
In this Verilog Vpi Code, I am getting two register value from verilog
Code.The third printf statement print the same value for both register
values.
actually it will print the value like 0 1
Here i am getting the reg value is 1 1.
Here i Coludnt findout the error...where did i do the mistake..
could someone plz help me out from this error.
regards
priya