Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > How to detect a sync and start of a frame in an optimal way

Reply
Thread Tools

How to detect a sync and start of a frame in an optimal way

 
 
VIPS
Guest
Posts: n/a
 
      06-15-2010
Hi All

I am designing a module and I am having some issues .. Let me explain
what I am doing.

I am getting data as 64 bytes in each clock cycle . In these 64 bytes
I look for sync bits which is "01" and then a fixed pattern of "1111"
for the start of the frame . The next byte tells us the length of the
payload . Now the minimum payload could be of 4 byes so there is a
chance that in the current 64 bytes we can have multiple short frames
of 4 bytes and henceforth we can have many start and stop bytes .

Once we have detected a sync and the start of frame pattern then we
have to make sure it is not mistakingly taking the patter in the
payload as the start of the frma e again .

I have made a loop that goes 63 downto 0 and looks for each byte for
sync and start bit pattern

if it finds the sync and the start fame pattern then i am using a flag
to make sure it is not mistakingly taking the pattern in the payload
as the another start frame once it has detected the start of the frame
and sync successfully.

Solution : I have made a counter that runs inside the loop (63 down to
0) and it is 13 bits wide ( as there could be 8192 max payload)

so once the count length is equal to payload length I am disabling the
flag to allow it to go into detection of sync and start of the frame.

Problem: The problem is that whe i am using a 13 bit counter inside a
loop that goes 64 iterations makes a very large HW during syntheis .

Can you provide a solution to this problem as i would be able to
detect smallest payload ( 4 bytes in this case) as well as max payload
bytes in an efficient way.

I will really appreciate you help in this regard.


Regards

Vips
 
Reply With Quote
 
 
 
 
Tricky
Guest
Posts: n/a
 
      06-16-2010
On 15 June, 11:57, VIPS <thevipulsi...@gmail.com> wrote:
> Hi All
>
> I am designing a module and I am having some issues .. Let me explain
> what *I am doing.
>
> I am getting *data as 64 bytes in each clock cycle . In these 64 bytes
> I look for sync bits which is "01" and then a fixed pattern of "1111"
> for the start of the frame . The next byte tells us the length of the
> payload . Now the minimum payload could be of 4 byes so there is a
> chance that in the current 64 bytes we can have multiple short frames
> of 4 bytes and henceforth we can have many start and stop bytes .
>
> Once we have detected a sync and the start of frame pattern then we
> have to make sure it is not mistakingly taking the patter in the
> payload as the start of the frma e again .
>
> I have made a loop that goes 63 downto 0 and looks for each byte for
> sync and start bit pattern
>
> if it finds the sync and the start fame pattern then i am using a flag
> to make sure it is not mistakingly taking the pattern in the payload
> as the another start frame once it has detected the start of the frame
> and sync successfully.
>
> Solution : I have made a counter that runs inside the loop (63 down to
> 0) and it is 13 bits wide ( as there could be 8192 max payload)
>
> so once the count length is equal to payload length I am disabling the
> flag to allow it to go into detection of sync and start of the frame.
>
> Problem: The problem is that whe i am using a 13 bit counter inside a
> loop that goes 64 iterations makes a very large HW during syntheis .
>
> Can you provide a solution to this problem as i would be able to
> detect smallest payload ( 4 bytes in this case) as well as max payload
> bytes in an efficient way.
>
> I will really appreciate you help in this regard.
>
> Regards
>
> Vips


It sounds like you're trying to write VHDL like software. You have to
remember that in VHDL loops un-roll into parrallel hardware, hence
your very large HW. Loops are not usually what you want when you're
trying to look at sequential data.

Post up some of your code so we can have a look.
 
Reply With Quote
 
 
 
 
vipin lal
Guest
Posts: n/a
 
      06-16-2010
On Jun 15, 3:57*pm, VIPS <thevipulsi...@gmail.com> wrote:
> Hi All
>
> I am designing a module and I am having some issues .. Let me explain
> what *I am doing.
>
> I am getting *data as 64 bytes in each clock cycle . In these 64 bytes
> I look for sync bits which is "01" and then a fixed pattern of "1111"
> for the start of the frame . The next byte tells us the length of the
> payload . Now the minimum payload could be of 4 byes so there is a
> chance that in the current 64 bytes we can have multiple short frames
> of 4 bytes and henceforth we can have many start and stop bytes .
>
> Once we have detected a sync and the start of frame pattern then we
> have to make sure it is not mistakingly taking the patter in the
> payload as the start of the frma e again .
>
> I have made a loop that goes 63 downto 0 and looks for each byte for
> sync and start bit pattern
>
> if it finds the sync and the start fame pattern then i am using a flag
> to make sure it is not mistakingly taking the pattern in the payload
> as the another start frame once it has detected the start of the frame
> and sync successfully.
>
> Solution : I have made a counter that runs inside the loop (63 down to
> 0) and it is 13 bits wide ( as there could be 8192 max payload)
>
> so once the count length is equal to payload length I am disabling the
> flag to allow it to go into detection of sync and start of the frame.
>
> Problem: The problem is that whe i am using a 13 bit counter inside a
> loop that goes 64 iterations makes a very large HW during syntheis .
>
> Can you provide a solution to this problem as i would be able to
> detect smallest payload ( 4 bytes in this case) as well as max payload
> bytes in an efficient way.
>
> I will really appreciate you help in this regard.
>
> Regards
>
> Vips


