Bit stuffing in a Crc encoder

Discussion in 'VHDL' started by jpereira, May 25, 2005.

  1. jpereira

    jpereira Guest

    Hi all,
    I am a uni student looking for some help concerning bit stuffing in vhdl.
    The assignment question is:
    Design of a serial transmitter/receiver with CRC-8 error check. The
    on-board memory is used as the source and destination of the data. The PS2
    port on the Digilab board should be used as the synchronous
    transmit/receive port. The mode (TX/RX) should be set by a switch. Another
    switch should be used to activate scrolling and displaying the contents of
    the memory for verification. The CRC-8 polynomial is x8 + x2 + x + 1. The
    frame consists of one byte with frame length followed by data bytes and
    the CRC checksum byte. The transmission speed 1 kbps and bit stuffing
    should be used for frame and byte synchronisation.

    I seemed to have found my way though the crc,transmitter & reciever bits
    with help off the internet but I cant seem to find anything on bit
    Can one of ya'll genius programmer help me out please cus i really suck at
    this stuff & couldnt have done most of it without help.
    Thanks for your help.
    Can you please email your replies to my mail add.It is

    Thanks a lot.
    jpereira, May 25, 2005
    1. Advertisements

  2. jpereira

    ALuPin Guest

    Where exactly is the problem with bit stuffing ?
    Don't you know why to use it or how to implement it ?

    ALuPin, May 25, 2005
    1. Advertisements

  3. jpereira

    Neo Guest

    bit stuffing is nothing but adding extra bits (usually zeroes) to a
    payload to make it equal to the stated size or min size.
    Neo, May 25, 2005
  4. jpereira

    mk Guest

    He is talking about bit stuffing for "... synchronization" which
    suggests that he needs to insert bits to cause transitions to streams
    which don't have the minimum number of transitions per byte etc so
    that if you transmit a constant stream of 1s or 0s there will be a
    minimum number of transitions. This is not hard but requires careful
    design/implementation as one needs to accumulate the bits which were
    replaced during the packet and send them at the end of the packet.
    mk, May 25, 2005
  5. If you have access to the entire buffer,
    you can use a function like this:

    function stuff_pattern (constant arg_raw : unsigned)
    return unsigned is
    variable arg : unsigned(1 to arg_raw'length) := arg_raw;
    size:if arg'length < 5 then return arg;
    elsif arg(1 to 5) = "11111" then
    -- return stuff token and the rest:
    return "111110" & stuff_pattern(arg(6 to arg'length));
    return arg(1) & stuff_pattern(arg(2 to arg'length));
    -- return one bit and the rest
    end if size;
    end function stuff_pattern;

    -- Mike Treseler
    Mike Treseler, May 31, 2005
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.