用VHDL语言设计2位数值比较器 要程序 急!!

真值表如下A1B1A0B0F(A>B)F(A<B)F(A=B)A1>B1X100A1<B1X010A1=B1A0>B0100A1=B1A0<B0010A1=B1A0=B0... 真值表如下
A1 B1 A0 B0 F(A>B) F(A<B) F(A=B)
A1>B1 X 1 0 0
A1<B1 X 0 1 0
A1=B1 A0>B0 1 0 0
A1=B1 A0<B0 0 1 0
A1=B1 A0=B0 0 0 1
展开
 我来答
leemzity
推荐于2018-04-09 · 超过14用户采纳过TA的回答
知道答主
回答量:28
采纳率:0%
帮助的人:34.3万
展开全部
优点:逻辑少,关键路径少,布线方便
缺点:书写麻烦
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_ARITH.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
entity Comp is
port (
A1 : in std_logic;
B1 : in std_logic;
A0 : in std_logic;
B0 : in std_logic;
AsmallerB : out std_logic;
AgreaterB : out std_logic;
AequalB : out std_logic
);
end Comp;
architecture RTL of Comp is
signal S_TMP : std_logic_vector(3 downto 0);
begin
S_TMP <= A1 & B1 & A0 & B0;
process (S_TMP) begin
case (S_TMP) is
when "0000" => AsmallerB <= '0';AgreaterB <= '0';AequalB <= '1';
when "0001" => AsmallerB <= '1';AgreaterB <= '0';AequalB <= '0';
when "0010" => AsmallerB <= '0';AgreaterB <= '1';AequalB <= '0';
when "0011" => AsmallerB <= '0';AgreaterB <= '0';AequalB <= '1';
when "0100" => AsmallerB <= '1';AgreaterB <= '0';AequalB <= '0';
when "0101" => AsmallerB <= '1';AgreaterB <= '0';AequalB <= '0';
when "0110" => AsmallerB <= '1';AgreaterB <= '0';AequalB <= '0';
when "0111" => AsmallerB <= '1';AgreaterB <= '0';AequalB <= '0';
when "1000" => AsmallerB <= '0';AgreaterB <= '1';AequalB <= '0';
when "1001" => AsmallerB <= '0';AgreaterB <= '1';AequalB <= '0';
when "1010" => AsmallerB <= '0';AgreaterB <= '1';AequalB <= '0';
when "1011" => AsmallerB <= '0';AgreaterB <= '1';AequalB <= '0';
when "1100" => AsmallerB <= '0';AgreaterB <= '0';AequalB <= '1';
when "1101" => AsmallerB <= '1';AgreaterB <= '0';AequalB <= '0';
when "1110" => AsmallerB <= '0';AgreaterB <= '1';AequalB <= '0';
when "1111" => AsmallerB <= '0';AgreaterB <= '0';AequalB <= '1';
when others => AsmallerB <= '0';AgreaterB <= '0';AequalB <= '0';
end case;
end process;
end RTL;
本回答被提问者和网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式