electronics forum

Rules | Recent posts | topic RSS | Search | Register  | Log in

BIT STUFFING........


Post new topic  Reply to topic    EDAboard.com Forum Index -> PLD, SPLD, GAL, CPLD, FPGA Design -> BIT STUFFING........
Author Message
rakesh_aadhimoolam



Joined: 14 Mar 2006
Posts: 218
Helped: 16


Post14 Jul 2006 9:58   

BIT STUFFING........


HELLO EVERYONE.............

i was doing a program on "bit stuffing"....
the q is "Design a bit stuffer. The circuit takes serial data in and gives serial data out. If in the input stream five consecutive 1’s or 0’s are detected than a ‘0’ or a ‘1’ is inserted in the stream respectively"

i tried to do the following program but though bit stuffing is processed but for
the next bits that are entered the re a bit loss..

how can i rectify it?


LIBRARY ieee;
USE ieee.std_logic_1164.ALL;

ENTITY BitStuffer IS
PORT
( serial_in :IN std_logic;
rst,clk :IN std_logic;
serial_out :IN std_logic;
);
END BitStuffer;

ARCHITECTURE arch OF Bitstuffer IS

begin
process(clk,rst,serial_in)
variable temp1 : std_logic(4 downto 0);
variable stuffbit:std_logic;
variable count:integer range 0 to 4;
begin
if(rst='1') then
temp:='0';
serial_out<='0';
count:=0;
elsif(clk'event and clk='1') then
case serial_in is
when 1=>
for i in 0 to 4 loop
temp(i):=temp(i+1);
temp(4):=serial_in;
count:=count+1;
if(count=5) then
stuffbit:='0';
else
count:='0';
end loop;
when 0=>
for i in 0 to 4 loop
temp(i):=temp(i+1);
temp(4):=serial_in;
count:=count+1;
if(count=5) then
stuffbit:='1';
else
count:='0';
end loop;


thank you.............
Back to top
tkbits



Joined: 04 Dec 2004
Posts: 235
Helped: 36


Post16 Jul 2006 10:06   

Re: BIT STUFFING........


You will lose bits if you don't control the shifting (external to BitStuffer) of serial_in. You need to stall the serial_in bit stream in order to provide the time to insert each one of the stuffing bits.

Last edited by tkbits on 17 Jul 2006 4:03; edited 4 times in total
Back to top
Google
AdSense
Google Adsense




Post16 Jul 2006 10:06   

Ads




Back to top
bansalr



Joined: 22 Dec 2005
Posts: 158
Helped: 13


Post17 Jul 2006 3:08   

Re: BIT STUFFING........


Use the pipeling method to avoid loss of data. Register the input so that u will have one data in the storage and one data on the line.
Back to top
Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
Post new topic  Reply to topic    EDAboard.com Forum Index -> PLD, SPLD, GAL, CPLD, FPGA Design -> BIT STUFFING........
Page 1 of 1 All times are GMT + 1 Hour
Similar topics:
Need HDLC bit stuffing in VHDL example (1)
about usb what do bit stuffing do in usb 2.0 design (3)
zero stuffing (1)
Difference in Writing Code between 8-bit/16-bit/32-bit Micro (1)
How do I know whether 8-bit or 16-bit MCU shall be adopted? (2)
LPC1111 32-bit for 65 cent! 8-bit finally going obsolete? (3)
Whats the difference between 32 bit os and 64 bit os (3)
Quick overview of common 8-bit and 16-bit microcontrollers? (5)
logic to detect 1 bit (only 1 bit) High in a bus (2)
Difference between 8 bit and 16 bit UC...process POV (1)


Abuse || Administrator || Moderators || Support us || sitemap
topic RSS