基于仿真的32位虚拟计算机设计与实现
网络工程班
摘要:本文针对计算机组成原理与系统结构课程的学习要求,为进一步研究学习不同指令在CPU中的执行情况及流水线过程、尝试利用不同的方案解决流水线阻滞,基于C/C++语言,编程设计实现了32位的虚拟计算机。该虚拟计算机使用MIPS32指令集,能够模拟运行大部分MIPS32指令、展示指令在计算机中的流水线过程、利用暂停执行的方法解决数据冲突。最后,为了能够更生动形象地展示流水线过程,本文利用计算机图形库graphics.h,编程实现了流水线生成程序,配合系统的使用,完成了设计任务书的所有目标。
关键词:虚拟计算机、MIPS32指令集、流水线、C/C++
Abstract: According to the learning requirements of the computer composition principle and system architecture courses, in order to further study the execution and pipeline process of different instructions in the CPU, and try to solve the pipeline block, this paper designs a 32-bit virtual computer based on the C / C + + language.The virtual computer uses the MIPS32 instruction set, which can simulate the running of most of the MIPS32 instructions, display the pipeline process of the instructions in the computer, and use the suspended execution method to resolve data conflicts.Finally, to show the pipeline process more vividly, the computer graphics library graphics.Programh, the pipeline generation program, with the use of the system, achieves all the goals of the design task book.
Keywords: virtual computer, MIPS32 instruction set, pipeline, C / C + +
目录
1 项目简介 4
2 功能介绍 4
2.1 概述 4
2.2 功能描述 4
2.2.1 指令控制 4
2.2.2 指令执行 5
2.2.3 内存控制 5
2.2.4 寄存器控制 5
2.2.5 流水线 6
2.2.6 使用说明 6
2.2.7 关于 7
2.2.8 退出 7
2.2.9 流水线绘图 7
3 设计介绍 7
3.1 设计思路 7
3.2 数据结构设计 8
3.3 功能模块设计 8
3.3.1 内存模块 9
3.3.2 寄存器模块 9
3.3.3 取指模块 9
3.3.4 译码模块 10
3.3.5 执行模块 10
3.3.6 记录模块 11
3.3.7 全局数据模块 11
3.3.8 菜单面板模块 11
3.3.9 流水线模块 12
3.3.10 控制模块 13
3.3.11 流水线绘图模块 14
4 关键算法 14
4.1 流水线生成 14
4.1.1 各项数据的意义 14
4.1.2 二维XY坐标系 15
4.1.3 寄存器占用检测与标记 16
4.1.4 部件占用检测与标记 16
4.1.5 时间点检测 17
4.1.6 生成步骤 18
4.2 流水线单步执行 19
4.2.1 二维XY坐标系的读取 19
4.2.2 时间点检测 19
4.2.3 各部件调用 19
4.3 流水线绘图 19
4.3.1 图形库调用 19
4.3.2 过程绘制 19
5 测试及结果 19
5.1 菜单面板 19
5.2 指令执行 21
5.2.1 测试前准备 21
5.2.2 全部执行 22
5.2.3 单步执行 23
5.3 流水线 24
5.3.1 全部流通情况 24
5.3.2 写$zero寄存器情况 26
5.3.3 数据相关情况 28
5.3.4 混合情况 30
6 详细设计 33
6.1 内存类 33
6.2 寄存器类 33
6.3 取指类 34
6.4 译码类 34
6.5 执行类 34
6.6 记录类 36
6.7 菜单面板类 36
6.8 全局数据类 37
6.9 流水线类 39
6.10 全局控制类 40
7 结束语 42
7.1 总结 42
7.2 展望 42
8 参考文献 43





TM~@Y@L@PCH9GNSK.png)





LVH082R.png)


