组成原理实验报告基于硬布线控制器设计并实现.doc

上传人:文库蛋蛋多 文档编号:2882170 上传时间:2023-03-01 格式:DOC 页数:16 大小:1.56MB
返回 下载 相关 举报
组成原理实验报告基于硬布线控制器设计并实现.doc_第1页
第1页 / 共16页
组成原理实验报告基于硬布线控制器设计并实现.doc_第2页
第2页 / 共16页
组成原理实验报告基于硬布线控制器设计并实现.doc_第3页
第3页 / 共16页
组成原理实验报告基于硬布线控制器设计并实现.doc_第4页
第4页 / 共16页
组成原理实验报告基于硬布线控制器设计并实现.doc_第5页
第5页 / 共16页
点击查看更多>>
资源描述

《组成原理实验报告基于硬布线控制器设计并实现.doc》由会员分享,可在线阅读,更多相关《组成原理实验报告基于硬布线控制器设计并实现.doc(16页珍藏版)》请在三一办公上搜索。

1、评语:课中检查完成的题号及题数: 课后完成的题号与题数:成绩:指导教师:实验报告实验名称:基于硬布线控制器设计并实现带中断功能的复杂模型机日期:2011-1-12班级:学号:姓名:一、实验目的:1.掌握硬布线控制器的组成原理、设计方法;2.了解硬布线控制器和微程序控制器的各自优缺点;3.掌握并会设计带中断功能的复杂模型机的硬布线控制器。二、实验内容:1.根据带中断功能的复杂模型机的微程序流图,画出状态机描述图;2.分析每个状态所需的控制信号,产生控制信号表,并用VHDL语言来设计程序,实现状态机描述的功能;3.用Quartus软件进行编译链接,选择器件,定义管脚,编程下载,然后用CM3P联机测

2、试每一条机器指令的功能。 三、项目要求及分析: 实验要求设计带中断功能的复杂模型机的硬布线控制器,可先参照前面带中断处理能力的模型机设计实验画出微程序流程图,参照二进制微代码表设控制信号表。然后用VHDL语言编程实现,主要注意原PP的修改,采用分支语句实现。然后就是连线装载带中断处理能力的模型机微程序检验。 四、具体实现: 应包括:状态图、控制信号表、控制引脚图、VHDL程序、机器码验证程序等。1、状态图: 2、控制状态表:INTA/WR/RD/IOM/S3/S2/S1/S0/LDA/LDB/LDR0/LDSP/L0AD/LDAR/LDIR/ALUB/RSB/RDB/RIB/SPB/PCB/L

3、DPC/STI/CLIS0 100000000000100111111010S1 100000000000100111111011S2 100000000000110111110111S3 101000000000101111111011S4 100000000100100101111011S5100010010010100011111011S6100000000100100101111011S7 100000100010100011111011S8101000000000110111111011S9101100000010100111111011S1010100000000011011111

4、1011S11100000000000100111111011S12101000000010100111111011S13110000000000100110111011S14100000000000000011111111S15100000000000100111111011S16110100000000100101111011S17101000000010100111111011S18110000000000100101111011S19100000001000100111101011S20100011010001100011111011S2110001100000110001111101

5、1S22100000000000110111101011S23101000000010100111111011S24100011000001100011111011S25100000000000110111101011S26101000000000000111111111S27100000000000000011111111S28101000001000100111111011S29101000000000110111111011S30101000000000110111111011S31101000001000100111111011S32101000000000110111111011S3

6、3000000000000110111101011S34110000000000100111110011S35100000001000100111101011S36100011010001100011111011S37000000000000110111111011S38101000000000000111111111S39101000001000100111111011S40100000000100100111011011S41100010010000110011111011S42100010011000100011111011S43101000001000100111111011S4410

7、0000000100100111110011S45100010010000110011111011S46100010011000100011111011S47100000001000100110111011S48100000001000100110111011S49100000000000110111110111S50100000000000110111110111S51100000000010100101111011S52100000000000100111111011S53100000000000110111110111S54100000000000100111111001S5510000

