📄 00883.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<html>
<head>
<title>附录E DPI C-layer</title>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312" />
<meta name="generator" content="Doc-O-Matic" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<link rel="STYLESHEET" href="default.css" type="text/css" />
<script type="text/javascript" src="scripts.js"></script>
</head>
<body class="Element700" onload="onBodyLoadEx('systemverilog31a.html', 'topic', '00883.html');" onmousedown="onBodyMouseDown();">
<!-- Begin Popups -->
<div class="Element801" id="popup00762">
<div class="Element800">
<div class="Element14">
链接</div>
<div class="Element11">
<div class="Element10">
<a href="01031.html" target="topic">主题</a></div>
</div>
</div>
</div>
<!-- End Popups -->
<!-- Begin Page Header -->
<div class="Element710" id="areafixed">
<div class="Element92">
<table width="100%" cellspacing="0" cellpadding="0">
<tr><td width="33%">
<div class="Element1">
<a href="#" onmousedown="showPopup(this, 'popup00762');"><img src="seealsolink.png" border="0" alt="" title=""></a> SystemVerilog 3.1a语言参考手册</div>
</td><td width="34%">
<div class="Element2">
</div>
</td><td width="33%">
<div class="Element90">
<a href="00724.html" target="topic"><img src="btn_prev_lightblue.gif" border="0" alt="Previous" title="Previous" onmouseover="switchImage(this, 'btn_prev_lightblue_hover.gif');" onmouseout="switchImage(this, 'btn_prev_lightblue.gif');"></a><img src="btn_up_d.gif" border="0" alt="Up" title="Up"><a href="00736.html" target="topic"><img src="btn_next_lightblue.gif" border="0" alt="Next" title="Next" onmouseover="switchImage(this, 'btn_next_lightblue_hover.gif');" onmouseout="switchImage(this, 'btn_next_lightblue.gif');"></a></div>
</td></tr></table><div class="Element5">
附录E DPI C-layer</div>
</div>
</div>
<!-- End Page Header -->
<!-- Begin Client Area -->
<div class="Element720" id="areascroll">
<div class="Element721">
<!-- Begin Page Content -->
<div class="Element58">
<a name="主题"></a><div class="Element14">
<a onclick="toggleVisibilityStored('主题');" class="a_Element14"><img src="sectionminus.png" border="0" alt="" title="" id="img主题">主题</a></div>
<div id="div主题">
<div class="Element11">
<div class="Element10">
<div class="Element212">
<div class="TableDiv">
<table cellspacing="0" class="Table0">
<tr>
<td class="Element200" valign="top" width="50%">
<div class="Element201">
主题 </div></td><td class="Element204" valign="top" width="50%">
<div class="Element205">
描述 </div></td></tr><tr>
<td class="Element202" valign="top" width="50%">
<div class="Element203">
<a href="00736.html" target="topic">E.1 概述</a> </div></td><td class="Element206" valign="top" width="50%">
<div class="Element207">
The SystemVerilog Direct Programming Interface (DPI) allows direct inter-language function calls between SystemVerilog and any foreign programming language with a C function call protocol and linking model:
<ul class="Element630">
<li class="Element600">Functions implemented in C and given import declarations in SystemVerilog can be called from System- Verilog; such functions are referred to as imported functions.</li>
<li class="Element600">Functions implemented in SystemVerilog and specified in export declarations can be called from C; such functions are referred to as exported functions.</li>
<li class="Element600">Tasks implemented in SystemVerilog and specified in export declarations can be called from C; such functions are referred to as exported tasks.</li>
<li class="Element600">Functions implemented in C which... <a href="00736.html" target="topic">more</a> </div></td></tr><tr>
<td class="Element202" valign="top" width="50%">
<div class="Element203">
<a href="00755.html" target="topic">E.2 Naming conventions</a> </div></td><td class="Element206" valign="top" width="50%">
<div class="Element207">
All names introduced by this interface shall conform to the following conventions.
<ul class="Element630">
<li class="Element600">All names defined in this interface are prefixed with sv or SV_.</li>
<li class="Element600">Function and type names start with sv, followed by initially capitalized words with no separators, e.g., svBitPackedArrRef.</li>
<li class="Element600">Names of symbolic constants start with sv_, e.g., sv_x.</li>
<li class="Element600">Names of macro definitions start with SV_, followed by all upper-case words separated by a underscore (_), e.g., SV_CANONICAL_SIZE. </li>
</ul> </div></td></tr><tr>
<td class="Element202" valign="top" width="50%">
<div class="Element203">
<a href="00756.html" target="topic">E.3 Portability</a> </div></td><td class="Element206" valign="top" width="50%">
<div class="Element207">
Depending on the data types used for imported or exported tasks or functions, the C code can be binary-level or source-level compatible. Applications that do not use SystemVerilog packed types are always binary compatible. Applications that don’t mix SystemVerilog packed and unpacked types in the same data type can be written to guarantee binary compatibility. Open arrays with both packed and unpacked parts are also binary compatible.<br><br>The values of SystemVerilog packed types can be accessed via interface tasks or functions using the canonical representation of 2-state and 4-state packed arrays, or directly through pointers using the implementation representation. The... <a href="00756.html" target="topic">more</a> </div></td></tr><tr>
<td class="Element202" valign="top" width="50%">
<div class="Element203">
<a href="00759.html" target="topic">E.4 Include files</a> </div></td><td class="Element206" valign="top" width="50%">
<div class="Element207">
The C-layer of the Direct Programming Interface defines two include files corresponding to these two levels of compatibility: svdpi.h and svdpi_src.h.<br><br>Binary compatibility of an application depends on the data types of the values passed through the interface. If all corresponding type definitions can be written in C without the need to include the svdpi_src.h file, then an application is binary compatible. If the svdpi_src.h file is required, then the application is not binary compatible and needs to be recompiled for each simulator of choice.<br><br>Applications that pass solely C-compatible data types or standalone packed arrays (both 2-state and 4-state)... <a href="00759.html" target="topic">more</a> </div></td></tr><tr>
<td class="Element202" valign="top" width="50%">
<div class="Element203">
<a href="00762.html" target="topic">E.5 Semantic constraints</a> </div></td><td class="Element206" valign="top" width="50%">
<div class="Element207">
Formal and actual arguments of both imported tasks or functions and exported tasks or functions are bound by the principle “What You Specify Is What You Get.” This principle is binding both for the caller and for the callee, in C code and in SystemVerilog code. For the callee, it guarantees the actual arguments are as specified for the formal ones. For the caller, it means the function call arguments shall conform with the types of the formal arguments, which might require type-coercion on the caller side.<br><br>Another way to state this is that no compiler (either C or SystemVerilog)... <a href="00762.html" target="topic">more</a> </div></td></tr><tr>
<td class="Element202" valign="top" width="50%">
<div class="Element203">
<a href="00770.html" target="topic">E.6 Data types</a> </div></td><td class="Element206" valign="top" width="50%">
<div class="Element207">
This section defines the data types of the C-layer of the Direct Programming Interface. </div></td></tr><tr>
<td class="Element202" valign="top" width="50%">
<div class="Element203">
<a href="00778.html" target="topic">E.7 Argument passing modes</a> </div></td><td class="Element206" valign="top" width="50%">
<div class="Element207">
This section defines the ways to pass arguments in the C-layer of the Direct Programming Interface. </div></td></tr><tr>
<td class="Element202" valign="top" width="50%">
<div class="Element203">
<a href="00788.html" target="topic">E.8 Context tasks and functions</a> </div></td><td class="Element206" valign="top" width="50%">
<div class="Element207">
Some DPI imported tasks and functions require that the context of their call is known. For example, those calls can be associated with instances of C models that have a one-to-one correspondence with instances of SystemVerilog modules that are making the calls. Alternatively, a DPI imported task or function might need to access or modify simulator data structures using PLI or VPI calls, or by making a call back into SystemVerilog via an export task or function. Context knowledge is required for such calls to function properly. It can take special instrumentation of their call to provide such context.<br><br>To... <a href="00788.html" target="topic">more</a> </div></td></tr><tr>
<td class="Element202" valign="top" width="50%">
<div class="Element203">
<a href="00794.html" target="topic">E.9 Include files</a> </div></td><td class="Element206" valign="top" width="50%">
<div class="Element207">
The C-layer of the Direct Programming Interface defines two include files. The main include file, svdpi.h, is implementation-independent and defines the canonical representation, all basic types, and all interface functions. The second include file, svdpi_src.h, defines only the actual representation of packed arrays and, hence, is implementation-dependent. Both files are shown in Annex B.<br><br>Applications which do not need to include svdpi_src.h are binary-level compatible. </div></td></tr><tr>
<td class="Element202" valign="top" width="50%">
<div class="Element203">
<a href="00737.html" target="topic">E.10 Arrays</a> </div></td><td class="Element206" valign="top" width="50%">
<div class="Element207">
Normalized ranges are used for accessing SystemVerilog arrays, with the exception of formal arguments specified as open arrays. </div></td></tr><tr>
<td class="Element202" valign="top" width="50%">
<div class="Element203">
<a href="00743.html" target="topic">E.11 Open arrays</a> </div></td><td class="Element206" valign="top" width="50%">
<div class="Element207">
Formal arguments specified as open arrays allows passing actual arguments of different sizes (i.e., different range and/or different number of elements), which facilitates writing more general C code that can handle SystemVerilog arrays of different sizes. The elements of an open array can be accessed in C by using the same range of indices and the same indexing as in SystemVerilog. Plus, inquiries about the dimensions and the original boundaries of SystemVerilog actual arguments are supported for open arrays.<br><br>NOTE—Both packed and unpacked array dimensions can be unsized.<br><br>All formal arguments declared in SystemVerilog as open arrays are passed by... <a href="00743.html" target="topic">more</a> </div></td></tr></table></div></div>
</div>
</div>
</div>
<a name="Links"></a><div class="Element14">
<a onclick="toggleVisibilityStored('链接');" class="a_Element14"><img src="sectionminus.png" border="0" alt="" title="" id="img链接">链接</a></div>
<div id="div链接">
<div class="Element11">
<div class="Element10">
<a href="01031.html" target="topic">主题</a></div>
</div>
</div>
</div>
<!-- End Page Content -->
<!-- Begin Page Footer -->
<hr width="98%" align="center" size="1" color="#CCCCCC" />
<table align="center" cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr height="10">
<td></td>
</tr>
<tr align="center">
<td>
<script type="text/javascript"><!--
google_ad_client = "pub-5266859600380184";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text_image";
google_ad_channel ="";
google_page_url = document.location;
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</td>
</tr>
<tr height="15">
<td></td>
</tr>
<tr align="center">
<td>
<font size=2>除非特别声明,原文版权归作者所有,如有转摘请注明原作者以及译者(<a href="http://www.fpgatech.net/" target="_blank">FPGA技术网</a>)信息。<br />
如果您对本主题有何建议或意见,请登陆<a href="http://www.fpgatech.net/forum/forumdisplay.php?fid=18" target="_blank">FPGA开发者家园</a>提交,您的参与是我们前进的动力。</font>
<script language="javascript" type="text/javascript" src="http://js.users.51.la/195685.js"></script>
<noscript><a href="http://www.51.la/?195685" target="_blank"><img alt="我要啦免费统计" src="http://img.users.51.la/195685.asp" style="border:none" /></a></noscript>
</td>
</tr>
</tbody>
</table>
<!-- End Page Footer -->
</div>
</div>
<!-- End Client Area -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -