Hello Everyone,
I am encountering some errors with my codes.Being a beginner, I dn't know much about loops.. I tried to use multiple looping but i cn't reach a proper result....can anyone help??? and PFA my flowchart
my codes are as follows:
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity comparator is
generic (N : integer := 6);
port(
S : in STD_LOGIC_VECTOR(N-1 downto 0);
Z : out STD_LOGIC_VECTOR(2 downto 0)
);
end comparator;
architecture comparator of comparator is
begin
process(S)
begin
comp1: for N in 0 to 4 loop -- for the sensors 0-4--
if S(N) < S(N-1) then
N <= N+1;
elsif ( comp2: while ( S(N)= '1')loop ) then --for S(N) < max value --
Z(0) <= 1 ; --rotate in specific direction--
end loop comp2;
elsif N = '4' then
Z(1) <= 1; --reset motor that is return to initial position --
else
N <= N+1;
end if;
end if;
end if;
end loop comp1;
if S(5) > S(2) then
Z(2) <= 1 ;-- second motor is rotated --
end if;
end process;
end comparator;
end comparator;
and here are the errors:
# Compile...
# Warning: DAGGEN_0523: The source is compiled without the -dbg switch. Line breakpoints and assertion debug will not be available.
Question
1116345
Hello Everyone,
I am encountering some errors with my codes.Being a beginner, I dn't know much about loops.. I tried to use multiple looping but i cn't reach a proper result....can anyone help??? and PFA my flowchart
my codes are as follows:
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity comparator is
generic (N : integer := 6);
port(
S : in STD_LOGIC_VECTOR(N-1 downto 0);
Z : out STD_LOGIC_VECTOR(2 downto 0)
);
end comparator;
architecture comparator of comparator is
begin
process(S)
begin
comp1: for N in 0 to 4 loop -- for the sensors 0-4--
if S(N) < S(N-1) then
N <= N+1;
elsif ( comp2: while ( S(N)= '1')loop ) then --for S(N) < max value --
Z(0) <= 1 ; --rotate in specific direction--
end loop comp2;
elsif N = '4' then
Z(1) <= 1; --reset motor that is return to initial position --
else
N <= N+1;
end if;
end if;
end if;
end loop comp1;
if S(5) > S(2) then
Z(2) <= 1 ;-- second motor is rotated --
end if;
end process;
end comparator;
end comparator;
and here are the errors:
Link to comment
Share on other sites
12 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.