8、0000000100111111010S56100000000000110111101011S57100000001000100111101011S58100000001000100111101011S59100000000000110111110111S60100000000000110111110111S61100000000000110111110111S621000000000001101111101113、控制引脚图:五、调试运行结果: 4、VHDL程序:LIBRARY IEEE;USE IEEE.std_logic_1164.ALL;ENTITY CONTROLLER ISPORT

9、(RESET: INSTD_LOGIC;T1: INSTD_LOGIC;INTR : IN STD_LOGIC;INS : INSTD_LOGIC_VECTOR(7 DOWNTO 0);CTRL : OUTSTD_LOGIC_VECTOR(23 DOWNTO 0);END CONTROLLER;ARCHITECTURE CONTROLLER_ARCH OF CONTROLLER ISTYPE STATE IS (S0,S1,S2,S3,S4,S5,S6,S7,S8,S9,S10,S11,S12,S13,S14,S15,S16,S17,S18,S19,S20,S21,S22,S23,S24,S2

10、5,S26,S27,S28,S29,S30,S31,S32,S33,S34,S35,S36,S37,S38,S39,S40,S41,S42,S43,S44,S45,S46,S47,S48,S49,S50,S51,S52,S53,S54,S55,S56,S57,S58,S59,S60,S61,S62);SIGNAL CUFSM: STATE;-CTRL:INTA,WR,RD,IOM,S3,S2,S1,S0,LDA,LDB,LDRI,LDSP,LOAD,LDAR,LDIR,ALU_B,RS_B,RD_B,RI_B,SP_B,PC_B,LDPC,STI,CLIBEGINPROCESS (T1,RES

11、ET,INTR,INS)BEGINIF RESET = 0 THEN CTRL = 100000000000100111111010; -CLICUFSM CTRL = 100000000000100111111011; -中断判断CUFSM IF INTR=1 THEN CTRL BUS,BUS-ACUFSM = S33;ELSE CTRL = 100000000000110111110111; CUFSM CTRL = 110000000000100111110011; CUFSM CTRL = 100000001000100111101011; CUFSM CTRL = 10001101

12、0001100011111011; CUFSM CTRL = 000000000000110111111011; CUFSM CTRL = 101000000000000111111111; CUFSM CTRL = 100000000000110111110111; CUFSM CTRL = 101000000000101111111011; CUFSM IF INS(7 downto 4) = 0000 THEN -ADD INSCTRL = 100000001000100110111011; CUFSM = S47;ELSIF INS(7 downto 4) = 0001 THEN -A

13、ND INSCTRL = 100000001000100110111011; CUFSM = S48;ELSIF INS(7 downto 4) = 0010 THEN - IN INSCTRL = 100000000000110111110111; CUFSM = S49;ELSIF INS(7 downto 4) = 0011 THEN -OUT INSCTRL = 100000000000110111110111; CUFSM = S50;ELSIF INS(7 downto 4) = 0100 THEN - MOV INSCTRL = 100000000010100101111011;

14、 CUFSM = S51;ELSIF INS(7 downto 4) = 0101 THEN - HLT INSCTRL = 100000000000100111111011; CUFSM = S52;ELSIF INS(7 downto 4) = 0110 THEN - LDI INSCTRL = 100000000000110111110111; CUFSM = S53;ELSIF INS(7 downto 4)= 0111 THEN - STI INSCTRL = 100000000000100111111001; CUFSM = S54;ELSIF INS(7 downto 4) =

15、1000 THEN - CLI INSCTRL = 100000000000100111111010; CUFSM = S55;ELSIF INS(7 downto 4) = 1001 THEN - PUSH INSCTRL = 100000000000110111101011; CUFSM = S56;ELSIF INS(7 downto 4) = 1010 THEN - POP INSCTRL = 100000001000100111101011; CUFSM = S57;ELSIF INS(7 downto 4) = 1011 THEN - INET INSCTRL = 10000000

16、1000100111101011; CUFSM = S58;ELSIF INS(7 downto 6) = 11 AND INS(3 downto 2) = 00 THEN - 直接 INSCTRL = 100000000000110111110111; CUFSM = S59;ELSIF INS(7 downto 6) = 11 AND INS(3 downto 2) = 01 THEN - 间接 INSCTRL = 100000000000110111110111; CUFSM = S60;ELSIF INS(7 downto 6) = 11 AND INS(3 downto 2) = 1

17、0 THEN - 变址 INSCTRL = 100000000000110111110111; CUFSM = S61;ELSIF INS(7 downto 6) = 11 AND INS(3 downto 2) = 11 THEN - 相对 INSCTRL = 100000000000110111110111; CUFSM CTRL = 100000000100100101111011; CUFSM CTRL = 100010010010100011111011; CUFSM CTRL = 100000000000100111111011; CUFSM CTRL = 100000000100

18、100101111011; CUFSM CTRL = 100000100010100011111011; CUFSM CTRL = 100000000000100111111011; CUFSM CTRL = 101000000000110111111011; CUFSM CTRL = 101100000010100111111011; CUFSM CTRL = 100000000000100111111011; CUFSM CTRL = 101000000000110111111011; CUFSM CTRL = 110100000000100101111011; CUFSM CTRL =

19、100000000000100111111011; CUFSM CTRL = 100000000000100111111011; CUFSM CTRL = 100000000000100111111011; CUFSM CTRL = 101000000010100111111011; CUFSM CTRL = 100000000000100111111011; CUFSM CTRL = 100000000000100111111011; CUFSM CTRL = 100000000000100111111011; CUFSM CTRL = 110000000000100101111011; C

20、UFSM CTRL = 100000001000100111101011; CUFSM CTRL = 100011010001100011111011; CUFSM CTRL = 100000000000100111111011; CUFSM CTRL = 100011000001100011111011; CUFSM CTRL = 100000000000110111101011; CUFSM CTRL = 101000000010100111111011; CUFSM CTRL = 100000000000100111111011; CUFSM CTRL = 100011000001100

21、011111011; CUFSM CTRL = 100000000000110111101011; CUFSM CTRL = 101000000000000111111111; CUFSM CTRL = 100000000000100111111011; CUFSM CTRL = 101000001000100111111011; CUFSM CTRL = 101000000000110111111011; CUFSM CTRL = 101000000000110111111011; CUFSM CTRL = 101000001000100111111011; CUFSM CTRL = 101

22、000000000110111111011; CUFSM CTRL = 101000001000100111111011; CUFSM CTRL = 100000000100100111011011; CUFSM CTRL = 100010010000110011111011; CUFSM CTRL = 100010011000100011111011; CUFSM CTRL = 101000001000100111111011; CUFSM CTRL = 100000000100100111110011; CUFSM CTRL = 100010010000110011111011; CUFS

23、M CTRL = 100010011000100011111011; CUFSM IF INS(7 downto 4) = 1100 THEN CTRL = 101000000010100111111011; CUFSM = S12;ELSIF INS(7 downto 4) = 1101 THEN CTRL = 110000000000100110111011; CUFSM = S13;ELSIF INS(7 downto 4) = 1110 THEN CTRL = 100000000000000011111111; CUFSM = S14;ELSIF INS(7 downto 4) = 1

24、111 THEN CTRL = 100000000000100111111011; CUFSM IF INS(7 downto 4) = 1100 THEN CTRL = 101000000010100111111011; CUFSM = S12;ELSIF INS(7 downto 4) = 1101 THEN CTRL = 110000000000100110111011; CUFSM = S13;ELSIF INS(7 downto 4) = 1110 THEN CTRL = 100000000000000011111111; CUFSM = S14;ELSIF INS(7 downto

25、 4) = 1111 THEN CTRL = 100000000000100111111011; CUFSM IF INS(7 downto 4) = 1100 THEN CTRL = 101000000010100111111011; CUFSM = S12;ELSIF INS(7 downto 4) = 1101 THEN CTRL = 110000000000100110111011; CUFSM = S13;ELSIF INS(7 downto 4) = 1110 THEN CTRL = 100000000000000011111111; CUFSM = S14;ELSIF INS(7

26、 downto 4) = 1111 THEN CTRL = 100000000000100111111011; CUFSM IF INS(7 downto 4) = 1100 THEN CTRL = 101000000010100111111011; CUFSM = S12;ELSIF INS(7 downto 4) = 1101 THEN CTRL = 110000000000100110111011; CUFSM = S13;ELSIF INS(7 downto 4) = 1110 THEN CTRL = 100000000000000011111111; CUFSM = S14;ELSI

27、F INS(7 downto 4) = 1111 THEN CTRL = 100000000000100111111011; CUFSM CTRL BUS,BUS-BCUFSM CTRL BUS,BUS-BCUFSM CTRL BUS,BUS-BCUFSM IF INS = 00000000 THEN CTRL = 100000000000100111111011; CUFSM = S11;ELSIF INS = 10000000 THEN CTRL = 100000000000000011111111; CUFSM CTRL BUS,BUS-BCUFSM CTRL BUS,BUS-BCUFS

28、M = S1;END CASE;END IF;END PROCESS;END CONTROLLER_ARCH ;5、机器码验证程序: $P 00 60 ; LDI R0,13H 将立即数13装入R0 $P 01 13 $P 02 30 ; OUT C0H,R0 将R0中的内容写入端口C0中,即写 $P 03 C0 ; ICW1,边沿触发,单片模式,需要ICW4 $P 04 60 ; LDI R0,30H 将立即数30装入R0 $P 05 30 $P 06 30 ; OUT C1H,R0 将R0中的内容写入端口C1中,即写 $P 07 C1 ; ICW2,中断向量为30-37 $P 08 60

29、; LDI R0,03H 将立即数03装入R0 $P 09 03 $P 0A 30 ; OUT C1H,R0 将R0中的内容写入端口C1中,即写 $P 0B C1 ; ICW4,非缓冲,86模式,自动EOI $P 0C 60 ; LDI R0,FEH 将立即数FE装入R0 $P 0D FE $P 0E 30 ; OUT C1H,R0 将R0中的内容写入端口C1中,即写 $P 0F C1 ; OCW1,只允许IR0请求 $P 10 63 ; LDI SP,A0H 初始化堆栈指针为A0 $P 11 A0 $P 12 70 ; STI CPU开中断 $P 13 20 ; IN R0,00H 从端口0

30、0(IN单元)读入计数初值 $P 14 00 $P 15 41 ; LOOP:MOV R1,R0 移动数据,并等待中断 $P 16 E0 ; JMP LOOP 跳转,并等待中断 $P 17 15 ; 以下为中断服务程序: $P 20 80 ; CLI CPU关中断 $P 21 61 ; LDI R1,01H 将立即数01装入R1 $P 22 01 $P 23 04 ; ADD R0,R1 将R0和R1相加,即计数值加1 $P 24 30 ; OUT 40H,R0 将计数值输出到端口40(OUT单元) $P 25 40 $P 26 70 ; STI CPU开中断 $P 27 B0 ; IRET

31、中断返回 $P 30 20 ; IR0的中断入口地址20五、运行结果:初始化8259,然后原地踏步等待中断,每中断一次R0 +1,把R0输出到OUT单元计算了14次,如out 单元:六、所遇问题及解决方法: VHDL语言编程主要实现各个分支,这里要参照流程图,细心不出错后面实现就比较简单了。由于刚接触这种语言,开始犯了很多语法错误,后来在老师的帮助下逐一修改了过来。后面遇到最多的问题还是实验的接线,由于没有标准的接线图,又没有自己画出模拟图,导致接线错误频出,后来也在老师的帮助下改正了过来。 七、实验总结:1.本次实验由于内容较多,编程、设计也十分繁琐,导致小错不断,以后再做类似的工作时一定要画出流程图,一步一步细心完成;2.设计二进制代码时一定要注意0和1的位数,合理分配指令操作码; 3.用visio绘制微程序流程图时要注意流程顺序。 八、建议:1.感觉实验时间很紧,觉得应适当延长课程设计时间,给同学们充分时间完成;2.可以考虑适当启用研究生当辅导老师,这样不仅可以减轻老师负担,还能便于管理和同学们的答疑;3.建议多联系课堂上所学过的知识,拓展知识面。

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 建筑/施工/环境 > 项目建议


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号