📄 5.htm
字号:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>一种简单的逻辑实现 </title>
<meta name="Microsoft Theme" content="arcs 011">
<meta name="Microsoft Border" content="none">
</head>
<body background="../images/arctile.jpg" bgcolor="#FFFFFF" text="#000000" link="#3399FF" vlink="#666666" alink="#FF9900">
<p align="center"><font color="#000000" size="6"> 5.5 一种简单的逻辑实现
</font></p>
<p align="right"><font color="#000000"><a href="index.htm"><img border="0" src="Image/BACK.GIF" align="left" width="60" height="45"></a><a href="4.htm"><img border="0" src="Image/PREV.GIF" width="60" height="45"></a>
<a href="6.htm"><img border="0" src="Image/FORW.GIF" width="60" height="45"></a></font></p>
<p><font color="#000000"> </font></p>
<p> <b><font color="#000000" size="4">这章里用lw ,sw ,beq,add,sub,and,or,slt,jump来说明数据通路的设计,CPU的逐步的设计过程</font></b></p>
<p><b><font color="#000000" size="4">一:创建单一的数据通路:Single Datapath</font></b></p>
<p><b><font color="#000000" size="4"> 单一的数据通路可以在一个时钟周期内完成所有的指令,这样就使没有任何的一条数据的通路可以被使用两次。这样就造成了<br>
</font></b></p>
<p><b><font color="#000000" size="4">资源的浪费,在后面的介绍中,我们将使用一种叫multiplexor的装置来选择使用哪一条的数据通路。在前一章我们已经使用过这</font></b></p>
<p> </p>
<p><b><font color="#000000" size="4">种装置。</font></b></p>
<p><font color="#000000" size="4">
<img border="0" src="Image/5-1.gif" width="208" height="182"></font></p>
<p><b><font color="#000000" size="4">二 .ALU 的控制的逻辑实现</font></b></p>
<p><b><font color="#000000" size="4">我们现在讨论的是指令包括R型指令,Beq指令和lw,sw
指令。区分这三种指令</font></b></p>
<p><b><font color="#000000" size="4">需要两位Aluop,现定义如下</font></b></p>
<table border="1" width="100%" bordercolordark="#CC9966" bordercolorlight="#FFCC66">
<tr>
<td width="50%"><b><font color="#000000" size="4"> Aluop</font></b></td>
<td width="50%"><font color="#000000" size="4"> <b>Function</b></font></td>
</tr>
<tr>
<td width="50%"><b><font color="#000000" size="4"> 00</font></b></td>
<td width="50%"><font color="#000000" size="4"> <b>lw,sw</b></font></td>
</tr>
<tr>
<td width="50%"><b><font color="#000000" size="4"> 01</font></b></td>
<td width="50%"><font color="#000000" size="4"> <b>Beq</b></font></td>
</tr>
<tr>
<td width="50%"><b><font color="#000000" size="4"> 10</font> </b></td>
<td width="50%"><font color="#000000" size="4"> <b>R型指令</b></font></td>
</tr>
</table>
<p><font color="#000000" size="4"><b>对R 型指令包括And,Or,Add,Subtract 和 Set on less than五种</b>,<b>这样通过 Instruction[0-5]共六位来控制定义如下</b></font></p>
<table border="1" width="100%" bordercolordark="#CC9966" bordercolorlight="#FFCC66">
<tr>
<td width="28%"><b><font color="#000000" size="4">Instruction<br>
operation</font></b></td>
<td width="20%"><b><font color="#000000" size="4">Function code<br>
Instruction[0-5]</font></b></td>
<td width="27%"><b><font color="#000000" size="4">Desired<br>
Alu action</font></b></td>
<td width="25%"><b><font color="#000000" size="4">Alu control<br>
input</font></b></td>
</tr>
<tr>
<td width="28%"><b><font color="#000000" size="4"> add</font></b></td>
<td width="20%"><b><font color="#000000" size="4">100000</font></b></td>
<td width="27%"><b><font color="#000000" size="4">add</font></b></td>
<td width="25%"><b><font color="#000000" size="4">010</font></b></td>
</tr>
<tr>
<td width="28%"><b><font color="#000000" size="4"> subtract</font></b></td>
<td width="20%"><b><font color="#000000" size="4">100010</font></b></td>
<td width="27%"><b><font color="#000000" size="4">subtract</font></b></td>
<td width="25%"><b><font color="#000000" size="4">110</font></b></td>
</tr>
<tr>
<td width="28%"><b><font color="#000000" size="4"> AND</font></b></td>
<td width="20%"><b><font color="#000000" size="4">100100</font></b></td>
<td width="27%"><b><font color="#000000" size="4">and</font></b></td>
<td width="25%"><b><font color="#000000" size="4">000</font></b></td>
</tr>
<tr>
<td width="28%"><b><font color="#000000" size="4"> OR</font></b></td>
<td width="20%"><b><font color="#000000" size="4">100101</font></b></td>
<td width="27%"><b><font color="#000000" size="4">or</font></b></td>
<td width="25%"><b><font color="#000000" size="4">001</font></b></td>
</tr>
<tr>
<td width="28%"><b><font color="#000000" size="4"> Set-0n-less-than</font></b></td>
<td width="20%"><b><font color="#000000" size="4">101010</font></b></td>
<td width="27%"><b><font color="#000000" size="4">set-on-less-than</font></b></td>
<td width="25%"><b><font color="#000000" size="4">111</font></b></td>
</tr>
</table>
<p><font color="#000000" size="4"> </font></p>
<p><b><font color="#000000" size="4">所以对于所有的指令来说,可以如下定义:</font></b></p>
<table border="1" width="100%" bordercolordark="#CC9966" bordercolorlight="#FFCC66">
<tr>
<td width="16%"><b><font color="#000000" size="4">Instruction<br>
opcode</font></b></td>
<td width="10%"><b><font color="#000000" size="4">ALUOp</font></b></td>
<td width="23%"><b><font color="#000000" size="4">Instruction<br>
operation</font></b></td>
<td width="17%"><b><font color="#000000" size="4">Function<br>
code</font></b></td>
<td width="17%"><b><font color="#000000" size="4">Desired<br>
ALU action</font></b></td>
<td width="17%"><b><font color="#000000" size="4">ALU control<br>
input</font></b></td>
</tr>
<tr>
<td width="16%"><b><font color="#000000" size="4">LW</font></b></td>
<td width="10%"><b><font color="#000000" size="4">00</font></b></td>
<td width="23%"><b><font color="#000000" size="4">load word</font></b></td>
<td width="17%"><b><font color="#000000" size="4">xxxxxx</font></b></td>
<td width="17%"><b><font color="#000000" size="4">add</font></b></td>
<td width="17%"><b><font color="#000000" size="4">010</font></b></td>
</tr>
<tr>
<td width="16%"><b><font color="#000000" size="4">SW</font></b></td>
<td width="10%"><b><font color="#000000" size="4">00</font></b></td>
<td width="23%"><b><font color="#000000" size="4">store word</font></b></td>
<td width="17%"><b><font color="#000000" size="4">xxxxxx</font></b></td>
<td width="17%"><b><font color="#000000" size="4">add</font></b></td>
<td width="17%"><b><font color="#000000" size="4">010</font></b></td>
</tr>
<tr>
<td width="16%"><b><font color="#000000" size="4">Branch equal</font></b></td>
<td width="10%"><b><font color="#000000" size="4">01</font></b></td>
<td width="23%"><b><font color="#000000" size="4">branch equal</font></b></td>
<td width="17%"><b><font color="#000000" size="4">xxxxxx</font></b></td>
<td width="17%"><b><font color="#000000" size="4">subtract</font></b></td>
<td width="17%"><b><font color="#000000" size="4">110</font></b></td>
</tr>
<tr>
<td width="16%"><b><font color="#000000" size="4">R-type</font></b></td>
<td width="10%"><b><font color="#000000" size="4">10</font></b></td>
<td width="23%"><b><font color="#000000" size="4">add</font></b></td>
<td width="17%"><b><font color="#000000" size="4">100000</font></b></td>
<td width="17%"><b><font color="#000000" size="4">add</font></b></td>
<td width="17%"><b><font color="#000000" size="4">010</font></b></td>
</tr>
<tr>
<td width="16%"><b><font color="#000000" size="4">R-type</font></b></td>
<td width="10%"><b><font color="#000000" size="4">10</font></b></td>
<td width="23%"><b><font color="#000000" size="4">subtract</font></b></td>
<td width="17%"><b><font color="#000000" size="4">100010</font></b></td>
<td width="17%"><b><font color="#000000" size="4">subtract</font></b></td>
<td width="17%"><b><font color="#000000" size="4">110</font></b></td>
</tr>
<tr>
<td width="16%"><b><font color="#000000" size="4">R-type</font></b></td>
<td width="10%"><b><font color="#000000" size="4">10</font></b></td>
<td width="23%"><b><font color="#000000" size="4">AND</font></b></td>
<td width="17%"><b><font color="#000000" size="4">100100</font></b></td>
<td width="17%"><b><font color="#000000" size="4">and</font></b></td>
<td width="17%"><b><font color="#000000" size="4">000</font></b></td>
</tr>
<tr>
<td width="16%"><b><font color="#000000" size="4">R-type</font></b></td>
<td width="10%"><b><font color="#000000" size="4">10</font></b></td>
<td width="23%"><b><font color="#000000" size="4">OR</font></b></td>
<td width="17%"><b><font color="#000000" size="4">100101</font></b></td>
<td width="17%"><b><font color="#000000" size="4">or</font></b></td>
<td width="17%"><b><font color="#000000" size="4">001</font></b></td>
</tr>
<tr>
<td width="16%"><b><font color="#000000" size="4">R-type</font></b></td>
<td width="10%"><b><font color="#000000" size="4">10</font></b></td>
<td width="23%"><b><font color="#000000" size="4">set-on-less-than</font></b></td>
<td width="17%"><b><font color="#000000" size="4">101010</font></b></td>
<td width="17%"><b><font color="#000000" size="4">set-on-less-than</font></b></td>
<td width="17%"><b><font color="#000000" size="4">111</font></b></td>
</tr>
</table>
<p><b><font color="#000000" size="4">注:这儿的x表示无关项。</font></b></p>
<p><b><font color="#000000" size="4">接下来我们所要做的是通过ALUOp和Function code来产生ALU control input(op0,op1,op2)。</font></b></p>
<p><b><font color="#000000" size="4">这里我们用真值表法</font></b></p>
<p><b><font color="#000000" size="4">我们先列出真值表</font></b></p>
<table border="1" width="100%" bordercolordark="#CC9966" bordercolorlight="#FFCC66">
<tr>
<td width="22%" colspan="2"><b><font color="#000000" size="4"> ALUOp</font></b></td>
<td width="66%" colspan="6"><b><font color="#000000" size="4"> Function code</font></b></td>
<td width="12%" rowspan="2"><b><font color="#000000" size="4">ALU control<br>
input</font></b> <p><b><font color="#000000" size="4"> </font> </b></td>
</tr>
<tr>
<td width="11%"><b><font color="#000000" size="4">ALUOp1</font></b></td>
<td width="11%"><b><font color="#000000" size="4">ALUOp2</font></b></td>
<td width="11%"><b><font color="#000000" size="4"> F5</font></b></td>
<td width="11%"><b><font color="#000000" size="4"> F4</font></b></td>
<td width="11%"><b><font color="#000000" size="4"> F3</font></b></td>
<td width="11%"><b><font color="#000000" size="4"> F2</font></b></td>
<td width="11%"><b><font color="#000000" size="4"> F1</font></b></td>
<td width="11%"><b><font color="#000000" size="4"> F0</font></b></td>
</tr>
<tr>
<td width="11%"><b><font color="#000000" size="4"> 0</font></b></td>
<td width="11%"><b><font color="#000000" size="4"> 0</font></b></td>
<td width="11%"><b><font color="#000000" size="4"> x</font></b></td>
<td width="11%"><b><font color="#000000" size="4"> x</font></b></td>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -