function output_bit = conv_decoding(input_bit,reset)
% convolutional decoding for IEEE802.11a
% Input: input_bit is a 1-by-4 matrix represents 4 bits input.
% Output: output_bit is a 1-by-2 matrix represents 2 bits output.
% Copy right T-Square Design. All rights reserved.
% Confidential, do not give this program to anyone outside the T2 IEEE802.11a group.
% Current responsible engineer: Antony Lee
% When this file is modified, inform Antony Lee, Simon Qiu, Andy Lu.
% History
% 2002-03-08 Created by Antony Lee.
% 2002-04-26 Modified by Simon Qiu.
% 2002-07-05 Modified by Simon Qiu:
% Reduced one "for" circulation to accelerate calculation rate.
global RegisterStateLen;
global InputStateLen;
global VITERBI_DELAY;
global AccumulateDistance;
global DelayState;
global delayPaths;
global curnDelayIndex;
global viterbiClockCounter;
State_Path_Backward=[ 0 3 13 14;
4 7 9 10;
3 0 14 13;
7 4 10 9;
15 12 2 1;
11 8 6 5;
12 15 1 2;
8 11 5 6;
14 13 3 0;
10 9 7 4;
13 14 0 3;
9 10 4 7;
1 2 12 15;
5 6 8 11;
2 1 15 12;
6 5 11 8;
11 8 6 5;
15 12 2 1;
8 11 5 6;
12 15 1 2;
4 7 9 10;
0 3 13 14;
7 4 10 9;
3 0 14 13;
5 6 8 11;
1 2 12 15;
6 5 11 8;
2 1 15 12;
10 9 7 4;
14 13 3 0;
9 10 4 7;
13 14 0 3;
12 15 1 2;
8 11 5 6;
15 12 2 1;
11 8 6 5;
3 0 14 13;
7 4 10 9;
0 3 13 14;
4 7 9 10;
2 1 15 12;
6 5 11 8;
1 2 12 15;
5 6 8 11;
13 14 0 3;
9 10 4 7;
14 13 3 0;
10 9 7 4;
7 4 10 9;
3 0 14 13;
4 7 9 10;
0 3 13 14;
8 11 5 6;
12 15 1 2;
11 8 6 5;
15 12 2 1;
9 10 4 7;
13 14 0 3;
10 9 7 4;
14 13 3 0;
6 5 11 8;
2 1 15 12;
5 6 8 11;
1 2 12 15];
State_State_Backward = zeros(4,64);
State_State_Backward(:) = [1:64,1:64,1:64,1:64];
State_State_Backward = State_State_Backward';
State_Input_Backward = zeros(64,4);
State_Input_Backward(17:32,:) = 1;
State_Input_Backward(33:48,:) = 2;
State_Input_Backward(49:64,:) = 3;
StateInitial = [0,8,7,7,7,7,6,6,5,7,6,8,4,6,5,7,3,11,6,6,4,4,7,7,4,6,5,7,5,7,6,8,...
2,8,9,7,5,7,4,6,3,7,4,8,6,6,7,7,3,9,6,4,4,6,7,9,4,8,5,9,5,5,6,6];
if reset == 1 %convolutional decoding initial
RegisterStateLen = 64; %6-bit states=2^6=64
InputStateLen = 4; %1-bit Input Path=1^2=2
AccumulateDistance = StateInitial;
DelayState = zeros(RegisterStateLen,VITERBI_DELAY+1);
delayPaths = zeros(RegisterStateLen,VITERBI_DELAY+1);
curnDelayIndex = 1;
viterbiClockCounter = 1;
output_bit = zeros(1,2);
else
CurnAccumulateDistance = AccumulateDistance;
AccumulateDistance = ones(1,RegisterStateLen) * 127;
StateBackward = zeros(RegisterStateLen,1);
InputBackward = zeros(RegisterStateLen,1);
for curnPath = 1:InputStateLen %InputStateLen = 1--4
tempStateBackward = State_State_Backward(:,curnPath); %look backward to the State
tempPathBackward = State_Path_Backward(:,curnPath); %look backward to the Path
tempInputBackward = State_Input_Backward(:,curnPath); %look backward to get the input bit
%in different rate, the distance computing is different
curnDistance = zeros(RegisterStateLen,1);
temp = bitget(tempPathBackward,1); %get bit1
if input_bit(1) ~= -1
curnDistance = curnDistance + bitxor(temp,input_bit(1)); %compute the hamming distance
end
temp = bitget(tempPathBackward,2); %get bit2
if input_bit(2) ~= -1
curnDistance = curnDistance + bitxor(temp,input_bit(2)); %compute the hamming distance
end
temp = bitget(tempPathBackward,3); %get bit3
if input_bit(3) ~= -1
curnDistance = curnDistance + bitxor(temp,input_bit(3)); %compute the hamming distance
end
temp = bitget(tempPathBackward,4); %get bit4
if input_bit(4) ~= -1
curnDistance = curnDistance + bitxor(temp,input_bit(4)); %compute the hamming distance
end
tempAccumulateDistance = CurnAccumulateDistance(tempStateBackward) + curnDistance'; %compute the accumulating hamming distance
%add the distance of each state
idx = find(tempAccumulateDistance < AccumulateDistance);
AccumulateDistance(idx) = tempAccumulateDistance(idx);
StateBackward(idx) = tempStateBackward(idx); %select the minimum distance of each state
%PathBackward=tempPathBackward; %select the minimum distance of each path
InputBackward(idx) = tempInputBackward(idx); %select the minimum distance of each input
end
DelayState(:,curnDelayIndex) = StateBackward;
delayPaths(:,curnDelayIndex) = InputBackward; %save the current input
%we define the VITERBI_DELAY, when viterbiClockCounter >= VITERBI_DELAY we output
if viterbiClockCounter >= VITERBI_DELAY+1
[AccumulateDistanceMin,tempStateBackward] = min(AccumulateDistance);
%we use these function to avoid AccumulateDistance overflow
AccumulateDistance = AccumulateDistance - AccumulateDistanceMin;
%we trace back to find the correct output
traceDelayIndex = curnDelayIndex;
for k = 1:VITERBI_DELAY
tempStateBackward = DelayState(tempStateBackward,traceDelayIndex);
traceDelayIndex = traceDelayIndex - 1;
if traceDelayIndex < 1
traceDelayIndex = VITERBI_DELAY + 1;
end
end
output_bit = bitget(delayPaths(tempStateBackward,traceDelayIndex),1:2);
else
viterbiClockCounter = viterbiClockCounter + 1;
output_bit = zeros(1,2);
end
curnDelayIndex = curnDelayIndex + 1;
if curnDelayIndex > VITERBI_DELAY+1
curnDelayIndex = 1;
end
end
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
28482582Vblast_QRmatlab.zip (17个子文件)
www.imdn.cn.txt 366B
Vblast_QRmatlab
vblast_decoder_QR.m 1KB
demodulation_soft.m 3KB
vblast_encoder.m 1KB
flat_channel.asv 1KB
conv_decoding_soft.m 7KB
modulation.m 1KB
vblast_decoder_QR.asv 1KB
performance.m 116B
conv_coding.m 1KB
conv_decoding.m 7KB
vblast_encoder.asv 1KB
Blast_QR.m 2KB
flat_channel.m 1002B
modulation.asv 1KB
demodulation.m 3KB
www.imdn.cn.html 66B
共 17 条
- 1
资源评论
- Forever博哥2023-11-29资源内容总结的很到位,内容详实,很受用,学到了~
- m0_749068962023-12-29资源内容详细,总结地很全面,与描述的内容一致,对我启发很大,学习了。
且行好事莫问前程
- 粉丝: 2w+
- 资源: 443
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功