用VHDL写的8位比较器,麻烦大家帮小弟找找错误,用MAXPLUS2编译的,好像应该是数据类型不对吧,但我不会改,大家看看吧
library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity compare is port( a,b: in std_logic_vector( 7 downto 0); d,e,f: out integer range 1 downto 0); end entity compare;
architecture behave of compare is begin process(a,b) variable m: integer range 7 downto 0; variable n: integer range 7 downto 0; begin m:= conv_integer(a); n:= conv_integer(b); if m=n then d<='1'; elsif m>n then e<='1'; elsif n>m then f<='1'; end if; end process; end architecture behave;
|