📄 4-6.htm
字号:
<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta name="Microsoft Theme" content="arcs 001">
<meta http-equiv=Content-Type content="text/html; charset=GB2312">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 9">
<meta name=Originator content="Microsoft Word 9">
<link rel=File-List href="./4-6.files/filelist.xml">
<link rel=Edit-Time-Data href="./4-6.files/editdata.mso">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<title>Multiplication 乘法运算</title>
<!--[if gte mso 9]><xml>
<o:DocumentProperties>
<o:Author>Dracula</o:Author>
<o:Template>Normal</o:Template>
<o:LastAuthor>Dracula</o:LastAuthor>
<o:Revision>3</o:Revision>
<o:TotalTime>2</o:TotalTime>
<o:Created>2002-06-16T00:12:00Z</o:Created>
<o:LastSaved>2002-06-16T00:52:00Z</o:LastSaved>
<o:Pages>7</o:Pages>
<o:Words>1232</o:Words>
<o:Characters>7028</o:Characters>
<o:Company>Tomb</o:Company>
<o:Lines>58</o:Lines>
<o:Paragraphs>14</o:Paragraphs>
<o:CharactersWithSpaces>8630</o:CharactersWithSpaces>
<o:Version>9.2812</o:Version>
</o:DocumentProperties>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:DrawingGridVerticalSpacing>7.8 磅</w:DrawingGridVerticalSpacing>
<w:Compatibility>
<w:UseFELayout/>
</w:Compatibility>
</w:WordDocument>
</xml><![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"\@宋体";
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:宋体;
mso-bidi-font-family:"Times New Roman";
color:black;}
h3
{margin-right:0cm;
mso-margin-top-alt:auto;
mso-margin-bottom-alt:auto;
margin-left:0cm;
mso-pagination:widow-orphan;
mso-outline-level:3;
font-size:13.5pt;
font-family:宋体;
color:black;
font-weight:bold;}
a:link, span.MsoHyperlink
{color:#3399FF;
text-decoration:underline;
text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
{color:#666666;
text-decoration:underline;
text-underline:single;}
p
{margin-right:0cm;
mso-margin-top-alt:auto;
mso-margin-bottom-alt:auto;
margin-left:0cm;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:宋体;
mso-bidi-font-family:"Times New Roman";
color:black;}
/* Page Definitions */
@page
{mso-page-border-surround-header:no;
mso-page-border-surround-footer:no;}
@page Section1
{size:595.3pt 841.9pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;
mso-header-margin:42.55pt;
mso-footer-margin:49.6pt;
mso-paper-source:0;}
div.Section1
{page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1030"/>
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1"/>
</o:shapelayout></xml><![endif]-->
</head>
<body bgcolor=white background=arctile.jpg lang=ZH-CN link="#3399ff"
vlink="#666666" style='tab-interval:21.0pt' alink="#FF9900">
<div class=Section1>
<h3 align=center style='text-align:center'><span lang=EN-US style='font-size:
24.0pt'>4.6 Multiplication 乘法运算</span></h3>
<p align=right style='text-align:right'><span lang=EN-US><a href="chapter4.htm"></a></span><!--[if gte vml 1]><v:shapetype
id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t"
path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f">
<v:stroke joinstyle="miter"/>
<v:formulas>
<v:f eqn="if lineDrawn pixelLineWidth 0"/>
<v:f eqn="sum @0 1 0"/>
<v:f eqn="sum 0 0 @1"/>
<v:f eqn="prod @2 1 2"/>
<v:f eqn="prod @3 21600 pixelWidth"/>
<v:f eqn="prod @3 21600 pixelHeight"/>
<v:f eqn="sum @0 0 1"/>
<v:f eqn="prod @6 1 2"/>
<v:f eqn="prod @7 21600 pixelWidth"/>
<v:f eqn="sum @8 21600 0"/>
<v:f eqn="prod @7 21600 pixelHeight"/>
<v:f eqn="sum @10 21600 0"/>
</v:formulas>
<v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/>
<o:lock v:ext="edit" aspectratio="t"/>
</v:shapetype><v:shape id="_x0000_s1026" type="#_x0000_t75" alt=""
href="chapter4.htm" style='position:absolute;left:0;text-align:left;
margin-left:0;margin-top:0;width:45pt;height:33.75pt;z-index:1;
mso-wrap-distance-left:0;mso-wrap-distance-top:0;mso-wrap-distance-right:0;
mso-wrap-distance-bottom:0;mso-position-horizontal:left;
mso-position-horizontal-relative:text;mso-position-vertical-relative:line'
o:allowoverlap="f" o:button="t">
<v:imagedata src="images\BACK.GIF"/>
<w:wrap type="square" anchorx="page"/>
</v:shape><![endif]--><![if !vml]><a href="chapter4.htm"><img border=0
width=60 height=45 src="images\BACK.GIF" align=left v:shapes="_x0000_s1026"></a><![endif]><a
href="chapter4.htm"></a><a href="chapter4.htm"></a><span lang=EN-US>
<a href="4-5.htm"><span style='text-decoration:none;text-underline:none'><img
border=0 width=60 height=45 id="_x0000_i1025" src="images\PREV.GIF"></span></a>
<a href="4-7.htm"><span style='text-decoration:none;text-underline:none'><img
border=0 width=60 height=45 id="_x0000_i1026" src="images\FORW.GIF"></span></a> </span></p>
<p><span style='font-size:13.5pt'>本节问题:</span></p>
<p><span lang=EN-US style='font-size:13.5pt'><img border=0 width=26 height=27
id="_x0000_i1027" src="images\SUB.GIF"><a href="#乘法的基本原理">乘法的基本原理</a><br>
<img border=0 width=26 height=27 id="_x0000_i1028" src="images\SUB.GIF"><a
href="#第一代乘法算法和硬件设计">第一代乘法算法与硬件实现</a><br>
<img border=0 width=26 height=27 id="_x0000_i1029" src="images\SUB.GIF"><a
href="#第二代乘法算法和硬件设计">第二代乘法算法与硬件实现</a><br>
<img border=0 width=26 height=27 id="_x0000_i1030" src="images\SUB.GIF"><a
href="#:第三代乘法算法和硬件设计">第三代乘法算法与硬件实现</a><br>
<img border=0 width=26 height=27 id="_x0000_i1031" src="images\SUB.GIF"><a
href="#带符号乘法运算">带符号乘法运算</a><br>
<img border=0 width=26 height=27 id="_x0000_i1032" src="images\SUB.GIF"><a
href="#Booth's Algorithm布斯算法">Booth算法<br>
</a><img border=0 width=26 height=27 id="_x0000_i1033" src="images\SUB.GIF"><a
href="#MIPS机器乘法的实现">MIPS机器乘法的实现</a></span></p>
<p><span style='font-size:13.5pt'>一:<a name=乘法的基本原理>乘法的基本原理</a></span><span
style='mso-bookmark:乘法的基本原理'></span></p>
<p><span lang=EN-US style='font-size:13.5pt'> </span></p>
<p><span lang=EN-US style='font-size:13.5pt'> 在实现ALU和加法、减法和位移功能之后,我们着手构建更复杂的乘法器。首先我们通过人工地将十进制数相乘来回忆乘法的步骤。为了简便起见,这两个十进制数中只出现0和1。</span></p>
<p><span lang=EN-US style='font-size:13.5pt'> For
example: Multiplying 1000<sub>ten</sub> by 1001<sub>ten</sub>:<br>
Multiplicand (被乘数)
1000<sub>ten</sub><br>
Multiplier ( 乘数)
× 1001<sub>ten</sub><br>
----------------------<br>
1000<br>
0000<br>
0000
<br>
1000 <br>
-----------------------<br>
Product 1001000<sub>ten</sub><br>
第一个操作数称为被乘数multiplicand;第二个操作数称为乘数multiplier;最后的结果称为积product。我们发现product的位数比multiplicand和multiplier都大。如果不算符号位,若n-bit
multiplicand和m-bit multiplier相乘,product是n+m bits。同样乘法也会产生溢出。</span></p>
<p><span lang=EN-US style='font-size:13.5pt'> 由于在十进制中我们只取了0和1两个数,每步的计算都面临两个选择,place
a copy of the multiplicand (1×multiplicand) in the proper place if the multiplier
digit is a 1; or place 0 (0×multiplicand) if the digit is 0,在二进制中同样如此。</span></p>
<p><span style='font-size:13.5pt'>二:<a name=第一代乘法算法和硬件设计>第一代乘法算法和硬件设计</a></span><span
style='mso-bookmark:第一代乘法算法和硬件设计'></span></p>
<p><span lang=EN-US style='font-size:13.5pt'> 第一代乘法算法与手工计算相似。我们将multiplier放在the
32-bit Multiplier register中,同时the 64-bit Product register 中都初始化为0,用the 63-bit
Multiplicand rigister,将multiplicand放在右半部分,左半部分初始化为0。其具体的硬件设计图和流程图如下:</span></p>
<p><span lang=EN-US style='font-size:13.5pt'> <img border=0 width=800
height=381 id="_x0000_i1034" src="images\4-6-pic1.gif"></span></p>
<p><span lang=EN-US style='font-size:13.5pt'> Example: Using
4-bit numbers to save space, multiply 2<sub>ten</sub>×3<sub>ten</sub> or 0010<sub>two</sub>×0011<sub>two</sub>.<br>
按照上面的流程图,我们可以得到下面的具体的实现步骤表格:<b>1=>或0=>表示导致什么...</b></span></p>
<p align=center style='text-align:center'><span style='font-size:13.5pt'> </span><span
lang=EN-US><o:p></o:p></span></p>
<div align=center>
<table border=1 cellspacing=0 cellpadding=0 width=603 style='width:452.25pt;
mso-cellspacing:0cm;mso-padding-alt:0cm 0cm 0cm 0cm' height=191
bordercolordark="#CC9966" bordercolorlight="#FFCC66">
<tr style='height:17.25pt'>
<td width=83 style='width:62.25pt;background:#CCFF99;padding:0cm 0cm 0cm 0cm;
height:17.25pt'>
<p align=center style='text-align:center'><span lang=EN-US style='font-size:
13.5pt'>Iteration</span></p>
</td>
<td width=220 style='width:165.15pt;background:#CCFF99;padding:0cm 0cm 0cm 0cm;
height:17.25pt'>
<p align=center style='text-align:center'><span lang=EN-US style='font-size:
13.5pt'>Step</span></p>
</td>
<td width=92 style='width:69.0pt;background:#CCFF99;padding:0cm 0cm 0cm 0cm;
height:17.25pt'>
<p align=center style='text-align:center'><span lang=EN-US style='font-size:
13.5pt'>Multiplier</span></p>
</td>
<td width=110 style='width:82.5pt;background:#CCFF99;padding:0cm 0cm 0cm 0cm;
height:17.25pt'>
<p align=center style='text-align:center'><span lang=EN-US style='font-size:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -