为保证子程序的原汁原味,避免拉跨拙劣的翻译水平,所有子程序列表均保留英文说明。建议使用时再仔细研究对应类型的子程序。这里也没有对所有的子程序都进行验证,由于版本或抄写问题,可能会有所疏漏,欢迎指正。
TF 子程序常用于 Verilog 和用户 C 子程序之间的双向数据传输。当以 tf_ 为前缀的子程序有一个以 tf_i 为前缀的子程序与之对应时,这个以 tf_i 为前缀的对应子程序中发生操作的实例指针必须被当做变量列表最后的附加变量加以传递。
TF 子程序在命名形式上没有明确的分类标志,简单做如下总结。
| 返回类型 | 调用格式及说明 |
|---|---|
| char * | ◆tf_getinstance() |
| Get a pointer to the current instance of a user-defined system task or function. | |
| char * | ◆tf_mipname() ◆tf_imipname(char *instance_p) |
| Get the hierarchical module instance path name as a string. | |
| char * | ◆tf_spname() ◆tf_ispname(char *instance_p) |
| Get scope hierarchical path name as a string. |
| 返回类型 | 调用格式及说明 |
|---|---|
| int | ◆tf_nump() ◆tf_inump(char *instance_p) |
| Get number of task or function arguments. | |
| int | ◆tf_typep(int narg) ◆tf_itypep(int narg, char *instance_p) |
| Get a system task/function argument type. | |
| int | ◆tf_sizep(narg) ◆tf_isizep(int narg, char *instance_p) |
| Get the bit length of a system task/function argument. | |
| t_tfexprinfo * | ◆tf_exprinfo(int narg, t_tfexprinfo *exprinfo_p) ◆tf_iexprinfo(int narg, t_tfexprinfo *exprinfo_p, char *instance_p) |
| Get system task/function argument expression information. t_tfexprinfo is a data structure, defined in veriuser.h. | |
| t_tfnodeinfo * | ◆tf_nodeinfo(int narg, t_tfnodeinfo *nodeinfo_p) ◆tf_inodeinfo(int narg, t_tfnodeinfo *nodeinfo_p, char *instance_p) |
| Get system task/function argument node information. t_tfnodeinfo is a data structure, defined in veriuser.h. |
| 返回类型 | 调用格式及说明 |
|---|---|
| int | ◆tf_getp(int narg) ◆tf_igetp(int narg, char *instance_p) |
| Get a system task/function argument value as an integer or character string pointer | |
| double | ◆tf_getrealp(int narg) ◆tf_igetrealp(int narg, char *instance_p) |
| Get a system task/function argument value as a double-precision value. | |
| int | ◆tf_getlongp(int *aof_highvalue, int narg) ◆tf_igetlongp(int *aof_highvalue, int narg, char *instance_p) |
| Get system task/function argument value as a 64-bit integer. | |
| char * | ◆tf_strgetp(int narg, int format) ◆tf_istrgetp(int narg, int format, char *instance_p) |
| Get formatted system task/function argument values. | |
| char * | ◆tf_getcstringp(int narg) ◆tf_igetcstringp(int narg, char *instance_p) |
| Get system task/function argument value as a string. | |
| int | ◆tf_evaluatep(int narg) ◆tf_ievaluatep(int narg, char *instance_p) |
| Evaluate a system task/function argument expression. |
| 返回类型 | 调用格式及说明 |
|---|---|
| int | ◆tf_putp(int narg, int value) ◆tf_iputp(int narg, int value, char *instance_p) |
| Put an integer value to a system task/function argument or function return. | |
| int | ◆tf_putrealp(int narg, double value) ◆tf_iputrealp(int narg, double value, char *instance_p) |
| Write a real value to a system task/function argument or function return. | |
| int | ◆tf_putlongp(int narg, int lowvalue, int highvalue) ◆tf_iputlongp(int narg, int lowvalue, int highvalue, char *instance_p) |
| Write a 64-bit integer value to a system task/function argument or function return. | |
| int | ◆tf_propagatep(int narg) ◆tf_ipropagatep(int narg, char *instance_p) |
| Propagate a system task/function argument value. | |
| int | ◆tf_strdelputp(int narg, int bitlength, char format, char *value_p, int delay, int delaytype) ◆tf_istrdelputp(int narg, int bitlength, char format, char *value_p, int delay, int delaytype, char *instance_p) |
| Write a value to a system task/function argument from string value specification, using a 32-bit integer delay. | |
| int | ◆tf_strrealdelputp(int narg, int bitlength, char format, char *value_p, double realdelay, int delaytype) ◆tf_istrrealdelputp(int narg, int bitlength, char format, char *value_p, double realdelay, int delaytype, char *instance_p) |
| Write a value to a system task/function argument from string value specification, using a real number delay. | |
| int | ◆tf_strlongdelputp(int narg, int bitlength, char format, char *value_p, int lowdelay, int highdelay, int delaytype) ◆tf_istrlongdelputp(int narg, int bitlength, char format, char *value_p, int lowdelay, int highdelay, int delaytype, char *instance_p) |
| Write a value to a system task/function argument from string value specification, using a 64-bit integer delay. |
| 返回类型 | 调用格式及说明 |
|---|---|
| int | ◆tf_asynchon() ◆tf_iasynchon(char *instance_p) |
| Enable asynchronous calling of the misctf application for system task/function argument value changes. | |
| int (always 0) | ◆tf_asynchoff() ◆tf_iasynchoff(char *instance_p) |
| Disable asynchronous calling of the misctf application. | |
| int | ◆tf_synchronize() ◆tf_isynchronize(char *instance_p) |
| Synchronize to end of simulation time step. | |
| int | ◆tf_rosynchronize() ◆tf_irosynchronize(char *instance_p) |
| Synchronize to end of simulation time step. | |
| int | ◆tf_getpchange(int narg) ◆tf_igetpchange(int narg, char *instance_p) |
| Get the index number of the next system task/function argument that changed value. | |
| int | ◆tf_copypvc_flag(int narg) ◆tf_icopypvc_flag(int narg, char *instance_p) |
| Copy system task/function argument value change flags. | |
| int | ◆tf_movepvc_flag(int narg) ◆tf_imovepvc_flag(int narg, char *instance_p) |
| Move system task/function argument value change flags. | |
| int | ◆tf_testpvc_flag(int narg) ◆tf_itestpvc_flag(int narg, char *instance_p) |
| Test system task/function argument value change flags. |
| 返回类型 | 调用格式及说明 |
|---|---|
| int | ◆tf_gettime() ◆tf_igettime(char *instance_p) |
| Get the current simulation time as a 32-bit integer. | |
| double | ◆tf_getrealtime() ◆tf_igetrealtime(char *instance_p) |
| Get the current simulation time in double-precision format. | |
| int | ◆tf_getlongtime(int *aof_hightime) ◆tf_igetlongtime(int *aof_hightime, char *instance_p) |
| Get current simulation time as a 64-bit integer. Return least significant (right-most) 32 bits of simulation time | |
| char * | ◆tf_strgettime() |
| Get the current simulation time as a string. | |
| int | ◆tf_getnextlongtime(int *aof_lowtime, int *aof_hightime) |
| Get next time at which a simulation event is scheduled | |
| int | ◆tf_gettimeprecision() ◆tf_igettimeprecision(char *instance_p) |
| Get the timescale precision of a module or a simulation. | |
| int | ◆tf_gettimeunit() ◆tf_igettimeunit(char *instance_p) |
| Get the timescale unit of a module or a simulation. | |
| int | ◆tf_setdelay(int delay) ◆tf_isetdelay(int delay, char *instance_p) |
| Activate the misctf application at a particular simulation time. | |
| int | ◆tf_setlongdelay(int lowdelay, int highdelay) ◆tf_isetlongdelay(int lowdelay, int highdelay, char *instance_p) |
| Activate the misctf application at a particular simulation time. | |
| int | ◆tf_setrealdelay(double realdelay) ◆tf_isetrealdelay(double realdelay, char *instance_p) |
| Activate the misctf application at a particular simulation time. | |
| void | ◆tf_scale_longdelay(char *instance_p, int delay_lo, int delay_hi, int *aof_delay_lo, int *aof_delay_hi) |
| Convert a 64-bit integer delay to the timescale of the module instance. | |
| void | ◆tf_scale_realdelay(char *instance_p, double realdelay, double *aof_realdelay) |
| Convert a double-precision floating-point delay to the timescale of the module instance. | |
| void | ◆tf_unscale_longdelay(char *instance_p, int delay_lo, int delay_hi, int *aof_delay_lo, int *aof_delay_hi) |
| Convert a delay from internal simulation time units to the timescale of a particular module. | |
| void | ◆tf_unscale_realdelay(char *instance_p, double realdelay, double *aof_realdelay) |
| Convert a delay expressed in internal simulation time units to the timescale of a particular module. | |
| int | ◆tf_clearalldelays() ◆tf_iclearalldelays(char *instance_p) |
| Clear all scheduled reactivations by tf_setdelay() or tf_isetdelay(). |
| 返回类型 | 调用格式及说明 |
|---|---|
| int (always 0) | ◆tf_add_long(int *aof_low1, int *aof_high1, int low2, int high2) |
| Add two 64-bit integers. | |
| int (always 0) | ◆tf_subtract_long(int *aof_low1, int *aof_high1, int low2, int high2) |
| Subtract two 64-bit integers. | |
| void | ◆tf_multiply_long(int *aof_low1, int *aof_high1, int low2, int high2) |
| Multiply two 64 bit integers. | |
| void | ◆tf_divide_long(int *aof_low1, int *aof_high1, int low2, int high2) |
| Divide two 64-bit integers. | |
| int | ◆tf_compare_long(int low1, int high1, int low2, int high2) |
| Compare two 64-bit integer values. | |
| char * | ◆tf_longtime_tostr(int lowtime, int hightime) |
| Convert 64-bit integer time value to a character string. | |
| void | ◆tf_real_to_long(double realvalue, int *aof_low, int *aof_high) |
| Convert a real number to a 64-bit integer. | |
| void | ◆tf_long_to_real(int low, int high, double *aof_real) |
| Convert a 64-bit integer to a real number. |
| 返回类型 | 调用格式及说明 |
|---|---|
| void | ◆io_printf(char *format, arg1, ..., arg12) |
| Print a formatted message to the output channel of the software product which invoked the PLI appcation and to the log file of the product. | |
| void | ◆io_mcdprintf(int mcd, char *format, arg1, ..., arg12) |
| Write a formatted message to one or more files. | |
| int (always 0) | ◆tf_error(char *format, arg1,..., arg5) |
| Report an error message. | |
| int (always 0) | ◆tf_warning(char *format, arg1, ..., arg5) |
| Report a warning message. | |
| int (always 0) | ◆tf_message(int level, char *facility, char *code, char *message, arg1,..., arg5) |
| Report an error or warning message with software product interruption control. | |
| int (always 0) | ◆tf_text(char *message, arg1,..., arg5) |
| Store error message information. |
| 返回类型 | 调用格式及说明 |
|---|---|
| int (always 0) | ◆tf_setworkarea(char *workarea) ◆tf_isetworkarea(char *workarea, char *instance_p) |
| Store user data pointer in work area. | |
| char * | ◆tf_getworkarea() ◆tf_igetworkarea(char *instance_p) |
| Get work area pointer. |
| 返回类型 | 调用格式及说明 |
|---|---|
| int (always 0) | ◆tf_dostop() |
| Cause software product to enter interactive mode. | |
| int (always 0) | ◆tf_dofinish() |
| Exit software product execution. | |
| char * | ◆mc_scan_plusargs(char *startarg) |
| Scan software product invocation command line for plus (+) options. | |
| int | ◆tf_write_save(char *blockptr, int blocklen) |
| Append a block of data to a save file. | |
| int | ◆tf_read_restart(char *blockptr, int blocklen) |
| Get a block of data from a previously written save file. |
我需要在客户计算机上运行Ruby应用程序。通常需要几天才能完成(复制大备份文件)。问题是如果启用sleep,它会中断应用程序。否则,计算机将持续运行数周,直到我下次访问为止。有什么方法可以防止执行期间休眠并让Windows在执行后休眠吗?欢迎任何疯狂的想法;-) 最佳答案 Here建议使用SetThreadExecutionStateWinAPI函数,使应用程序能够通知系统它正在使用中,从而防止系统在应用程序运行时进入休眠状态或关闭显示。像这样的东西:require'Win32API'ES_AWAYMODE_REQUIRED=0x0
Rackup通过Rack的默认处理程序成功运行任何Rack应用程序。例如:classRackAppdefcall(environment)['200',{'Content-Type'=>'text/html'},["Helloworld"]]endendrunRackApp.new但是当最后一行更改为使用Rack的内置CGI处理程序时,rackup给出“NoMethodErrorat/undefinedmethod`call'fornil:NilClass”:Rack::Handler::CGI.runRackApp.newRack的其他内置处理程序也提出了同样的反对意见。例如Rack
我想用ruby编写一个小的命令行实用程序并将其作为gem分发。我知道安装后,Guard、Sass和Thor等某些gem可以从命令行自行运行。为了让gem像二进制文件一样可用,我需要在我的gemspec中指定什么。 最佳答案 Gem::Specification.newdo|s|...s.executable='name_of_executable'...endhttp://docs.rubygems.org/read/chapter/20 关于ruby-在Ruby中编写命令行实用程序
我构建了两个需要相互通信和发送文件的Rails应用程序。例如,一个Rails应用程序会发送请求以查看其他应用程序数据库中的表。然后另一个应用程序将呈现该表的json并将其发回。我还希望一个应用程序将存储在其公共(public)目录中的文本文件发送到另一个应用程序的公共(public)目录。我从来没有做过这样的事情,所以我什至不知道从哪里开始。任何帮助,将不胜感激。谢谢! 最佳答案 无论Rails是什么,几乎所有Web应用程序都有您的要求,大多数现代Web应用程序都需要相互通信。但是有一个小小的理解需要你坚持下去,网站不应直接访问彼此
我尝试运行2.x应用程序。我使用rvm并为此应用程序设置其他版本的ruby:$rvmuseree-1.8.7-head我尝试运行服务器,然后出现很多错误:$script/serverNOTE:Gem.source_indexisdeprecated,useSpecification.Itwillberemovedonorafter2011-11-01.Gem.source_indexcalledfrom/Users/serg/rails_projects_terminal/work_proj/spohelp/config/../vendor/rails/railties/lib/r
刚入门rails,开始慢慢理解。有人可以解释或给我一些关于在application_controller中编码的好处或时间和原因的想法吗?有哪些用例。您如何为Rails应用程序使用应用程序Controller?我不想在那里放太多代码,因为据我了解,每个请求都会调用此Controller。这是真的? 最佳答案 ApplicationController实际上是您应用程序中的每个其他Controller都将从中继承的类(尽管这不是强制性的)。我同意不要用太多代码弄乱它并保持干净整洁的态度,尽管在某些情况下ApplicationContr
是否有类似“RVMuse1”或“RVMuselist[0]”之类的内容而不是键入整个版本号。在任何时候,我们都会看到一个可能包含5个或更多ruby的列表,我们可以轻松地键入一个数字而不是X.X.X。这也有助于rvmgemset。 最佳答案 这在RVM2.0中是可能的=>https://docs.google.com/document/d/1xW9GeEpLOWPcddDg_hOPvK4oeLxJmU3Q5FiCNT7nTAc/edit?usp=sharing-知道链接的任何人都可以发表评论
我是一个Rails初学者,但我想从我的RailsView(html.haml文件)中查看Ruby变量的内容。我试图在ruby中打印出变量(认为它会在终端中出现),但没有得到任何结果。有什么建议吗?我知道Rails调试器,但更喜欢使用inspect来打印我的变量。 最佳答案 您可以在View中使用puts方法将信息输出到服务器控制台。您应该能够在View中的任何位置使用Haml执行以下操作:-puts@my_variable.inspect 关于ruby-on-rails-如何在我的R
如何检查Ruby文件是否是通过“require”或“load”导入的,而不是简单地从命令行执行的?例如:foo.rb的内容:puts"Hello"bar.rb的内容require'foo'输出:$./foo.rbHello$./bar.rbHello基本上,我想调用bar.rb以不执行puts调用。 最佳答案 将foo.rb改为:if__FILE__==$0puts"Hello"end检查__FILE__-当前ruby文件的名称-与$0-正在运行的脚本的名称。 关于ruby-检查是否
是否可以在应用程序中包含的gem代码中知道应用程序的Rails文件系统根目录?这是gem来源的示例:moduleMyGemdefself.included(base)putsRails.root#returnnilendendActionController::Base.send:include,MyGem谢谢,抱歉我的英语不好 最佳答案 我发现解决类似问题的解决方案是使用railtie初始化程序包含我的模块。所以,在你的/lib/mygem/railtie.rbmoduleMyGemclassRailtie使用此代码,您的模块将在