FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > FPGA

FPGA comp.arch.fpga newsgroup (usenet)

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-06-2006, 10:36 PM
JL
Guest
 
Posts: n/a
Default Arbiter for several wires competing

Hi all,

I'm using a Virtex-2 FPGA and I wonder how can I efficiently choose one
from many wires competing to hold a resource. When 2 wires request the
resource at the same time, only the one with higher priority should be
taken. I know how to do it attaching all the wires to multiple AND
gates. The problem is that those AND gates can be huge if 20+ wires
compete.

Any ideas?

Thanks.
Jose.

Reply With Quote
  #2 (permalink)  
Old 02-06-2006, 10:55 PM
Slurp
Guest
 
Posts: n/a
Default Re: Arbiter for several wires competing


"JL" <[email protected]> wrote in message
news:[email protected] oups.com...
> Hi all,
>
> I'm using a Virtex-2 FPGA and I wonder how can I efficiently choose one
> from many wires competing to hold a resource. When 2 wires request the
> resource at the same time, only the one with higher priority should be
> taken. I know how to do it attaching all the wires to multiple AND
> gates. The problem is that those AND gates can be huge if 20+ wires
> compete.
>
> Any ideas?
>
> Thanks.
> Jose.
>


Hint: search Priority encoder


Reply With Quote
  #3 (permalink)  
Old 02-07-2006, 01:23 AM
Peter Alfke
Guest
 
Posts: n/a
Default Re: Arbiter for several wires competing

Jose, how fast do you need the answer? ns or perhaps even clock
cycles?
Peter Alfke

Reply With Quote
  #4 (permalink)  
Old 02-07-2006, 12:55 PM
JL
Guest
 
Posts: n/a
Default Re: Arbiter for several wires competing

I need the answer within clock cycles. One clock cycle would be great,
although I can bear a few more. I didn't mention that the priority
encoder or whatever solution should be parametrizable in VHDL. Just as
background information, I'm developing a bus where all modules (DMA,
CCD cameras, etc) can request a long write to SDRAM at any moment.
Since the transfer is quite long, over 512 words, I don't care if the
arbiter takes a few cycles to resolve who will be granted the bus.

I'm trying this now:

signal requests : std_logic_vector(m-1 downto 0);
signal resolved : std_logic_vector(m-1 downto 0);

process(i_Clk, i_Rst, first_level)
variable found : std_logic;
begin
if (i_Rst = '1') then
resolved <= (others=>'0');
elsif (i_Clk'event and i_Clk = '1') then
found := '0';
for y in 0 to m-1 loop
if (requests(x) = '1' and found = '0') then
resolved <= ext(requests(y downto 0), m);
found := '1';
end if;
end loop;
end if;
end process;

It synthesizes well, although I don't know if that is good coding
practice. It seems to work at behavioral and post-place&route
simulations.

I'm just a bit worried about the efficiency of that construct. Do you
think it will become a headache if I don't express it in another way?
Do you think it could grow too big for something like 30 wires
requests?

Regards.
Jose.

Reply With Quote
  #5 (permalink)  
Old 02-08-2006, 12:18 AM
Peter Alfke
Guest
 
Posts: n/a
Default Re: Arbiter for several wires competing

Let me tell you what can be done in Virtex-4 (probably also in
Spartan3):

A priority "linear encoder" with 4 x N inputs and 4 x N outputs, each
output corresponding to a prioritized input.
Only one output is ever active, the one corresponding to the
highest-priority active input.
Total cost: 5N+1 (LUTs+flip-flops).
Such a 32-input linear priority encoder uses 41 LUTs = 21 slices (<6
CLBs), and runs at >250 MHz.
The design is fully modular (per 4 bits).
Peter Alfke

Reply With Quote
  #6 (permalink)  
Old 02-08-2006, 02:20 PM
JL
Guest
 
Posts: n/a
Default Re: Arbiter for several wires competing

The VHDL code that I posted before is buggy. After the first signal
resolution, the resolved vector never becomes all '0'. The following
code solves it:

signal requests : std_logic_vector(m-1 downto 0);
signal resolved : std_logic_vector(m-1 downto 0);
signal some_request : std_logic;

process(i_Clk, i_Rst, first_level)
variable found : std_logic;
variable var_resolved : std_logic_vector(m-1 downto 0);
begin
if (i_Rst = '1') then
resolved <= (others=>'0');
var_resolved := (others=>'0');
some_request <= '0';
found := '0';
elsif (i_Clk'event and i_Clk = '1') then
found := '0';
var_resolved := (others=>'0');
for y in 0 to m-1 loop
if (requests(x) = '1' and found = '0') then
var_resolved <= ext(requests(y downto 0), m);
found := '1';
end if;
end loop;
some_request <= found;
resolved <= var_resolved;
end if;
end process;


It also adds a new wire, some_req, that is '1' when there is any wire
requesting the resource, and '0' when there isn't. That is useful when
you don't want to grant the resource inmediately, but controlled by a
state machine or any other decision-making procedure. It is tested and
it works after Place & Route in a Virtex-2 at 100 Mhz. The synthesizer
reports good operation over 200 Mhz, although I didn't try this.

Regards.
Jose.

Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference between bus of wires and array of wires [email protected] Verilog 1 03-25-2008 10:04 AM
pullup on array of wires? Mark McDougall Verilog 5 06-18-2007 02:38 AM
arrays of wires [email protected] Verilog 1 08-20-2005 06:09 PM
xilina altera competing history bill FPGA 0 10-02-2004 01:05 AM
Un used wires Javier Correa Verilog 1 10-20-2003 05:06 AM


All times are GMT +1. The time now is 04:23 AM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved