计算机系统原理实验:模型机(六)MADD部分

5)MADD部分
在这里插入图片描述

library ieee;
use ieee.std_logic_1164.all;
entity madd is
port(madd:in std_logic_vector(1 downto 0);
	input_0,input_1,input_2:in std_logic_vector(7 downto 0);
	output:out std_logic_vector(7 downto 0)
);
end madd;
architecture st of madd is
begin
process(madd)
begin
if (madd="00") then output<=input_0;
elsif (madd="01") then output<=input_1;
elsif (madd="10") then output<=input_2;
else output<="ZZZZZZZZ";
end if;
end process;
end st;

接口设计:
Input_0,input_1,input_2:传入的处理数据
madd:控制信号
Output:数据的输出

功能实现:
在madd指令的指导下,对三条输入进行选择,可自定义选择方式。实际上就是一个三选一的选择器,没有什么特别的,实际上只有在mov操作和跳转操作中可能会改变madd的值,否则基本上一直是00,是因为要读取pc的地址好给RAM指令地址,由此来读取指令。
仿真验证:
在这里插入图片描述在这里插入图片描述

在madd=00时输出0的值,即11001100
在madd=01时输出1的值,即11001001
在madd=10时输出2的值,即11111101
在madd=11时输出随机值ZZZZZZZZ
注意,不唯一,可随意更改
结论:正确,各个信号展示正确

发布了275 篇原创文章 · 获赞 160 · 访问量 4万+

猜你喜欢

转载自blog.csdn.net/qq_40851744/article/details/104899670