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

Funtion or something that finds the smaller integer

$
0
0
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...

Code:

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

Viewing all articles
Browse latest Browse all 19390

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>