1、 4、通过单步运行若干条微指令,深入理解微程序控制器的工作原理;二、实验电路 图1附:电路图过大,请放大观察详情三、实验原理 将机器指令的操作(从取指到执行)分解为若干个更基本的微操作序列,并将有 关的控制信息(微命令)以微码的形式编成微指令输入到控制存储器中。这样, 每条机器指令将与一段微程序对应,取出微指令就产生微命令,以实现机器指令 要求的信息传送与加工。四、实验步骤及概述 1)设计状态机部分 a、编写VHDL代码如下LIBRARY ieee;USE ieee.std_logic_1164.all;ENTITY zhuangtaiji IS PORT ( reset : IN STD_L
2、OGIC := 0; clock : IN STD_LOGIC; qd : dp : tj : t1 : OUT STD_LOGIC; t2 : t3 : t4 : OUT STD_LOGIC );END zhuangtaiji;ARCHITECTURE BEHAVIOR OF zhuangtaiji IS TYPE type_fstate IS (idle,st1,s_st2,st4,st2,st3,s_st4,s_st3); SIGNAL fstate : type_fstate; SIGNAL reg_fstate :BEGIN PROCESS (clock,reset,reg_fsta
3、te) BEGIN IF (reset=1) THEN fstate = idle; ELSIF (clock= AND clockevent) THEN= reg_fstate; END IF; END PROCESS; PROCESS (fstate,qd,dp,tj) t1 t2 t3 t4 IF (NOT(qd = ) THEN reg_fstate IF (tj = ) AND NOT(dp = ) THEN ELSIF (dp = ) AND NOT(tj = = s_st2;= st2; WHEN s_st2 = IF (tj = ) THEN= s_st3; WHEN st4
4、= st4; WHEN st2 = st3; WHEN st3 = s_st4; WHEN s_st4 = WHEN s_st3 = WHEN OTHERS =X report Reach undefined state END CASE;END BEHAVIOR; b、新建block file选定zhaungtaiji得到电路图 2)设计rom部分 LIBRARY ieee; ENTITY rom IS PORT ( address : IN STD_LOGIC_VECTOR (4 DOWNTO 0); q : OUT STD_LOGIC_VECTOR (27 DOWNTO 0);END r
5、om;ARCHITECTURE SYN OF rom IS SIGNAL sub_wire0 : STD_LOGIC_VECTOR (27 DOWNTO 0);BEGIN sub_wire0= 1011000000100000010100000001 WHEN address= 0000011101001001000000101011000100000110010001001000000101001010000001011101001001000000101000101010100110011011001000000101000101101010110010011001000000111000
6、000011011011101001001000000101000101110101010011011001000000101000110001011110010101001000000100000000011100011101001001000000101000110010101110011011001000000101000110101100110010011001000000101000000011101010010001011000000100000110110110010010001001100000011000000011101111101001001000000101000111
7、000110110110011001000000101000000011110011101001001000000101000000110111010011011001000000101000001000001110010011001000000101100001010010010010001011000000100000001100010110010001001010011011000000010011011101001001000000101000111010111110011011001000000101000111101110110010011001000000101100111111
8、11101001000101100000010000000111111111001000100100001111100000001001111011000000100000010100010011010001110100100100000010100010100100111001001100100000010100010011101001011000000100000010100010001100001110100100100000010100010010100011001010000100000010100010001 ; q = sub_wire0(27 DOWNTO 0);END SYN
9、; b、新建block file选定rom得到电路图 3)、整合电路图 整合电路图如图1所示。 建工程-建立BlockDiagramFile-按照电路图连好电路-保存、编译-建立 VectorWaveformFile-插入引脚-设置波形-保存、仿真。 仿真后的波形如下: 参数设置:Grid Size:50ns End Time:5.0us其具体实现还需要与数据通路结合才能最终进行具体运算。分析ADD的每条微指的指令格式和功能:ADD:为双字长指令。第一字为操作码,第二字为操作数地址,其含义是将R0寄存器的内容与内存中以A为地址单元的数相加,结果放R0寄存器中。ADD加法指令由 :S3S2S1S
10、0M CnWE A9 A8 A B C A5-A0 a、(PCAR ,PC+1):011 11 01b、(RAMBUS, BUSAR):0 1C、(RAMBUS ,BUSDR2):0 011d、(RODR1):e、(DR1)+(DR2)RO): 共8条微指令组成。a微指令功能是RAM赋给BUS,BUS赋给DR2; S3 S2 S1 S0 M CN 的值为“000000”代表进行自加1运算;A字段“110”代表选择LDAR操作,B字段“110”是选择PC-B操作;UA5-UA0中“000011”代表下一指令的地址为“011”。b微指令功能是RAM赋给BUS,BUS赋给DR2;A字段“110”代表选择LDAR操作,B字段“000”是无选择操作;UA5-UA0中“000100”代表下一指令的地址为“100”。c微指令功能是RAM赋给BUS,BUS赋给DR2;A字段“011”代表选择LDDR2操作,B字段“000”是无选择操作;UA5-UA0中“000101”代表下一指令的地址为“101”。d微指令功能是RO赋给DR1;A字段“010”代表选择LDDR1操作,B字段“001”是选择RS-B操作;UA5-UA0中“000110”代表下一指令的地址为“110”。e微指令功能是DR1+DR2的和赋给R0; S3 S2 S1 S0 M CN 的值为“100101”代表进行加法运算;A字段“001
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1