Do you have any other clock(other than the clock which supplies 64
bytes to your module) available in the system?If you have a clock
which has a time period of 1 byte length then you can use it to create
a state machine.This will reduce the hardware considerably.

--vipin
 
Reply With Quote
 
Mike Treseler
Guest
Posts: n/a
 
      06-16-2010
VIPS wrote:

> I am getting data as 64 bytes in each clock cycle . In these 64 bytes
> I look for sync bits which is "01" and then a fixed pattern of "1111"
> for the start of the frame .


Without bit or byte stuffing the data,
it is impossible to tell the flags (sync bits) from the data.

-- Mike Treseler
 
Reply With Quote
 
VIPS
Guest
Posts: n/a
 
      06-17-2010
On Jun 16, 12:47*pm, Tricky <trickyh...@gmail.com> wrote:
> On 15 June, 11:57, VIPS <thevipulsi...@gmail.com> wrote:
>
>
>
> > Hi All

>
> > I am designing a module and I am having some issues .. Let me explain
> > what *I am doing.

>
> > I am getting *data as 64 bytes in each clock cycle . In these 64 bytes
> > I look for sync bits which is "01" and then a fixed pattern of "1111"
> > for the start of the frame . The next byte tells us the length of the
> > payload . Now the minimum payload could be of 4 byes so there is a
> > chance that in the current 64 bytes we can have multiple short frames
> > of 4 bytes and henceforth we can have many start and stop bytes .

>
> > Once we have detected a sync and the start of frame pattern then we
> > have to make sure it is not mistakingly taking the patter in the
> > payload as the start of the frma e again .

>
> > I have made a loop that goes 63 downto 0 and looks for each byte for
> > sync and start bit pattern

>
> > if it finds the sync and the start fame pattern then i am using a flag
> > to make sure it is not mistakingly taking the pattern in the payload
> > as the another start frame once it has detected the start of the frame
> > and sync successfully.

>
> > Solution : I have made a counter that runs inside the loop (63 down to
> > 0) and it is 13 bits wide ( as there could be 8192 max payload)

>
> > so once the count length is equal to payload length I am disabling the
> > flag to allow it to go into detection of sync and start of the frame.

>
> > Problem: The problem is that whe i am using a 13 bit counter inside a
> > loop that goes 64 iterations makes a very large HW during syntheis .

>
> > Can you provide a solution to this problem as i would be able to
> > detect smallest payload ( 4 bytes in this case) as well as max payload
> > bytes in an efficient way.

>
> > I will really appreciate you help in this regard.

>
> > Regards

>
> > Vips

>
> It sounds like you're trying to write VHDL like software. You have to
> remember that in VHDL loops un-roll into parrallel hardware, hence
> your very large HW. Loops are not usually what you want when you're
> trying to look at sequential data.
>
> Post up some of your code so we can have a look.


Yes i know loop gives a large HW and more worse a 13 bit counter
inside a loop that runs 64 iterations...

But what is the way to look for sync bits and fixed patter "1111" for
start of the frame .MInd you you can have actual start also that has
to be separated out with false start.

Thanks

Vips
 
Reply With Quote
 
Pieter Hulshoff
Guest
Posts: n/a
 
      06-17-2010
VIPS,

What kind of bandwidth and clock frequency are you working with to end up with a 512 bit wide databus?

In any case: you're looking for a 6 bit pattern in a 512 bit databus, so you'll need a 512+(6-1)=517
bit wide sliding window. You can either do this in multiple clock cycles, or split the databus into
small parts with a 5 bit overlap, and combine the results. In either case, it's wise to separate your
framing algorithm from your data handling part, and don't look at the data until you're in-frame.

With regards to your framing algorithm: build in some rebustness against bit errors and false framing
patterns.

Kind regards,

Pieter Hulshoff
 
Reply With Quote
 
Mike Treseler
Guest
Posts: n/a
 
      06-18-2010
> But what is the way to look for sync bits and fixed patter "1111" for
> start of the frame .MInd you you can have actual start also that has
> to be separated out with false start.


To pick packets out of a data-stream I either have to insert fixed flag
patterns that are *only* used between packets, or a fixed frame
size with assigned counts for variable data and fixed frame bits.

In the first case I just watch for flags and unstuff the data.

In the second case, I have to synch up to the data by
counting from an arbitrary start bit and checking the frame bits.
If a frame bit is wrong, I reset the counter and try again
until they are all correct.
While synced, I know which counts to output as data.

-- Mike Treseler
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Re: python and filter design: calculating "s" optimal transform Terry Reedy Python 1 06-02-2010 03:14 PM
JTable and optimal column width. Christian-Josef Schrattenthaler Java 2 07-23-2006 05:14 PM
Opinion: Optimal way of holding large amounts of data between pages? David ASP .Net 0 06-21-2006 08:08 PM
sync.rb difference between Sync::UN, Sync::EX and Sync::SH Trans Ruby 2 12-12-2005 02:43 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57