Viterbi Decoder vitdec for HDL-Code generation

20 visualizzazioni (ultimi 30 giorni)
Hello, I need to model a Viterbi Decoder. Since I want to generate HDL code out of my model, vitdec(...) is no solution. It´s not supportet by the HDL coder. Has someone a working model which is equivalent to:
out_1 = vitdec(c_in,t,35,'trunc','hard',punct);
Thanks a lot, Stefan

Risposta accettata

Tim McBrayer
Tim McBrayer il 18 Ott 2013
The Viterbi decoder is well supported for HDL code generation from both MATLAB and Simulink. This is amply demonstrated in the Examples published with HDL Coder. Please see any one of these published examples; they are all part of the HDL Coder documentation.
  1. HDL Code Generation from Viterbi Decoder System Object
  2. Viterbi Decoder Using Simulink Blocks
  3. Viterbi Decoder Using the MATLAB Function Block
You may also use the Viterbi Decoder Simulink block, which is part of the Communications System Toolbox.

Più risposte (3)

Bharath Venkataraman
Bharath Venkataraman il 18 Ott 2013
There is also an example in the Communications System Toolbox (category HDL) called "HDL Code Generation for Viterbi Decoder" that may be of help.

Stefan
Stefan il 22 Ott 2013
Thanks a lot. I now realized the Viterbi Decoder with the communication toolbox. It works well for real signals. But I want to decode a complex signal. I can run it, but get some errors when I want to generate HDL code. Here my code:
function y = decode_dep_msc(c_in)
persistent hVitDec;
hVitDec = comm.ViterbiDecoder('TrellisStructure', poly2trellis(7,[133 171 145 133]),........)
out_1 = step(hVitDec, c_in);
y = out_1(1:L);
end
where c_in is a complex signal. The HDL-Code-Generater error massage:
"Complexity mismacht with input 1; expected real, got complex"
Has someone a solution? Thanks a lot!!!

Bharath Venkataraman
Bharath Venkataraman il 24 Ott 2013
The Viterbi decoder expects to receive the systematic and parity bits in a vector format. Please change your input to a vector format.
Also, you should put the Viterbi decoder in an isempty statement. This will ensure that the decoder is created only once and retains state across multiple calls.
function y = decode_dep_msc(c_in)
persistent hVitDec;
if isempty(hVitDec)
hVitDec = comm.ViterbiDecoder('TrellisStructure', poly2trellis(7,[133 171 145 133]),...)
end
out_1 = step(hVitDec, c_in);
y = out_1(1:L);
end

Prodotti

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by