OpenCores
URL https://opencores.org/ocsvn/turbocodes/turbocodes/trunk

Subversion Repositories turbocodes

[/] [turbocodes/] [trunk/] [src/] [myhdl/] [sova.py] - Blame information for rev 7

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 7 dbrochart
######################################################################
2
####                                                              ####
3
####  sova.py                                                     ####
4
####                                                              ####
5
####  This file is part of the turbo decoder IP core project      ####
6
####  http://www.opencores.org/projects/turbocodes/               ####
7
####                                                              ####
8
####  Author(s):                                                  ####
9
####      - David Brochart(dbrochart@opencores.org)               ####
10
####                                                              ####
11
####  All additional information is available in the README.txt   ####
12
####  file.                                                       ####
13
####                                                              ####
14
######################################################################
15
####                                                              ####
16
#### Copyright (C) 2005 Authors                                   ####
17
####                                                              ####
18
#### This source file may be used and distributed without         ####
19
#### restriction provided that this copyright statement is not    ####
20
#### removed from the file and that any derivative work contains  ####
21
#### the original copyright notice and the associated disclaimer. ####
22
####                                                              ####
23
#### This source file is free software; you can redistribute it   ####
24
#### and/or modify it under the terms of the GNU Lesser General   ####
25
#### Public License as published by the Free Software Foundation; ####
26
#### either version 2.1 of the License, or (at your option) any   ####
27
#### later version.                                               ####
28
####                                                              ####
29
#### This source is distributed in the hope that it will be       ####
30
#### useful, but WITHOUT ANY WARRANTY; without even the implied   ####
31
#### warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ####
32
#### PURPOSE. See the GNU Lesser General Public License for more  ####
33
#### details.                                                     ####
34
####                                                              ####
35
#### You should have received a copy of the GNU Lesser General    ####
36
#### Public License along with this source; if not, download it   ####
37
#### from http://www.opencores.org/lgpl.shtml                     ####
38
####                                                              ####
39
######################################################################
40
 
41
 
42
 
43
from extInf import extInf
44
from misc import delayer
45
from trellis import trellis1, trellis2
46
from acs import acs
47
from myhdl import Signal, intbv, instances
48
 
49
def sova(clk, rst, aNoisy, bNoisy, y1Noisy, y2Noisy, zin, zout, aClean, bClean, l = 20, m = 10, q = 8, r = 5, n = 4):
50
    """ Soft Output Viterbi Algorithm top level.
51
 
52
    l               -- first trellis length
53
    m               -- second trellis length
54
    q               -- accumulated distance width
55
    r               -- extrinsic information width
56
    n               -- systematic data width
57
    clk, rst        -- in  : clock and negative reset
58
    aNoisy, bNoisy, y1Noisy, y2Noisy    -- in  : received decoder signals
59
    zin             -- in  : extrinsic information input
60
    zout            -- out : extrinsic information output
61
    aClean, bClean  -- out : decoded systematic data
62
 
63
    """
64
    selStateL2  = Signal(intbv(0, 0, 8))
65
    selStateL1  = Signal(intbv(0, 0, 8))
66
    selTransL2  = Signal(intbv(0, 0, 4))
67
    selTrans    = [Signal(intbv(0, 0, 4)) for i in range(8)]
68
    selState    = Signal(intbv(0, 0, 8))
69
    weight      = [Signal(intbv(0, 0, 2**q)) for i in range(4)]
70
    selTransL1  = [Signal(intbv(0, 0, 4)) for i in range(8)]
71
    zinDel      = [Signal(intbv(0, 0, 2**r)) for i in range(4)]
72
    stateL1     = [Signal(intbv(0, 0, 8)) for i in range(4)]
73
    llr0        = Signal(intbv(0, 0, 2**q))
74
    llr1        = Signal(intbv(0, 0, 2**q))
75
    llr2        = Signal(intbv(0, 0, 2**q))
76
    llr3        = Signal(intbv(0, 0, 2**q))
77
    aNoisyDel   = Signal(intbv(0, -(2**(n-1)), 2**(n-1)))
78
    bNoisyDel   = Signal(intbv(0, -(2**(n-1)), 2**(n-1)))
79
 
80
    delayer_i   = [None for i in range(12)]
81
    acs_i0      = acs(clk, rst, aNoisy, bNoisy, y1Noisy, y2Noisy, zin, selStateL2, selTransL2, selState, selTrans, weight, q, l, n, r)
82
    trellis1_i0 = trellis1(clk, rst, selState, selTrans, selStateL2, selStateL1, stateL1, selTransL2, l)
83
    trellis2_i0 = trellis2(clk, rst, selStateL1, stateL1, selTransL1, weight, llr0, llr1, llr2, llr3, aClean, bClean, m, q)
84
    for i in range(8):
85
        delayer_i[i] = delayer(clk, rst, selTrans[i], selTransL1[i], l - 1, 0, 2**2)
86
    for i in range(4):
87
        delayer_i[i + 8] = delayer(clk, rst, zin[i], zinDel[i], l + m, 0, 2**r)
88
    delayer_i0  = delayer(clk, rst, aNoisy, aNoisyDel, l + m, -(2**(n-1)), 2**(n-1))
89
    delayer_i1  = delayer(clk, rst, bNoisy, bNoisyDel, l + m, -(2**(n-1)), 2**(n-1))
90
    extInf_i0   = extInf(llr0, llr1, llr2, llr3, zinDel, aNoisyDel, bNoisyDel, zout, r, n, q)
91
 
92
    return delayer_i0, delayer_i1, extInf_i0, trellis1_i0, trellis2_i0, acs_i0, delayer_i

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.