FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > Verilog

Verilog comp.lang.verilog newsgroup / usenet

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-23-2008, 09:52 AM
Shiv
Guest
 
Posts: n/a
Default Hamming Encoder

hello friends

I am making hamming encoder, I got its verilog code on the net but, I
am understanding its last few if any of you can help me, i will be
thankful to you..
here is the code...

`timescale 1ns/1ns

module hamm_enc(out,in,reset);

parameter n=11,k=7;
output[n-1:0] out;
input[k-1:0] in;
input reset;

reg[n-1:0] out;
integer i,j;

[email protected](in or reset)

begin
if (reset)
out=0;
else
begin
i=0;j=0;
while((i<n)||(j<k))

//FROM HERE I AM UNDERSTANDING WHAT THEY DID
//AND WHAT THEY WANT TO DO
begin
while (i==0||i==1||i==3||i==7)
begin
out[i]=0;
i=i+1;
end
out[i]=in[j];
i=i+1;
j=j+1;
end

if(^(out &11'b101_0101_0101))
out[0]=~out[0];

if(^(out &11'b110_0110_0110))
out[1]=~out[1];

if(^(out &11'b000_0111_1000))
out[3]=~out[3];

if(^(out &11'b111_1000_0000))
out[7]=~out[7];

end
end


endmodule
Reply With Quote
  #2 (permalink)  
Old 06-23-2008, 09:54 AM
Shiv
Guest
 
Posts: n/a
Default Re: Hamming Encoder

On Jun 23, 1:52 pm, Shiv <[email protected]> wrote:
> hello friends
>
> I am making hamming encoder, I got its verilog code on the net but, I
> am understanding its last few if any of you can help me, i will be
> thankful to you..
> here is the code...
>
> `timescale 1ns/1ns
>
> module hamm_enc(out,in,reset);
>
> parameter n=11,k=7;
> output[n-1:0] out;
> input[k-1:0] in;
> input reset;
>
> reg[n-1:0] out;
> integer i,j;
>
> [email protected](in or reset)
>
> begin
> if (reset)
> out=0;
> else
> begin
> i=0;j=0;
> while((i<n)||(j<k))
>
> //FROM HERE I AM UNDERSTANDING WHAT THEY DID
> //AND WHAT THEY WANT TO DO
> begin
> while (i==0||i==1||i==3||i==7)
> begin
> out[i]=0;
> i=i+1;
> end
> out[i]=in[j];
> i=i+1;
> j=j+1;
> end
>
> if(^(out &11'b101_0101_0101))
> out[0]=~out[0];
>
> if(^(out &11'b110_0110_0110))
> out[1]=~out[1];
>
> if(^(out &11'b000_0111_1000))
> out[3]=~out[3];
>
> if(^(out &11'b111_1000_0000))
> out[7]=~out[7];
>
> end
> end
>
> endmodule


sorry for invonveneince ,,

instead of I am understand that was "I am not understandin"
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 On


Similar Threads
Thread Thread Starter Forum Replies Last Post
64 bit priority encoder suchitra Verilog 2 02-02-2005 06:28 PM
Convolution encoder ~~ VerilogMan ~~ Verilog 2 11-22-2004 06:01 AM


All times are GMT +1. The time now is 03:16 PM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved