OpenCores
URL https://opencores.org/ocsvn/reed_solomon_decoder/reed_solomon_decoder/trunk

Subversion Repositories reed_solomon_decoder

[/] [reed_solomon_decoder/] [trunk/] [simulation/] [RS_test_vectors.m] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 aelmahmoud
clc,clear
2
 
3
n=100;
4
data=randint(n,188,[0 255]);
5
 
6
%reed-solomom encoding
7
K = 188;
8
N = 204;
9
field = gf(data,8);
10
coded_bytes = rsenc(field,N,K);
11
code = double(coded_bytes.x);
12
code_e=code;
13
%%%%%%%%% put errors %%%%%%%%%%
14
e_num=randint(1,n,[0 8]);
15
for k=1:n
16
   d=randperm(204);
17
   e_loc=d(1:e_num(k));
18
   code_e(k,e_loc)=255-code_e(k,e_loc);
19
end
20
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
21
data=reshape(data',1,[]);
22
code_e=reshape(code_e',1,[]);
23
 
24
fdi = fopen('input_RS_blocks','w');
25
fdo = fopen('output_RS_blocks','w');
26
 
27
 
28
for k =1:length(code_e)
29
    fprintf(fdi,'%s\n',dec2bin(code_e(k),8));
30
end
31
 
32
for k =1: length(data)
33
    fprintf(fdo,'%s\n',dec2bin(data(k),8));
34
end
35
fclose('all')
36
save Rs_test_data

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.