我必须在VHDL中制作一个4位大小的比较器,只有并发语句(没有if / else或case / when) .
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity Exercise is
port ( A : in std_logic_vector (3 downto 0);
B : in std_logic_vector (3 downto 0);
Ag : out std_logic;
Bg : out std_logic;
AeqB: out std_logic
);
end Exercise;
architecture Comparator of Exercise is
begin
Ag <= '1'when (A>B) else '0';
Bg <= '1' when (B>A) else '0'; --Problem: Here if i sumulate B="ZZZZ", Bg is 1, asi if B>A
AeqB<= '1' when (A=B) else '0';
end Comparator;
问题是我需要计算std_logic(U,X,Z,W,L,H, - )的所有其他值,我知道有 others
但是无法弄清楚如何用 with/select
制作比较器声明 .
谢谢
2 回答
通常,您可以'convert'使用
to_01
函数将std_logic带入0
或1
的各种值 . 我认为它在numeric_std
包中 .