组合逻辑控制单元设计.doc_第1页
组合逻辑控制单元设计.doc_第2页
组合逻辑控制单元设计.doc_第3页
组合逻辑控制单元设计.doc_第4页
组合逻辑控制单元设计.doc_第5页
已阅读5页,还剩6页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

一、实验课题实验要求:按照题目要求用硬布线(组合逻辑)控制法设计一个简单模型机的控制单元cu(微操作信号产生电路),决定外部的端口(名称、有效电平)和内部各元件的连接,画出系统框图和逻辑图,设计仿真数据,用vhdl编程和仿真。主要元件设计:1指令译码器功能要求:3-8译码器。2控制单元 功能要求:假设该模型机有8条不同类型的指令。包括:算术运算、逻辑运算、移位、数据传送、访存操作、转移等。根据每条指令的功能和时序,分析其执行过程中需要在各个阶段产生的全部微操作,导出产生这些微操作控制信号的逻辑。 3用层次结构设计的方法设计一个控制单元cu(微操作控制信号产生电路)。包括指令译码器和控制单元。功能要求:能够正确产生8条不同指令在执行过程中(每个机器周期、每拍)发出的全部微操作。二、逻辑设计写该实验的逻辑设计,包括:顶层系统框图,下层各主要元件的系统框图。顶层和下层各主要元件的端口(引脚)描述:端口名称、功能、有效电平、位数等。逻辑图,必须在图中清楚地标出每个内部连接线的signal(与vhdl程序中的signal一致)。根据所用的描述方式,可能还需要有:真值表/功能表/逻辑函数等。1、3-8译码器:系统框图:y7 y6 y5 y4 y3 y2 y1 y0 3-8译码器 s a2 a1 a0s是工作信号,当s=1时,3-8译码器工作;当s=0时,3-8译码器不工作。a是输入信号,y是输出信号s a2 a1 a0 y7 y6 y5 y4 y3 y2 y1 y0 1 0 0 0 0 0 0 0 0 0 0 1 加法1 0 0 1 0 0 0 0 0 0 1 0 与1 0 1 0 0 0 0 0 0 1 0 0 或1 0 1 1 0 0 0 0 1 0 0 0 左移1 1 0 0 0 0 0 1 0 0 0 0 右移1 1 0 1 0 0 1 0 0 0 0 0 数据传送1 1 1 0 0 1 0 0 0 0 0 0 取数1 1 1 1 1 0 0 0 0 0 0 0 无条件转移0 0 0 0 0 0 0 0 0 y(0)=s and (not a(2) and (not a(1) and (not a(0);y(1)=s and (not a(2) and (not a(1) and a(0);y(2)=s and (not a(2) and a(1) and (not a(0);y(3)=s and (not a(2) and a(1) and a(0);y(4)=s and a(2) and (not a(1) and (not a(0);y(5)=s and a(2) and (not a(1) and a(0);y(6)=s and a(2) and a(1) and (not a(0);y(7)=s and a(2) and a(1) and a(0);2、控制单元:设计过程:把每条指令的实现分成取指令、分析指令、执行指令三个步骤,每一步由一个机器周期实现,一条指令的实现需要三个机器周期,即m1(取指周期)、m2(分析周期)、m3(执行周期);每个机器周期由三个节拍组成,即t0、t1、t2。如下图所示:机器周期节拍t0t1t2m0m1m21、加法指令:寄存器r1中的一个数与寄存器r0中的一个数相加,结果放在r1中。即实现(r0)+(r1)r12、与指令:寄存器r1中的一个数与寄存器r0中的一个数,结果放在r1中。即实现(r1)and (r0) r1 3、或指令:寄存器r1中的一个数或寄存器r0中的一个数,结果放在r1中。即实现(r1)or (r0) r1 4、逻辑左移指令:寄存器r1中的数左移,移动位数存放在寄存器r0中,结果放在r1中。即实现(r1)r15、逻辑右移指令:寄存器r1中的数左移,移动位数存放在寄存器r0中,结果放在r1中。即实现(r1)r16、数据传送指令:寄存器r0中的数据送到寄存器r1中。即实现(r0) r1。7、取数指令:取出存储器中的一个数(地址在寄存器r0中)送到寄存器r1中。即实现(r0)(r1)8、无条件转移指令:寄存器r1中的地址送到pc中。即实现(r1) pc8条指令的微操作如下表所示,以教材p122的cpu控制图(省去了m/、ads)为例:由于每条指令取指周期的微操作是一样的,所以可以先设计取指周期微操作的节拍安排。取指周期:t0:pcab,w/=0t1:dbirt2:pc+1t0t1t2加法m1rs1gr(rs1) alurd gr(rd) alum2+alu gr与m1rs1gr(rs1) alurd gr(rd) alum2alu gr或m1rs1gr(rs1) alurd gr(rd) alum2alu gr左移m1rs1gr(rs1) alurd gr(rd) alum2alu gr右移m1rs1gr(rs1) alurd gr(rd) alum2alu gr数据传送m1rs1gr(rs1) alum2+alu gr取数m1rs1gr(rs1) alu+aluar,arabw/=0dbdrm2dralu+alu gr无条件转移m1rs1 gr(rs1) alum2+alupcd7 d0 m2 m1 m0 t2 t1 t0 控制单元 q18 q0系统框图:工作周期节拍微操作命令加法与或左移右移数据传送取数无条件转移addandorsalsarmovldajmp取指周期 t0pcab11111111w/=011111111t1dbir11111111t2pc+111111111分析周期t0rs1gr11111111(rs1)alu11111111+1t1aluar1arab1w/=01t2rdgr11111 (rd)alu11111dbdr1执行周期t0dralu1t1+11111111t2alugr1111111alu pc1所有指令:pcab = m0t0w/=0 = m0t0+m1t1取数dbir = m0t1pc+1 = m0 t2rs1gr = m1 t0(rs1)alu = m1 t0+ = m1 t0取数 +m2t1(加+传送+取数+转移)aluar =m1 t1 取数arab =m1t1 取数rdgr =m1 t2(加法+与+或+左移+右移)(rd)alu = m1 t2(加法+与+或+左移+右移)dbdr = m1 t2取数dralu = m2 t0取数 = m2t1与 = m2t1或 = m2t1左移 = m2t1右移alugr = m2t2(加法+与+或+左移+右移+数据传送+取数)alu pc = m2t2转移3、层次结构控制单元:t0 q18 q0 m0t1 控制单元 m1t2 d7 d0 m2逻辑图:i7 i0 y7 y6 y5 y4 y3 y2 y1 y0 3-8译码器 s a2 a1 a0t0 q18 q0 m0t1 控制单元 m1t2 d7 d0 m2 s a2 a1 a0t0t1t2m0m1m2 q18 q0 三、vhdl程序-3-8译码器library ieee;use ieee.std_logic_1164.all;entity decoder38 is port( s:in std_logic; a:in std_logic_vector(2 downto 0); y:out std_logic_vector(7 downto 0);end decoder38;architecture behave of decoder38 isbegin process(s) begin if s=1 then y(0)=(not a(2) and (not a(1) and (not a(0); y(1)=(not a(2) and (not a(1) and a(0); y(2)=(not a(2) and a(1) and (not a(0); y(3)=(not a(2) and a(1) and a(0); y(4)=a(2) and (not a(1) and (not a(0); y(5)=a(2) and (not a(1) and a(0); y(6)=a(2) and a(1) and (not a(0); y(7)=a(2) and a(1) and a(0); else y=00000000; end if; end process;end behave;-控制单元-3-8译码器library ieee;use ieee.std_logic_1164.all;entity cu is port( m:in std_logic_vector(2 downto 0); t:in std_logic_vector(2 downto 0); d:in std_logic_vector(7 downto 0); q:out std_logic_vector(18 downto 0);end cu;architecture behave of cu issignal iq:std_logic_vector(7 downto 0);begin iq(0)=not d(7) and not d(6) and not d(5) and not d(4) and not d(3) and not d(2) and not d(1) and d(0); iq(1)=not d(7) and not d(6) and not d(5) and not d(4) and not d(3) and not d(2) and d(1) and not d(0); iq(2)=not d(7) and not d(6) and not d(5) and not d(4) and not d(3) and d(2) and not d(1) and not d(0); iq(3)=not d(7) and not d(6) and not d(5) and not d(4) and d(3) and not d(2) and not d(1) and not d(0); iq(4)=not d(7) and not d(6) and not d(5) and d(4) and not d(3) and not d(2) and not d(1) and not d(0); iq(5)=not d(7) and not d(6) and d(5) and not d(4) and not d(3) and not d(2) and not d(1) and not d(0); iq(6)=not d(7) and d(6) and not d(5) and not d(4) and not d(3) and not d(2) and not d(1) and not d(0); iq(7)=d(7) and not d(6) and not d(5) and not d(4) and not d(3) and not d(2) and not d(1) and not d(0); q(0)=not m(2) and not m(1) and m(0) and not t(2) and not t(1) and t(0); q(1)=(not m(2) and not m(1) and m(0) and not t(2) and not t(1) and t(0) or (not m(2) and m(1) and not m(0) and not t(2) and t(1) and not t(0) and iq(6); q(2)=not m(2) and not m(1) and m(0) and not t(2) and t(1) and not t(0); q(3)=not m(2) and not m(1) and m(0) and t(2) and not t(1) and not t(0); q(4)=not m(2) and m(1) and not m(0) and not t(2) and not t(1) and t(0); q(5)=not m(2) and m(1) and not m(0) and not t(2) and not t(1) and t(0); q(6)=(not m(2) and m(1) and not m(0) and not t(2) and not t(1) and t(0) and iq(6) or (m(2) and not m(1) and not m(0) and not t(2) and t(1) and not t(0) and (iq(0) or iq(5) or iq(6) or iq(7); q(7)=not m(2) and m(1) and not m(0) and not t(2) and t(1) and not t(0) and iq(6); q(8)=not m(2) and m(1) and not m(0) and not t(2) and t(1) and not t(0) and iq(6);q(9)=not m(2) and m(1) and not m(0) and t(2) and not t(1) and not t(0) and (iq(0) or iq(1) or iq(2) or iq(3) or iq(4);q(10)=not m(2) and m(1) and not m(0) and t(2) and not t(1) and not t(0) and (iq(0) or iq(1) or iq(2) or iq(3) or iq(4); q(11)=not m(2) and m(1) and not m(0) and t(2) and not t(1) and not t(0) and iq(6); q(12)=m(2) and not m(1) and not m(0) and not t(2) and not t(1) and t(0) and iq(6); q(13)=m(2) and not m(1) and not m(0) and not t(2) and t(1) and not t(0) and iq(1); q(14)=m(2) and not m(1) and not m(0) and not t(2) and t(1) and not t(0) and iq(2); q(15)=m(2) and not m(1) and not m(0) and not t(2) and t(1) and not t(0) and iq(3); q(16)=m(2) and not m(1) and not m(0) and not t(2) and t(1) and not t(0) and iq(4); q(17)=m(2) and not m(1) and not m(0) and t(2) and not t(1) and not t(0) and (iq(0) or iq(1) or iq(2) or iq(3) or iq(4) or iq(5) or iq(6); q(18)s,a=a,y=i); g2:cu port map (d=i,t=t,m=m,q=q);end struct;四、仿真设计3-8译码器仿真设计:设计数据,输出3-8译码器的译码后的8种编码。s111111110a000001010011100101110111101y000000010000001000000100000010000001000000100000010000001000000000000000控制成员仿真设计:设计仿真数据使每一个微操作都可以有效输出:m001001001010100t001010100001010d0001000000100000100000000100000000000001q00000000000000000110000000000000000100000000000000000100000000000000011100000000000000001000000m010010010100100t010100100001010d0100000000001000010000000100000000000010q00000000001100000100000000011000000000000000010000000000000000010000000000000000010000000000000m100100100100100t010010010100100d0000010000001000000100000000001010000000q00001000000000000000001000000000000000001000000000000000001000000000000000001000000000000000000层次控制单元仿真设计:设计数据依次输出8条指令的微操作:例如:若要输出加法指令需要的所有微操作,则需设置数据如下:s1111a000000000000m001001001010t001010100001q0000000000000000011000000000000000010000000000000000010000000000000000110000s111a000000000m010100100t100010100q000000001100000000000000000000010000000100000000000000000由于每条指令都有取指令这个微指令,因此在下面的测试数据中将不再测试取指令的微操作。与:s1111a001001001001m010010100100t001100010100q0000000000000110000000000001100000000000000100000000000000100000000000000000或:s1111a010010010010m010010100100t00

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论