summaryrefslogtreecommitdiff
path: root/gr-trellis
diff options
context:
space:
mode:
authorjcorgan2007-11-27 19:15:30 +0000
committerjcorgan2007-11-27 19:15:30 +0000
commit7e5ff593896c6c1d832c17a7e0d0eb42f2277d9d (patch)
tree98879d1a1b4f02468cc1578c08e032164db9f6f2 /gr-trellis
parentb07df82d5536f65ad50d3029d69bd27cd25235de (diff)
downloadgnuradio-7e5ff593896c6c1d832c17a7e0d0eb42f2277d9d.tar.gz
gnuradio-7e5ff593896c6c1d832c17a7e0d0eb42f2277d9d.tar.bz2
gnuradio-7e5ff593896c6c1d832c17a7e0d0eb42f2277d9d.zip
Implements ticket:207
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@7042 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gr-trellis')
-rw-r--r--gr-trellis/doc/test_tcm.py14
-rw-r--r--gr-trellis/doc/test_tcm.py.xml14
-rwxr-xr-xgr-trellis/doc/test_viterbi_equalization1.py16
-rw-r--r--gr-trellis/doc/test_viterbi_equalization1.py.xml16
-rwxr-xr-xgr-trellis/src/examples/test_sccc_hard.py14
-rwxr-xr-xgr-trellis/src/examples/test_sccc_soft.py20
-rwxr-xr-xgr-trellis/src/examples/test_sccc_turbo.py40
-rwxr-xr-xgr-trellis/src/examples/test_tcm.py18
-rwxr-xr-xgr-trellis/src/examples/test_tcm1.py18
-rwxr-xr-xgr-trellis/src/examples/test_tcm2.py18
-rwxr-xr-xgr-trellis/src/examples/test_tcm_combined.py12
-rwxr-xr-xgr-trellis/src/examples/test_tcm_parallel.py18
-rwxr-xr-xgr-trellis/src/examples/test_turbo_equalization.py38
-rwxr-xr-xgr-trellis/src/examples/test_turbo_equalization1.py38
-rwxr-xr-xgr-trellis/src/examples/test_turbo_equalization2.py36
-rwxr-xr-xgr-trellis/src/examples/test_viterbi_equalization.py14
-rwxr-xr-xgr-trellis/src/examples/test_viterbi_equalization1.py16
-rwxr-xr-xgr-trellis/src/python/qa_trellis.py4
18 files changed, 182 insertions, 182 deletions
diff --git a/gr-trellis/doc/test_tcm.py b/gr-trellis/doc/test_tcm.py
index e2429b80c..0472535c1 100644
--- a/gr-trellis/doc/test_tcm.py
+++ b/gr-trellis/doc/test_tcm.py
@@ -10,7 +10,7 @@ import random
import fsm_utils
def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed):
- fg = gr.flow_graph ()
+ tb = gr.top_block ()
# TX
src = gr.lfsr_32k_source_s()
@@ -29,13 +29,13 @@ def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed):
fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack FSM input symbols to shorts
dst = gr.check_lfsr_32k_s();
- fg.connect (src,src_head,s2fsmi,enc,mod)
- fg.connect (mod,(add,0))
- fg.connect (noise,(add,1))
- fg.connect (add,metrics)
- fg.connect (metrics,va,fsmi2s,dst)
+ tb.connect (src,src_head,s2fsmi,enc,mod)
+ tb.connect (mod,(add,0))
+ tb.connect (noise,(add,1))
+ tb.connect (add,metrics)
+ tb.connect (metrics,va,fsmi2s,dst)
- fg.run()
+ tb.run()
# A bit of cheating: run the program once and print the
# final encoder state.
diff --git a/gr-trellis/doc/test_tcm.py.xml b/gr-trellis/doc/test_tcm.py.xml
index c8d11d303..b957f682d 100644
--- a/gr-trellis/doc/test_tcm.py.xml
+++ b/gr-trellis/doc/test_tcm.py.xml
@@ -12,7 +12,7 @@
10 import fsm_utils
11
12 def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed):
- 13 fg = gr.flow_graph ()
+ 13 tb = gr.top_block ()
14
15 # TX
16 src = gr.lfsr_32k_source_s()
@@ -31,13 +31,13 @@
29 fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack FSM input symbols to shorts
30 dst = gr.check_lfsr_32k_s();
31
- 32 fg.connect (src,src_head,s2fsmi,enc,mod)
- 33 fg.connect (mod,(add,0))
- 34 fg.connect (noise,(add,1))
- 35 fg.connect (add,metrics)
- 36 fg.connect (metrics,va,fsmi2s,dst)
+ 32 tb.connect (src,src_head,s2fsmi,enc,mod)
+ 33 tb.connect (mod,(add,0))
+ 34 tb.connect (noise,(add,1))
+ 35 tb.connect (add,metrics)
+ 36 tb.connect (metrics,va,fsmi2s,dst)
37
- 38 fg.run()
+ 38 tb.run()
39
40 # A bit of cheating: run the program once and print the
41 # final encoder state.
diff --git a/gr-trellis/doc/test_viterbi_equalization1.py b/gr-trellis/doc/test_viterbi_equalization1.py
index 57d617aa0..93b852e85 100755
--- a/gr-trellis/doc/test_viterbi_equalization1.py
+++ b/gr-trellis/doc/test_viterbi_equalization1.py
@@ -10,7 +10,7 @@ import random
import fsm_utils
def run_test (f,Kb,bitspersymbol,K,channel,modulation,dimensionality,tot_constellation,N0,seed):
- fg = gr.flow_graph ()
+ tb = gr.top_block ()
L = len(channel)
# TX
@@ -37,14 +37,14 @@ def run_test (f,Kb,bitspersymbol,K,channel,modulation,dimensionality,tot_constel
va = trellis.viterbi_combined_s(f,K+L,0,0,dimensionality,tot_constellation,trellis.TRELLIS_EUCLIDEAN) # using viterbi_combined_s instead of metrics_f/viterbi_s allows larger packet lengths because metrics_f is complaining for not being able to allocate large buffers. This is due to the large f.O() in this application...
dst = gr.vector_sink_s()
- fg.connect (src,mod)
- fg.connect (mod,isi,(add,0))
- fg.connect (noise,(add,1))
- #fg.connect (add,metrics)
- #fg.connect (metrics,va,dst)
- fg.connect (add,skip,va,dst)
+ tb.connect (src,mod)
+ tb.connect (mod,isi,(add,0))
+ tb.connect (noise,(add,1))
+ #tb.connect (add,metrics)
+ #tb.connect (metrics,va,dst)
+ tb.connect (add,skip,va,dst)
- fg.run()
+ tb.run()
data = dst.data()
ntotal = len(data) - L
diff --git a/gr-trellis/doc/test_viterbi_equalization1.py.xml b/gr-trellis/doc/test_viterbi_equalization1.py.xml
index 4ea83be99..a97d04d6e 100644
--- a/gr-trellis/doc/test_viterbi_equalization1.py.xml
+++ b/gr-trellis/doc/test_viterbi_equalization1.py.xml
@@ -12,7 +12,7 @@
10 import fsm_utils
11
12 def run_test (f,Kb,bitspersymbol,K,channel,modulation,dimensionality,tot_constellation,N0,seed):
- 13 fg = gr.flow_graph ()
+ 13 tb = gr.top_block ()
14 L = len(channel)
15
16 # TX
@@ -39,14 +39,14 @@
37 va = trellis.viterbi_combined_s(f,K+L,0,0,dimensionality,tot_constellation,trellis.TRELLIS_EUCLIDEAN) # using viterbi_combined_s instead of metrics_f/viterbi_s allows larger packet lengths because metrics_f is complaining for not being able to allocate large buffers. This is due to the large f.O() in this application...
38 dst = gr.vector_sink_s()
39
- 40 fg.connect (src,mod)
- 41 fg.connect (mod,isi,(add,0))
- 42 fg.connect (noise,(add,1))
- 43 #fg.connect (add,metrics)
- 44 #fg.connect (metrics,va,dst)
- 45 fg.connect (add,skip,va,dst)
+ 40 tb.connect (src,mod)
+ 41 tb.connect (mod,isi,(add,0))
+ 42 tb.connect (noise,(add,1))
+ 43 #tb.connect (add,metrics)
+ 44 #tb.connect (metrics,va,dst)
+ 45 tb.connect (add,skip,va,dst)
46
- 47 fg.run()
+ 47 tb.run()
48
49 data = dst.data()
50 ntotal = len(data) - L
diff --git a/gr-trellis/src/examples/test_sccc_hard.py b/gr-trellis/src/examples/test_sccc_hard.py
index d634282fe..a7933a18e 100755
--- a/gr-trellis/src/examples/test_sccc_hard.py
+++ b/gr-trellis/src/examples/test_sccc_hard.py
@@ -10,7 +10,7 @@ import random
import fsm_utils
def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed):
- fg = gr.flow_graph ()
+ tb = gr.top_block ()
# TX
@@ -35,13 +35,13 @@ def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation,
fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack FSM input symbols to shorts
dst = gr.check_lfsr_32k_s()
- fg.connect (src,src_head,s2fsmi,enc_out,inter,enc_in,mod)
- fg.connect (mod,(add,0))
- fg.connect (noise,(add,1))
- fg.connect (add,metrics_in)
- fg.connect (metrics_in,va_in,deinter,metrics_out,va_out,fsmi2s,dst)
+ tb.connect (src,src_head,s2fsmi,enc_out,inter,enc_in,mod)
+ tb.connect (mod,(add,0))
+ tb.connect (noise,(add,1))
+ tb.connect (add,metrics_in)
+ tb.connect (metrics_in,va_in,deinter,metrics_out,va_out,fsmi2s,dst)
- fg.run()
+ tb.run()
ntotal = dst.ntotal ()
nright = dst.nright ()
diff --git a/gr-trellis/src/examples/test_sccc_soft.py b/gr-trellis/src/examples/test_sccc_soft.py
index 23e6553ca..d96d36e3f 100755
--- a/gr-trellis/src/examples/test_sccc_soft.py
+++ b/gr-trellis/src/examples/test_sccc_soft.py
@@ -13,7 +13,7 @@ import fsm_utils
def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed):
- fg = gr.flow_graph ()
+ tb = gr.top_block ()
# TX
@@ -38,15 +38,15 @@ def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation,
fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack FSM input symbols to shorts
dst = gr.check_lfsr_32k_s()
- fg.connect (src,src_head,s2fsmi,enc_out,inter,enc_in,mod)
- fg.connect (mod,(add,0))
- fg.connect (noise,(add,1))
- fg.connect (add,metrics_in)
- fg.connect (gnd,(siso_in,0))
- fg.connect (metrics_in,(siso_in,1))
- fg.connect (siso_in,deinter,va_out,fsmi2s,dst)
-
- fg.run()
+ tb.connect (src,src_head,s2fsmi,enc_out,inter,enc_in,mod)
+ tb.connect (mod,(add,0))
+ tb.connect (noise,(add,1))
+ tb.connect (add,metrics_in)
+ tb.connect (gnd,(siso_in,0))
+ tb.connect (metrics_in,(siso_in,1))
+ tb.connect (siso_in,deinter,va_out,fsmi2s,dst)
+
+ tb.run()
ntotal = dst.ntotal ()
nright = dst.nright ()
diff --git a/gr-trellis/src/examples/test_sccc_turbo.py b/gr-trellis/src/examples/test_sccc_turbo.py
index f67fb0922..f3a856de7 100755
--- a/gr-trellis/src/examples/test_sccc_turbo.py
+++ b/gr-trellis/src/examples/test_sccc_turbo.py
@@ -11,7 +11,7 @@ import fsm_utils
-def make_rx(fg,fo,fi,dimensionality,constellation,K,interleaver,IT,Es,N0,type):
+def make_rx(tb,fo,fi,dimensionality,constellation,K,interleaver,IT,Es,N0,type):
metrics_in = trellis.metrics_f(fi.O(),dimensionality,constellation,trellis.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for innner Viterbi
scale = gr.multiply_const_ff(1.0/N0)
gnd = gr.vector_source_f([0],True);
@@ -32,27 +32,27 @@ def make_rx(fg,fo,fi,dimensionality,constellation,K,interleaver,IT,Es,N0,type):
siso_out.append( trellis.viterbi_s(fo,K,0,-1) ) # no soft outputs needed
# connect first stage
- fg.connect (gnd,inter[0])
- fg.connect (metrics_in,scale)
- fg.connect (scale,(siso_in[0],1))
+ tb.connect (gnd,inter[0])
+ tb.connect (metrics_in,scale)
+ tb.connect (scale,(siso_in[0],1))
# connect the rest
for it in range(IT):
if it < IT-1:
- fg.connect (metrics_in,(siso_in[it+1],1))
- fg.connect (siso_in[it],deinter[it],(siso_out[it],1))
- fg.connect (gnd,(siso_out[it],0))
- fg.connect (siso_out[it],inter[it+1])
- fg.connect (inter[it],(siso_in[it],0))
+ tb.connect (metrics_in,(siso_in[it+1],1))
+ tb.connect (siso_in[it],deinter[it],(siso_out[it],1))
+ tb.connect (gnd,(siso_out[it],0))
+ tb.connect (siso_out[it],inter[it+1])
+ tb.connect (inter[it],(siso_in[it],0))
else:
- fg.connect (siso_in[it],deinter[it],siso_out[it])
- fg.connect (inter[it],(siso_in[it],0))
+ tb.connect (siso_in[it],deinter[it],siso_out[it])
+ tb.connect (inter[it],(siso_in[it],0))
return (metrics_in,siso_out[IT-1])
def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation,Es,N0,IT,seed):
- fg = gr.flow_graph ()
+ tb = gr.top_block ()
# TX
@@ -69,18 +69,18 @@ def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation,
noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed)
# RX
- (head,tail) = make_rx(fg,fo,fi,dimensionality,constellation,K,interleaver,IT,Es,N0,trellis.TRELLIS_MIN_SUM)
- #(head,tail) = make_rx(fg,fo,fi,dimensionality,constellation,K,interleaver,IT,Es,N0,trellis.TRELLIS_SUM_PRODUCT)
+ (head,tail) = make_rx(tb,fo,fi,dimensionality,constellation,K,interleaver,IT,Es,N0,trellis.TRELLIS_MIN_SUM)
+ #(head,tail) = make_rx(tb,fo,fi,dimensionality,constellation,K,interleaver,IT,Es,N0,trellis.TRELLIS_SUM_PRODUCT)
fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack FSM input symbols to shorts
dst = gr.check_lfsr_32k_s()
- fg.connect (src,src_head,s2fsmi,enc_out,inter,enc_in,mod)
- fg.connect (mod,(add,0))
- fg.connect (noise,(add,1))
- fg.connect (add,head)
- fg.connect (tail,fsmi2s,dst)
+ tb.connect (src,src_head,s2fsmi,enc_out,inter,enc_in,mod)
+ tb.connect (mod,(add,0))
+ tb.connect (noise,(add,1))
+ tb.connect (add,head)
+ tb.connect (tail,fsmi2s,dst)
- fg.run()
+ tb.run()
#print enc_out.ST(), enc_in.ST()
diff --git a/gr-trellis/src/examples/test_tcm.py b/gr-trellis/src/examples/test_tcm.py
index f22501558..62e0c413a 100755
--- a/gr-trellis/src/examples/test_tcm.py
+++ b/gr-trellis/src/examples/test_tcm.py
@@ -10,7 +10,7 @@ import random
import fsm_utils
def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed):
- fg = gr.flow_graph ()
+ tb = gr.top_block ()
# TX
@@ -38,16 +38,16 @@ def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed):
dst = gr.check_lfsr_32k_s()
- fg.connect (src,src_head,s2fsmi,enc,mod)
- #fg.connect (src,b2s,s2fsmi,enc,mod)
- fg.connect (mod,(add,0))
- fg.connect (noise,(add,1))
- fg.connect (add,metrics)
- fg.connect (metrics,va,fsmi2s,dst)
- #fg.connect (metrics,va,fsmi2s,s2b,dst)
+ tb.connect (src,src_head,s2fsmi,enc,mod)
+ #tb.connect (src,b2s,s2fsmi,enc,mod)
+ tb.connect (mod,(add,0))
+ tb.connect (noise,(add,1))
+ tb.connect (add,metrics)
+ tb.connect (metrics,va,fsmi2s,dst)
+ #tb.connect (metrics,va,fsmi2s,s2b,dst)
- fg.run()
+ tb.run()
# A bit of cheating: run the program once and print the
# final encoder state..
diff --git a/gr-trellis/src/examples/test_tcm1.py b/gr-trellis/src/examples/test_tcm1.py
index 66d7131e3..746bd9336 100755
--- a/gr-trellis/src/examples/test_tcm1.py
+++ b/gr-trellis/src/examples/test_tcm1.py
@@ -10,7 +10,7 @@ import random
import fsm_utils
def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed):
- fg = gr.flow_graph ()
+ tb = gr.top_block ()
# TX
packet = [0]*Kb
@@ -40,16 +40,16 @@ def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed):
#dst = gr.check_lfsr_32k_s();
- #fg.connect (src,src_head,s2fsmi,enc,mod)
- fg.connect (src,b2s,s2fsmi,enc,mod)
- fg.connect (mod,(add,0))
- fg.connect (noise,(add,1))
- fg.connect (add,metrics)
- #fg.connect (metrics,va,fsmi2s,dst)
- fg.connect (metrics,va,fsmi2s,s2b,dst)
+ #tb.connect (src,src_head,s2fsmi,enc,mod)
+ tb.connect (src,b2s,s2fsmi,enc,mod)
+ tb.connect (mod,(add,0))
+ tb.connect (noise,(add,1))
+ tb.connect (add,metrics)
+ #tb.connect (metrics,va,fsmi2s,dst)
+ tb.connect (metrics,va,fsmi2s,s2b,dst)
- fg.run()
+ tb.run()
# A bit of cheating: run the program once and print the
# final encoder state..
diff --git a/gr-trellis/src/examples/test_tcm2.py b/gr-trellis/src/examples/test_tcm2.py
index 9680909ea..e527fc5ed 100755
--- a/gr-trellis/src/examples/test_tcm2.py
+++ b/gr-trellis/src/examples/test_tcm2.py
@@ -10,7 +10,7 @@ import random
import fsm_utils
def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed):
- fg = gr.flow_graph ()
+ tb = gr.top_block ()
# TX
@@ -38,16 +38,16 @@ def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed):
dst = gr.check_lfsr_32k_s()
- fg.connect (src,src_head,s2fsmi,enc,mod)
- #fg.connect (src,b2s,s2fsmi,enc,mod)
- fg.connect (mod,(add,0))
- fg.connect (noise,(add,1))
- fg.connect (add,metrics)
- fg.connect (metrics,va,fsmi2s,dst)
- #fg.connect (metrics,va,fsmi2s,s2b,dst)
+ tb.connect (src,src_head,s2fsmi,enc,mod)
+ #tb.connect (src,b2s,s2fsmi,enc,mod)
+ tb.connect (mod,(add,0))
+ tb.connect (noise,(add,1))
+ tb.connect (add,metrics)
+ tb.connect (metrics,va,fsmi2s,dst)
+ #tb.connect (metrics,va,fsmi2s,s2b,dst)
- fg.run()
+ tb.run()
# A bit of cheating: run the program once and print the
# final encoder state..
diff --git a/gr-trellis/src/examples/test_tcm_combined.py b/gr-trellis/src/examples/test_tcm_combined.py
index 92e020bea..d2d42b40b 100755
--- a/gr-trellis/src/examples/test_tcm_combined.py
+++ b/gr-trellis/src/examples/test_tcm_combined.py
@@ -9,7 +9,7 @@ import sys
import fsm_utils
def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed):
- fg = gr.flow_graph ()
+ tb = gr.top_block ()
# TX
src = gr.lfsr_32k_source_s()
@@ -30,13 +30,13 @@ def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed):
dst = gr.check_lfsr_32k_s();
- fg.connect (src,src_head,s2fsmi,enc,mod)
- fg.connect (mod,(add,0))
- fg.connect (noise,(add,1))
- fg.connect (add,va,fsmi2s,dst)
+ tb.connect (src,src_head,s2fsmi,enc,mod)
+ tb.connect (mod,(add,0))
+ tb.connect (noise,(add,1))
+ tb.connect (add,va,fsmi2s,dst)
- fg.run()
+ tb.run()
# A bit of cheating: run the program once and print the
# final encoder state..
diff --git a/gr-trellis/src/examples/test_tcm_parallel.py b/gr-trellis/src/examples/test_tcm_parallel.py
index f9dcb5852..8e2f5a230 100755
--- a/gr-trellis/src/examples/test_tcm_parallel.py
+++ b/gr-trellis/src/examples/test_tcm_parallel.py
@@ -9,7 +9,7 @@ import sys
import fsm_utils
def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed,P):
- fg = gr.flow_graph ()
+ tb = gr.top_block ()
# TX
src = gr.lfsr_32k_source_s()
@@ -33,17 +33,17 @@ def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed,P):
fsmi2s=gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack FSM input symbols to shorts
dst = gr.check_lfsr_32k_s()
- fg.connect (src,src_head,s2fsmi,s2p)
+ tb.connect (src,src_head,s2fsmi,s2p)
for i in range(P):
- fg.connect ((s2p,i),(enc,i),(mod,i))
- fg.connect ((mod,i),(add[i],0))
- fg.connect (noise[i],(add[i],1))
- fg.connect (add[i],(metrics,i))
- fg.connect ((metrics,i),(va,i),(p2s,i))
- fg.connect (p2s,fsmi2s,dst)
+ tb.connect ((s2p,i),(enc,i),(mod,i))
+ tb.connect ((mod,i),(add[i],0))
+ tb.connect (noise[i],(add[i],1))
+ tb.connect (add[i],(metrics,i))
+ tb.connect ((metrics,i),(va,i),(p2s,i))
+ tb.connect (p2s,fsmi2s,dst)
- fg.run()
+ tb.run()
# A bit of cheating: run the program once and print the
# final encoder state.
diff --git a/gr-trellis/src/examples/test_turbo_equalization.py b/gr-trellis/src/examples/test_turbo_equalization.py
index ff0497e2b..612f6951c 100755
--- a/gr-trellis/src/examples/test_turbo_equalization.py
+++ b/gr-trellis/src/examples/test_turbo_equalization.py
@@ -9,7 +9,7 @@ import sys
import fsm_utils
-def make_rx(fg,fo,fi,dimensionality,tot_constellation,K,interleaver,IT,Es,N0,type):
+def make_rx(tb,fo,fi,dimensionality,tot_constellation,K,interleaver,IT,Es,N0,type):
metrics_in = trellis.metrics_f(fi.O(),dimensionality,tot_constellation,trellis.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for innner SISO
scale = gr.multiply_const_ff(1.0/N0)
gnd = gr.vector_source_f([0],True);
@@ -30,27 +30,27 @@ def make_rx(fg,fo,fi,dimensionality,tot_constellation,K,interleaver,IT,Es,N0,typ
siso_out.append( trellis.viterbi_s(fo,K,0,-1) ) # no soft outputs needed
# connect first stage
- fg.connect (gnd,inter[0])
- fg.connect (metrics_in,scale)
- fg.connect (scale,(siso_in[0],1))
+ tb.connect (gnd,inter[0])
+ tb.connect (metrics_in,scale)
+ tb.connect (scale,(siso_in[0],1))
# connect the rest
for it in range(IT):
if it < IT-1:
- fg.connect (metrics_in,(siso_in[it+1],1))
- fg.connect (siso_in[it],deinter[it],(siso_out[it],1))
- fg.connect (gnd,(siso_out[it],0))
- fg.connect (siso_out[it],inter[it+1])
- fg.connect (inter[it],(siso_in[it],0))
+ tb.connect (metrics_in,(siso_in[it+1],1))
+ tb.connect (siso_in[it],deinter[it],(siso_out[it],1))
+ tb.connect (gnd,(siso_out[it],0))
+ tb.connect (siso_out[it],inter[it+1])
+ tb.connect (inter[it],(siso_in[it],0))
else:
- fg.connect (siso_in[it],deinter[it],siso_out[it])
- fg.connect (inter[it],(siso_in[it],0))
+ tb.connect (siso_in[it],deinter[it],siso_out[it])
+ tb.connect (inter[it],(siso_in[it],0))
return (metrics_in,siso_out[IT-1])
def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,tot_constellation,Es,N0,IT,seed):
- fg = gr.flow_graph ()
+ tb = gr.top_block ()
# TX
src = gr.lfsr_32k_source_s()
@@ -67,17 +67,17 @@ def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,tot_constellat
noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed)
# RX
- (head,tail) = make_rx(fg,fo,fi,dimensionality,tot_constellation,K,interleaver,IT,Es,N0,trellis.TRELLIS_MIN_SUM)
+ (head,tail) = make_rx(tb,fo,fi,dimensionality,tot_constellation,K,interleaver,IT,Es,N0,trellis.TRELLIS_MIN_SUM)
fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack FSM input symbols to shorts
dst = gr.check_lfsr_32k_s();
- fg.connect (src,src_head,s2fsmi,enc_out,inter,enc_in,mod)
- fg.connect (mod,(add,0))
- fg.connect (noise,(add,1))
- fg.connect (add,head)
- fg.connect (tail,fsmi2s,dst)
+ tb.connect (src,src_head,s2fsmi,enc_out,inter,enc_in,mod)
+ tb.connect (mod,(add,0))
+ tb.connect (noise,(add,1))
+ tb.connect (add,head)
+ tb.connect (tail,fsmi2s,dst)
- fg.run()
+ tb.run()
ntotal = dst.ntotal ()
nright = dst.nright ()
diff --git a/gr-trellis/src/examples/test_turbo_equalization1.py b/gr-trellis/src/examples/test_turbo_equalization1.py
index 5afd5ba66..8d2feec8a 100755
--- a/gr-trellis/src/examples/test_turbo_equalization1.py
+++ b/gr-trellis/src/examples/test_turbo_equalization1.py
@@ -9,7 +9,7 @@ import sys
import random
import fsm_utils
-def make_rx(fg,fo,fi,dimensionality,tot_constellation,K,interleaver,IT,Es,N0,type):
+def make_rx(tb,fo,fi,dimensionality,tot_constellation,K,interleaver,IT,Es,N0,type):
metrics_in = trellis.metrics_f(fi.O(),dimensionality,tot_constellation,trellis.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for innner SISO
scale = gr.multiply_const_ff(1.0/N0)
gnd = gr.vector_source_f([0],True);
@@ -30,27 +30,27 @@ def make_rx(fg,fo,fi,dimensionality,tot_constellation,K,interleaver,IT,Es,N0,typ
siso_out.append( trellis.viterbi_s(fo,K,0,-1) ) # no soft outputs needed
# connect first stage
- fg.connect (gnd,inter[0])
- fg.connect (metrics_in,scale)
- fg.connect (scale,(siso_in[0],1))
+ tb.connect (gnd,inter[0])
+ tb.connect (metrics_in,scale)
+ tb.connect (scale,(siso_in[0],1))
# connect the rest
for it in range(IT):
if it < IT-1:
- fg.connect (scale,(siso_in[it+1],1))
- fg.connect (siso_in[it],deinter[it],(siso_out[it],1))
- fg.connect (gnd,(siso_out[it],0))
- fg.connect (siso_out[it],inter[it+1])
- fg.connect (inter[it],(siso_in[it],0))
+ tb.connect (scale,(siso_in[it+1],1))
+ tb.connect (siso_in[it],deinter[it],(siso_out[it],1))
+ tb.connect (gnd,(siso_out[it],0))
+ tb.connect (siso_out[it],inter[it+1])
+ tb.connect (inter[it],(siso_in[it],0))
else:
- fg.connect (siso_in[it],deinter[it],siso_out[it])
- fg.connect (inter[it],(siso_in[it],0))
+ tb.connect (siso_in[it],deinter[it],siso_out[it])
+ tb.connect (inter[it],(siso_in[it],0))
return (metrics_in,siso_out[IT-1])
def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,channel,modulation,dimensionality,tot_constellation,Es,N0,IT,seed):
- fg = gr.flow_graph ()
+ tb = gr.top_block ()
L = len(channel)
# TX
@@ -70,16 +70,16 @@ def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,channel,modulation,dimensiona
noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed)
# RX
- (head,tail) = make_rx(fg,fo,fi,dimensionality,tot_constellation,K,interleaver,IT,Es,N0,trellis.TRELLIS_MIN_SUM)
+ (head,tail) = make_rx(tb,fo,fi,dimensionality,tot_constellation,K,interleaver,IT,Es,N0,trellis.TRELLIS_MIN_SUM)
dst = gr.vector_sink_s();
- fg.connect (src,enc_out,inter,mod)
- fg.connect (mod,isi,(add,0))
- fg.connect (noise,(add,1))
- fg.connect (add,head)
- fg.connect (tail,dst)
+ tb.connect (src,enc_out,inter,mod)
+ tb.connect (mod,isi,(add,0))
+ tb.connect (noise,(add,1))
+ tb.connect (add,head)
+ tb.connect (tail,dst)
- fg.run()
+ tb.run()
data = dst.data()
ntotal = len(data)
diff --git a/gr-trellis/src/examples/test_turbo_equalization2.py b/gr-trellis/src/examples/test_turbo_equalization2.py
index 7e252d6d1..f1731016e 100755
--- a/gr-trellis/src/examples/test_turbo_equalization2.py
+++ b/gr-trellis/src/examples/test_turbo_equalization2.py
@@ -9,7 +9,7 @@ import sys
import random
import fsm_utils
-def make_rx(fg,fo,fi,dimensionality,tot_constellation,K,interleaver,IT,Es,N0,type):
+def make_rx(tb,fo,fi,dimensionality,tot_constellation,K,interleaver,IT,Es,N0,type):
scale = gr.multiply_const_ff(math.sqrt(1.0/N0))
gnd = gr.vector_source_f([0],True);
@@ -29,26 +29,26 @@ def make_rx(fg,fo,fi,dimensionality,tot_constellation,K,interleaver,IT,Es,N0,typ
siso_out.append( trellis.viterbi_s(fo,K,0,-1) ) # no soft outputs needed
# connect first stage
- fg.connect (gnd,inter[0])
- fg.connect (scale,(siso_in[0],1))
+ tb.connect (gnd,inter[0])
+ tb.connect (scale,(siso_in[0],1))
# connect the rest
for it in range(IT):
if it < IT-1:
- fg.connect (scale,(siso_in[it+1],1))
- fg.connect (siso_in[it],deinter[it],(siso_out[it],1))
- fg.connect (gnd,(siso_out[it],0))
- fg.connect (siso_out[it],inter[it+1])
- fg.connect (inter[it],(siso_in[it],0))
+ tb.connect (scale,(siso_in[it+1],1))
+ tb.connect (siso_in[it],deinter[it],(siso_out[it],1))
+ tb.connect (gnd,(siso_out[it],0))
+ tb.connect (siso_out[it],inter[it+1])
+ tb.connect (inter[it],(siso_in[it],0))
else:
- fg.connect (siso_in[it],deinter[it],siso_out[it])
- fg.connect (inter[it],(siso_in[it],0))
+ tb.connect (siso_in[it],deinter[it],siso_out[it])
+ tb.connect (inter[it],(siso_in[it],0))
return (scale,siso_out[IT-1])
def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,channel,modulation,dimensionality,tot_constellation,Es,N0,IT,seed):
- fg = gr.flow_graph ()
+ tb = gr.top_block ()
L = len(channel)
# TX
@@ -68,16 +68,16 @@ def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,channel,modulation,dimensiona
noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed)
# RX
- (head,tail) = make_rx(fg,fo,fi,dimensionality,tot_constellation,K,interleaver,IT,Es,N0,trellis.TRELLIS_MIN_SUM)
+ (head,tail) = make_rx(tb,fo,fi,dimensionality,tot_constellation,K,interleaver,IT,Es,N0,trellis.TRELLIS_MIN_SUM)
dst = gr.vector_sink_s();
- fg.connect (src,enc_out,inter,mod)
- fg.connect (mod,isi,(add,0))
- fg.connect (noise,(add,1))
- fg.connect (add,head)
- fg.connect (tail,dst)
+ tb.connect (src,enc_out,inter,mod)
+ tb.connect (mod,isi,(add,0))
+ tb.connect (noise,(add,1))
+ tb.connect (add,head)
+ tb.connect (tail,dst)
- fg.run()
+ tb.run()
data = dst.data()
ntotal = len(data)
diff --git a/gr-trellis/src/examples/test_viterbi_equalization.py b/gr-trellis/src/examples/test_viterbi_equalization.py
index 24545e3b0..86fc00674 100755
--- a/gr-trellis/src/examples/test_viterbi_equalization.py
+++ b/gr-trellis/src/examples/test_viterbi_equalization.py
@@ -9,7 +9,7 @@ import sys
import fsm_utils
def run_test (f,Kb,bitspersymbol,K,dimensionality,tot_constellation,N0,seed):
- fg = gr.flow_graph ()
+ tb = gr.top_block ()
# TX
src = gr.lfsr_32k_source_s()
@@ -29,13 +29,13 @@ def run_test (f,Kb,bitspersymbol,K,dimensionality,tot_constellation,N0,seed):
fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack FSM input symbols to shorts
dst = gr.check_lfsr_32k_s();
- fg.connect (src,src_head,s2fsmi,enc,mod)
- fg.connect (mod,(add,0))
- fg.connect (noise,(add,1))
- fg.connect (add,metrics)
- fg.connect (metrics,va,fsmi2s,dst)
+ tb.connect (src,src_head,s2fsmi,enc,mod)
+ tb.connect (mod,(add,0))
+ tb.connect (noise,(add,1))
+ tb.connect (add,metrics)
+ tb.connect (metrics,va,fsmi2s,dst)
- fg.run()
+ tb.run()
ntotal = dst.ntotal ()
nright = dst.nright ()
diff --git a/gr-trellis/src/examples/test_viterbi_equalization1.py b/gr-trellis/src/examples/test_viterbi_equalization1.py
index 002d41a76..d26f73bc0 100755
--- a/gr-trellis/src/examples/test_viterbi_equalization1.py
+++ b/gr-trellis/src/examples/test_viterbi_equalization1.py
@@ -10,7 +10,7 @@ import random
import fsm_utils
def run_test (f,Kb,bitspersymbol,K,channel,modulation,dimensionality,tot_constellation,N0,seed):
- fg = gr.flow_graph ()
+ tb = gr.top_block ()
L = len(channel)
# TX
@@ -37,14 +37,14 @@ def run_test (f,Kb,bitspersymbol,K,channel,modulation,dimensionality,tot_constel
va = trellis.viterbi_combined_fs(f,K+L,0,0,dimensionality,tot_constellation,trellis.TRELLIS_EUCLIDEAN) # using viterbi_combined_fs instead of metrics_f/viterbi_s allows larger packet lengths because metrics_f is complaining for not being able to allocate large buffers. This is due to the large f.O() in this application...
dst = gr.vector_sink_s()
- fg.connect (src,mod)
- fg.connect (mod,isi,(add,0))
- fg.connect (noise,(add,1))
- #fg.connect (add,metrics)
- #fg.connect (metrics,va,dst)
- fg.connect (add,skip,va,dst)
+ tb.connect (src,mod)
+ tb.connect (mod,isi,(add,0))
+ tb.connect (noise,(add,1))
+ #tb.connect (add,metrics)
+ #tb.connect (metrics,va,dst)
+ tb.connect (add,skip,va,dst)
- fg.run()
+ tb.run()
data = dst.data()
ntotal = len(data) - L
diff --git a/gr-trellis/src/python/qa_trellis.py b/gr-trellis/src/python/qa_trellis.py
index 27cea8e87..306bf994d 100755
--- a/gr-trellis/src/python/qa_trellis.py
+++ b/gr-trellis/src/python/qa_trellis.py
@@ -26,10 +26,10 @@ import trellis
class qa_trellis (gr_unittest.TestCase):
def setUp (self):
- self.fg = gr.flow_graph ()
+ self.tb = gr.top_block ()
def tearDown (self):
- self.fg = None
+ self.tb = None
def test_001_fsm (self):
I = 2