?? ver_ram.html
字號(hào):
<html><head> <title>Verilog HDL: Parameterized RAM with Separate Input & Output Ports</title> <meta name="keywords" content="support, technical support, Atlas, solutions, devices, example, arithmetic"> <meta name="description" content="Altera offers users design examples for use in designs for Altera devices."> <meta name="date" content="2001-11-09"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link rel="stylesheet" type="text/css" href="/js.lib/style.css"> <link rel="stylesheet" type="text/css" href="/js.lib/style_form.css"></head><!--stopindex--><BODY BGCOLOR="#ffffff" marginwidth="0" marginheight="0" rightmargin="0" topmargin="0" leftmargin="0"><!-- Toolbar Header --><table cellSpacing=0 cellPadding=0 width="100%" border=0 nowrap><tr> <td><table width="100%" border="0" cellspacing="0" cellpadding="0" nowrap><tr> <td bgcolor="#0182C4" align="left"><img src="/common/template/altera_left.jpg" width="578" height="60" usemap="#banner_l" border="0" align="left" alt="Altera Homepage"><map name="banner_l"><area shape="rect" coords="9,16,158,55" href="/index.jsp"></map></td><td bgcolor="#0182C4" align="right"><img src="/common/template/altera_right.gif" width="181" height="62" usemap="#altera_right" border="0" alt="Altera Quicklinks"><map name="altera_right"><area shape="rect" coords="5,8,54,54" href="/support/software/sof-download_center.html" alt="Download" title="Download"><area shape="rect" coords="63,11,110,54" href="/support/licensing/lic-index.html" alt="Licensing" title="Licensing"><area shape="rect" coords="122,10,170,56" href="/literature/lit-index.html" alt="Literature" title="Literature"></map></td></tr></table><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr> <td bgcolor="#0182C4" height="2" width="161"> </td><!-- begin top level navigation (top) --><td bgcolor="#000000" height="2" colspan="3"><img src="/common/template/support.gif" width="617" height="19" usemap="#support" border="0" alt="Global Navigation Bar"><map name="support"><area shape="rect" coords="0,0,54,19" href="/index.jsp" alt="Altera Home"><area shape="rect" coords="56,0,127,19" href="/products/prd-index.html" alt="Altera Products"><area shape="rect" coords="130,0,198,19" href="/support/spt-index.html" alt="Altera Support Center"><area shape="rect" coords="200,0,315,19" href="/solutions/sln-index.html" alt="Altera System Solutions"><area shape="rect" coords="318,0,442,19" href="/education/edu-index.html" alt="Altera Education"><area shape="rect" coords="445,0,534,19" href="http://buy.altera.com/ecommerce/index.html" alt="Altera Buy On-Line"><area shape="rect" coords="538,0,608,19" href="/corporate/crp-index.html" alt="Altera Corporate"></map></td><!-- end top level navigation (top) --></tr><tr> <td bgcolor="#e0e0e0" height="2"><img src="/common/template/search.gif" width="161" height="19" alt="Search Here" border="0"></td><!-- begin second level navigation (top) --><td bgcolor="#747474" height="2" colspan="3"><img src="/common/template/support_examples.gif" width="617" height="19" usemap="#support_examples" border="0" alt="Second Level Navigation Bar"><map name="support_examples"><area shape="rect" coords="0,2,87,17" href="http://www.altera.com/mysupport" alt="Altera mySupport"><area shape="rect" coords="92,0,224,18" href="/support/kdb/spt-search_kdb.html" alt="Knowledge Database"><area shape="rect" coords="231,0,305,19" href="/support/software/sof-index.html" alt="Software"><area shape="rect" coords="308,1,381,18" href="/support/devices/dvs-index.html" alt="Altera Devices"><area shape="rect" coords="390,1,524,21" href="/support/examples/exm-index.html" alt="Design Examples"></map></td><!-- end second level navigation (top) --></tr><tr> <td valign="top" bgcolor="#e0e0e0" width="161" height="1%" align="center"> <script language="JavaScript"> document.writeln("<form name='search_altera' method=GET accept-charset='iso-8859-1' action='/cgi-bin/devsearch.pl'>"); document.writeln(" <table border=0 cellpadding=3 cellspacing=0 bgcolor=#e0e0e0>"); document.writeln(" <tr> "); document.writeln(" <td valign=middle height='1'>"); document.writeln(" <input type=hidden name=col value='corp'>"); document.write(" <input type=text name=qt maxlength=180 size="); if (navigator.appName.toUpperCase().indexOf("MICROSOFT")>=0) { document.writeln("11>"); } else { document.writeln("6>"); } document.writeln("<input type=image value=GO name='submit' src='/common/template/go.gif' width='27' height='27' align='absmiddle' alt='GO' border='0'>"); document.writeln(" </td>"); document.writeln(" </tr>"); document.writeln("<tr><td> <font class='footer'><a href='http://search.altera.com/?ql=a'>Advanced</a>"); document.writeln(" <a href='http://search.altera.com/help/?la=en'>Help</a></font></td></tr>"); document.writeln(" </table>"); document.writeln("</form>"); </script> <noscript> <form name="search_altera" method=GET accept-charset="iso-8859-1" action="/cgi-bin/devsearch.pl"> <table border=0 cellpadding=3 cellspacing=0 bgcolor=#e0e0e0> <tr> <td valign=middle height="1"> <input type=hidden name=col value="corp"> <input type=text name=qt maxlength=180 size=6> <input type=image value=GO name="submit" src="/common/template/go.gif" width="27" height="27" align="absmiddle" alt="GO" border="0"> </td> </tr> <tr><td> <font class="footer"><a href=http://search.altera.com/?ql=a>Advanced</a> <a href=http://search.altera.com/help/?la=en>Help</a></font></td></tr> </table> </form> </noscript> <p><table border=0 cellspacing=0 cellpadding=0> <tr> <td bgcolor="#e0e0e0" valign="top"> <table border=0 cellspacing=0 cellpadding=0 width=161 bgcolor="#e0e0e0" style="br {line-height: 6pt;}"> <tr> <td rowspan="50"><img src="/common/template/spacer.gif" width="4" height="4" alt="" border="0"></td> <td></td> </tr><!-- begin left navigation --><tr> <td class="category"><br><b>Devices</b></td></tr><tr> <td class="menu"> <a href="/support/examples/stratix/exm-stratix.html" class="menu">Stratix</a></td></tr><tr> <td class="menu"> <a href="/support/examples/cyclone/exm-cyclone.html" class="menu">Cyclone</a></td></tr><tr> <td class="menu"> <a href="/support/examples/exm-apex2.html" class="menu">APEX II</a></td></tr><tr> <td class="category"><br><b>Functionality</b></td></tr><tr> <td class="menu"> <a href="/support/examples/exm-arithmetic.html" class="menu">Arithmetic</a></td></tr><tr> <td class="menu"> <a href="/support/examples/exm-memory.html" class="menu">Memory</a></td></tr><tr> <td class="menu"> <a href="/support/examples/exm-bus_io.html" class="menu">Bus & I/O</a></td></tr><tr> <td class="menu"> <a href="/support/examples/exm-logic.html" class="menu">Logic</a></td></tr><tr> <td class="menu"> <a href="/support/examples/dsp/exm-dsp.html" class="menu">DSP</a></td></tr><tr> <td class="category"><br><b>Entry Method</b></td></tr><tr> <td class="menu"> <a href="/support/examples/quartus/quartus.html" class="menu">Quartus II Projects</a></td></tr><tr> <td class="menu"> <a href="/support/examples/tcl/tcl.html" class="menu">TCL</a></td></tr><tr> <td class="menu"> <a href="/support/examples/vhdl/vhdl.html" class="menu">VHDL</a></td></tr><tr> <td class="menu" bgcolor="white"> <a href="/support/examples/verilog/verilog.html" class="menu"><font color="#ff6600">Verilog HDL</font></a></td></tr><tr> <td class="submenu" bgcolor="white"> </td><tr><tr> <td class="menu"> <a href="/support/examples/ged/ged.html" class="menu">Graphic Editor</a></td></tr><tr> <td class="menu"> <a href="/support/examples/ahdl/ahdl.html" class="menu">AHDL</a></td></tr><!-- end left navigation --> </table> </td> </tr> </table></p> </td> <td rowspan="3" width="15"><img src="/common/template/spacer.gif" width="15" height="15" alt="" border="0"></td> <td rowspan="3" valign="top" bgcolor="#ffffff"><br> <!--startindex--><!-- begin content --> <!-- begin content --><H2>Verilog HDL: Parameterized RAM with Separate Input & Output Ports</H2><P>This example shows how to instantiate a memory block using the LPM function <code>lpm_ram_dq</code>. The variable <code>ram</code> uses the <code>lpm_ram_dq</code> function from the LPM library. The ports are initially defined and then mapped to the LPM ports, as shown in red text. The parameter values are then passed through with the keyword <code>defparam</code>. In this example, a 16 x 256 RAM block is instantiated; you can use a similar process to instantiate RAM blocks of other sizes.<p><p>The <code>lpm_file</code> parameter refers to the Memory Initialization File (<b>.mif</b>) that specifies the initial content of a memory block (RAM or ROM). An MIF is an ASCII text file can be created manually or saved from the output of a simulation. In an MIF, you are required to specify the memory depth and width values and optionally you can specify the radixes used to display and interpret addresses and data values. These values are shown in red text in the <a href="#mif">extract</a> from the sample file, <b>map_lpm_ram.mif</b>, which is included below. An MIF is used as an input file for memory initialization in the MAX+PLUS II Compiler and Simulator.</P>For more information on using this example in your project, go to:<UL TYPE=DISC> <LI><A HREF="verilog.html#using">How to Use Verilog HDL Examples</A> <LI>MAX+PLUS II Help</UL></P><HR noshade><P><B><I>RAMveri.v</I></B></P><PRE>// instantiation of lpm_ram_dq, 16-bit data, 256 address locationmodule map_lpm_ram (dataout, datain, addr, we, inclk, outclk);// port instantiationinput [15:0] datain;input [7:0] addr;input we, inclk, outclk;output [15:0] dataout;// instantiating lpm_ram_dq<font color="#FF0000">lpm_ram_dq ram (.data(datain), .address(addr), .we(we), .inclock(inclk), .outclock(outclk), .q(dataout));</font>// passing the parameter valuesdefparam ram.lpm_width = 16;defparam ram.lpm_widthad = 8;defparam ram.lpm_indata = "REGISTERED";defparam ram.lpm_outdata = "REGISTERED";defparam ram.lpm_file = "map_lpm_ram.mif";endmodule-----------------------------------------------------------------------------</pre><a name="mif"><h3>Extract from the MIF file </h3><p>Download <a href="map_lpm_ram.mif">map_lpm_ram.mif</a></p><pre><font color="#FF0000">WIDTH = 16;DEPTH = 256;ADDRESS_RADIX = HEX;DATA_RADIX = HEX;</font>CONTENT BEGIN 0 : ffff; 1 : 0000; 2 : bbf3; 3 : 0000; 4 : 0000; . . . fb : 0000; fc : 0000; fd : 0000; fe : 0000; ff : 0000;END;</PRE><HR noshade><h2>Feedback</h2><p>Did this information help you?</p><p>If no, please log onto <a href="https://mysupport.altera.com/eservice/">mySupport</a> to file a technical request or enhancement.</p><p><hr noshade></p><font size="-1">Altera does not warrant that this solution will work for the customer's intended purpose and disclaims all liability for use of or reliance on the solution.</font><!-- end content --><!--stopindex--> <p> </p> </td> <td rowspan="3" width="15"><img src="/common/template/spacer.gif" width="15" height="15" alt="" border="0"></td> </tr> <tr valign="top"> <td bgcolor="#e0e0e0" valign="top" width="161"> </td></tr><tr> <td bgcolor=#e0e0e0 valign="bottom" width="161" height="2"> <p class="footer"> <br> Contact Us<br> <a href="/corporate/contact/info/con-feedback_form.jsp">Please Give Us Feedback</a><br> <a href="/corporate/contact/signup/con-signup.jsp">Sign Up for E-mail Updates</a></p> </td></tr><!-- Footer Information --> <tr><td bgcolor="#0182C4" colspan="4" align="right"><img src="/common/template/footer_user.gif" width="761" height="18" usemap="#footer_user" border="0" alt="footer"><map name="footer_user"><area shape="rect" coords="521,3,578,16" href="/common/new_user.html" alt="New User to the Altera Web Site" title="New User to the Altera Web Site"><area shape="rect" coords="587,4,631,15" href="/common/sitemap.html" alt="Altera Site Map" title="Altera Site Map"><area shape="rect" coords="643,3,684,14" href="/common/privacy.html" alt="Altera Privacy Policy" title="Altera Privacy Policy"><area shape="rect" coords="690,3,757,14" href="/common/legal.html" alt="Altera Legal Notice" title="Altera Legal Notice"></map></td> </tr><tr> <td width="161"> </td> <td colspan="3" width="100%"class="footer"><br><!-- begin top level navigation (bottom) --><a href=/index.jsp>Home</a> | <a href=/products/prd-index.html>Products</a> | <a href=/support/spt-index.html>Support</a> | <a href=/solutions/sln-index.html>System Solutions</a> | <a href=/education/edu-index.html>Education & Events</a> | <a href=http://buy.altera.com/ecommerce/>Buy On-Line</a> | <a href=/corporate/crp-index.html>Corporate</a><br><!-- end top level navigation (bottom) --> <!-- begin second level navigation (bottom) --><a href=/mysupport >mySupport</a> | <a href=/support/kdb/spt-search_kdb.html>Knowledge Database</a> | <a href=/support/software/sof-index.html>Software</a> | <a href=/support/devices/dvs-index.html>Devices</a> | <a href=/support/examples/exm-index.html>Design Examples</a><br><!-- end second level navigation (bottom) --> <p class="footer">Copyright © 1995 - 2002 Altera Corporation, 101 Innovation Drive, San Jose, California 95134, USA.</p> </td> </tr> </table> </td></tr></table><!--startindex--></body></html>
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -