这篇教程C++ vpi_get_value函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中vpi_get_value函数的典型用法代码示例。如果您正苦于以下问题:C++ vpi_get_value函数的具体用法?C++ vpi_get_value怎么用?C++ vpi_get_value使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了vpi_get_value函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: vpi_get_valueconst char* VpiSignalObjHdl::get_signal_value_binstr(void){ FENTER s_vpi_value value_s = {vpiBinStrVal}; p_vpi_value value_p = &value_s; vpi_get_value(GpiObjHdl::get_handle<vpiHandle>(), value_p); check_vpi_error(); return value_p->value.str;}
开发者ID:ambikeshwar1991,项目名称:cocotb,代码行数:11,
示例2: sys_ferror_calltfstatic PLI_INT32 sys_ferror_calltf(PLI_BYTE8 *name){ vpiHandle callh = vpi_handle(vpiSysTfCall, 0); vpiHandle argv = vpi_iterate(vpiArgument, callh); vpiHandle reg; s_vpi_value val; char *msg; PLI_INT32 size; unsigned chars; PLI_UINT32 fd_mcd; /* Get the file pointer. */ val.format = vpiIntVal; vpi_get_value(vpi_scan(argv), &val); fd_mcd = val.value.integer; /* Get the register to put the string result and figure out how many * characters it will hold. */ reg = vpi_scan(argv); size = vpi_get(vpiSize, reg); chars = size / 8; vpi_free_object(argv); /* If we do not already have an error check that the fd is valid. * The assumption is that the other routines have set errno to * EBADF when they encounter a bad file descriptor, so we do not * need to check here. We also need to special case this since * $fopen() will return 0 (a bad file descriptor) when it has a * problem (sets errno). */ if (!errno && !vpi_get_file(fd_mcd) ) { vpi_printf("WARNING: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("invalid file descriptor (0x%x) given to %s./n", (unsigned int)fd_mcd, name); errno = EBADF; } /* Return the error code. */ val.format = vpiIntVal; val.value.integer = errno; vpi_put_value(callh, &val, 0, vpiNoDelay); /* Only return the number of characters that will fit in the reg. */ msg = (char *) malloc(chars); if (errno != 0) strncpy(msg, strerror(errno), chars-1); else strncpy(msg, "", chars-1); msg[chars-1] = '/0'; val.format = vpiStringVal; val.value.str = msg; vpi_put_value(reg, &val, 0, vpiNoDelay); free(msg); return 0;}
开发者ID:AmkG,项目名称:iverilog,代码行数:54,
示例3: sys_dumpvars_calltfstatic PLI_INT32 sys_dumpvars_calltf(ICARUS_VPI_CONST PLI_BYTE8*name){ vpiHandle callh = vpi_handle(vpiSysTfCall, 0); vpiHandle argv = vpi_iterate(vpiArgument, callh); vpiHandle item; s_vpi_value value; unsigned depth = 0; if (dump_file == 0) { open_dumpfile(callh); if (dump_file == 0) { if (argv) vpi_free_object(argv); return 0; } } if (install_dumpvars_callback()) { if (argv) vpi_free_object(argv); return 0; } /* Get the depth if it exists. */ if (argv) { value.format = vpiIntVal; vpi_get_value(vpi_scan(argv), &value); depth = value.value.integer; } if (!depth) depth = 10000; /* This dumps all the modules in the design if none are given. */ if (!argv || !(item = vpi_scan(argv))) { argv = vpi_iterate(vpiModule, 0x0); assert(argv); /* There must be at least one top level module. */ item = vpi_scan(argv); } for ( ; item; item = vpi_scan(argv)) { int dep = draw_scope(item); scan_item(depth, item, 0); /* The scope list must be sorted after we scan an item. */ vcd_names_sort(&lxt_tab); while (dep--) pop_scope(); } /* Most effective compression. */ if (lxm_optimum_mode == LXM_SPACE) { lt_set_no_interlace(dump_file); } return 0;}
开发者ID:funningboy,项目名称:iverilog,代码行数:54,
示例4: tf_igetp/* * tf_getp and friends, implemented using VPI interface */PLI_INT32 tf_igetp(PLI_INT32 n, void *obj){ vpiHandle sys_h, sys_i, arg_h = 0; s_vpi_value value; int rtn = 0; assert(n > 0); /* get task/func handle */ sys_h = (vpiHandle)obj; sys_i = vpi_iterate(vpiArgument, sys_h); /* find nth arg */ while (n > 0) { if (!(arg_h = vpi_scan(sys_i))) { goto out; } n--; } /* If it is a constant string, return a pointer to it else int value */ if (vpi_get(vpiType, arg_h) == vpiConstant && vpi_get(vpiConstType, arg_h) == vpiStringConst) { value.format = vpiStringVal; vpi_get_value(arg_h, &value); rtn = (int) value.value.str; /* Oh my */ } else { value.format = vpiIntVal; vpi_get_value(arg_h, &value); rtn = value.value.integer; } vpi_free_object(sys_i);out: if (pli_trace) { fprintf(pli_trace, "tf_igetp(n=%d, obj=%p) --> %d/n", n, obj, rtn); } return rtn;}
开发者ID:gserdyuk,项目名称:gnucap-icarus,代码行数:44,
示例5: exm_python_vpi_fileint exm_python_vpi_file(char* arg) { vpiHandle href; vpiHandle arglist; s_vpi_value vpi_value; href = vpi_handle(vpiSysTfCall, 0); arglist = vpi_iterate(vpiArgument, href); vpi_value.format = vpiStringVal; vpi_get_value(vpi_scan(arglist), &vpi_value); return exm_python_file(vpi_value.value.str);}
开发者ID:rporter,项目名称:verilog_integration,代码行数:12,
示例6: show_this_itemstatic void show_this_item(struct vcd_info*info){ s_vpi_value value; if (vpi_get(vpiType, info->item) == vpiRealVar) { value.format = vpiRealVal; vpi_get_value(info->item, &value); fprintf(dump_file, "r%.16g %s/n", value.value.real, info->ident); } else if (vpi_get(vpiSize, info->item) == 1) { value.format = vpiBinStrVal; vpi_get_value(info->item, &value); fprintf(dump_file, "%s%s/n", value.value.str, info->ident); } else { value.format = vpiBinStrVal; vpi_get_value(info->item, &value); fprintf(dump_file, "b%s %s/n", truncate_bitvec(value.value.str), info->ident); }}
开发者ID:Virtual-Labs,项目名称:metal-forming-virtual-simulation-lab-dei,代码行数:21,
示例7: uvm_register_get_max_size/* * FUNCTION: uvm_register_get_max_size() * * This C code checks to see if there is PLI handle * with a value set to define the maximum bit width. * * If no such variable is found, then the default * width of 1024 is used. * * This function should only get called once or twice, * its return value is cached in the caller. * */static int uvm_register_get_max_size(){ vpiHandle ms; s_vpi_value value_s = { vpiIntVal }; ms = vpi_handle_by_name("uvm_register_pkg::UVM_REGISTER_MAX_WIDTH", 0); if(ms == 0) return 1024; /* If nothing else is defined, this is the DEFAULT */ vpi_get_value(ms, &value_s); vpi_printf("UVM_Register DPI-C : Lookup of 'uvm_register_pkg::UVM_REGISTER_MAX_WIDTH' successful. "); vpi_printf("Setting new maximum width to %0d/n", value_s.value.integer); return value_s.value.integer;}
开发者ID:anssprasad,项目名称:UVM_Examples,代码行数:25,
示例8: get_command_datavoid get_command_data(char *userdata){ vpiHandle systfref, args_iter, argh; struct t_vpi_value argval; int value,i; int n = 0; uint32_t data; char* recv_buf; recv_buf = (char *) &data; // cast data as our receive char buffer read_command_data_again: n = read(rsp_to_vpi_pipe[0],recv_buf,4); if ((n < 4) && errno==EAGAIN) goto read_command_data_again; else if (n < 4) { printf("jp_vpi: get_command_data errno: %d/n",errno); perror("jp_vpi: get_command_data read failed"); } if (DBG_JP_VPI) printf("jp_vpi: get_command_data = 0x%.8x/n",data); // Obtain a handle to the argument list systfref = vpi_handle(vpiSysTfCall, NULL); // Now call iterate with the vpiArgument parameter args_iter = vpi_iterate(vpiArgument, systfref); // get a handle on the variable passed to the function argh = vpi_scan(args_iter); // now store the command value back in the sim argval.format = vpiIntVal; // Now set the data value vpi_get_value(argh, &argval); argval.value.integer = (uint32_t) data; // And vpi_put_value() it back into the sim vpi_put_value(argh, &argval, NULL, vpiNoDelay); // Cleanup and return vpi_free_object(args_iter); return;}
开发者ID:AmesianX,项目名称:orpsoc-cores,代码行数:53,
示例9: _mon_check_getputint _mon_check_getput() { VlVpiHandle vh2 = vpi_handle_by_name((PLI_BYTE8*)"t.onebit", NULL); CHECK_RESULT_NZ(vh2); s_vpi_value v; v.format = vpiIntVal; vpi_get_value(vh2, &v); CHECK_RESULT(v.value.integer, 0); s_vpi_time t; t.type = vpiSimTime; t.high = 0; t.low = 0; v.value.integer = 1; vpi_put_value(vh2, &v, &t, vpiNoDelay); vpi_get_value(vh2, &v); CHECK_RESULT(v.value.integer, 1); return 0;}
开发者ID:VarunKoyyalagunta,项目名称:verilator,代码行数:21,
示例10: get_command_addressvoid get_command_address(char *userdata){ vpiHandle systfref, args_iter, argh; struct t_vpi_value argval; int value,i; int n; uint32_t data; char* recv_buf; recv_buf = (char *) &data; // cast data as our receive char buffer n = read(rsp_to_vpi_pipe[0],recv_buf,4); if (n<0) { //client has closed connection //attempt to close and return gracefully return; } if (DBG_JP_VPI) printf("jp_vpi: get_command_address adr=0x%.8x/n",data); // now put the address into the argument passed to the task // Obtain a handle to the argument list systfref = vpi_handle(vpiSysTfCall, NULL); // Now call iterate with the vpiArgument parameter args_iter = vpi_iterate(vpiArgument, systfref); // get a handle on the variable passed to the function argh = vpi_scan(args_iter); // now store the command value back in the sim argval.format = vpiIntVal; // Now set the address value vpi_get_value(argh, &argval); argval.value.integer = (uint32_t) data; // And vpi_put_value() it back into the sim vpi_put_value(argh, &argval, NULL, vpiNoDelay); // Cleanup and return vpi_free_object(args_iter); return;}
开发者ID:AmesianX,项目名称:orpsoc-cores,代码行数:53,
示例11: uvm_hdl_max_width/* * This C code checks to see if there is PLI handle * with a value set to define the maximum bit width. * * If no such variable is found, then the default * width of 1024 is used. * * This function should only get called once or twice, * its return value is cached in the caller. * */static int uvm_hdl_max_width(){ vpiHandle ms; s_vpi_value value_s = { vpiIntVal, { 0 } }; ms = vpi_handle_by_name( (PLI_BYTE8*) "uvm_pkg::UVM_HDL_MAX_WIDTH", 0); if(ms == 0) return 1024; /* If nothing else is defined, this is the DEFAULT */ vpi_get_value(ms, &value_s); return value_s.value.integer;}
开发者ID:enzochiau,项目名称:adopting-uvm,代码行数:23,
示例12: sys_fputc_calltfstatic PLI_INT32 sys_fputc_calltf(PLI_BYTE8*name){ vpiHandle callh = vpi_handle(vpiSysTfCall, 0); vpiHandle argv = vpi_iterate(vpiArgument, callh); vpiHandle arg; s_vpi_value val; PLI_UINT32 fd_mcd; FILE *fp; unsigned char chr; (void) name; /* Not used! */ /* Get the character. */ arg = vpi_scan(argv); val.format = vpiIntVal; vpi_get_value(arg, &val); chr = val.value.integer; /* Get the file/MC descriptor. */ arg = vpi_scan(argv); vpi_free_object(argv); val.format = vpiIntVal; vpi_get_value(arg, &val); fd_mcd = val.value.integer; /* Put the character and return the result. */ fp = vpi_get_file(fd_mcd); val.format = vpiIntVal; if (!fp || IS_MCD(fd_mcd)) { vpi_printf("WARNING: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("invalid file descriptor (0x%x) given to %s./n", fd_mcd, name); val.value.integer = EOF; } else val.value.integer = fputc(chr, fp); vpi_put_value(callh, &val, 0, vpiNoDelay); return 0;}
开发者ID:gserdyuk,项目名称:gnucap-icarus,代码行数:40,
示例13: _mon_check_quadint _mon_check_quad() { VlVpiHandle vh2 = vpi_handle_by_name((PLI_BYTE8*)"t.quads", NULL); CHECK_RESULT_NZ(vh2); s_vpi_value v; t_vpi_vecval vv[2]; bzero(&vv,sizeof(vv)); s_vpi_time t; t.type = vpiSimTime; t.high = 0; t.low = 0; VlVpiHandle vhidx2 = vpi_handle_by_index(vh2, 2); CHECK_RESULT_NZ(vhidx2); VlVpiHandle vhidx3 = vpi_handle_by_index(vh2, 3); CHECK_RESULT_NZ(vhidx2); v.format = vpiVectorVal; v.value.vector = vv; v.value.vector[1].aval = 0x12819213UL; v.value.vector[0].aval = 0xabd31a1cUL; vpi_put_value(vhidx2, &v, &t, vpiNoDelay); v.format = vpiVectorVal; v.value.vector = vv; v.value.vector[1].aval = 0x1c77bb9bUL; v.value.vector[0].aval = 0x3784ea09UL; vpi_put_value(vhidx3, &v, &t, vpiNoDelay); vpi_get_value(vhidx2, &v); CHECK_RESULT(v.value.vector[1].aval, 0x12819213UL); CHECK_RESULT(v.value.vector[1].bval, 0); vpi_get_value(vhidx3, &v); CHECK_RESULT(v.value.vector[1].aval, 0x1c77bb9bUL); CHECK_RESULT(v.value.vector[1].bval, 0); return 0;}
开发者ID:VarunKoyyalagunta,项目名称:verilator,代码行数:40,
示例14: sys_fopenrwa_calltfstatic PLI_INT32 sys_fopenrwa_calltf(PLI_BYTE8*name){ vpiHandle callh = vpi_handle(vpiSysTfCall, 0); vpiHandle argv = vpi_iterate(vpiArgument, callh); vpiHandle file = vpi_scan(argv); s_vpi_value val; char *mode; unsigned idx, len; vpi_free_object(argv); /* Get the mode. */ mode = name + strlen(name) - 1; /* Get the filename. */ val.format = vpiStringVal; vpi_get_value(file, &val); /* Verify that we have a string and that it is not NULL. */ if (val.format != vpiStringVal || !*(val.value.str)) { vpi_printf("WARNING: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's file name argument is not a valid string./n", name); return 0; } /* * Verify that the file name is composed of only printable * characters. */ len = strlen(val.value.str); for (idx = 0; idx < len; idx++) { if (! isprint(val.value.str[idx])) { char msg [64]; snprintf(msg, 64, "WARNING: %s:%d:", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s %s's file name argument contains non-" "printable characters./n", msg, name); vpi_printf("%*s /"%s/"/n", (int) strlen(msg), " ", val.value.str); return 0; } } /* Open the file and return the result. */ val.format = vpiIntVal; val.value.integer = vpi_fopen(val.value.str, mode); vpi_put_value(callh, &val, 0, vpiNoDelay); return 0;}
开发者ID:gserdyuk,项目名称:gnucap-icarus,代码行数:52,
示例15: PLIbook_PowCalltfstatic PLI_INT32 PLIbook_PowCalltf(PLI_BYTE8 *user_data)#endif{ s_vpi_value value_s; vpiHandle systf_handle, arg_itr, arg_handle; PLI_INT32 base, expo; double result; (void)user_data; /* Parameter is not used. */ //vpi_printf("/n$my_pow PLI calltf function./n/n"); systf_handle = vpi_handle(vpiSysTfCall, NULL); arg_itr = vpi_iterate(vpiArgument, systf_handle); if (arg_itr == NULL) { vpi_printf("ERROR: $my_pow failed to obtain systf arg handles/n"); return(0); } /* read base from systf arg 1 (compiletf has already verified) */ arg_handle = vpi_scan(arg_itr); value_s.format = vpiIntVal; vpi_get_value(arg_handle, &value_s); base = value_s.value.integer; /* read exponent from systf arg 2 (compiletf has already verified) */ arg_handle = vpi_scan(arg_itr); vpi_free_object(arg_itr); /* not calling scan until returns null */ vpi_get_value(arg_handle, &value_s); expo = value_s.value.integer; /* calculate result of base to power of exponent */ result = pow( (double)base, (double)expo ); /* write result to simulation as return value $my_pow */ value_s.value.integer = (PLI_INT32)result; vpi_put_value(systf_handle, &value_s, NULL, vpiNoDelay); return(0);}
开发者ID:SuvenduDash,项目名称:ivtest,代码行数:39,
示例16: sys_mti_random_calltfstatic PLI_INT32 sys_mti_random_calltf(ICARUS_VPI_CONST PLI_BYTE8*name){ vpiHandle callh, argv, seed = 0; s_vpi_value val; int i_seed = COOKIE; struct context_s *context; (void)name; /* Parameter is not used. */ /* Get the argument list and look for a seed. If it is there, get the value and reseed the random number generator. */ callh = vpi_handle(vpiSysTfCall, 0); argv = vpi_iterate(vpiArgument, callh); val.format = vpiIntVal; if (argv) { seed = vpi_scan(argv); vpi_free_object(argv); vpi_get_value(seed, &val); i_seed = val.value.integer; /* Since there is a seed use the current context or create a new one */ context = (struct context_s *)vpi_get_userdata(callh); if (!context) { context = (struct context_s *)calloc(1, sizeof(*context)); context->mti = NP1; /* squirrel away context */ vpi_put_userdata(callh, (void *)context); } /* If the argument is not the Icarus cookie, then reseed context */ if (i_seed != COOKIE) sgenrand(context, i_seed); } else { /* use global context */ context = &global_context; } /* Calculate and return the result */ val.value.integer = genrand(context); vpi_put_value(callh, &val, 0, vpiNoDelay); /* mark seed with cookie */ if (seed && i_seed != COOKIE) { val.value.integer = COOKIE; vpi_put_value(seed, &val, 0, vpiNoDelay); } return 0;}
开发者ID:13572293130,项目名称:iverilog,代码行数:51,
示例17: sys_dumplimit_calltfstatic PLI_INT32 sys_dumplimit_calltf(ICARUS_VPI_CONST PLI_BYTE8 *name){ vpiHandle callh = vpi_handle(vpiSysTfCall, 0); vpiHandle argv = vpi_iterate(vpiArgument, callh); s_vpi_value val; /* Get the value and set the dump limit. */ val.format = vpiIntVal; vpi_get_value(vpi_scan(argv), &val); dump_limit = val.value.integer; vpi_free_object(argv); return 0;}
开发者ID:ThomsonTan,项目名称:iverilog,代码行数:14,
示例18: sys_fgets_calltfstatic int sys_fgets_calltf(char *name){ unsigned int mcd; FILE*fd; s_vpi_value value, rval; char*txt; unsigned txt_len; vpiHandle sys = vpi_handle(vpiSysTfCall, 0); vpiHandle argv = vpi_iterate(vpiArgument, sys); vpiHandle str = vpi_scan(argv); vpiHandle mch = vpi_scan(argv); value.format = vpiIntVal; vpi_get_value(mch, &value); mcd = value.value.integer; fd = vpi_get_file(mcd); if (!fd || IS_MCD(mcd)) { rval.format = vpiIntVal; rval.value.integer = 0; vpi_put_value(sys, &rval, 0, vpiNoDelay); return 0; } txt_len = vpi_get(vpiSize, str) / 8; txt = malloc(txt_len + 1); if (fgets(txt, txt_len, fd) == 0) { rval.format = vpiIntVal; rval.value.integer = 0; vpi_put_value(sys, &rval, 0, vpiNoDelay); free(txt); return 0; } rval.format = vpiIntVal; rval.value.integer = strlen(txt); vpi_put_value(sys, &rval, 0, vpiNoDelay); value.format = vpiStringVal; value.value.str = txt; vpi_put_value(str, &value, 0, vpiNoDelay); free(txt); return 0;}
开发者ID:Virtual-Labs,项目名称:metal-forming-virtual-simulation-lab-dei,代码行数:49,
示例19: uvm_register_get_hdl/* * FUNCTION: uvm_register_set_hdl * * Given a path, look the path name up using the PLI, * and return its 'value'. */void uvm_register_get_hdl(char *path, p_vpi_vecval value){ static int maxsize = -1; int i, size, chunks; vpiHandle r; s_vpi_value value_s; r = vpi_handle_by_name(path, 0); if(r == 0) { vpi_printf("FATAL uvm_register : unable to locate hdl path %s/n", path); vpi_printf(" Either the name is incorrect, or you may not have PLI visibility to that name"); vpi_printf(" To gain PLI visibility, make sure you use +acc=rmb when you invoke vlog"); vpi_printf(" vlog +acc=rmb ...."); tf_dofinish(); } else { if(maxsize == -1) maxsize = uvm_register_get_max_size(); size = vpi_get(vpiSize, r); if(size > maxsize) { vpi_printf("FATAL uvm_register : hdl path '%s' is %0d bits,/n", path, size); vpi_printf(" but the maximum size is %0d, redefine using a compile/n", maxsize); vpi_printf(" flag. i.e. %s/n", "vlog ... +define+UVM_REGISTER_MAX_WIDTH=<value>"); tf_dofinish(); } chunks = (size-1)/32 + 1; value_s.format = vpiVectorVal; vpi_get_value(r, &value_s); /*dpi and vpi are reversed*/ /* -> Not on Questa, and not in the LRM */ for(i=0;i<chunks; ++i) {#ifdef NCSIM // Code for NC. // Reverse a/b on NC. value[i].aval = value_s.value.vector[i].bval; value[i].bval = value_s.value.vector[i].aval;#else // Code for Questa value[i].aval = value_s.value.vector[i].aval; value[i].bval = value_s.value.vector[i].bval;#endif } }}
开发者ID:anssprasad,项目名称:UVM_Examples,代码行数:55,
示例20: va_double_argument_calltf/* * Routine to implement the double argument math functions. */static PLI_INT32 va_double_argument_calltf(ICARUS_VPI_CONST PLI_BYTE8 *ud){ vpiHandle callh = vpi_handle(vpiSysTfCall, 0); s_vpi_value val; double first_arg; va_double_t* fun_data; (void) ud; /* Not used! */ /* Retrieve the function and argument data. */ fun_data = vpi_get_userdata(callh); /* Calculate the result */ val.format = vpiRealVal; vpi_get_value(fun_data->arg1, &val); first_arg = val.value.real; vpi_get_value(fun_data->arg2, &val); val.value.real = (fun_data->func)(first_arg, val.value.real); /* Return the result */ vpi_put_value(callh, &val, 0, vpiNoDelay); return 0;}
开发者ID:ThomsonTan,项目名称:iverilog,代码行数:27,
示例21: sys_mti_dist_uniform_calltfstatic PLI_INT32 sys_mti_dist_uniform_calltf(ICARUS_VPI_CONST PLI_BYTE8*name){ vpiHandle callh, argv, seed, start, end; s_vpi_value val; long i_seed, i_start, i_end; (void)name; /* Parameter is not used. */ /* Get the argument handles and convert them. */ callh = vpi_handle(vpiSysTfCall, 0); argv = vpi_iterate(vpiArgument, callh); seed = vpi_scan(argv); start = vpi_scan(argv); end = vpi_scan(argv); val.format = vpiIntVal; vpi_get_value(seed, &val); i_seed = val.value.integer; vpi_get_value(start, &val); i_start = val.value.integer; vpi_get_value(end, &val); i_end = val.value.integer; /* Calculate and return the result. */ val.value.integer = mti_dist_uniform(&i_seed, i_start, i_end); vpi_put_value(callh, &val, 0, vpiNoDelay); /* Return the seed. */ val.value.integer = i_seed; vpi_put_value(seed, &val, 0, vpiNoDelay); vpi_free_object(argv); return 0;}
开发者ID:13572293130,项目名称:iverilog,代码行数:36,
示例22: watchreal_cbstatic PLI_INT32 watchreal_cb(p_cb_data cb){ s_vpi_value value; vpiHandle arg = (vpiHandle) (cb->user_data); value.format = vpiRealVal; vpi_get_value(arg, &value); assert(value.format == vpiRealVal); vpi_printf("watchreal: %s = %f/n", vpi_get_str(vpiName, arg), value.value.real); return 0;}
开发者ID:orsonmmz,项目名称:ivtest,代码行数:15,
示例23: vpi_procvoidvpi_proc (void){ vpiHandle net; s_vpi_value val; net = vpi_handle_by_name ("test_load.dat_o", NULL); if (net == NULL) { printf ("cannot get net/n"); return; } val.format = vpiBinStrVal; vpi_get_value (net, &val); printf ("value: %s/n", val.value.str);}
开发者ID:Jonsba,项目名称:ghdl,代码行数:16,
示例24: sys_fflush_calltf/* * Implement $fflush system function */static PLI_INT32 sys_fflush_calltf(PLI_BYTE8*name){ vpiHandle callh = vpi_handle(vpiSysTfCall, 0); vpiHandle argv = vpi_iterate(vpiArgument, callh); vpiHandle arg; s_vpi_value val; PLI_UINT32 fd_mcd; FILE *fp; errno = 0; /* If we have no argument then flush all the streams. */ if (argv == 0) { fflush(NULL); return 0; } /* Get the file/MC descriptor and verify that it is valid. */ arg = vpi_scan(argv); vpi_free_object(argv); val.format = vpiIntVal; vpi_get_value(arg, &val); fd_mcd = val.value.integer; /* If the MCD is zero we have nothing to do so just return. */ if (fd_mcd == 0) return 0; if ((! IS_MCD(fd_mcd) && vpi_get_file(fd_mcd) == NULL) || ( IS_MCD(fd_mcd) && vpi_mcd_printf(fd_mcd, "%s", "") == EOF) || (! fd_mcd)) { vpi_printf("WARNING: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("invalid file descriptor/MCD (0x%x) given to %s./n", (unsigned int)fd_mcd, name); errno = EBADF; return 0; } if (IS_MCD(fd_mcd)) { vpi_mcd_flush(fd_mcd); } else { /* If we have a valid file descriptor flush the file. */ fp = vpi_get_file(fd_mcd); if (fp) fflush(fp); } return 0;}
开发者ID:AmkG,项目名称:iverilog,代码行数:50,
示例25: sys_dumplimit_calltfstatic PLI_INT32 sys_dumplimit_calltf(ICARUS_VPI_CONST PLI_BYTE8 *name){ vpiHandle callh = vpi_handle(vpiSysTfCall, 0); vpiHandle argv = vpi_iterate(vpiArgument, callh); s_vpi_value val; (void)name; /* Parameter is not used. */ /* Get the value and set the dump limit. */ val.format = vpiIntVal; vpi_get_value(vpi_scan(argv), &val); dump_limit = val.value.integer; fstWriterSetDumpSizeLimit(dump_file, dump_limit); vpi_free_object(argv); return 0;}
开发者ID:bzero,项目名称:iverilog,代码行数:17,
示例26: listparams_calltfstatic PLI_INT32 listparams_calltf(PLI_BYTE8*name)#endif{ vpiHandle sys = vpi_handle(vpiSysTfCall,0); vpiHandle scope= vpi_handle(vpiScope, sys); vpiHandle argv = vpi_iterate(vpiArgument, sys); vpiHandle item; while ( (item = vpi_scan(argv)) ) { s_vpi_value value; value.format = vpiStringVal; vpi_get_value(item, &value); param_by_name(scope, value.value.str); } return 0;}
开发者ID:jaredcasper,项目名称:ivtest,代码行数:17,
示例27: next_sim_time_callbackstatic PLI_INT32 next_sim_time_callback(struct t_cb_data*cb){ vpiHandle obj = (vpiHandle)cb->user_data; s_vpi_value val; s_vpi_time tim; val.format = vpiIntVal; vpi_get_value(obj, &val); tim.type = vpiSimTime; vpi_get_time(obj, &tim); vpi_printf("Callback time=%d %s=%d/n", (int)tim.low, vpi_get_str(vpiName, obj), (int)val.value.integer); return 0;}
开发者ID:orsonmmz,项目名称:ivtest,代码行数:17,
示例28: _mon_check_value_callbacksint _mon_check_value_callbacks() { vpiHandle vh1 = vpi_handle_by_name((PLI_BYTE8*)"t.count", NULL); CHECK_RESULT_NZ(vh1); s_vpi_value v; v.format = vpiIntVal; vpi_get_value(vh1, &v); t_cb_data cb_data; cb_data.reason = cbValueChange; cb_data.cb_rtn = _value_callback; cb_data.obj = vh1; cb_data.value = &v; vpiHandle vh = vpi_register_cb(&cb_data); CHECK_RESULT_NZ(vh); vh1 = vpi_handle_by_name((PLI_BYTE8*)"t.half_count", NULL); CHECK_RESULT_NZ(vh1); cb_data.obj = vh1; cb_data.cb_rtn = _value_callback_half; vh = vpi_register_cb(&cb_data); CHECK_RESULT_NZ(vh); vh1 = vpi_handle_by_name((PLI_BYTE8*)"t.quads", NULL); CHECK_RESULT_NZ(vh1); v.format = vpiVectorVal; cb_data.obj = vh1; cb_data.cb_rtn = _value_callback_quad; vh = vpi_register_cb(&cb_data); CHECK_RESULT_NZ(vh); vh1 = vpi_handle_by_index(vh1, 2); CHECK_RESULT_NZ(vh1); cb_data.obj = vh1; cb_data.cb_rtn = _value_callback_quad; vh = vpi_register_cb(&cb_data); CHECK_RESULT_NZ(vh); return 0;}
开发者ID:VarunKoyyalagunta,项目名称:verilator,代码行数:46,
示例29: sys_sdf_annotate_calltfstatic PLI_INT32 sys_sdf_annotate_calltf(PLI_BYTE8*name){ s_vpi_value value; vpiHandle sys = vpi_handle(vpiSysTfCall,0); vpiHandle argv = vpi_iterate(vpiArgument, sys); /* The first argument is the path to the SDF file. */ vpiHandle path = vpi_scan(argv); assert(path); value.format = vpiStringVal; vpi_get_value(path, &value); if ((value.format != vpiStringVal) || !value.value.str) { vpi_printf("ERROR: %s: File name argument (type=%d)" " does not have a string value./n", name, vpi_get(vpiType, path)); vpi_control(vpiFinish, 1); return 0; } char*path_str = strdup(value.value.str); FILE*sdf_fd = fopen(path_str, "r"); if (sdf_fd == 0) { vpi_printf("ERROR: %s: Unable to open SDF file `%s'." " Skipping annotation./n", name, path_str); return 0; } /* The optional second argument is the scope to annotate. */ sdf_scope = vpi_scan(argv); if (sdf_scope) vpi_free_object(argv); if (sdf_scope == 0) { sdf_scope = vpi_handle(vpiScope,sys); } sdf_cur_cell = 0; sdf_process_file(sdf_fd, path_str); fclose(sdf_fd); free(path_str); return 0;}
开发者ID:gserdyuk,项目名称:gnucap-icarus,代码行数:45,
注:本文中的vpi_get_value函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ vpi_handle函数代码示例 C++ vpi_get_str函数代码示例 |