Altera_Forum
Honored Contributor
13 years agoFuntion or something that finds the smaller integer
Hi, I'm looking for a simple way to find the smallest of a large number of integer signals (About 256)
All I have right now is just 4 and I do as the code below, but it will grow up to 256 and I think that it will not be sane to do it by this way...
process (clkwork,reset)
begin
if reset='0' then
if (clkwork'event and clkwork='1') then
if ((TaoA<TaoB) and(TaoA<TaoC)and(TaoA<TaoD))then
DataOut<=decodedBitA;
elsif ((TaoB<TaoA)and(TaoB<TaoC)and(TaoB<TaoD))then
DataOut<=decodedBitB;
elsif ((TaoC<TaoA)and(TaoC<TaoB)and(TaoC<TaoD))then
DataOut<=decodedBitC;
elsif ((TaoD<TaoA)and(TaoD<TaoB)and(TaoD<TaoC))then
DataOut<=decodedBitD;
end if;
end if;
end if;
if reset='1' then
DataOut<='0';
end if;
end process; TaoA,TaoB,TaoC,TaoD... are the integer signal and basically the code is if TaoA is the smaller do 'A' thing Thanks