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()
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.
59 sys.exit (1)
60
61 # system parameters
- 62 f=trellis.fsm(fname) # get the FSM specification from a file (will hopefully be automated in the future...)
+ 62 f=trellis.fsm(fname) # get the FSM specification from a file
63 Kb=1024*16 # packet size in bits (make it multiple of 16 so it can be packed in a short)
64 bitspersymbol = int(round(math.log(f.I())/math.log(2))) # bits per FSM input symbol
65 K=Kb/bitspersymbol # packet size in trellis steps