std_match vhdl
Hi!
You can also use std_match function from ieee.numeric_std package
below is example code from my design .It is an priority encoder
if std_match(dane_24(23 downto 0),"-----------------------1")then
decoded<="00001";
elsif std_match(dane_24(23 downto 0),"----------------------1-")then
decoded<="00010" ;
elsif std_match(dane_24(23 downto 0),"---------------------1--")then
decoded<="00011";
elsif std_match(dane_24(23 downto 0),"--------------------1---")then
decoded<="00100";
elsif std_match(dane_24(23 downto 0),"-------------------1----")then
decoded<="00101";
elsif std_match(dane_24(23 downto 0),"------------------1-----")then
decoded<="00110";
elsif std_match(dane_24(23 downto 0),"-----------------1------")then
decoded<="00111";
elsif std_match(dane_24(23 downto 0),"----------------1-------")then
decoded<="01000";
elsif std_match(dane_24(23 downto 0),"---------------1--------")then
decoded<="01001";
elsif std_match(dane_24(23 downto 0),"--------------1---------")then
decoded<="01010";
elsif std_match(dane_24(23 downto 0),"-------------1----------")then
decoded<="01011";
elsif std_match(dane_24(23 downto 0),"------------1-----------")then
decoded<="01100";
elsif std_match(dane_24(23 downto 0),"-----------1------------")then
decoded<="01101";
elsif std_match(dane_24(23 downto 0),"----------1-------------")then
decoded<="01110";
elsif std_match(dane_24(23 downto 0),"---------1--------------")then
decoded<="01111";
elsif std_match(dane_24(23 downto 0),"--------1---------------")then
decoded<="10000";
elsif std_match(dane_24(23 downto 0),"-------1----------------")then
decoded<="10001";
elsif std_match(dane_24(23 downto 0),"------1-----------------")then
decoded<="10010";
elsif std_match(dane_24(23 downto 0),"-----1------------------")then
decoded<="10011";
elsif std_match(dane_24(23 downto 0),"----1-------------------")then
decoded<="10100";
elsif std_match(dane_24(23 downto 0),"---1--------------------")then
decoded<="10101";
elsif std_match(dane_24(23 downto 0),"--1---------------------")then
decoded<="10110";
elsif std_match(dane_24(23 downto 0),"-1----------------------")then
decoded<="10111";
elsif std_match(dane_24(23 downto 0),"1-----------------------")then
decoded<="00000";
end if;
Regards Martin (PL)