subtractor_unsigned.vhd
来自「DLX CPU VHDL CODE UNIVERSITY」· VHDL 代码 · 共 40 行
VHD
40 行
use work.dp32_types.all;entity subtractor_unsigned is generic (width : positive); port(a,b : in bit_vector(width-1 downto 0); y : out bit_vector(width-1 downto 0); n,z : out bit);end subtractor_unsigned;architecture behaviour of subtractor_unsigned isbeginmain : process (a,b)variable t: bit_vector(width-1 downto 0);begin--wait for 1 ns;int_to_bits(bits_to_uint(a)-bits_to_uint(b) ,t);y<=t;if(bits_to_uint(a)-bits_to_uint(b) = 0) then z<='1';else if(bits_to_uint(a)-bits_to_uint(b) < 0) then n<='1'; else n<='0'; end if; z<='0';end if;end process;end behaviour;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?