I made some changes to it, it is slightly neater now but now it won't compile because it is expecting a bracket or something...error 10500
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 (asyncr, clk)
begin
if(asyncr = '1') then
y < = 0;
elsif(rising_edge(clk)) then
if(en = '1') then
if(dir = '1') then
if(y < y'high) then
y < = y + 1;
end if;
else
if(y > y'low) then
y <= y - 1;
end if;
end if;
end if;
end if;
end process;
end counter_v1;