这是我的代码
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
-- Uncomment the following library declaration if using
--arithmetic functions with Signed or Unsigned values
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
-- Uncomment the following library declaration if instantiating
-- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity booth is port(
m: in SIGNED(6 downto 0); -- multiplicand 2's comp
r: in SIGNED(6 downto 0); -- multiplier 2's comp
reset: in std_logic;
product: out SIGNED(13 downto 0);
clk: in std_logic
);
end booth;
architecture Behavioral of booth is
COMPONENT ALU
PORT(
X : IN SIGNED(15 downto 0);
Y : IN SIGNED(15 downto 0);
Z : OUT SIGNED(15 downto 0);
func : IN std_logic_vector(2 downto 0)
);
END COMPONENT;
SIGNAL X : SIGNED(15 downto 0) := (others=>'0');
SIGNAL Y : SIGNED(15 downto 0) := (others=>'0');
SIGNAL Z : SIGNED(15 downto 0) := (others=>'0');
SIGNAL func : std_logic_vector(2 downto 0) := (others=>'0');
type stateType is (beg, two, finish);
signal state: stateType;
SIGNAL A, S, P: SIGNED(15 downto 0) := (others=>'0');
signal count : std_logic_vector(2 downto 0) := (others=>'0');
BEGIN
foo: ALU PORT MAP(
X => X,
Y => Y,
Z => Z,
func => func
);
process(clk) is begin
if rising_edge(clk) then
if reset = '1' then
A <= (others => '0'); S <= (others => '0'); P <= (others => '0'); state <= beg;
else
case state is
when beg =>
A(15 downto 9) <= m;
A(8 downto 0) <= "0";
P(7 downto 1) <= r;
P(15 downto 8) <= "0";
P(0) <= '0';
S(15 downto 9) <= -m;
S(8 downto 0) <= "0";
state <= two;
when two =>
if P(1 downto 0) = "01" then
func <= "001"; -- P + A
X <= P;
Y <= A;
P <= Z;
elsif P(1 downto 0) = "10" then
func <= "010"; -- P - A
X <= P;
Y <= S;
P <= Z;
end if;
func <= "100"; -- ASR
X <= P;
P <= Z;
count <= count + 1;
if count = x"6" then
state <= finish;
end if;
when finish =>
product <= P(15 downto 1); --bit(s)???
end case;
end if;
end if;
end process;
end Behavioral;
我在 P(1 downto 0) = "01"; 的两行得到错误 和 P(1 到 0) = "10";
找到运算符“=”的“2”个定义,无法确定“=”的确切重载匹配定义
知道发生了什么吗?