Round-robin priority encoder

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;
 
P

Pasacco

It is not quite clear what normalized index means and how to use.

In this example of priority encoder,

input :
current: integer range 0 to 3;
req: array(0 to 3) of std_logic;

output:
nxt: integer range 0 to 3;

If you have some idea, please let me know -:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top