Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix syndrome matrix decode bug #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions hamming_producer.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@

clear all

K = 4; % data bits
K = 64; % data bits
USE_POLY = 0;
POLY = [0 1 0 0 1];

FILE='HammingCode.v';

% calculate correction bits
% 1.25 - still magic numbers
m = ceil(log2(1.25*K));
m = log2(K)+1;%ceil(log2(1.25*K));

if USE_POLY == 1
[h,g,n,k] = hammgen(m, POLY);
Expand Down Expand Up @@ -93,7 +93,8 @@
fprintf(fid,'\n');

for kk = 1:K
fprintf(fid,' assign DOUT[%02d] = D[%02d] ^',kk-1,kk-1);
fprintf(fid,' assign DOUT[%02d] = D[%02d] ^(',kk-1,kk-1);
%fprintf(fid,'(S==%02d%''h%X); ',m,g(kk));
and_flag = 0;
for mm = 1:m
if g(kk,mm) == 1
Expand All @@ -102,11 +103,18 @@
else
fprintf(fid,' & ');
end
if kk<11 fprintf(fid,' '); end
fprintf(fid,'S[%d]',mm-1);
else
if and_flag == 0
fprintf(fid,'!');
and_flag = 1;
else
fprintf(fid,' & !');
end
end
if kk<11 fprintf(fid,' '); end
fprintf(fid,'S[%d]',mm-1);
end
fprintf(fid,';\n');
fprintf(fid,');\n');
end
fprintf(fid,'\n');

Expand All @@ -118,4 +126,4 @@

fclose(fid);

quit
%quit