Digesting runs of ones or zeros "well"

Sep 30, 2003 45 Replies

John,

I did something similar to this in a Spartan II. I was searching through a 2^7-1 PRBS pattern (at the output of a SERDES, data bus is

10-bits wide) for the longest string of zeros. Granted the longest string of zeros in a 2^7-1 PRBS pattern is 6, the idea could be extrapolated to longer strings like 9 in a 65-bit wide bus.

Here's an example of what I did for searching for 6 zeros in a row. You'll notice that in my casez statement, I'm actually searching for 6 ones in a row. This is because the BERT that I was using inverted it's output PRBS pattern.

always @(posedge clock1) begin casez (datasi[9:0]) 10'b???111111? : Q[9:0] = {datasi[9:8],7'b1111111,datasi[0]}; default : Q[9:0] = datasi[9:0]; endcase end

Once you find the string that you're looking for, you can do what ever you'd like.

Hope this helps,

Jeremy

I'm afraid I'm lost. The example you give shows a single alignment for a

6-ones check. There are 10 total alignments that can apply. Once detected, there doesn't seem to be an indication THAT the detection occurred except that one of the bits from the SERDES is now a one (by definition of your pattern, it would have been a zero).

Were you suggesting that, in general, a casez might produce good results from the synthesizer for run detection?

to

Not possible for the HDL which is not a complete programming language ;-)

--

--Ray Andraka, P.E. President, the Andraka Consulting Group, Inc.

401/884-7930 Fax 401/884-7950 email snipped-for-privacy@andraka.com
formatting link

"They that give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin, 1759

John,

This was only a snippit of my code. In my final design I accounted for all possible rotations of the code. Using the casez worked quite well in my application. Sorry for any confusion.

Sincerely,

Jeremy

Tim,

Philip pointed out that my link was to your website, which I totally missed. Got a good laugh out of Philip's pointing it out though!

Ray Andraka wrote:

--

--Ray Andraka, P.E. President, the Andraka Consulting Group, Inc.

401/884-7930 Fax 401/884-7950 email snipped-for-privacy@andraka.com
formatting link

"They that give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin, 1759

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required