BinärZähler: + Operand falsch

Gast #2718238
Lesenswert?
• ▲
▼
entity BinaryCounter is
    Port ( rst : in  STD_LOGIC;
           clk : in  STD_LOGIC;
           enable : in  STD_LOGIC;
           binout : out  STD_LOGIC_VECTOR (3 downto 0));
end BinaryCounter;

architecture Behavioral of BinaryCounter is
  signal x: STD_LOGIC_VECTOR (3 downto 0);
begin
  binout <= x;
   Count: process (clk, rst, enable) is
   begin
    if rst = '1' then
      x <= "0000";
    else
      if (clk'event and clk = '1') then
        if (enable = '1') then
          if(x = "1001") then
            x <= "0000";
          else
          x <= x + "0001";
          end if;
        end if;
      end if;
    end if;
  end process;

end Behavioral;


Ich bekomme immer den Fehler:
ERROR:HDLParsers:808 - "D:/VHDL/Zeahler/BinaryCounter.vhd" Line 53. + 
can not have such operands in this context.

Zeile 53 ist: x <= x + "0001";

Bei meinem Kommilitonen läuft das ohne Probleme. Ich sehe leider nicht 
was ich verändern muss
Gast #2719005
Lesenswert?
• ▲
▼
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use ieee.numeric_std.all;

-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;

-- Uncomment the following library declaration if instantiating
-- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;

entity BinaryCounter is
    Port ( rst : in  STD_LOGIC;
           clk : in  STD_LOGIC;
           enable : in  STD_LOGIC;
           binout : out  STD_LOGIC_VECTOR (3 downto 0));
end BinaryCounter;

architecture Behavioral of BinaryCounter is
  signal x: unsigned (3 downto 0);
begin
  binout <= std_logic_vector(unsigned(x));
   Count: process (clk, rst, enable) is
   begin
    if rst = '1' then
      x <= "0000";
    else
      if (clk'event and clk = '1') then
        if (enable = '1') then
          if(x = "1001") then
            x <= "0000";
          else
          x <= x + "0001";
          end if;
        end if;
      end if;
    end if;
  end process;

end Behavioral;

Hab es soabgeändert und bekomme keine Fehler mehr, testen kann ich es 
erst nächsten Donerstag.

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren