没有合适的资源?快使用搜索试试~ 我知道了~
首页计算机组成原理实验报告 CPU设计
资源详情
资源推荐
![](https://csdnimg.cn/release/download_crawler_static/3280788/bg1.jpg)
计算机组成原理实验报告
——CPU 综合实验
姓名:赵悦梅 学号:2008432002 专业:网络工程 成绩:
指导老师: 张芳 实验地点:主楼 502 时间:2010-10-18
一、 实验要求:
用 VHDL 语言编写具有一定功能的 CPU.
二、 实验目的:
使学生掌握计算机整机的工作原理,通过 CPU 设计实例,使学生能够深
入的掌握计算机的整机的工作原理。
三、 实验原理:
实验 CPU 采用 16 位字长,指令系统只有 15 条指令。
0000 DR SR 0000 0111
(1)设指令名为 IR,从左到右的编号从 15 到 0. IR[ 15]到 IR[12]代表执行
是什么功能的指令,DR、SR 为所要操作的数.IR[15]为 0 时,运算指令;
IR[15]、IR[14]为 10 时转移指令;IR[15]、IR[14]为 11 时存储指令。算术
逻辑指令的 IR14 到 IR12 对应运算器 ALU 的 3 为运算操作。当 IR[0]=1
时,本指令中有对 DR 的写操作;当 IR[1] =1 时,本指令影响标志位
Z;IR[2]=1 时,本指令影响标志位 C.
(2)一条指令执行需要 3 拍时间。T1: 取值。在 t2 的上升沿,奖从存储器
取出的指令写入指令寄存器 IR 中。T2:根据指令寄存器 IR 的内容进行指
令译码;根据指令译码得到的控制信号进行运算和其他操作。T3:存储
器读、写操作;在 t3 的下降沿将运算结果写入目的寄存器,改变 C 标志
和 Z 标志;在 T3 的下降沿,改变 PC 的值,为取下一条指令做准备。
(3)CPU 由五部分组成,包括取指部分、指令译码部分、执行部分、
存储器部分和通用寄存器组。还有一个程序包,将各低层设计实体作为
元件存储,供各个设计实体使用。还有一个顶层设计实体完成 5 部分的
链接。
四、 实验内容:
完成具有简单功能的 CPU,主要进行的运算指令有加法、自加 1、减法、
自减 1、与、或、取反、算术左移一位的功能。还有转移指令,包括
JMP、JNC、JNZ。还包括存储功能,包括 MVRD、LDR、STR、和
NOP。
(1) 先执行 MVRD DR,DATA 指令即 1100 0000 0000 0000,摁两个节拍,
然后输入想要运算的数,在摁一个节拍,便把这个数存进去了,代
表为 R0;如果想将值存进 R1 中,便将上述指令 1100 0100 0000
0000。
(2) 然后再想做执行的操作,例如,R1 和 R2 进行加操作,则需要的输
入指令 0000 0001 0000 0111,然后摁三个节拍,便可显示结果。
(3) 用 R5—R0,可以分别查看 R0,R1,R2,R3,R4,PC,IR 在任意时刻的
值。
五、 程序源码
decoder_2_to_4.cs
![](https://csdnimg.cn/release/download_crawler_static/3280788/bg2.jpg)
Library ieee;
use ieee.std_logic_1164.all;
entity decoder_2_to_4 is
port (
sel: in std_logic_vector(1 downto 0);
sel00: out std_logic;
sel01: out std_logic;
sel02: out std_logic;
sel03: out std_logic
);
end decoder_2_to_4;
architecture Behavioral of decoder_2_to_4 is
begin
sel00 <= (not sel(1)) and (not sel(0));
sel01 <= (not sel(1)) and sel(0) ;
sel02 <= sel(1) and (not sel(0)) ;
sel03 <= sel(1) and sel(0) ;
end Behavioral;
decoder_unit.cs
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
use work.exp_cpu_components.all;
entity decoder_unit is
port (IR: in std_logic_vector(15 downto 0);
SR: out std_logic_vector(1 downto 0);
DR: out std_logic_vector(1 downto 0);
op_code: out std_logic_vector(3 downto 0);
zj_instruct: out std_logic;
cj_instruct: out std_logic;
lj_instruct: out std_logic;
DRWr: buffer std_logic; --为 1 时写 DR 寄存器
Mem_Write: out std_logic;
DW_intruct: buffer std_logic;
change_z: out std_logic;
change_c: out std_logic;
sel_memdata: out std_logic; --为 1 时存储器的读出数据作为写入 DR 的数据
r_sjmp_addr: out std_logic_vector(15 downto 0) --相对转移地址
);
end decoder_unit;
![](https://csdnimg.cn/release/download_crawler_static/3280788/bg3.jpg)
architecture behav of decoder_unit is
begin
SR <= IR(9 downto 8);
DR <= IR(11 downto 10);
sel_memdata <= IR(15) and IR(14) and (not IR(13));
change_z <= not IR(15) and IR(1);
change_c <= not IR(15) and IR(2);
DRWr_proc: process(IR)
begin
if IR(15) = '0' then
if IR(0) ='1' then
DRWr <= '1';
else
DRWr <= '0';
end if;
elsif IR(14) = '1' and IR(13) = '0' then
DRWr <= '1';
else
DRWr <= '0';
end if;
end process;
sj_addr_proc: process(IR) --条件转移指令的相对转移地址从 8 位扩展到 16 位
begin
if IR(7) ='1' then
r_sjmp_addr <= "11111111" & IR(7 downto 0);
else
r_sjmp_addr <= "00000000" & IR(7 downto 0);
end if;
end process;
M_instruct:process(IR)
begin
case IR(15 downto 12) is
when "1000" | "1100" => --jmp addr;mvDR dr,data
Mem_Write <= '0';
DW_intruct <= '1';
when "1110" => -- str dr,sr
Mem_Write <= '1';
DW_intruct <= '0';
![](https://csdnimg.cn/release/download_crawler_static/3280788/bg4.jpg)
when others =>
Mem_Write <= '0';
DW_intruct <= '0';
end case;
end process;
ALUOP_CODE_PROC:PROCESS(IR)
begin
if IR(15) = '0' then
op_code <= IR(15 downto 12);
else
op_code <= "1111";
end if;
end process;
Jinstruct_PROC: process(IR)
begin
case IR(15 downto 12) is
when "1000" => --jmp adr
zj_instruct <= '0';
cj_instruct <= '0';
lj_instruct <= '1';
when "1001" => --jnc addr
zj_instruct <= '0';
cj_instruct <= '1';
lj_instruct <= '0';
when "1010" => --jnz addr
zj_instruct <= '1';
cj_instruct <= '0';
lj_instruct <= '0';
when others =>
zj_instruct <= '0';
cj_instruct <= '0';
lj_instruct <= '0';
end case;
end process;
end behav;
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
剩余19页未读,继续阅读
![circ](https://img-home.csdnimg.cn/images/20210720083646.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://profile-avatar.csdnimg.cn/default.jpg!1)
zhaoyuemei_1104
- 粉丝: 2
- 资源: 4
上传资源 快速赚钱
我的内容管理 收起
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![](https://csdnimg.cn/release/wenkucmsfe/public/img/voice.245cc511.png)
会员权益专享
最新资源
- 京瓷TASKalfa系列维修手册:安全与操作指南
- 小波变换在视频压缩中的应用
- Microsoft OfficeXP详解:WordXP、ExcelXP和PowerPointXP
- 雀巢在线媒介投放策划:门户网站与广告效果分析
- 用友NC-V56供应链功能升级详解(84页)
- 计算机病毒与防御策略探索
- 企业网NAT技术实践:2022年部署互联网出口策略
- 软件测试面试必备:概念、原则与常见问题解析
- 2022年Windows IIS服务器内外网配置详解与Serv-U FTP服务器安装
- 中国联通:企业级ICT转型与创新实践
- C#图形图像编程深入解析:GDI+与多媒体应用
- Xilinx AXI Interconnect v2.1用户指南
- DIY编程电缆全攻略:接口类型与自制指南
- 电脑维护与硬盘数据恢复指南
- 计算机网络技术专业剖析:人才培养与改革
- 量化多因子指数增强策略:微观视角的实证分析
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![](https://img-home.csdnimg.cn/images/20220527035711.png)
![](https://img-home.csdnimg.cn/images/20220527035711.png)
![](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![](https://csdnimg.cn/release/wenkucmsfe/public/img/green-success.6a4acb44.png)