📄 5.htm
字号:
<td width="33%" align="center"><b><font color="#000000" size="4"> None</font></b></td>
<td width="34%" align="center"><b><font color="#000000" size="4">The register on the Write register input
is written into with the value on the write data input</font></b></td>
</tr>
<tr>
<td width="33%" align="center"><b><font color="#000000" size="4"> PCSrc</font></b></td>
<td width="33%" align="center"><b><font color="#000000" size="4"> The PC is replaced by the output of the
adder that computes the value of PC+4</font></b></td>
<td width="34%" align="center"><b><font color="#000000" size="4">The PC is replaced by the output of the
adder that computes the branch target</font></b></td>
</tr>
<tr>
<td width="33%" align="center"><b><font color="#000000" size="4"> MemtoReg</font></b></td>
<td width="33%" align="center"><b><font color="#000000" size="4"> The value fed to the register write
data input comes from the ALU </font></b></td>
<td width="34%" align="center"><b><font color="#000000" size="4">The value fed to the register write data
input comes from the data memory</font></b></td>
</tr>
</table>
<p><font color="#000000" size="4"> <img border="0" src="Image/5-3.gif" width="768" height="550"></font></p>
<p><b><font color="#000000" size="4">指令执行过程举例:</font></b></p>
<p><b><font color="#000000" size="4">1)R型指令执行过程: 如 add $1,$2,$3 #$2+$3=>$1</font></b></p>
<p><b><font color="#000000" size="4"> a)取指令: i)指令存储器读出指令,把opcode送指令译码器,rs,rt,rd
对应相对的选择线</font></b></p>
<p><b><font color="#000000" size="4"> j)pc+4:
准备取下一条指令</font></b></p>
<p><b><font color="#000000" size="4"> b)指令译码器产生相应的控制信号</font></b></p>
<p><b><font color="#000000" size="4"> c)ALU执行相应的运算</font></b></p>
<p><b><font color="#000000" size="4"> d)运算的结果送rd</font></b></p>
<p><b><font color="#000000" size="4"> 注:R型指令是在一个周期内完成的</font></b></p>
<p> </p>
<p><b><font color="#000000" size="4">2)I型指令:如 sw $3,offset($5)</font></b></p>
<p><font color="#000000" size="4"> <b>a)取指令 ,pc+4: 准备取下一条指令</b></font></p>
<p><b><font color="#000000" size="4"> b)从寄存器组中读出$5</font></b></p>
<p><font color="#000000" size="4"> <b>c)计算存储器的有效地址 offset(符号扩展) +$5 </b></font></p>
<p><font color="#000000" size="4"><b> </b><img border="0" src="Image/31.gif" width="345" height="264"></font></p>
<p><b><font color="#000000" size="4"> d) EA =有效地址,送给存储器读地址</font></b></p>
<p><b><font color="#000000" size="4"> e)以Memory读出值送指定的寄存器 :由Instruction[20-16]决定</font></b></p>
<p><b><font color="#000000" size="4">3)Branch指令 Beq $3,$2,offset </font></b></p>
<p><font color="#000000" size="4"> <b>a)取指令 ,pc+4: 准备取下一条指令</b></font></p>
<p><b><font color="#000000" size="4"> b)从寄存器组中读出$2,$3</font></b></p>
<p><b><font color="#000000" size="4"> c)扩展指令[15-0](16位)到32位 </font></b></p>
<p><b><font color="#000000" size="4"> d)根据ALU的Zero=1? 选择pc+4还是pc+4+offset(扩展后)送pc</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="10%"><b><font color="#000000" size="4">Instruction</font></b></td>
<td width="10%"><b><font color="#000000" size="4">RegDst</font></b></td>
<td width="10%"><b><font color="#000000" size="4">ALUSrc</font></b></td>
<td width="10%"><b><font color="#000000" size="4">MemtoReg</font></b></td>
<td width="10%"><b><font color="#000000" size="4">Reg<br>
Write</font></b></td>
<td width="10%"><b><font color="#000000" size="4">Mem Read</font></b></td>
<td width="10%"><b><font color="#000000" size="4">Mem<br>
Write</font></b></td>
<td width="10%"><b><font color="#000000" size="4">Branch</font></b></td>
<td width="10%"><b><font color="#000000" size="4">ALUOp1</font></b></td>
<td width="10%"><b><font color="#000000" size="4">ALUOp2</font></b></td>
</tr>
<tr>
<td width="10%"><b><font color="#000000" size="4"> R-format</font></b></td>
<td width="10%"><b><font color="#000000" size="4"> 1</font></b></td>
<td width="10%"><b><font color="#000000" size="4"> 0</font></b></td>
<td width="10%"><b><font color="#000000" size="4"> 0</font></b></td>
<td width="10%"><b><font color="#000000" size="4"> 1</font></b></td>
<td width="10%"><b><font color="#000000" size="4"> 0</font></b></td>
<td width="10%"><b><font color="#000000" size="4"> 0</font></b></td>
<td width="10%"><b><font color="#000000" size="4"> 0 </font></b></td>
<td width="10%"><b><font color="#000000" size="4"> 1</font></b></td>
<td width="10%"><b><font color="#000000" size="4"> 0</font></b></td>
</tr>
<tr>
<td width="10%"><b><font color="#000000" size="4"> lw</font></b></td>
<td width="10%"><b><font color="#000000" size="4"> 0</font></b></td>
<td width="10%"><b><font color="#000000" size="4"> 1</font></b></td>
<td width="10%"><b><font color="#000000" size="4"> 1</font></b></td>
<td width="10%"><b><font color="#000000" size="4"> 1</font></b></td>
<td width="10%"><b><font color="#000000" size="4"> 1</font></b></td>
<td width="10%"><b><font color="#000000" size="4"> 0</font></b></td>
<td width="10%"><b><font color="#000000" size="4"> 0</font></b></td>
<td width="10%"><b><font color="#000000" size="4"> 0</font></b></td>
<td width="10%"><b><font color="#000000" size="4"> 0</font></b></td>
</tr>
<tr>
<td width="10%"><b><font color="#000000" size="4"> sw</font></b></td>
<td width="10%"><b><font color="#000000" size="4"> x</font></b></td>
<td width="10%"><b><font color="#000000" size="4"> 1</font></b></td>
<td width="10%"><b><font color="#000000" size="4"> x</font></b></td>
<td width="10%"><b><font color="#000000" size="4"> 0 </font></b></td>
<td width="10%"><b><font color="#000000" size="4"> 0</font></b></td>
<td width="10%"><b><font color="#000000" size="4"> 1</font></b></td>
<td width="10%"><b><font color="#000000" size="4"> 0</font></b></td>
<td width="10%"><b><font color="#000000" size="4"> 0 </font></b></td>
<td width="10%"><b><font color="#000000" size="4"> 0</font></b></td>
</tr>
<tr>
<td width="10%"><b><font color="#000000" size="4"> beq</font></b></td>
<td width="10%"><b><font color="#000000" size="4"> x</font></b></td>
<td width="10%"><b><font color="#000000" size="4"> 0</font></b></td>
<td width="10%"><b><font color="#000000" size="4"> x</font></b></td>
<td width="10%"><b><font color="#000000" size="4"> 0</font></b></td>
<td width="10%"><b><font color="#000000" size="4"> 0</font></b></td>
<td width="10%"><b><font color="#000000" size="4"> 0</font></b></td>
<td width="10%"><b><font color="#000000" size="4"> 1</font></b></td>
<td width="10%"><b><font color="#000000" size="4"> 0</font></b></td>
<td width="10%"><b><font color="#000000" size="4"> 1</font></b></td>
</tr>
</table>
<p><b><font color="#000000" size="4">所以我们可以列出真值表来实现主控制单元的逻辑实现</font></b></p>
<table border="1" width="100%" bordercolordark="#CC9966" bordercolorlight="#FFCC66">
<tr>
<td width="49%" colspan="3" align="center"><b><font color="#000000" size="4">R-format</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">lw</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">sw</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">beq</font></b></td>
</tr>
<tr>
<td width="16%" rowspan="6" align="center"><b><font color="#000000" size="4">inputs</font></b></td>
<td width="16%" align="center"><b><font color="#000000" size="4">Op5</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">0</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">1</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">1</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">0</font></b></td>
</tr>
<tr>
<td width="16%" align="center"><b><font color="#000000" size="4">Op4</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">0</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">0</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">0</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">0</font></b></td>
</tr>
<tr>
<td width="16%" align="center"><b><font color="#000000" size="4">Op3</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">0</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">0</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">1</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">0</font></b></td>
</tr>
<tr>
<td width="16%" align="center"><b><font color="#000000" size="4">Op2</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">0</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">0</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">0</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">1</font></b></td>
</tr>
<tr>
<td width="16%" align="center"><b><font color="#000000" size="4">Op1</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">0</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">1</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">1</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">0</font></b></td>
</tr>
<tr>
<td width="16%" align="center"><b><font color="#000000" size="4">Op0</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">0</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">1</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">1</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">0</font></b></td>
</tr>
<tr>
<td width="16%" rowspan="9" align="center"><b><font color="#000000" size="4">Outputs</font></b></td>
<td width="16%" align="center"><b><font color="#000000" size="4">RegDst</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">1</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">0</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">x</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">x</font></b></td>
</tr>
<tr>
<td width="16%" align="center"><b><font color="#000000" size="4">ALUSrc </font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">0</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">1</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">1</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">0</font></b></td>
</tr>
<tr>
<td width="16%" align="center"><b><font color="#000000" size="4">MemtoReg </font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">0</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">1</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">x</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">x</font></b></td>
</tr>
<tr>
<td width="16%" align="center"><b><font color="#000000" size="4">RegWrite </font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">1</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">1</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">0</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">0</font></b></td>
</tr>
<tr>
<td width="16%" align="center"><b><font color="#000000" size="4">MemRead</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">0</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">1</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">0</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">0</font></b></td>
</tr>
<tr>
<td width="16%" align="center"><b><font color="#000000" size="4">MemWrite</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">0</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">0</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">1</font></b></td>
<td width="17%" align="center"><b><font color="#000000" size="4">0</font></b></td>
</tr>
<tr>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -