Prev: Memory in VHDL
Next: PLX 9056 application
From: Jim Granville on 29 Nov 2005 15:51 Andy Peters wrote: > damir wrote: > >>I need to implement slow FIFO (16-bit wide, max. 10 MHz) using external >>single-port SRAM connected to the FPGA (Spartan II/III). >> >>Does anyone have similar FIFO controller (sync/async) implemented using >>VHDL? > > > A FIFO in a single-port RAM? Neat trick, although I suppose the slow > speed makes it do-able. Most Video systems are essentially FIFOs - the simplest ones just alternate R/W slots, at 2x the bandwidth - with the caveats that most of the available WRITE slots are ignored, and the READ slots will pause during non-display time zones. To ease the EMC, the WRITE slot should activate the WR address only when actually needed. Normally, what needs the most attention is the WR_Enable pulse setup and hold times, so that becomes narrower than the 1/2 time slot (50ns) Peter's idea of 50MHz state engine, would allow you to allocate 2 tw to read, and 3 tw to write, with a centred 20ns WRN pulse width, using simple sync designs - or you could go to 60MHz and do 3tw+3tw, - decreases tWRN to 16.6ns, but increases tRdCYC to 50ns..... -jg
From: Ray Andraka on 29 Nov 2005 17:46 Andy Peters wrote: > > A FIFO in a single-port RAM? Neat trick, although I suppose the slow > speed makes it do-able. > > -a > Andy, Sure, I've done that many times, as well as virtual multi-port memory. The key is to time multiplex the ports into the single port using a faster memory clock than the access rate you need on any one port. Damir, It isn't really a hard problem, you basically have two address counters muxed into the single address of the RAM. An additional up/down counter will give you the population count needed for a synchronous FIFO, and a little bit of extra logic to decode the flags from the population count is all that it takes. An async FIFO can only be approximated by a single ported memory, because by definition all accesses to the memory happen on the same clock domain. For an 'async' fifo you will need to implement a syncrhonous fifo in the memory with a small on-chip async fifo cascaded to the input or output to take care of the clock domain crossing.
From: Andy Peters on 29 Nov 2005 19:32 Ray Andraka wrote: > Andy Peters wrote: > > > > > A FIFO in a single-port RAM? Neat trick, although I suppose the slow > > speed makes it do-able. > > > > -a > > > Andy, > > Sure, I've done that many times, as well as virtual multi-port memory. > The key is to time multiplex the ports into the single port using a > faster memory clock than the access rate you need on any one port. OK, of course you're right :) I wasn't thinkin'. I built an audio digital delay out of a CPLD, an audio CODEC (DAC and ADC in the same chip) and a couple of async SRAMs. Basically, it's a big FIFO. Two address pointers are maintained, one for read, one for write. Empty and full flags are irrelevant. A state machine, running at the CODEC MCLK frequency, handles interleaving the memory reads and writes. It's pretty neat. A microcontroller handles the interface to an LCD and a rotary encoder. It'd be a good homework assignment for a VHDL or Verilog class. -a
From: damir on 1 Dec 2005 10:16 Nice solution! "Arlet" <usenet+5(a)ladybug.xs4all.nl> wrote in message news:1133294098.430743.59950(a)g14g2000cwa.googlegroups.com... > damir wrote: >> I need to implement slow FIFO (16-bit wide, max. 10 MHz) using external >> single-port SRAM connected to the FPGA (Spartan II/III). >> >> Does anyone have similar FIFO controller (sync/async) implemented using >> VHDL? >> >> Thanks, >> >> Damir > > I would put two small FIFOs on the FPGA, and then have a simple, > synchronous state machine to control the external RAM. The state > machine would look at how full/empty the FIFOs are, and based on their > priority determine whether it will do a either a read or write access > to the external RAM. > > If you need an asych FIFO, then use one of the on-chip FIFOs to cross > the clock domains, and keep the rest on the same clock. >
From: dp on 1 Dec 2005 12:26
Peter's explanation on how to implement a FIFO cannot be improved much, if any - this is how FIFOs are implemented in hard- and software. Here is an alternative to building your own FIFO out of RAM - has worked for me more than once. If the purpose is to have the FIFO (and not to build it, say, for learning or economic purposes), you can use one of the 72XX (IDT used to make them) FIFO chips. They have the R/W pointer circuitry inside etc., really convenient to use - and you will need no memory address lines out of the FPGA, nor will the data necessarily go through it (that is, you can just handle the full/empty flags and the R/W strobes - and there also is a half full flag). Dimiter ------------------------------------------------------ Dimiter Popoff Transgalactic Instruments http://www.tgi-sci.com ------------------------------------------------------ |