Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

bit unstuffing concept - help needed

Status
Not open for further replies.

Mkanimozhi

Full Member level 4
Joined
Aug 8, 2007
Messages
193
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,296
Activity points
3,445
bit unstuffing

Hi Friends,
I need to design the bit un-stuffing concept in my module, can i get any sample code for bit unstuffing in verilog.


Thanks and regards,
Kanimozhi.M
 

I have written a code for bit unstuffing for USB protocol. A '0' bit is stuffed after 6 consecutive 1's.............

11111101111

For implementing bit unstuffing u need an 'enable' signal

Except for stuffed zero the enable bit is high................This can be coded in verilog....

Thus the receiver block shuldn't accept the data if enable is low
 

module bitunstuffing(clk,rst,en,data_in,data_out,data_valid);

input clk,rst,data_in,en;
output data_out,data_valid;

wire clk,rst,data_in,en;
reg data_out;

reg [3:0] count;
reg data_valid; //Signal to determine whether data_out is valid or not

always@(posedge clk)
begin
if(rst)
begin
data_out<=1'b0;
data_valid<=1'b1;
count<=4'b0;
end

else
begin
if(en)
begin

data_out<=data_in;

if(data_in) //Counter Logic
begin
count<=count+1;
end

else
begin
count<=4'b0;
end

if(count==4'b0110) //If count equals 6
begin
data_valid<=1'b0;
count<=4'b0;
end

else
begin
data_valid<=1'b1;
end
end
end
end
endmodule
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top