📄 sova.py
字号:
########################################################################## ######## sova.py ######## ######## This file is part of the turbo decoder IP core project ######## http://www.opencores.org/projects/turbocodes/ ######## ######## Author(s): ######## - David Brochart(dbrochart@opencores.org) ######## ######## All additional information is available in the README.txt ######## file. ######## ############################################################################## ######## Copyright (C) 2005 Authors ######## ######## This source file may be used and distributed without ######## restriction provided that this copyright statement is not ######## removed from the file and that any derivative work contains ######## the original copyright notice and the associated disclaimer. ######## ######## This source file is free software; you can redistribute it ######## and/or modify it under the terms of the GNU Lesser General ######## Public License as published by the Free Software Foundation; ######## either version 2.1 of the License, or (at your option) any ######## later version. ######## ######## This source is distributed in the hope that it will be ######## useful, but WITHOUT ANY WARRANTY; without even the implied ######## warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ######## PURPOSE. See the GNU Lesser General Public License for more ######## details. ######## ######## You should have received a copy of the GNU Lesser General ######## Public License along with this source; if not, download it ######## from http://www.opencores.org/lgpl.shtml ######## ##########################################################################from extInf import extInffrom misc import delayerfrom trellis import trellis1, trellis2from acs import acsfrom myhdl import Signal, intbv, instancesdef sova(clk, rst, aNoisy, bNoisy, y1Noisy, y2Noisy, zin, zout, aClean, bClean, l = 20, m = 10, q = 8, r = 5, n = 4): """ Soft Output Viterbi Algorithm top level. l -- first trellis length m -- second trellis length q -- accumulated distance width r -- extrinsic information width n -- systematic data width clk, rst -- in : clock and negative reset aNoisy, bNoisy, y1Noisy, y2Noisy -- in : received decoder signals zin -- in : extrinsic information input zout -- out : extrinsic information output aClean, bClean -- out : decoded systematic data """ selStateL2 = Signal(intbv(0, 0, 8)) selStateL1 = Signal(intbv(0, 0, 8)) selTransL2 = Signal(intbv(0, 0, 4)) selTrans = [Signal(intbv(0, 0, 4)) for i in range(8)] selState = Signal(intbv(0, 0, 8)) weight = [Signal(intbv(0, 0, 2**q)) for i in range(4)] selTransL1 = [Signal(intbv(0, 0, 4)) for i in range(8)] zinDel = [Signal(intbv(0, 0, 2**r)) for i in range(4)] stateL1 = [Signal(intbv(0, 0, 8)) for i in range(4)] llr0 = Signal(intbv(0, 0, 2**q)) llr1 = Signal(intbv(0, 0, 2**q)) llr2 = Signal(intbv(0, 0, 2**q)) llr3 = Signal(intbv(0, 0, 2**q)) aNoisyDel = Signal(intbv(0, -(2**(n-1)), 2**(n-1))) bNoisyDel = Signal(intbv(0, -(2**(n-1)), 2**(n-1))) delayer_i = [None for i in range(12)] acs_i0 = acs(clk, rst, aNoisy, bNoisy, y1Noisy, y2Noisy, zin, selStateL2, selTransL2, selState, selTrans, weight, q, l, n, r) trellis1_i0 = trellis1(clk, rst, selState, selTrans, selStateL2, selStateL1, stateL1, selTransL2, l) trellis2_i0 = trellis2(clk, rst, selStateL1, stateL1, selTransL1, weight, llr0, llr1, llr2, llr3, aClean, bClean, m, q) for i in range(8): delayer_i[i] = delayer(clk, rst, selTrans[i], selTransL1[i], l - 1, 0, 2**2) for i in range(4): delayer_i[i + 8] = delayer(clk, rst, zin[i], zinDel[i], l + m, 0, 2**r) delayer_i0 = delayer(clk, rst, aNoisy, aNoisyDel, l + m, -(2**(n-1)), 2**(n-1)) delayer_i1 = delayer(clk, rst, bNoisy, bNoisyDel, l + m, -(2**(n-1)), 2**(n-1)) extInf_i0 = extInf(llr0, llr1, llr2, llr3, zinDel, aNoisyDel, bNoisyDel, zout, r, n, q) return instances()
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -