summaryrefslogtreecommitdiff
path: root/gnuradio-examples/python/channel-coding/fsm_utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'gnuradio-examples/python/channel-coding/fsm_utils.py')
-rwxr-xr-xgnuradio-examples/python/channel-coding/fsm_utils.py95
1 files changed, 0 insertions, 95 deletions
diff --git a/gnuradio-examples/python/channel-coding/fsm_utils.py b/gnuradio-examples/python/channel-coding/fsm_utils.py
index dc5ee79f1..fe9f4f3b8 100755
--- a/gnuradio-examples/python/channel-coding/fsm_utils.py
+++ b/gnuradio-examples/python/channel-coding/fsm_utils.py
@@ -60,101 +60,6 @@ def base2dec(s,base):
-
-
-######################################################################
-# Automaticaly generate the FSM structure for a binary feed-forward
-# convolutional code.
-# Input: k x n generator matrix (decimal representation)
-######################################################################
-def make_fsm_bin_cc_ff(k,n,GM):
- mem=[[]]*k
- max_mem_x=[-1]*k
- max_mem = -1
- for i in range(k):
- memr=[0]*n
- for j in range(n):
- if GM[i][j]==0:
- memr[j]=-1
- else:
- memr[j]=int(math.log(GM[i][j],2))
- if memr[j]>max_mem_x[i]:
- max_mem_x[i]=memr[j]
- if memr[j]>max_mem:
- max_mem=memr[j]
- mem[i]=memr
-
- sum_max_mem = 0
- for i in range(k):
- sum_max_mem = sum_max_mem+max_mem_x[i]
-
-
- #print mem
- #print max_mem_x
- #print max_mem
- #print sum_max_mem
-
- I=2**k
- S=2**sum_max_mem
- O=2**n
-
- #print I, S, O
-
- NS=[0]*S*I;
- OS=[0]*S*I;
- for s in range(S):
- for i in range(I):
- ss=dec2base(s,2,sum_max_mem)
- ind=0
- ss_r=[]
- for kk in range(k):
- ss1 = [0]*max_mem
- ss1[0:max_mem_x[kk]] = ss[ind:ind+max_mem_x[kk]]
- ss_r.append(ss1)
- ind=ind+max_mem_x[kk]
- ii=dec2base(i,2,k)
-
- tt_r = ss_r
- for kk in range(k):
- tt_r[kk].insert(0,ii[kk])
- #print tt_r
-
- ns_r = []
- for kk in range(k):
- ns_r.append(tt_r[kk][0:max_mem])
-
- ns=[]
- for kk in range(k):
- ns = ns + ns_r[kk][0:max_mem_x[kk]]
- NS[s*I+i]=base2dec(ns,2);
-
- out_r=[0]*n
- for nn in range(n):
- out=0;
- for kk in range(k):
- c=[0]*max_mem
- gm = dec2base(GM[kk][nn],2,max_mem_x[kk]+1)
- gm.reverse()
- c[0:len(gm)] = gm
- sy = 0
- for m in range(len(c)):
- sy = sy + c[m]*tt_r[kk][m];
- out=operator.mod(out+sy,2);
- out_r[nn]=out;
- out_r.reverse()
- OS[s*I+i] = base2dec(out_r,2);
-
- #O=max(max(OS))+1;
- print I, S, O
- print NS
- print OS
-
- return (I,S,O,NS,OS)
-
-
-
-
-
######################################################################
# Automatically generate the lookup table that maps the FSM outputs
# to channel inputs corresponding to a channel 'channel' and a modulation