---------------hugong
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity test_yunsuan is
Port ( CLK : in STD_LOGIC;
disvaluein : in STD_LOGIC_VECTOR (3 downto 0);
disvalueout0 : out STD_LOGIC_VECTOR (3 downto 0);
disvalueout1 : out STD_LOGIC_VECTOR (3 downto 0));
end test_yunsuan;
architecture ben of test_yunsuan is
signal A: std_logic_vector(7 downto 0):="00000000";
signal B0: std_logic_vector(7 downto 0):="00000000";
signal B1: std_logic_vector(7 downto 0):="00000000";
signal X: std_logic_vector(7 downto 0):="00000000";
begin
process(CLK)
variable flag:std_logic;
begin
IF CLK' EVENT AND CLK='1' THEN
case disvaluein is
when "1101" =>B0<=B0&A;
flag:='1';
when "1110" =>B0<=B0&A;
flag:='0';
when "1111" =>B1<=B1&A;
if flag='1' then
X<=(((B0(7)&B0(6)&B0(5)&B0(4))+(B1(7)&B1(6)&B1(5)&B1(4)))*"1010")+(B0(3)&B0(2)&B0(1)&B0(0))+(B1(3)&B1(2)&B1(1)&B1(0));
else X<=((B0(7)&B0(6)&B0(5)&B0(4))*"1010")-((B1(7)&B1(6)&B1(5)&B1(4))*"1010")+(B0(3)&B0(2)&B0(1)&B0(0))-(B1(3)&B1(2)&B1(1)&B1(0));
end if;
when others =>A<=A&disvaluein;
X<=X&disvaluein;
end case;
END IF;
end process;
end ben;
此帖出自
小平头技术问答
Error (10327): VHDL error at test_yunsuan.vhd(33): can't determine definition of operator ""+"" -- found 5 possible definitions
程序中:
X<=(((B0(7)&B0(6)&B0(5)&B0(4))+(B1(7)&B1(6)&B1(5)&B1(4)))*"1010")+(B0(3)&B0(2)&B0(1)&B0(0))+(B1(3)&B1(2)&B1(1)&B1(0));
一周热门 更多>