discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] gr-trellis : problem in using viterbi decoder


From: Raman O
Subject: Re: [Discuss-gnuradio] gr-trellis : problem in using viterbi decoder
Date: Tue, 20 Jul 2010 01:49:11 +0530 (IST)

Hello Achilleas,

 Thanks for your response.
 I have connected encoder block , it disappeared during editing mail by mistake.

Input is in the form of an array of size K and vector2stream feeds encoder bit a time ,so i am using following syntax :
gr_vector_source_s_sptr bit_src = gr_make_vector_source_s(in_bits,false,K );
    
gr_vector_to_stream_sptr vector2stream = gr_make_vector_to_stream(sizeof(short),K)
------------------------------------------------------------------------------------------------------------
int K=100;  
  short inputbits[100]={ ....contains bits....  };
std::vector<short> in_bits;
       
        for (int i = 0; i <K ; i++)  { //  K - no of bits
        in_bits.push_back(inputbits[i]); // input bits
        }
        std::vector<float> constellation; // BPSK mapping
          
constellation.push_back(1);
           constellation.push_back(-1);
    
          
         gr_vector_source_s_sptr bit_src = gr_make_vector_source_s(in_bits,false,K );
    
         gr_vector_to_stream_sptr vector2stream= gr_make_vector_to_stream(sizeof(short),K);
    
     // encoder    
           fsm f= fsm("../../../gr-trellis/src/examples/fsm_files/awgn1o2_128.fsm");
           trellis_encoder_ss_sptr encoder = trellis_make_encoder_ss (f, 0);
    
     // modulate
 gr_chunks_to_symbols_sf_sptr mod = gr_make_chunks_to_symbols_sf
(constellation, 1);

     // ----------- ideal channel -------------
    
     // decoder
    
     trellis_metric_type_t type= TRELLIS_EUCLIDEAN;
     trellis_metrics_f_sptr metrics = trellis_make_metrics_f (f.O(), 1, constellation, type);
     trellis_viterbi_s_sptr viterbi =trellis_make_viterbi_s ( f,K, 0,-1);
   
     gr_stream_to_vector_sptr stream2vector= gr_make_stream_to_vector(sizeof(short), K);
     d_dst = gr_make_vector_sink_s (K);

connect( bit_src ,   0, vector2stream,   0);
     connect( vector2stream ,   0,encoder, 0);
connect( encoder ,   0,mod, 0);
     connect(mod,   0,metrics,  
0);
     connect(metrics,   0, viterbi,   0);
     connect( viterbi,   0,stream2vector,   0);
     connect(stream2vector,   0, d_dst, 0);

 

--- On Mon, 19/7/10, Achilleas Anastasopoulos <address@hidden> wrote:

From: Achilleas Anastasopoulos <address@hidden>
Subject: Re: [Discuss-gnuradio] gr-trellis : problem in using viterbi decoder
To: "gnuradio mailing list" <address@hidden>, address@hidden
Date: Monday, 19 July, 2010, 6:47 PM



I also realized that the way you call
gr_make_vector_source_s(in_bits,false,K );
is incorrect.
I think you have misunderstood what this block does.

You should use:
gr_make_vector_source_s(in_bits,false,1 );
or simply
gr_make_vector_source_s(in_bits,false);
and you really don't need the vector2stream block.

Achilleas



---------------------
In your code the "encoder" block is not connected to any other block...

It should be:

info bits -> encoder -> modulator -> channel -> metrics -> viterbi

Achilleas


reply via email to

[Prev in Thread] Current Thread [Next in Thread]