P
Pasacco
Dear
I am having problem to implement "circular round-robin" priority
encoder.
My goal is to implement using "generic" number of ports.
I tried to use two "for" loops.
Problem was that the index is not always increasing.
It seems that it is not possible to implement using generic.
If anyone has this experience, please let me know.
Manual implementation is below:
--------------------------------------------------------
-- 4-port circular round-robin
-- priority encoder
-- current : current pointer
-- req : request
-- next : next pointer
--------------------------------------------------------
process(current,req)
begin
case current is
when 0=>
if req(1)='1' then next<=1;
elsif req(2)='1' then next<=2;
elsif req(3)='1' then next<=3;
else next<=0;
end if;
when 1=>
if req(2)='1' then next<=2;
elsif req(3)='1' then next<=3;
elsif req(0)='1' then next<=0;
else next<=1;
end if;
when 2=>
elsif req(3)='1' then next<=3;
elsif req(0)='1' then next<=0;
elsif req(1)='1' then next<=1;
else next<=2;
end if;
when 3=>
if req(0)='1' then next<=0;
elsif req(1)='1' then next<=1;
elsif req(2)='1' then next<=2;
else next<=3;
end if;
end case;
end process;
I am having problem to implement "circular round-robin" priority
encoder.
My goal is to implement using "generic" number of ports.
I tried to use two "for" loops.
Problem was that the index is not always increasing.
It seems that it is not possible to implement using generic.
If anyone has this experience, please let me know.
Manual implementation is below:
--------------------------------------------------------
-- 4-port circular round-robin
-- priority encoder
-- current : current pointer
-- req : request
-- next : next pointer
--------------------------------------------------------
process(current,req)
begin
case current is
when 0=>
if req(1)='1' then next<=1;
elsif req(2)='1' then next<=2;
elsif req(3)='1' then next<=3;
else next<=0;
end if;
when 1=>
if req(2)='1' then next<=2;
elsif req(3)='1' then next<=3;
elsif req(0)='1' then next<=0;
else next<=1;
end if;
when 2=>
elsif req(3)='1' then next<=3;
elsif req(0)='1' then next<=0;
elsif req(1)='1' then next<=1;
else next<=2;
end if;
when 3=>
if req(0)='1' then next<=0;
elsif req(1)='1' then next<=1;
elsif req(2)='1' then next<=2;
else next<=3;
end if;
end case;
end process;