tx_symbols = gp_interleave(tx_symbols);
% generate UW and txt symbols to prepend to every frame after LDPC encoding and interleaving
-
- tx_uw_tx_bits = [zeros(1,Nuwbits) zeros(1,Ntxtbits)];
+
+ tx_uw_tx_bits = [1 0 0 1 0 1 0 0 1 0 zeros(1,Ntxtbits)];
tx_uw_tx_symbols = [];
for b=1:2:length(tx_uw_tx_bits)
tx_uw_tx_symbols = [tx_uw_tx_symbols qpsk_mod(tx_uw_tx_bits(b:b+1))];
% generate a test frame of ldpc encoded bits, used for raw and
% coded BER testing. Includes UW and txt files
-function [tx_bits payload_data_bits] = create_ldpc_test_frame
+function [tx_bits payload_data_bits codeword] = create_ldpc_test_frame
Ts = 0.018; Tcp = 0.002; Rs = 1/Ts; bps = 2; Nc = 17; Ns = 8;
states = ofdm_init(bps, Rs, Tcp, Ns, Nc);
ofdm_load_const;
%
function test_bits_ofdm_file
- [test_bits_ofdm payload_data_bits] = create_ldpc_test_frame;
+ [test_bits_ofdm payload_data_bits codeword] = create_ldpc_test_frame;
printf("%d test bits\n", length(test_bits_ofdm));
f=fopen("../src/test_bits_ofdm.h","wt");
fprintf(f," %d,\n",payload_data_bits(m));
endfor
fprintf(f," %d\n};\n",payload_data_bits(end));
+
+ fprintf(f,"\nconst int test_codeword[]={\n");
+ for m=1:length(codeword)-1
+ fprintf(f," %d,\n",codeword(m));
+ endfor
+ fprintf(f," %d\n};\n",codeword(end));
+
fclose(f);
endfunction
% freq offset est may be too far out, and has aliases every 1/Ts, so
% we use a Unique Word to get a really solid indication of sync.
- states.uw_errors = sum(rx_uw);
+ tx_uw = [1 0 0 1 0 1 0 0 1 0];
+
+ states.uw_errors = sum(xor(tx_uw,rx_uw));
if (states.uw_errors > uw_thresh)
states.sync_counter++;
if states.sync_counter == sync_counter_thresh