problem in code of hamming code:not able 2 analise if statements in hamming code...

Status
Not open for further replies.

Diapanagar

Newbie
Joined
Oct 20, 2011
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,290
in the below code of hamming code how does that if statements work?? der wat does ^ indicate.....is it xor??? plz help me out


Code Verilog - [expand]
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
module hamm_enc(outp,inp,reset);
parameter n=11,k=7;
output [n-1:0] outp;
input [k-1:0] inp;
input reset;
reg [n-1:0] outp;
integer i,j;
always @(inp or reset)
begin
if(reset)
outp = 0;
else
begin
i=0; j=0;
while((i<n) || (j<k))
begin
while(i==0 || i==1 || i==3 || i==7)
begin
outp[i] = 0;
i=i+1;
end
outp[i] = inp[j];
i=i+1;
j=j+1;
end
if(^(outp & 11'b101_0101_0101))
outp[0] = ~outp[0];
if(^(outp & 11'b110_0110_0110))
outp[1] = ~outp[1];
if(^(outp & 11'b000_0111_1000))
outp[3] = ~outp[3];
if(^(outp & 11'b111_1000_0000))
outp[7] = ~outp[7];
end
end
endmodule


Chapter 8
 
Last edited by a moderator:

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…