Quantcast
Channel: Altera Forums
Viewing all articles
Browse latest Browse all 19390

Error 10327 confusion

$
0
0
Hello.
I am trying to make a simple UP/DOWN counter and I am fairly new to VHDL. I keep getting the following error
"Error (10327): VHDL error at Counter.vhd(51): can't determine definition of operator ""+"" -- found 0 possible definitions"

My code is

Code:

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;


entity counter is
        generic
        (
        startnum : natural := 0;
        N : natural := 16
        );
        port
        (
                --Inputs
                EN                :        in std_logic;
                synchr        :        in std_logic;
                asyncr        :        in std_logic;
                dir        :        in        std_logic;                        --0 for count down 1 for count up.
                clk        : in std_logic;
                --Outputs
                Y        :        out natural range startnum to n-1
        );
end entity;
architecture counter_v1 of counter is
signal cntconst        :        integer;
begin
process (dir)                                --dir in sensitivity list as when this changes we want this process to run.
begin
if (dir = '0') then
        cntconst <= -1;                                --this will count down when added onto to the counter value
end if;
if (dir = '1') then
        cntconst <= 1;
end if;
end process;
process (EN, synchr, asyncr, clk)
variable notsurewhyitworkswiththis        :        integer range startnum to n-1;                        --I tried to just use y but for some reason it won't allow that.
begin
if (en = '0') then
else
        if (asyncr = '1') then
                notsurewhyitworkswiththis := 0;
        else
                if (clk = '1') then
                        if (synchr = '1') then
                                notsurewhyitworkswiththis := 0;
                        end if;
        end if;
end if;
if (cntconst < n-1) then
        if (dir = '1') then
                notsurewhyitworkswiththis := notsurewhyitworkswiththis + dir;
        end if;
end if;
if (cntconst > startnum) then
        if (dir = '0') then
                notsurewhyitworkswiththis := notsurewhyitworkswiththis + dir;
        end if;
end if;
end if;
y <= cntconst;
end process;
end counter_v1;

It is starting tio get a bit annoying now, I have tried loads of things I read online but to no avail.

Any help would be hugely appreciated.

Viewing all articles
Browse latest Browse all 19390

Trending Articles