⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch17.htm

📁 Verilog DHL教程
💻 HTM
📖 第 1 页 / 共 3 页
字号:
misctf</EM> PLI routine is called by a Verilog software implementation for miscellaneous reasons while the Verilog HDL source description is being executed.  Among these reasons are the end of a simulation time step, a logic value change on a user-defined system task/function argument, and the execution of the <EM CLASS="Italic">$stop</EM> and <EM CLASS="Italic">$finish</EM> built-in system functions.  When the software implementation calls the <EM CLASS="ItalicBold">misctf</EM> PLI routine, it passes in a reason argument, which may be used within the <EM CLASS="ItalicBold">misctf</EM> routine to determine why the routine was called.  The reason argument is a predefined integer constant.  <A HREF="ch17.htm#15540" CLASS="XRef">See : &nbsp;Predefined reason integer constants</A>, in <A HREF="ch17.htm#25028" CLASS="XRef">See The reason C argument</A> lists the reasons the <EM CLASS="ItalicBold">misctf</EM> routine may be called. Note that the <EM CLASS="ItalicBold">misctf</EM> routine associated with a specific instance of a user-defined task or function $ name shall not be activated until that instance of the task/function has been executed the first time.</P></DIV><DIV><H4 CLASS="H3(1.1.1)"><A NAME="pgfId=187"> </A>The <A NAME="marker=63"> </A><EM CLASS="Italic">consumer</EM> class of PLI routines</H4><P CLASS="BodyText"><A NAME="pgfId=283"> </A>A <EM CLASS="ItalicBold">consumer</EM> PLI application is called through a PLI call-back mechanism referred to as the <EM CLASS="Italic">Value Change Link</EM> (VCL).  Using the VCL, another PLI application, typically the <EM CLASS="Italic">calltf</EM> routine, can place VCL flags on objects within the Verilog HDL data structure, such as a specific net.  Whenever an object with a VCL flag changes value during a simulation, the <EM CLASS="ItalicBold">consumer</EM> PLI routine is called and passed information about the change.</P></DIV></DIV><DIV><H3 CLASS="H2(1.1)"><A NAME="pgfId=291"> </A><A NAME="marker=64"> </A>Associating PLI C routines to a class and system task/function name</H3><P CLASS="BodyText"><A NAME="pgfId=147"> </A>Each user-provided PLI C application is a standard C language function which makes use of the library of PLI functions.  These user-provided PLI applications must be associated with both the class of routine (such as <EM CLASS="Italic">calltf</EM> or <EM CLASS="Italic">checktf</EM>) and the user-defined system task or function $ name.  In addition, the user-defined name must be declared as either a system task or a system function.</P><P CLASS="BodyText"><A NAME="pgfId=148"> </A>The method of associating PLI applications with a class and system task/function name is not defined as part of the IEEE 1364 PLI standard.  Each software product vendor shall define an association mechanism specific to their product.  Refer to the vendor's documentation for instructions on associating PLI routines to classes and system task/function names and then linking the PLI routines into the vendor's software products.</P></DIV><DIV><H3 CLASS="H2(1.1)"><A NAME="pgfId=146"> </A>PLI routine arguments</H3><P CLASS="BodyText"><A NAME="pgfId=152"> </A>When the <EM CLASS="Italic">calltf</EM>, <EM CLASS="Italic">checktf</EM>, and <EM CLASS="Italic">sizetf</EM> PLI routines are called by a Verilog software implementation, they are always passed two C arguments, <EM CLASS="ItalicBold">data</EM> and <EM CLASS="ItalicBold">reason</EM> (in that order).  When the <EM CLASS="Italic">misctf</EM> routine is called, it is always passed three C arguments, <EM CLASS="ItalicBold">data</EM>, <EM CLASS="ItalicBold">reason</EM> and <EM CLASS="ItalicBold">paramvc</EM> (in that order).  The arguments are defined in more detail in the following sections.</P><DIV><H4 CLASS="H3(1.1.1)"><A NAME="pgfId=292"> </A>The <A NAME="marker=65"> </A><EM CLASS="Italic">data</EM> C argument</H4><P CLASS="BodyText"><A NAME="pgfId=154"> </A>The <EM CLASS="ItalicBold">data</EM> C argument is an integer value.  The value is defined by the user at the time the PLI applications are associated with a user-defined system task or function name. This value may be used to allow several different system task/function names to use the same <EM CLASS="Italic">calltf</EM>,<EM CLASS="Italic"> checktf</EM>, <EM CLASS="Italic">sizetf</EM>, or <EM CLASS="Italic">misctf</EM> routines.  To do this, each system task/function name would be associated with the same PLI C routines, but would have a different value for the user-defined <EM CLASS="ItalicBold">data</EM> argument.  When PLI C routine is called, it can then check the value of the <EM CLASS="ItalicBold">data</EM> argument to determine which system task/function name was used to call the routine.</P></DIV><DIV><H4 CLASS="H3(1.1.1)"><A NAME="pgfId=293"> </A><A NAME="25028"> </A>The <A NAME="marker=66"> </A><EM CLASS="Italic">reason</EM> C argument</H4><P CLASS="BodyText"><A NAME="pgfId=156"> </A>The <EM CLASS="ItalicBold">reason</EM> C argument is a predefined integer constant that is passed to the <EM CLASS="Italic">calltf</EM>, <EM CLASS="Italic">checktf</EM>, <EM CLASS="Italic">sizetf</EM> and <EM CLASS="Italic">misctf</EM> routines each time the routines are called.  Generally, the <EM CLASS="Italic">calltf</EM>, <EM CLASS="Italic">checktf</EM> and <EM CLASS="Italic">sizetf</EM> have no need to check the reason argument, since these routines can only be called under specific circumstances.  The <EM CLASS="Italic">misctf</EM> routine, however, may be called for a wide variety of reasons, and therefore should always examine the reason argument to determine why the routine was called and what action should be taken.  The value for the reason argument is defined in the PLI include file   <B CLASS="Keyword">veriuser.h</B>.  The predefined constants that may be passed to the reason argument are listed in <A HREF="ch17.htm#15540" CLASS="XRef">See : &nbsp;Predefined reason integer constants</A>, below.</P></DIV><DIV><H4 CLASS="H3(1.1.1)"><A NAME="pgfId=235"> </A><A NAME="25028"> </A>The <A NAME="marker=67"> </A><EM CLASS="Italic">paramvc</EM> C argument</H4><P CLASS="BodyText"><A NAME="pgfId=160"> </A>The <EM CLASS="ItalicBold">paramvc</EM> C argument is an integer value passed to the <EM CLASS="Italic">misctf</EM> routine.  The value of <EM CLASS="ItalicBold">paramvc</EM> indicates which parameter changed value when the <EM CLASS="Italic">misctf</EM> routine is called back after activating the utility routine <EM CLASS="Italic">tf_asynchon()</EM>.  This routine will cause the <EM CLASS="Italic">misctf</EM> routine to be called with a reason argument of <EM CLASS="ItalicBold">reason_paramvc</EM> or <EM CLASS="ItalicBold">reason_paramdrc</EM>.</P><P CLASS="BodyText"><A NAME="pgfId=161"> </A>      </P><TABLE BORDER="1"><CAPTION><P CLASS="TableTitle"><A NAME="pgfId=305"> </A>Table&nbsp;17-1: &nbsp;<A NAME="15540"> </A>Predefined <A NAME="marker=68"> </A>reason integer constants</P></CAPTION><TR><TH ROWSPAN="1" COLSPAN="1"><P CLASS="CellHeading"><A NAME="pgfId=289"> </A>Reason value passed to</P></TH><TH ROWSPAN="1" COLSPAN="1"><P CLASS="CellHeading"><A NAME="pgfId=290"> </A>Predefined integer constant</P></TH></TR><TR><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellBody"><A NAME="pgfId=294"> </A><EM CLASS="ItalicBold">calltf</EM> routines</P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellHeading"><A NAME="pgfId=296"> </A><EM CLASS="Italic">reason_calltf</EM><A NAME="marker=69"> </A><EM CLASS="TableCode"> </EM></P></TD></TR><TR><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellBody"><A NAME="pgfId=297"> </A><EM CLASS="ItalicBold">checktf</EM> routines</P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellHeading"><A NAME="pgfId=298"> </A><EM CLASS="Italic">reason_checktf</EM><A NAME="marker=70"> </A><EM CLASS="TableCode"> </EM></P></TD></TR><TR><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellBody"><A NAME="pgfId=299"> </A><EM CLASS="ItalicBold">sizetf</EM> routines</P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellHeading"><A NAME="pgfId=300"> </A><EM CLASS="Italic">reason_sizetf</EM><A NAME="marker=71"> </A><EM CLASS="TableCode"> </EM></P></TD></TR><TR><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellBody"><A NAME="pgfId=301"> </A><EM CLASS="ItalicBold">misctf</EM> routines</P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellHeading"><A NAME="pgfId=302"> </A></P></TD></TR><TR><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellBodyIndent"><A NAME="pgfId=239"> </A>for the end of Verilog source compilation/start of execution</P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellHeading"><A NAME="pgfId=240"> </A><EM CLASS="Italic">reason_endofcompile</EM><A NAME="marker=72"> </A> </P></TD></TR><TR><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellBodyIndent"><A NAME="pgfId=303"> </A>for a change of value on a user-defined system task or function argument parameter</P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellHeading"><A NAME="pgfId=304"> </A><EM CLASS="Italic">reason_paramvc</EM><A NAME="marker=73"> </A><EM CLASS="TableCode"> </EM></P></TD></TR><TR><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellBodyIndent"><A NAME="pgfId=218"> </A>for a value change on the driver of a user-defined system task or function argument parameter</P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellHeading"><A NAME="pgfId=219"> </A><EM CLASS="Italic">reason_paramdrc</EM><A NAME="marker=74"> </A> </P></TD></TR><TR>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -