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 11-08-2007, 01:15 PM
Readon
Guest
 
Posts: n/a
Default FIFO interface design

i want to read & write data to/from a fifo placed in fpga. MCU's
external bus is connected to the chip. I am using the sync-fifo ip of
Altera CycloneII. The data bus and control signal are connected to
fifo directly. it's unfortune that when i read once from bus, data
would be read twice from fifo because there are two clock rising edges
during read signal(low active) is resetted. I think it will read more
datas from fifo if the read signal is resetted long enough.
Is there any good design for fifo interface connecting on the
exteranl bus?

Reply With Quote
  #2 (permalink)  
Old 11-09-2007, 12:07 AM
Dave Pollum
Guest
 
Posts: n/a
Default Re: FIFO interface design

On Nov 8, 8:15 am, Readon <[email protected]> wrote:
> i want to read & write data to/from a fifo placed in fpga. MCU's
> external bus is connected to the chip. I am using the sync-fifo ip of
> Altera CycloneII. The data bus and control signal are connected to
> fifo directly. it's unfortune that when i read once from bus, data
> would be read twice from fifo because there are two clock rising edges
> during read signal(low active) is resetted. I think it will read more
> datas from fifo if the read signal is resetted long enough.
> Is there any good design for fifo interface connecting on the
> exteranl bus?


Using a Synchronous FIFO implies that the read clock and the write
clock are in the same clock domain. Is your MCU supplying the FIFO's
clock or is the FPGA supplying the MCU's clock? If the clock sources
are different, then you either need an Asynchronous FIFO, or you need
to run the MCU and FPGA from the same clock.
HTH
-Dave Pollum

Reply With Quote
  #3 (permalink)  
Old 11-09-2007, 01:25 AM
Readon
Guest
 
Posts: n/a
Default Re: FIFO interface design

On Nov 9, 8:07 am, Dave Pollum <[email protected]> wrote:
> On Nov 8, 8:15 am, Readon <[email protected]> wrote:
>
> > i want to read & write data to/from a fifo placed in fpga. MCU's
> > external bus is connected to the chip. I am using the sync-fifo ip of
> > Altera CycloneII. The data bus and control signal are connected to
> > fifo directly. it's unfortune that when i read once from bus, data
> > would be read twice from fifo because there are two clock rising edges
> > during read signal(low active) is resetted. I think it will read more
> > datas from fifo if the read signal is resetted long enough.
> > Is there any good design for fifo interface connecting on the
> > exteranl bus?

>
> Using a Synchronous FIFO implies that the read clock and the write
> clock are in the same clock domain. Is your MCU supplying the FIFO's
> clock or is the FPGA supplying the MCU's clock? If the clock sources
> are different, then you either need an Asynchronous FIFO, or you need
> to run the MCU and FPGA from the same clock.
> HTH
> -Dave Pollum


It is in different clock, i tried altera's asynchronous FIFO which
need two extra clock for reading.
is there any better solution?

Reply With Quote
  #4 (permalink)  
Old 11-09-2007, 02:54 AM
Gabor
Guest
 
Posts: n/a
Default Re: FIFO interface design

On Nov 8, 8:25 pm, Readon <[email protected]> wrote:
> On Nov 9, 8:07 am, Dave Pollum <[email protected]> wrote:
>
>
>
> > On Nov 8, 8:15 am, Readon <[email protected]> wrote:

>
> > > i want to read & write data to/from a fifo placed in fpga. MCU's
> > > external bus is connected to the chip. I am using the sync-fifo ip of
> > > Altera CycloneII. The data bus and control signal are connected to
> > > fifo directly. it's unfortune that when i read once from bus, data
> > > would be read twice from fifo because there are two clock rising edges
> > > during read signal(low active) is resetted. I think it will read more
> > > datas from fifo if the read signal is resetted long enough.
> > > Is there any good design for fifo interface connecting on the
> > > exteranl bus?

>
> > Using a Synchronous FIFO implies that the read clock and the write
> > clock are in the same clock domain. Is your MCU supplying the FIFO's
> > clock or is the FPGA supplying the MCU's clock? If the clock sources
> > are different, then you either need an Asynchronous FIFO, or you need
> > to run the MCU and FPGA from the same clock.
> > HTH
> > -Dave Pollum

>
> It is in different clock, i tried altera's asynchronous FIFO which
> need two extra clock for reading.
> is there any better solution?



If your MCU is running much slower than the FPGA, you can use the
FPGA's internal clock to run the synchronous FIFO, and a little
state logic to generate the necessary (single cycle) pulses for
read and write from the MCU interface signals.

Reply With Quote
  #5 (permalink)  
Old 11-09-2007, 02:39 PM
John Retta
Guest
 
Posts: n/a
Default Re: FIFO interface design


>
> If your MCU is running much slower than the FPGA, you can use the
> FPGA's internal clock to run the synchronous FIFO, and a little
> state logic to generate the necessary (single cycle) pulses for
> read and write from the MCU interface signals.


In this case, logic is simply an edge detect.

ie.

reg read_level_q;
wire fifo_read_trailing_edge_det = ~read_level & read_level_q;

always @ (posedge clk)
begin
read_level_q <= read_level;
end


--

Regards,
John Retta
Owner and Designer
Retta Technical Consulting Inc.

Colorado Based Xilinx Consultant

email : [email protected]
web : www.rtc-inc.com
Reply With Quote
  #6 (permalink)  
Old 11-10-2007, 04:56 AM
Readon
Guest
 
Posts: n/a
Default Re: FIFO interface design

On Nov 9, 10:54 am, Gabor <[email protected]> wrote:
> On Nov 8, 8:25 pm, Readon <[email protected]> wrote:
>
>
>
> > On Nov 9, 8:07 am, Dave Pollum <[email protected]> wrote:

>
> > > On Nov 8, 8:15 am, Readon <[email protected]> wrote:

>
> > > > i want to read & write data to/from a fifo placed in fpga. MCU's
> > > > external bus is connected to the chip. I am using the sync-fifo ip of
> > > > Altera CycloneII. The data bus and control signal are connected to
> > > > fifo directly. it's unfortune that when i read once from bus, data
> > > > would be read twice from fifo because there are two clock rising edges
> > > > during read signal(low active) is resetted. I think it will read more
> > > > datas from fifo if the read signal is resetted long enough.
> > > > Is there any good design for fifo interface connecting on the
> > > > exteranl bus?

>
> > > Using a Synchronous FIFO implies that the read clock and the write
> > > clock are in the same clock domain. Is your MCU supplying the FIFO's
> > > clock or is the FPGA supplying the MCU's clock? If the clock sources
> > > are different, then you either need an Asynchronous FIFO, or you need
> > > to run the MCU and FPGA from the same clock.
> > > HTH
> > > -Dave Pollum

>
> > It is in different clock, i tried altera's asynchronous FIFO which
> > need two extra clock for reading.
> > is there any better solution?

>
> If your MCU is running much slower than the FPGA, you can use the
> FPGA's internal clock to run the synchronous FIFO, and a little
> state logic to generate the necessary (single cycle) pulses for
> read and write from the MCU interface signals.


unfortunately, the problem i met is on the contrary. MCU is much
faster then FPGA, about 4 times.

Reply With Quote
  #7 (permalink)  
Old 11-10-2007, 05:04 PM
John Retta
Guest
 
Posts: n/a
Default Re: FIFO interface design

Readon wrote:
> On Nov 9, 10:54 am, Gabor <[email protected]> wrote:
>> On Nov 8, 8:25 pm, Readon <[email protected]> wrote:
>>
>>
>>
>>> On Nov 9, 8:07 am, Dave Pollum <[email protected]> wrote:
>>>> On Nov 8, 8:15 am, Readon <[email protected]> wrote:
>>>>> i want to read & write data to/from a fifo placed in fpga. MCU's
>>>>> external bus is connected to the chip. I am using the sync-fifo ip of
>>>>> Altera CycloneII. The data bus and control signal are connected to
>>>>> fifo directly. it's unfortune that when i read once from bus, data
>>>>> would be read twice from fifo because there are two clock rising edges
>>>>> during read signal(low active) is resetted. I think it will read more
>>>>> datas from fifo if the read signal is resetted long enough.
>>>>> Is there any good design for fifo interface connecting on the
>>>>> exteranl bus?
>>>> Using a Synchronous FIFO implies that the read clock and the write
>>>> clock are in the same clock domain. Is your MCU supplying the FIFO's
>>>> clock or is the FPGA supplying the MCU's clock? If the clock sources
>>>> are different, then you either need an Asynchronous FIFO, or you need
>>>> to run the MCU and FPGA from the same clock.
>>>> HTH
>>>> -Dave Pollum
>>> It is in different clock, i tried altera's asynchronous FIFO which
>>> need two extra clock for reading.
>>> is there any better solution?

>> If your MCU is running much slower than the FPGA, you can use the
>> FPGA's internal clock to run the synchronous FIFO, and a little
>> state logic to generate the necessary (single cycle) pulses for
>> read and write from the MCU interface signals.

>
> unfortunately, the problem i met is on the contrary. MCU is much
> faster then FPGA, about 4 times.
>


- Just for info purposes what is the fpga clk rate and MCU rate?
- What is the fastest clk available on pwb?
- Does the MCU provide a clk at all for this interface? ie synchronous
interface?

Personally, I like to have an FPGA clk that is faster than any of my
interfaces, or I use a clk from the fastest source on the pwb, and make
my logic synchronous to that source, or I hope that if I have a high
speed interface, there is an external clk that I can use, and limit the
use of this clk within the fpga to just that interface..

That being said you are where you are.

You might want to look at using the clk multiplier function in the
Cyclone. You will be able to generate a higher clk fpga rate than
you currently have, treat the read pulse asynchronously, and use the
trailing edge detect I previously described. Since it is now
asynchronous you will have to make the single FF, two FF and decode
your edge detect off of these signals.

--

Regards,
John Retta
Owner and Designer
Retta Technical Consulting Inc.

Colorado Based Xilinx Consultant

phone : 303.926.0068
email : [email protected]
web : www.rtc-inc.com
Reply With Quote
  #8 (permalink)  
Old 11-10-2007, 05:53 PM
John_H
Guest
 
Posts: n/a
Default Re: FIFO interface design

Readon wrote:
> On Nov 9, 10:54 am, Gabor <[email protected]> wrote:
>> On Nov 8, 8:25 pm, Readon <[email protected]> wrote:
>>> On Nov 9, 8:07 am, Dave Pollum <[email protected]> wrote:
>>>> On Nov 8, 8:15 am, Readon <[email protected]> wrote:


>>>>> i want to read & write data to/from a fifo placed in fpga. MCU's
>>>>> external bus is connected to the chip. I am using the sync-fifo ip of
>>>>> Altera CycloneII. The data bus and control signal are connected to
>>>>> fifo directly. it's unfortune that when i read once from bus, data
>>>>> would be read twice from fifo because there are two clock rising edges
>>>>> during read signal(low active) is resetted. I think it will read more
>>>>> datas from fifo if the read signal is resetted long enough.
>>>>> Is there any good design for fifo interface connecting on the
>>>>> exteranl bus?


>>>> Using a Synchronous FIFO implies that the read clock and the write
>>>> clock are in the same clock domain. Is your MCU supplying the FIFO's
>>>> clock or is the FPGA supplying the MCU's clock? If the clock sources
>>>> are different, then you either need an Asynchronous FIFO, or you need
>>>> to run the MCU and FPGA from the same clock.
>>>> HTH
>>>> -Dave Pollum


>>> It is in different clock, i tried altera's asynchronous FIFO which
>>> need two extra clock for reading.
>>> is there any better solution?


>> If your MCU is running much slower than the FPGA, you can use the
>> FPGA's internal clock to run the synchronous FIFO, and a little
>> state logic to generate the necessary (single cycle) pulses for
>> read and write from the MCU interface signals.


> unfortunately, the problem i met is on the contrary. MCU is much
> faster then FPGA, about 4 times.


I can get 600 Mb/s connections on a $5 FPGA. I don't know any fast MCUs
though the front side bus on some embedded processors can get pretty fast.

It sounds like you have an extremely simple logic problem. The read
from the MCU is too wide compared to the sync FIFO's clock.

Change that! If you know that you'll only have one read during a read
signal from the MCU, use that information to only assert the read
control to the sync FIFO once. *Do not* connect the double-wide read
pulse directly to the MCU. This is very, very simple logic.
Reply With Quote
  #9 (permalink)  
Old 11-10-2007, 07:00 PM
Marlboro
Guest
 
Posts: n/a
Default Re: FIFO interface design

On Nov 9, 10:56 pm, Readon <[email protected]> wrote:
> On Nov 9, 10:54 am, Gabor <[email protected]> wrote:
>
>
>
>
>
> > On Nov 8, 8:25 pm, Readon <[email protected]> wrote:

>
> > > On Nov 9, 8:07 am, Dave Pollum <[email protected]> wrote:

>
> > > > On Nov 8, 8:15 am, Readon <[email protected]> wrote:

>
> > > > > i want to read & write data to/from a fifo placed in fpga. MCU's
> > > > > external bus is connected to the chip. I am using the sync-fifo ip of
> > > > > Altera CycloneII. The data bus and control signal are connected to
> > > > > fifo directly. it's unfortune that when i read once from bus, data
> > > > > would be read twice from fifo because there are two clock rising edges
> > > > > during read signal(low active) is resetted. I think it will read more
> > > > > datas from fifo if the read signal is resetted long enough.
> > > > > Is there any good design for fifo interface connecting on the
> > > > > exteranl bus?

>
> > > > Using a Synchronous FIFO implies that the read clock and the write
> > > > clock are in the same clock domain. Is your MCU supplying the FIFO's
> > > > clock or is the FPGA supplying the MCU's clock? If the clock sources
> > > > are different, then you either need an Asynchronous FIFO, or you need
> > > > to run the MCU and FPGA from the same clock.
> > > > HTH
> > > > -Dave Pollum

>
> > > It is in different clock, i tried altera's asynchronous FIFO which
> > > need two extra clock for reading.
> > > is there any better solution?

>
> > If your MCU is running much slower than the FPGA, you can use the
> > FPGA's internal clock to run the synchronous FIFO, and a little
> > state logic to generate the necessary (single cycle) pulses for
> > read and write from the MCU interface signals.

>
> unfortunately, the problem i met is on the contrary. MCU is much
> faster then FPGA, about 4 times.- Hide quoted text -
>
> - Show quoted text -



Some how you need to synchronize your MCU read to the FIFO read clock
(edge detect as others said), then make sure the read connects to the
FIFO has 1 clock wide only

btw, building your own FIFO isn't difficult if the speed fairly "slow"





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
fifo interface design Readon Verilog 1 11-08-2007 02:29 PM
Where can I get a opencore of a fifo with atlantic interface? PLD Hacker FPGA 0 11-09-2006 05:22 AM
FIFO design [email protected] FPGA 1 02-26-2006 05:08 PM
ADC unit with 2 input channels, 12 bit, 10MHz conversion rate, 4Ksamples FIFO, USB (or PCI on PC104+ form) interface, Linux, QNX driver FPGA 0 09-03-2004 12:48 PM


All times are GMT +1. The time now is 01:41 AM.


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