ver_magnitude.html

来自「verilog的入门级别的例子(转载)」· HTML 代码 · 共 352 行 · 第 1/2 页

HTML
352
字号
<html><head>	<title>Verilog HDL: Magnitude</title>	<meta name="keywords" content="Verilog HDL, Magnitude, CORDIC">	<meta name="description" content="A common approach to implementing these arithmetic functions is using the Coordinate Rotation Digital Computer (CORDIC) algorithm.">	<meta name="date" content="2002-08-29">	<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">&nbsp;</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>&nbsp;<font class='footer'><a href='http://search.altera.com/?ql=a'>Advanced</a>");			document.writeln("&nbsp;&nbsp;&nbsp;&nbsp;<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>&nbsp;<font class="footer"><a href=http://search.altera.com/?ql=a>Advanced</a>                        &nbsp;&nbsp;&nbsp;<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">&nbsp;&nbsp;<a href="/support/examples/stratix/exm-stratix.html" class="menu">Stratix</a></td></tr><tr>	<td class="menu">&nbsp;&nbsp;<a href="/support/examples/cyclone/exm-cyclone.html" class="menu">Cyclone</a></td></tr><tr>	<td class="menu">&nbsp;&nbsp;<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">&nbsp;&nbsp;<a href="/support/examples/exm-arithmetic.html" class="menu">Arithmetic</a></td></tr><tr>	<td class="menu">&nbsp;&nbsp;<a href="/support/examples/exm-memory.html" class="menu">Memory</a></td></tr><tr>	<td class="menu">&nbsp;&nbsp;<a href="/support/examples/exm-bus_io.html" class="menu">Bus & I/O</a></td></tr><tr>	<td class="menu">&nbsp;&nbsp;<a href="/support/examples/exm-logic.html" class="menu">Logic</a></td></tr><tr>	<td class="menu">&nbsp;&nbsp;<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">&nbsp;&nbsp;<a href="/support/examples/quartus/quartus.html" class="menu">Quartus II Projects</a></td></tr><tr>	<td class="menu">&nbsp;&nbsp;<a href="/support/examples/tcl/tcl.html" class="menu">TCL</a></td></tr><tr>	<td class="menu">&nbsp;&nbsp;<a href="/support/examples/vhdl/vhdl.html" class="menu">VHDL</a></td></tr><tr>	<td class="menu" bgcolor="white">&nbsp;&nbsp;<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">&nbsp;&nbsp;<a href="/support/examples/ged/ged.html" class="menu">Graphic Editor</a></td></tr><tr>	<td class="menu">&nbsp;&nbsp;<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: Magnitude</H2><P>For a vector (<i>a,b</i>), the magnitude representation is the following:</P><img src="images/ver-magnitude_eqn.gif" width="178" height="35" border="0"><p>A common approach to implementing these arithmetic functions is to use the Coordinate Rotation Digital Computer (CORDIC) algorithm. The CORDIC algorithm calculates the trigonometric functions of sine, cosine, magnitude, and phase using an iterative process. It is made up of a series of micro-rotations of the vector by a set of predetermined constants, which are powers of two.Using binary arithmetic, this algorithm essentially replaces multipliers with shift and add operations. In a Stratix<sup>&#153;</sup> device, it is possible to calculate some of these arithmetic functions directly, without having to implement the CORDIC algorithm.</p><p>This design example calculates the magnitude of a 9-bit signed vector (<i>a,b</i>) using a pipelined square root function. To calculate the sum of the squares of the input (<i>a<SUP><font size="-1">2</font></SUP> + b<SUP><font size="-1">2</font></SUP></i>), the DSP block can be configured in the Two-Multipliers Adder mode. The square root function is implemented using an iterative algorithm, which is similar to the long division operation. The binary numbers are paired off, and subtracted by a trial number. Depending if the remainder is positive or negative, each bit of the square root is determined and the process is repeated. This square root function does not require memory and is implemented in logic cells only.</p>

⌨️ 快捷键说明

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