这篇教程C++ vpi_put_value函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中vpi_put_value函数的典型用法代码示例。如果您正苦于以下问题:C++ vpi_put_value函数的具体用法?C++ vpi_put_value怎么用?C++ vpi_put_value使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了vpi_put_value函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: uvm_hdl_set_vlog/* * Given a path, look the path name up using the PLI, * and set it to 'value'. */static int uvm_hdl_set_vlog(char *path, p_vpi_vecval value, PLI_INT32 flag){ static int maxsize = -1; vpiHandle r; s_vpi_value value_s = { vpiIntVal, { 0 } }; s_vpi_time time_s = { vpiSimTime, 0, 0, 0.0 }; //vpi_printf("uvm_hdl_set_vlog(%s,%0x)/n",path,value[0].aval); #ifdef QUESTA int result = 0; result = uvm_hdl_set_vlog_partsel(path,value,flag); if (result < 0) return 0; if (result == 1) return 1; if (!strncmp(path,"$root.",6)) r = vpi_handle_by_name(path+6, 0); else #endif r = vpi_handle_by_name(path, 0); if(r == 0) { vpi_printf((PLI_BYTE8*) "UVM_ERROR: set: unable to locate hdl path (%s)/n",path); vpi_printf((PLI_BYTE8*) " Either the name is incorrect, or you may not have PLI/ACC visibility to that name/n"); return 0; } else { if(maxsize == -1) maxsize = uvm_hdl_max_width(); if (flag == vpiReleaseFlag) { //size = vpi_get(vpiSize, r); //value_p = (p_vpi_vecval)(malloc(((size-1)/32+1)*8*sizeof(s_vpi_vecval))); //value = &value_p; } value_s.format = vpiVectorVal; value_s.value.vector = value; vpi_put_value(r, &value_s, &time_s, flag); //if (value_p != NULL) // free(value_p); if (value == NULL) { value = value_s.value.vector; } }#ifndef VCS //vpi_release_handle(r);#endif return 1;}
开发者ID:enzochiau,项目名称:adopting-uvm,代码行数:57,
示例2: _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,
示例3: 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,
示例4: set_arg_intvoid set_arg_int(const s_riscyArg *const arg, const int value, const int offset, const int zero_at){ s_vpi_value value_s; s_vpi_time time_s; value_s.format = vpiIntVal; time_s.type = vpiScaledRealTime; value_s.value.integer = value; if (!offset) { vpi_put_value(arg->handle, &value_s, NULL, vpiNoDelay); } else { time_s.real = offset; vpi_put_value(arg->handle, &value_s, &time_s, vpiInertialDelay); } if (zero_at) { time_s.real = zero_at; value_s.value.integer = 0; vpi_put_value(arg->handle, &value_s, &time_s, vpiInertialDelay); }}
开发者ID:afi-lambda,项目名称:riscymips,代码行数:23,
示例5: vpiset_to_real/* * set a handle to a real value * * user must make sure href can have have a value put into it * notice the key to vpi_ processing is to save and pass handles */static void vpiset_to_real(vpiHandle href, double d1){ struct t_vpi_value valrec; struct t_vpi_error_info einfotab; valrec.format = vpiRealVal; valrec.value.real = d1; vpi_put_value(href, &valrec, NULL, vpiNoDelay); if (vpi_chk_error(&einfotab)) { vpi_printf("** ERR: vpi_put_value of real error:/n"); prtvpiemsg(&einfotab); }}
开发者ID:kammoh,项目名称:cvcx,代码行数:20,
示例6: 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,
示例7: ivl_method_prev_calltfstatic PLI_INT32 ivl_method_prev_calltf(PLI_BYTE8*data){ vpiHandle sys = vpi_handle(vpiSysTfCall, 0); vpiHandle argv = vpi_iterate(vpiArgument, sys); vpiHandle arg_enum = vpi_scan(argv); vpiHandle arg_item = vpi_scan(argv); vpiHandle arg_extra = vpi_scan(argv); vpiHandle enum_list = 0; vpiHandle memb = 0, prev = 0, last_memb = 0; int use_wid = 0; s_vpi_value memb_value, item_value; assert(arg_extra == 0); item_value.format = vpiIntVal; vpi_get_value(arg_item, &item_value); enum_list = vpi_iterate(vpiMember, arg_enum); assert(enum_list); /* Search for the current value in the member list. */ do { prev = memb; memb = vpi_scan(enum_list); if (memb == 0) break; if (use_wid == 0) use_wid = vpi_get(vpiSize, memb); last_memb = memb; memb_value.format = vpiIntVal; vpi_get_value(memb, &memb_value); } while (! compare_value_eequal(&memb_value, &item_value, use_wid)); while (memb) { last_memb = memb; memb = vpi_scan(enum_list); } if (prev == 0) prev = last_memb; vpi_get_value(prev, &memb_value); vpi_put_value(sys, &memb_value, 0, vpiNoDelay); return 0;}
开发者ID:nickg,项目名称:iverilog,代码行数:48,
示例8: writableint VpiSignalObjHdl::set_signal_value(std::string &value){ FENTER s_vpi_value value_s; std::vector<char> writable(value.begin(), value.end()); writable.push_back('/0'); value_s.value.str = &writable[0]; value_s.format = vpiBinStrVal; vpi_put_value(GpiObjHdl::get_handle<vpiHandle>(), &value_s, NULL, vpiNoDelay); check_vpi_error(); FEXIT return 0;}
开发者ID:cpehle,项目名称:cocotb,代码行数:17,
示例9: sys_fgetc_calltfstatic int sys_fgetc_calltf(char *name){ unsigned int mcd; int type; s_vpi_value value, rval; vpiHandle sys = vpi_handle(vpiSysTfCall, 0); vpiHandle argv = vpi_iterate(vpiArgument, sys); vpiHandle item = vpi_scan(argv); FILE *fp; if (item == 0) { vpi_printf("%s: mcd parameter missing./n", name); return 0; } type = vpi_get(vpiType, item); switch (type) { case vpiReg: case vpiRealVal: case vpiIntegerVar: break; default: vpi_printf("ERROR: %s mcd parameter must be of integral", name); vpi_printf(", got vpiType=%d/n", type); vpi_free_object(argv); return 0; } value.format = vpiIntVal; vpi_get_value(item, &value); mcd = value.value.integer; rval.format = vpiIntVal; fp = vpi_get_file(mcd); if (!fp || IS_MCD(mcd)) rval.value.integer = EOF; else rval.value.integer = fgetc(fp); vpi_put_value(sys, &rval, 0, vpiNoDelay); return 0;}
开发者ID:Virtual-Labs,项目名称:metal-forming-virtual-simulation-lab-dei,代码行数:44,
示例10: sys_test_plusargs_calltf/* * Compare the +arguments passed to the simulator with the argument * passed to the $test$plusargs. If there is a simulator argument that * is like this argument, then return true. Otherwise return false. */static PLI_INT32 sys_test_plusargs_calltf(ICARUS_VPI_CONST PLI_BYTE8*name){ s_vpi_value val; s_vpi_vlog_info info; int idx; int flag = 0; size_t slen, len; (void)name; /* Parameter is not used. */ vpiHandle callh = vpi_handle(vpiSysTfCall, 0); vpiHandle argv = vpi_iterate(vpiArgument, callh); val.format = vpiStringVal; vpi_get_value(vpi_scan(argv), &val); slen = strlen(val.value.str); vpi_get_vlog_info(&info); /* Look for a +arg that matches the prefix supplied. */ for (idx = 0 ; idx < info.argc ; idx += 1) { /* Skip arguments that are not +args. */ if (info.argv[idx][0] != '+') continue; len = strlen(info.argv[idx]+1); if (len < slen) continue; if (strncmp(val.value.str, info.argv[idx]+1, slen) != 0) continue; flag = 1; break; } val.format = vpiIntVal; val.value.integer = flag; vpi_put_value(callh, &val, 0, vpiNoDelay); vpi_free_object(argv); return 0;}
开发者ID:bzero,项目名称:iverilog,代码行数:49,
示例11: 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; errno = 0; /* 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) { 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; val.value.integer = EOF; } else { val.value.integer = fputc(chr, fp); if (val.value.integer != EOF) val.value.integer = 0; } vpi_put_value(callh, &val, 0, vpiNoDelay); return 0;}
开发者ID:AmkG,项目名称:iverilog,代码行数:43,
示例12: terminal_calltfstatic int terminal_calltf(char* user_data){ QList<quint64> val; // retrieve signal values { vpiHandle funchandle; vpiHandle arghandle; vpiHandle arg; t_vpi_value argval; funchandle = vpi_handle(vpiSysTfCall, NULL); arghandle = vpi_iterate(vpiArgument, funchandle); while(arg = vpi_scan(arghandle)){ argval.format = vpiIntVal; vpi_get_value(arg, &argval); val.append(argval.value.integer); } } // get new values procpoll(val); // assert new signal values { vpiHandle funchandle; vpiHandle arghandle; vpiHandle arg; t_vpi_value argval; funchandle = vpi_handle(vpiSysTfCall, NULL); arghandle = vpi_iterate(vpiArgument, funchandle); for(int i=0; (i<val.length()) && (arg = vpi_scan(arghandle)); ++i){ argval.format = vpiIntVal; argval.value.integer = val[i]; vpi_put_value(arg, &argval, NULL,vpiNoDelay); } } return 0;}
开发者ID:titorgalaxy,项目名称:Titor,代码行数:42,
示例13: sys_deposit_calltfstatic PLI_INT32 sys_deposit_calltf(ICARUS_VPI_CONST PLI_BYTE8 *name){ vpiHandle callh, argv, target, value; s_vpi_value val; callh = vpi_handle(vpiSysTfCall, 0); argv = vpi_iterate(vpiArgument, callh); target = vpi_scan(argv); assert(target); value = vpi_scan(argv); assert(value); val.format = vpiIntVal; vpi_get_value(value, &val); vpi_put_value(target, &val, 0, vpiNoDelay); vpi_free_object(argv); return 0;}
开发者ID:ThomsonTan,项目名称:iverilog,代码行数:20,
示例14: sys_clog2_calltfstatic PLI_INT32 sys_clog2_calltf(PLI_BYTE8 *name){ vpiHandle callh = vpi_handle(vpiSysTfCall, 0); vpiHandle argv = vpi_iterate(vpiArgument, callh); vpiHandle arg; s_vpi_value val; s_vpi_vecval vec; (void) name; /* Not used! */ /* Get the argument. */ arg = vpi_scan(argv); vpi_free_object(argv); vec = vpip_calc_clog2(arg); val.format = vpiVectorVal; val.value.vector = &vec; vpi_put_value(callh, &val, 0, vpiNoDelay); return 0;}
开发者ID:AmkG,项目名称:iverilog,代码行数:20,
示例15: vpi_put_valueint VpiSignalObjHdl::set_signal_value(double value){ FENTER s_vpi_value value_s; value_s.value.real = value; value_s.format = vpiRealVal; s_vpi_time vpi_time_s; vpi_time_s.type = vpiSimTime; vpi_time_s.high = 0; vpi_time_s.low = 0; vpi_put_value(GpiObjHdl::get_handle<vpiHandle>(), &value_s, &vpi_time_s, vpiInertialDelay); check_vpi_error(); FEXIT return 0;}
开发者ID:cpehle,项目名称:cocotb,代码行数:20,
示例16: sys_itor_calltfstatic PLI_INT32 sys_itor_calltf(ICARUS_VPI_CONST PLI_BYTE8*name){ vpiHandle callh = vpi_handle(vpiSysTfCall, 0); vpiHandle arg = (vpiHandle) vpi_get_userdata(callh); s_vpi_value value; (void)name; /* Parameter is not used. */ /* get value */ value.format = vpiIntVal; vpi_get_value(arg, &value); /* convert */ value.value.real = value.value.integer; value.format = vpiRealVal; /* return converted value */ vpi_put_value(callh, &value, 0, vpiNoDelay); return 0;}
开发者ID:steveicarus,项目名称:iverilog,代码行数:21,
示例17: _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,
示例18: reset_regsstatic void reset_regs(vpiHandle module) { vpiHandle reg, i; s_vpi_value value; int size, j; char * charData; value.format = vpiBinStrVal; i = vpi_iterate(vpiReg, module); while (reg = vpi_scan(i)) { vpi_get_value(reg, &value); charData = value.value.str; size = vpi_get(vpiSize, reg); for (j = 0; j < size; j++) { if (charData[j] == 'x') { charData[j] = '0'; } } vpi_put_value(reg, &value, NULL, vpiNoDelay); }}
开发者ID:resetnow,项目名称:verilog-zeroall,代码行数:21,
示例19: va_single_argument_calltf/* * Routine to implement the single argument math functions. */static PLI_INT32 va_single_argument_calltf(ICARUS_VPI_CONST PLI_BYTE8 *ud){ vpiHandle callh = vpi_handle(vpiSysTfCall, 0); s_vpi_value val; va_single_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->arg, &val); val.value.real = (fun_data->func)(val.value.real); /* Return the result */ vpi_put_value(callh, &val, 0, vpiNoDelay); return 0;}
开发者ID:ThomsonTan,项目名称:iverilog,代码行数:24,
示例20: scan_format_char/* * Routine to return a character value (implements %c). * * Return: 1 for a match, 0 for no match/variable and -1 for a * suppressed match. No variable is fatal. */static int scan_format_char(vpiHandle callh, vpiHandle argv, struct byte_source *src, unsigned width, unsigned suppress_flag, PLI_BYTE8 *name){ vpiHandle arg; s_vpi_value val; int ch; /* If we are being asked for no digits then return a match fail. */ if (width == 0) return 0; /* Get the character to return. */ ch = byte_getc(src); /* Nothing was matched. */ if (ch == EOF) return 0; /* If this match is being suppressed then return after consuming * the character and report that no arguments were used. */ if (suppress_flag) return -1; /* We must have a variable to put the character value into. */ arg = vpi_scan(argv); if (! arg) { vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s() ran out of variables for %%c format code.", name); vpi_control(vpiFinish, 1); return 0; } /* Put the character into the variable. */ val.format = vpiIntVal; val.value.integer = ch; vpi_put_value(arg, &val, 0, vpiNoDelay); /* We always consume one variable if it is available. */ return 1;}
开发者ID:ThomsonTan,项目名称:iverilog,代码行数:45,
示例21: 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,
示例22: fread_word/* * The pattern here is get the current vector, load the new bits on * top of the old ones and then put the modified vector. We need the * "get" first so that if we run out of bits in the file we keep the * original ones. */static unsigned fread_word(FILE *fp, vpiHandle word, unsigned words, unsigned bpe, s_vpi_vecval *vector){ unsigned rtn, clr_mask, bnum; int bidx, byte; s_vpi_value val; struct t_vpi_vecval *cur = &vector[words-1]; rtn = 0; /* Get the current bits from the register and copy them to * my local vector. */ val.format = vpiVectorVal; vpi_get_value(word, &val); for (bidx = 0; bidx < words; bidx += 1) { vector[bidx].aval = val.value.vector[bidx].aval; vector[bidx].bval = val.value.vector[bidx].bval; } /* Copy the bytes to the local vector MSByte first. */ for (bidx = bpe-1; bidx >= 0; bidx -= 1) { byte = fgetc(fp); if (byte == EOF) break; /* Clear the current byte and load the new value. */ bnum = bidx % 4; clr_mask = ~(0xff << bnum*8); cur->aval &= clr_mask; cur->bval &= clr_mask; cur->aval |= byte << bnum*8; rtn += 1; if (bnum == 0) cur -= 1; } /* Put the updated bits into the register. */ val.value.vector = vector; vpi_put_value(word, &val, 0, vpiNoDelay); return rtn;}
开发者ID:AmkG,项目名称:iverilog,代码行数:45,
示例23: scan_format_float/* * Routine to return a floating point value (implements %e, %f and %g). * * Return: 1 for a match, 0 for no match/variable and -1 for a * suppressed match. No variable is fatal. */static int scan_format_float(vpiHandle callh, vpiHandle argv, struct byte_source *src, unsigned width, unsigned suppress_flag, PLI_BYTE8 *name, char code){ vpiHandle arg; int match; s_vpi_value val; double result; /* Get the real value. */ result = get_float(src, width, &match); /* Nothing was matched. */ if (match == 0) return 0; /* If this match is being suppressed then return after consuming * the digits and report that no arguments were used. */ if (suppress_flag) return -1; /* We must have a variable to put the double value into. */ arg = vpi_scan(argv); if (! arg) { vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s() ran out of variables for %%%c format code.", name, code); vpi_control(vpiFinish, 1); return 0; } /* Put the value into the variable. */ val.format = vpiRealVal; val.value.real = result; vpi_put_value(arg, &val, 0, vpiNoDelay); /* We always consume one variable if it is available. */ return 1;}
开发者ID:ThomsonTan,项目名称:iverilog,代码行数:45,
示例24: ivlh_attribute_event_calltfstatic PLI_INT32 ivlh_attribute_event_calltf(ICARUS_VPI_CONST PLI_BYTE8*data){ event_type_t type = (event_type_t) data; vpiHandle sys = vpi_handle(vpiSysTfCall, 0); struct t_vpi_value rval; struct monitor_data*mon; rval.format = vpiScalarVal; mon = (struct monitor_data*) (vpi_get_userdata(sys)); if (mon->last_event.type == 0) { rval.value.scalar = vpi0; } else { struct t_vpi_time tnow; tnow.type = vpiSimTime; vpi_get_time(0, &tnow); rval.value.scalar = vpi1; // Detect if change occured in this moment if (mon->last_event.high != tnow.high) rval.value.scalar = vpi0; if (mon->last_event.low != tnow.low) rval.value.scalar = vpi0; // Determine the edge, if required if (type == RISING_EDGE && mon->last_value.value.scalar != vpi1) rval.value.scalar = vpi0; else if (type == FALLING_EDGE && mon->last_value.value.scalar != vpi0) rval.value.scalar = vpi0; } vpi_put_value(sys, &rval, 0, vpiNoDelay); return 0;}
开发者ID:nicklfitz,项目名称:iverilog,代码行数:38,
示例25: readUnsignedHalf_calltfint readUnsignedHalf_calltf(char *user_data){ int data; vpiHandle systf_handle, arg_iterator, arg_handle, reg_handle; s_vpi_value current_value; s_vpi_value value_s; //unsigned long long instruction; /* obtain a handle to the system task instance. */ systf_handle = vpi_handle(vpiSysTfCall, 0); /* obtain handle to system task argument. */ arg_iterator = vpi_iterate(vpiArgument, systf_handle); reg_handle = vpi_scan(arg_iterator); /* free iterator memory */ vpi_free_object(arg_iterator); /* read current value */ current_value.format = vpiIntVal; /* read value as a integer */ vpi_get_value(reg_handle, ¤t_value); data = (int) VMEM[0]->read_unsigned_half(current_value.value.integer); data = (data & 0x0000FFFF); //vpi_printf("Data read /t%x/n",data); value_s.format = vpiIntVal; value_s.value.integer = data; vpi_put_value(systf_handle, &value_s, 0, vpiNoDelay); return(0); }
开发者ID:HackLinux,项目名称:fabscalar,代码行数:38,
示例26: EndOfCompilestatic PLI_INT32EndOfCompile(s_cb_data *data){ vpiHandle hand; s_vpi_time timerec = { vpiSimTime, 0, 0, 0 }; s_vpi_value val; int i; (void)data; /* Parameter is not used. */ hand = vpi_handle_by_name("test.r", 0); assert(hand); // Get current state val.format = vpiIntVal; vpi_get_value(hand, &val); // Add a few transitions for (i = 0; i < 6; i++) { if (i < 3) { // delay 10+i time units timerec.low = 1000 * (i + 1); } else { timerec.type = vpiScaledRealTime; timerec.low = 0; timerec.real = 10000.0 * (i+1); } // Toggle state val.value.integer ^= 1; // Put new state vpi_put_value(hand, &val, &timerec, vpiPureTransportDelay); } return 0;}
开发者ID:orsonmmz,项目名称:ivtest,代码行数:38,
示例27: vpi_input_strint vpi_input_str(PLI_BYTE8 *d) { vpiHandle systfref, argh, argsiter; s_vpi_value v; systfref = vpi_handle(vpiSysTfCall, NULL); argsiter = vpi_iterate(vpiArgument, systfref); argh = vpi_scan(argsiter); if (!argh) { vpi_printf("$VPI: missing parameter/n"); return 0; } v.format = vpiIntVal; vpi_get_value(argh, &v); vpi_printf("VPI: %d/n", v.value.integer); // vpi_put_value(systfref, &v, NULL, vpiNoDelay); vpi_put_value(systfref, &v, NULL, vpiNoDelay); return 0;}
开发者ID:hsyhsw,项目名称:PIC16C57,代码行数:23,
注:本文中的vpi_put_value函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ vpi_register_systf函数代码示例 C++ vpi_printf函数代码示例 |