Re: Help with verilog: write_count


Message: 3
Date: Thu, 16 Nov 2006 12:44:48 -0800
From: Eric B. [email protected]
Subject: Re: [Discuss-gnuradio] Help with Verilog: write_count[8]
To: seph 004 [email protected]
Cc: [email protected]
Message-ID: [email protected]
Content-Type: text/plain; charset=us-ascii

On Thu, Nov 16, 2006 at 01:11:15AM -0800, seph 004 wrote:

Hi

I’m still trying to figure out the problem in my code. I think that
along the way I misunderstood the purpose of the write_count
register. How does it actually work? WR triggers every time a 16 bit
packet is ready from the FX2 doesn’t it?

write_count counts from 0 to 256, then back to 0.
It’s at 256 when WR is still asserted but there’s really no data to
receive. This works around some strange behavior in the FX2 GPIF
interface and/or programming.

The wreq trigger of the FIFO is triggered by (WR &
~write_count[8]). Does this mean that only 256 16 bit samples enter
the FIFO before the WR is removed? Why is this? How could I
determine exactly when there is an I or Q sample that must be
written into the FIFO?

.wrreq tells the FIFO when data should be written to the fifo. So, we
write when (WR & ~write_count[8]). That is, when WR is asserted, but
the count does not have 0x100 bit set. As I recall, WR is asserted an
extra cycle, and the counter trick works around this.

You may want to take a look at the Altera Cyclone documentation. The
block called tx_fifo is one of their standard blocks. It’s the dual
clock version of the fifo, and is used (amongst other things), to
bridge between the USB clock domain (.wrclk(usbclk)) and the signal
processing clock (.rdclk(txclk)).

Eric

Hi

Thanks for responding. So WR & ~write_count[8] should be able to serve
as a write enable for a ram block?

Also, while testing with one of the unmodified FPGA builds, I found that
the have_space control line would sometimes go to zero even though I am
only sending small amounts of data (60 bytes for instance). In the
original build, have_space would only go to zero temporarily if the FIFO
became full. So why then does this happen even when sending small
numbers of samples? Shouldn’t the 4k FIFO never become full under those
circumstances?

Regards

Lance

On Fri, Nov 17, 2006 at 01:02:31AM -0800, seph 004 wrote:

Hi

Thanks for responding. So WR & ~write_count[8] should be able to
serve as a write enable for a ram block?

Also, while testing with one of the unmodified FPGA builds, I found
that the have_space control line would sometimes go to zero even
though I am only sending small amounts of data (60 bytes for
instance). In the original build, have_space would only go to zero
temporarily if the FIFO became full. So why then does this happen
even when sending small numbers of samples? Shouldn’t the 4k FIFO
never become full under those circumstances?

Using the standard host code, there’s no such thing as sending 60
bytes from the host. We always send 512 byte packets across the USB.

Not sure what you are doing…

Eric