commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r3381 - in gnuradio/branches/developers/eb/mb: . confi


From: eb
Subject: [Commit-gnuradio] r3381 - in gnuradio/branches/developers/eb/mb: . config ezdop/src/firmware ezdop/src/host ezdop/src/host/hunter ezdop/src/host/hunter/src gnuradio-examples/python/channel-coding gr-audio-osx/src gr-error-correcting-codes/src/lib/libecc/tests gr-trellis gr-trellis/doc gr-trellis/src gr-trellis/src/lib gr-trellis/src/python pmt/src/lib usrp/fpga/toplevel/mrfm
Date: Tue, 22 Aug 2006 20:38:54 -0600 (MDT)

Author: eb
Date: 2006-08-22 20:38:53 -0600 (Tue, 22 Aug 2006)
New Revision: 3381

Added:
   
gnuradio/branches/developers/eb/mb/gnuradio-examples/python/channel-coding/test_viterbi_equalization.py
   
gnuradio/branches/developers/eb/mb/gnuradio-examples/python/channel-coding/test_viterbi_equalization1.py
Modified:
   gnuradio/branches/developers/eb/mb/config/grc_ezdop.m4
   gnuradio/branches/developers/eb/mb/configure.ac
   gnuradio/branches/developers/eb/mb/ezdop/src/firmware/Makefile.am
   gnuradio/branches/developers/eb/mb/ezdop/src/host/Makefile.am
   gnuradio/branches/developers/eb/mb/ezdop/src/host/hunter/Makefile.am
   gnuradio/branches/developers/eb/mb/ezdop/src/host/hunter/src/Makefile.am
   
gnuradio/branches/developers/eb/mb/gnuradio-examples/python/channel-coding/Makefile.am
   
gnuradio/branches/developers/eb/mb/gnuradio-examples/python/channel-coding/fsm_utils.py
   
gnuradio/branches/developers/eb/mb/gnuradio-examples/python/channel-coding/test_sccc_hard.py
   
gnuradio/branches/developers/eb/mb/gnuradio-examples/python/channel-coding/test_sccc_soft.py
   
gnuradio/branches/developers/eb/mb/gnuradio-examples/python/channel-coding/test_sccc_turbo.py
   
gnuradio/branches/developers/eb/mb/gnuradio-examples/python/channel-coding/test_tcm.py
   
gnuradio/branches/developers/eb/mb/gnuradio-examples/python/channel-coding/test_tcm1.py
   
gnuradio/branches/developers/eb/mb/gnuradio-examples/python/channel-coding/test_tcm2.py
   
gnuradio/branches/developers/eb/mb/gnuradio-examples/python/channel-coding/test_tcm_combined.py
   
gnuradio/branches/developers/eb/mb/gnuradio-examples/python/channel-coding/test_tcm_parallel.py
   gnuradio/branches/developers/eb/mb/gr-audio-osx/src/Makefile.am
   
gnuradio/branches/developers/eb/mb/gr-error-correcting-codes/src/lib/libecc/tests/qa_encoder_convolutional_ic1_ic1.cc
   gnuradio/branches/developers/eb/mb/gr-trellis/Makefile.am
   gnuradio/branches/developers/eb/mb/gr-trellis/doc/Makefile.am
   gnuradio/branches/developers/eb/mb/gr-trellis/doc/make_numbered_listing.py
   gnuradio/branches/developers/eb/mb/gr-trellis/doc/test_tcm.py
   gnuradio/branches/developers/eb/mb/gr-trellis/src/Makefile.am
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/Makefile.am
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/base.cc
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/base.h
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/build_utils.py
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/build_utils_codes.py
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/fsm.cc
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/fsm.h
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/generate_all.py
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/generate_common.py
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/interleaver.cc
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/interleaver.h
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/quicksort_index.cc
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/quicksort_index.h
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_calc_metric.cc
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_calc_metric.h
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_encoder_bb.cc
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_encoder_bb.h
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_encoder_bi.cc
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_encoder_bi.h
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_encoder_bs.cc
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_encoder_bs.h
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_encoder_ii.cc
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_encoder_ii.h
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_encoder_si.cc
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_encoder_si.h
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_encoder_ss.cc
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_encoder_ss.h
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_metric_type.h
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_metrics_c.cc
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_metrics_c.h
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_metrics_f.cc
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_metrics_f.h
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_metrics_i.cc
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_metrics_i.h
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_metrics_s.cc
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_metrics_s.h
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_permutation.cc
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_permutation.h
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_siso_f.cc
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_siso_f.h
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_siso_type.h
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_viterbi_b.cc
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_viterbi_b.h
   
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_viterbi_combined_b.cc
   
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_viterbi_combined_b.h
   
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_viterbi_combined_i.cc
   
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_viterbi_combined_i.h
   
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_viterbi_combined_s.cc
   
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_viterbi_combined_s.h
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_viterbi_i.cc
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_viterbi_i.h
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_viterbi_s.cc
   gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_viterbi_s.h
   gnuradio/branches/developers/eb/mb/gr-trellis/src/python/Makefile.am
   gnuradio/branches/developers/eb/mb/gr-trellis/src/python/qa_trellis.py
   gnuradio/branches/developers/eb/mb/pmt/src/lib/generate_unv.py
   gnuradio/branches/developers/eb/mb/usrp/fpga/toplevel/mrfm/mrfm.py
   gnuradio/branches/developers/eb/mb/usrp/fpga/toplevel/mrfm/mrfm_fft.py
Log:
merged trunk -r3332:3380 in branch

Modified: gnuradio/branches/developers/eb/mb/config/grc_ezdop.m4
===================================================================
--- gnuradio/branches/developers/eb/mb/config/grc_ezdop.m4      2006-08-23 
02:18:16 UTC (rev 3380)
+++ gnuradio/branches/developers/eb/mb/config/grc_ezdop.m4      2006-08-23 
02:38:53 UTC (rev 3381)
@@ -33,24 +33,30 @@
 
     succeeded=yes
 
-    AC_PATH_PROG(AVRGCC, [avr-gcc -v], no)
-    if test $AVRGCC = no; then
+    # Firmware build requires Atmel AVR microcontroller port of GCC
+    AC_PATH_PROG([AVRGCC], [avr-gcc -v], [no])
+    if test x$AVRGCC = xno; then
        succeeded=no
     fi
     
-    AC_PATH_PROG(AVROBJCOPY, [avr-objcopy], no)
-    if test $AVROBJCOPY = no; then
+    # ...and binutils
+    AC_PATH_PROG([AVROBJCOPY], [avr-objcopy], [no])
+    if test x$AVROBJCOPY = xno; then
        succeeded=no
     fi
     
+    # ...and standard library (test not working yet)
+    #AC_CHECK_HEADERS([avr/io.h],[],[succeeded=no])
+
+    # Device access is via libftdi
     AC_LANG_PUSH(C)
     AC_CHECK_HEADERS([ftdi.h],[],[succeeded=no])
     save_LIBS="$LIBS"
-    AC_SEARCH_LIBS(ftdi_init, [ftdi],[FTDI_LIBS="$LIBS"],[succeeded=no])
+    AC_SEARCH_LIBS([ftdi_init], [ftdi],[FTDI_LIBS="$LIBS"],[succeeded=no])
     LIBS="$save_LIBS"
     AC_LANG_POP
     
-    if test $succeeded = yes; then
+    if test x$succeeded = xyes; then
        EZDOP_INCLUDES='-I$(top_srcdir)/ezdop/src/host/ezdop/ 
-I$(top_srcdir)/ezdop/src/firmware/'
        EZDOP_LIBS='-lezdop'
        AC_SUBST(FTDI_LIBS)

Modified: gnuradio/branches/developers/eb/mb/configure.ac
===================================================================
--- gnuradio/branches/developers/eb/mb/configure.ac     2006-08-23 02:18:16 UTC 
(rev 3380)
+++ gnuradio/branches/developers/eb/mb/configure.ac     2006-08-23 02:38:53 UTC 
(rev 3381)
@@ -157,7 +157,7 @@
 dnl GRC_GR_AUDIO_ALSA
 dnl GRC_GR_AUDIO_JACK
 dnl GRC_GR_AUDIO_OSS
-dnl GRC_GR_AUDIO_OSX           dnl ***NOT TESTED***
+dnl GRC_GR_AUDIO_OSX
 dnl GRC_GR_AUDIO_PORTAUDIO     dnl ***NOT TESTED***
 dnl GRC_GR_AUDIO_WINDOWS       dnl ***NOT TESTED***
 dnl GRC_GR_ATSC
@@ -171,7 +171,7 @@
 GRC_PMT
 GRC_MBLOCK                     dnl this must come after GRC_PMT
 dnl GRC_GR_TRELLIS
-dnl GRC_EZDOP                  dnl disable until grc_ezdop.m4 fixed
+dnl GRC_EZDOP          
 dnl GRC_GR_EZDOP               dnl this must come after GRC_EZDOP
 
 dnl Has list of successfully configured components

Modified: gnuradio/branches/developers/eb/mb/ezdop/src/firmware/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/mb/ezdop/src/firmware/Makefile.am   
2006-08-23 02:18:16 UTC (rev 3380)
+++ gnuradio/branches/developers/eb/mb/ezdop/src/firmware/Makefile.am   
2006-08-23 02:38:53 UTC (rev 3381)
@@ -25,25 +25,26 @@
 CC=$(AVRGCC)
 OBJCOPY=$(AVROBJCOPY)
 
-# What's defined for rest of project not good for avr-gcc (no -pthread for 
instance)
-override CFLAGS=
-
 noinst_PROGRAMS = dopctrl.elf dopctrl.hex  
-      
-EXTRA_DIST = \
-    dopctrl.hex
 
-dopctrl_elf_CFLAGS=-mmcu=atmega8 -funsigned-char -funsigned-bitfields 
-fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=$(<:.c=.lst)
+dopctrl_elf_CFLAGS= \
+       -mmcu=atmega8 \
+       -funsigned-char \
+       -funsigned-bitfields \
+       -fpack-struct \
+       -fshort-enums \
+       -Wall \
+       -Wstrict-prototypes \
+       -Wa,address@hidden
 
 dopctrl_elf_SOURCES = dopctrl.c
-    
+
 include_HEADERS = dopctrl.h
 
 dopctrl.hex : dopctrl.elf
        $(OBJCOPY) -O ihex -R .eeprom dopctrl.elf dopctrl.hex
-       
-install-data-local:
-       $(INSTALL_DATA) -D $(top_builddir)/ezdop/src/firmware/dopctrl.hex 
$(DESTDIR)$(datadir)/dopctrl.hex
 
-uninstall-local:
-       $(RM) $(DESTDIR)$(datadir)/dopctrl.hex
+firmwaredir = $(prefix)/share/ezdop
+firmware_DATA = dopctrl.hex
+
+MOSTLYCLEANFILES = *.lst *~


Property changes on: 
gnuradio/branches/developers/eb/mb/ezdop/src/host/Makefile.am
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/ezdop/src/host/hunter/Makefile.am
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/ezdop/src/host/hunter/src/Makefile.am
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gnuradio-examples/python/channel-coding/Makefile.am
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gnuradio-examples/python/channel-coding/fsm_utils.py
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gnuradio-examples/python/channel-coding/test_sccc_hard.py
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gnuradio-examples/python/channel-coding/test_sccc_soft.py
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gnuradio-examples/python/channel-coding/test_sccc_turbo.py
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gnuradio-examples/python/channel-coding/test_tcm.py
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gnuradio-examples/python/channel-coding/test_tcm1.py
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gnuradio-examples/python/channel-coding/test_tcm2.py
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gnuradio-examples/python/channel-coding/test_tcm_combined.py
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gnuradio-examples/python/channel-coding/test_tcm_parallel.py
___________________________________________________________________
Name: svn:eol-style
   + native

Copied: 
gnuradio/branches/developers/eb/mb/gnuradio-examples/python/channel-coding/test_viterbi_equalization.py
 (from rev 3380, 
gnuradio/trunk/gnuradio-examples/python/channel-coding/test_viterbi_equalization.py)
===================================================================
--- 
gnuradio/branches/developers/eb/mb/gnuradio-examples/python/channel-coding/test_viterbi_equalization.py
                             (rev 0)
+++ 
gnuradio/branches/developers/eb/mb/gnuradio-examples/python/channel-coding/test_viterbi_equalization.py
     2006-08-23 02:38:53 UTC (rev 3381)
@@ -0,0 +1,94 @@
+#!/usr/bin/env python
+
+from gnuradio import gr
+from gnuradio import audio
+from gnuradio import trellis
+from gnuradio import eng_notation
+import math
+import sys
+import fsm_utils
+
+def run_test (f,Kb,bitspersymbol,K,dimensionality,tot_constellation,N0,seed):
+    fg = gr.flow_graph ()
+
+    # TX
+    src = gr.lfsr_32k_source_s()
+    src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts
+    s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack 
shorts to symbols compatible with the FSM input cardinality
+    enc = trellis.encoder_ss(f,0) # initial state = 0
+    # essentially here we implement the combination of modulation and channel 
as a memoryless modulation (the memory induced by the channel is hidden in the 
FSM)
+    mod = gr.chunks_to_symbols_sf(tot_constellation,dimensionality)
+
+    # CHANNEL
+    add = gr.add_ff()
+    noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed)
+    
+    # RX
+    metrics = 
trellis.metrics_f(f.O(),dimensionality,tot_constellation,trellis.TRELLIS_EUCLIDEAN)
 # data preprocessing to generate metrics for Viterbi
+    va = trellis.viterbi_s(f,K,0,-1) # Put -1 if the Initial/Final states are 
not set.
+    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)
+    
+    fg.run()
+
+    ntotal = dst.ntotal ()
+    nright = dst.nright ()
+    runlength = dst.runlength ()
+    #print ntotal,nright,runlength 
+    
+    return (ntotal,ntotal-nright)
+
+
+
+
+def main(args):
+    nargs = len (args)
+    if nargs == 2:
+        esn0_db=float(args[0])
+        rep=int(args[1])
+    else:
+        sys.stderr.write ('usage: test_viterbi_equalization.py Es/No_db  
repetitions\n')
+        sys.exit (1)
+
+    # system parameters
+    Kb=128*16  # packet size in bits (multiple of 16)
+    modulation = fsm_utils.pam4 # see fsm_utlis.py for available predefined 
modulations
+    channel = fsm_utils.c_channel # see fsm_utlis.py for available predefined 
test channels
+    f=trellis.fsm(len(modulation[1]),len(channel)) # generate the FSM 
automatically
+    bitspersymbol = int(round(math.log(f.I())/math.log(2))) # bits per FSM 
input symbol
+    K=Kb/bitspersymbol # packet size in trellis steps
+
+    tot_channel = fsm_utils.make_isi_lookup(modulation,channel,True) # 
generate the lookup table (normalize energy to 1)
+    dimensionality = tot_channel[0]
+    tot_constellation = tot_channel[1]
+    N0=pow(10.0,-esn0_db/10.0); # noise variance
+    if len(tot_constellation)/dimensionality != f.O():
+        sys.stderr.write ('Incompatible FSM output cardinality and lookup 
table size.\n')
+        sys.exit (1)
+
+
+    tot_s=0 # total number of transmitted shorts
+    terr_s=0 # total number of shorts in error
+    terr_p=0 # total number of packets in error
+
+    for i in range(rep):
+        
(s,e)=run_test(f,Kb,bitspersymbol,K,dimensionality,tot_constellation,N0,-long(666+i))
 # run experiment with different seed to get different noise realizations
+        tot_s=tot_s+s
+        terr_s=terr_s+e
+        terr_p=terr_p+(terr_s!=0)
+        if ((i+1)%100==0) : # display progress
+            print i+1,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, 
'%.2e' % ((1.0*terr_s)/tot_s)
+    # estimate of the (short or bit) error rate
+    print rep,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % 
((1.0*terr_s)/tot_s)
+
+
+
+if __name__ == '__main__':
+    main (sys.argv[1:])
+

Copied: 
gnuradio/branches/developers/eb/mb/gnuradio-examples/python/channel-coding/test_viterbi_equalization1.py
 (from rev 3380, 
gnuradio/trunk/gnuradio-examples/python/channel-coding/test_viterbi_equalization1.py)
===================================================================
--- 
gnuradio/branches/developers/eb/mb/gnuradio-examples/python/channel-coding/test_viterbi_equalization1.py
                            (rev 0)
+++ 
gnuradio/branches/developers/eb/mb/gnuradio-examples/python/channel-coding/test_viterbi_equalization1.py
    2006-08-23 02:38:53 UTC (rev 3381)
@@ -0,0 +1,101 @@
+#!/usr/bin/env python
+
+from gnuradio import gr
+from gnuradio import audio
+from gnuradio import trellis
+from gnuradio import eng_notation
+import math
+import sys
+import random
+import fsm_utils
+
+def run_test 
(f,Kb,bitspersymbol,K,channel,modulation,dimensionality,tot_constellation,N0,seed):
+    fg = gr.flow_graph ()
+    L = len(channel)
+
+    # TX
+    # this for loop is TOO slow in python!!!
+    packet = [0]*(K+2*L)
+    for i in range(len(packet)):
+        packet[i] = random.randint(0, 2**bitspersymbol - 1) # random symbols
+    for i in range(L): # first/last L symbols set to 0
+        packet[i] = 0
+        packet[len(packet)-i-1] = 0
+    src = gr.vector_source_s(packet,False)
+    mod = gr.chunks_to_symbols_sf(modulation[1],modulation[0])
+
+    # CHANNEL
+    isi = gr.fir_filter_fff(1,channel)
+    add = gr.add_ff()
+    noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed)
+    
+    # RX
+    #metrics = 
trellis.metrics_f(f.O(),dimensionality,tot_constellation,trellis.TRELLIS_EUCLIDEAN)
 # data preprocessing to generate metrics for Viterbi
+    #va = trellis.viterbi_s(f,K+2*L,-1,0) # Put -1 if the Initial/Final states 
are not set. Better if we could skip the first L symbols and start with a 0 
state... don't know how to "skip" samples in gnuradio
+    va = 
trellis.viterbi_combined_s(f,dimensionality,tot_constellation,K+2*L,-1,0,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,va,dst)
+
+    fg.run()
+
+    data = dst.data() 
+    ntotal = len(data) - 2*L
+    nright=0
+    for i in range(ntotal):
+        if packet[i+L]==data[i+L]:
+            nright=nright+1
+        #else:
+            #print "Error in ", i
+    
+    return (ntotal,ntotal-nright)
+
+
+def main(args):
+    nargs = len (args)
+    if nargs == 2:
+        esn0_db=float(args[0])
+        rep=int(args[1])
+    else:
+        sys.stderr.write ('usage: test_viterbi_equalization1.py Es/No_db  
repetitions\n')
+        sys.exit (1)
+
+    # system parameters
+    Kb=128*16  # packet size in bits (multiple of 16)
+    modulation = fsm_utils.pam4 # see fsm_utlis.py for available predefined 
modulations
+    channel = fsm_utils.c_channel # see fsm_utlis.py for available predefined 
test channels
+    f=trellis.fsm(len(modulation[1]),len(channel)) # generate the FSM 
automatically
+    bitspersymbol = int(round(math.log(f.I())/math.log(2))) # bits per FSM 
input symbol
+    K=Kb/bitspersymbol # packet size in trellis steps
+
+    tot_channel = fsm_utils.make_isi_lookup(modulation,channel,True) # 
generate the lookup table (normalize energy to 1)
+    dimensionality = tot_channel[0]
+    tot_constellation = tot_channel[1]
+    N0=pow(10.0,-esn0_db/10.0); # noise variance
+    if len(tot_constellation)/dimensionality != f.O():
+        sys.stderr.write ('Incompatible FSM output cardinality and lookup 
table size.\n')
+        sys.exit (1)
+
+    tot_s=0 # total number of transmitted shorts
+    terr_s=0 # total number of shorts in error
+    terr_p=0 # total number of packets in error
+
+    for i in range(rep):
+        
(s,e)=run_test(f,Kb,bitspersymbol,K,channel,modulation,dimensionality,tot_constellation,N0,-long(666+i))
 # run experiment with different seed to get different noise realizations
+        tot_s=tot_s+s
+        terr_s=terr_s+e
+        terr_p=terr_p+(terr_s!=0)
+        if ((i+1)%100==0) : # display progress
+            print i+1,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, 
'%.2e' % ((1.0*terr_s)/tot_s)
+    # estimate of the (short or symbol) error rate
+    print rep,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % 
((1.0*terr_s)/tot_s)
+
+
+
+if __name__ == '__main__':
+    main (sys.argv[1:])

Modified: gnuradio/branches/developers/eb/mb/gr-audio-osx/src/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/mb/gr-audio-osx/src/Makefile.am     
2006-08-23 02:18:16 UTC (rev 3380)
+++ gnuradio/branches/developers/eb/mb/gr-audio-osx/src/Makefile.am     
2006-08-23 02:38:53 UTC (rev 3381)
@@ -32,7 +32,7 @@
 TESTS = run_tests
 
 LOCAL_IFILES =                                 \
-       audio_osx.i                             
+       $(top_srcdir)/gr-audio-osx/src/audio_osx.i                              
 
 NON_LOCAL_IFILES =                     \
        $(GNURADIO_I)
@@ -78,8 +78,8 @@
 
 _audio_osx_la_LDFLAGS = $(NO_UNDEFINED) -module -avoid-version -framework 
AudioUnit -framework CoreAudio -framework AudioToolbox
 
-audio_osx.cc audio_osx.py: audio_osx.i
-       $(SWIG) $(SWIGCPPPYTHONARGS) -module audio_osx -o audio_osx.cc $<
+audio_osx.cc audio_osx.py: $(ALL_IFILES)
+       $(SWIG) $(SWIGCPPPYTHONARGS) -module audio_osx -o audio_osx.cc 
$(LOCAL_IFILES)
 
 noinst_PYTHON = qa_osx.py test_audio_loop.py
 

Modified: 
gnuradio/branches/developers/eb/mb/gr-error-correcting-codes/src/lib/libecc/tests/qa_encoder_convolutional_ic1_ic1.cc
===================================================================
--- 
gnuradio/branches/developers/eb/mb/gr-error-correcting-codes/src/lib/libecc/tests/qa_encoder_convolutional_ic1_ic1.cc
       2006-08-23 02:18:16 UTC (rev 3380)
+++ 
gnuradio/branches/developers/eb/mb/gr-error-correcting-codes/src/lib/libecc/tests/qa_encoder_convolutional_ic1_ic1.cc
       2006-08-23 02:38:53 UTC (rev 3381)
@@ -270,7 +270,7 @@
 // start state is 0, same feedback, no termination
 
 const static int t2_code_generator[] = {1, 0, 0, 1, 5, 6};
-const static size_t t2_code_feedback[] = {0, 0, 0, 0, 7, 7};
+const static int t2_code_feedback[] = {0, 0, 0, 0, 7, 7};
 const static int t2_encode_soai = 1;
 
 const static char t2_in_0[] =
@@ -1285,7 +1285,7 @@
 // start state is 0, same feedback, no termination
 
 const static int t25_code_generator[] = {1, 0, 0, 1, 5, 6};
-const static size_t t25_code_feedback[] = {0, 0, 0, 0, 7, 7};
+const static int t25_code_feedback[] = {0, 0, 0, 0, 7, 7};
 const static int t25_encode_soai = 1;
 
 const static char t25_in_0[] =


Property changes on: gnuradio/branches/developers/eb/mb/gr-trellis/Makefile.am
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/doc/Makefile.am
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/doc/make_numbered_listing.py
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/doc/test_tcm.py
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/Makefile.am
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/Makefile.am
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/base.cc
===================================================================
--- gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/base.cc       
2006-08-23 02:18:16 UTC (rev 3380)
+++ gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/base.cc       
2006-08-23 02:38:53 UTC (rev 3381)
@@ -1,92 +1,92 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2002 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * GNU Radio 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING.  If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <cstdio>
-#include <stdexcept>
-#include <cmath>
-#include "base.h"
-
-
-bool dec2base(unsigned int num, int base, std::vector<int> &s)
-{
-  int l = s.size();
-  unsigned int n=num;
-  for(int i=0;i<l;i++) {
-    s[l-i-1] = n % base; //MSB first
-    n /= base;
-  }
-  if(n!=0) {
-    printf("Number %d requires more than %d digits.",num,l);
-    return false;
-  }
-  else
-    return true;
-}
-
-
-unsigned int base2dec(const std::vector<int> &s, int base)
-{
-  int l = s.size();
-  unsigned int num=0;
-  for(int i=0;i<l;i++)
-      num=num*base+s[i];
-  return num;
-}
-
-
-bool dec2bases(unsigned int num, const std::vector<int> &bases, 
std::vector<int> &s)
-{
-  int l = s.size();
-  unsigned int n=num;
-  for(int i=0;i<l;i++) {
-      s[l-i-1] = n % bases[l-i-1];
-      n /= bases[l-i-1];
-  }
-  if(n!=0) {
-    printf("Number %d requires more than %d digits.",num,l);
-    return false;
-  }
-  else
-    return true;
-}
-
-
-
-unsigned int bases2dec(const std::vector<int> &s, const std::vector<int> 
&bases)
-{
-  int l = s.size();
-  unsigned int num=0;
-  for(int i=0;i<l;i++)
-      num = num * bases[i] + s[i];
-  return num;
-}
-
-
-
-
-
-
-
-
-
-
-
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GNU Radio 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <cstdio>
+#include <stdexcept>
+#include <cmath>
+#include "base.h"
+
+
+bool dec2base(unsigned int num, int base, std::vector<int> &s)
+{
+  int l = s.size();
+  unsigned int n=num;
+  for(int i=0;i<l;i++) {
+    s[l-i-1] = n % base; //MSB first
+    n /= base;
+  }
+  if(n!=0) {
+    printf("Number %d requires more than %d digits.",num,l);
+    return false;
+  }
+  else
+    return true;
+}
+
+
+unsigned int base2dec(const std::vector<int> &s, int base)
+{
+  int l = s.size();
+  unsigned int num=0;
+  for(int i=0;i<l;i++)
+      num=num*base+s[i];
+  return num;
+}
+
+
+bool dec2bases(unsigned int num, const std::vector<int> &bases, 
std::vector<int> &s)
+{
+  int l = s.size();
+  unsigned int n=num;
+  for(int i=0;i<l;i++) {
+      s[l-i-1] = n % bases[l-i-1];
+      n /= bases[l-i-1];
+  }
+  if(n!=0) {
+    printf("Number %d requires more than %d digits.",num,l);
+    return false;
+  }
+  else
+    return true;
+}
+
+
+
+unsigned int bases2dec(const std::vector<int> &s, const std::vector<int> 
&bases)
+{
+  int l = s.size();
+  unsigned int num=0;
+  for(int i=0;i<l;i++)
+      num = num * bases[i] + s[i];
+  return num;
+}
+
+
+
+
+
+
+
+
+
+
+


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/base.cc
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/base.h
===================================================================
--- gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/base.h        
2006-08-23 02:18:16 UTC (rev 3380)
+++ gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/base.h        
2006-08-23 02:38:53 UTC (rev 3381)
@@ -1,38 +1,38 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2002 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * GNU Radio 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING.  If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef INCLUDED_TRELLIS_BASE_H
-#define INCLUDED_TRELLIS_BASE_H
-
-#include <vector>
-
-/*!
- * \brief  change base
- */
-
-
-bool dec2base(unsigned int num, int base, std::vector<int> &s);
-bool dec2bases(unsigned int num, const std::vector<int> &bases, 
std::vector<int> &s);
-unsigned int base2dec(const std::vector<int> &s, int base);
-unsigned int bases2dec(const std::vector<int> &s, const std::vector<int> 
&bases);
-
-#endif
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GNU Radio 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef INCLUDED_TRELLIS_BASE_H
+#define INCLUDED_TRELLIS_BASE_H
+
+#include <vector>
+
+/*!
+ * \brief  change base
+ */
+
+
+bool dec2base(unsigned int num, int base, std::vector<int> &s);
+bool dec2bases(unsigned int num, const std::vector<int> &bases, 
std::vector<int> &s);
+unsigned int base2dec(const std::vector<int> &s, int base);
+unsigned int bases2dec(const std::vector<int> &s, const std::vector<int> 
&bases);
+
+#endif


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/base.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/build_utils.py
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/build_utils_codes.py
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/fsm.cc
===================================================================
--- gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/fsm.cc        
2006-08-23 02:18:16 UTC (rev 3380)
+++ gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/fsm.cc        
2006-08-23 02:38:53 UTC (rev 3381)
@@ -1,323 +1,323 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2002 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * GNU Radio 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING.  If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <cstdio>
-#include <stdexcept>
-#include <cmath>
-#include "base.h"
-#include "fsm.h"
-
-
-fsm::fsm()
-{
-  d_I=0;
-  d_S=0;
-  d_O=0;
-  d_NS.resize(0);
-  d_OS.resize(0);
-  d_PS.resize(0);
-  d_PI.resize(0);
-  d_TMi.resize(0);
-  d_TMl.resize(0);
-}
-
-fsm::fsm(const fsm &FSM)
-{
-  d_I=FSM.I();
-  d_S=FSM.S();
-  d_O=FSM.O();
-  d_NS=FSM.NS();
-  d_OS=FSM.OS();
-  d_PS=FSM.PS();
-  d_PI=FSM.PI();
-  d_TMi=FSM.TMi();
-  d_TMl=FSM.TMl();
-}
-
-fsm::fsm(int I, int S, int O, const std::vector<int> &NS, const 
std::vector<int> &OS)
-{
-  d_I=I;
-  d_S=S;
-  d_O=O;
-  d_NS=NS;
-  d_OS=OS;
- 
-  generate_PS_PI();
-  generate_TM();
-}
-
-//######################################################################
-//# Read an FSM specification from a file.
-//# Format (hopefully will become more flexible in the future...):
-//# I S O (in the first line)
-//# blank line
-//# Next state matrix (S lines, each with I integers separated by spaces)
-//# blank line
-//# output symbol matrix (S lines, each with I integers separated by spaces)
-//# optional comments
-//######################################################################
-fsm::fsm(const char *name) 
-{
-  FILE *fsmfile;
-
-  if((fsmfile=fopen(name,"r"))==NULL) 
-    throw std::runtime_error ("fsm::fsm(const char *name): file open error\n");
-    //printf("file open error in fsm()\n");
-  
-  fscanf(fsmfile,"%d %d %d\n",&d_I,&d_S,&d_O);
-  d_NS.resize(d_I*d_S);
-  d_OS.resize(d_I*d_S);
-
-  for(int i=0;i<d_S;i++) {
-    for(int j=0;j<d_I;j++) fscanf(fsmfile,"%d",&(d_NS[i*d_I+j]));
-  }
-  for(int i=0;i<d_S;i++) {
-    for(int j=0;j<d_I;j++) fscanf(fsmfile,"%d",&(d_OS[i*d_I+j]));
-  }
- 
-  generate_PS_PI();
-  generate_TM();
-}
-
-
-
-
-//######################################################################
-//# Automatically generate the FSM from the generator matrix
-//# of a (n,k) binary convolutional code
-//######################################################################
-fsm::fsm(int k, int n, const std::vector<int> &G)
-{
-
-  // calculate maximum memory requirements for each input stream
-  std::vector<int> max_mem_x(k,-1);
-  int max_mem = -1;
-  for(int i=0;i<k;i++) {
-    for(int j=0;j<n;j++) {
-      int mem = -1;
-      if(G[i*n+j]!=0)
-        mem=(int)(log(G[i*n+j])/log(2.0));
-      if(mem>max_mem_x[i])
-        max_mem_x[i]=mem;
-      if(mem>max_mem)
-        max_mem=mem;
-    }
-  }
-  
-//printf("max_mem_x\n");
-//for(int j=0;j<max_mem_x.size();j++) printf("%d ",max_mem_x[j]); printf("\n");
-
-  // calculate total memory requirements to set S
-  int sum_max_mem = 0;
-  for(int i=0;i<k;i++)
-    sum_max_mem += max_mem_x[i];
-
-//printf("sum_max_mem = %d\n",sum_max_mem);
-
-  d_I=1<<k;
-  d_S=1<<sum_max_mem;
-  d_O=1<<n;
- 
-  // binary representation of the G matrix
-  std::vector<std::vector<int> > Gb(k*n);
-  for(int j=0;j<k*n;j++) {
-    Gb[j].resize(max_mem+1);
-    dec2base(G[j],2,Gb[j]);
-//printf("Gb\n");
-//for(int m=0;m<Gb[j].size();m++) printf("%d ",Gb[j][m]); printf("\n");
-  }
-
-  // alphabet size of each shift register 
-  std::vector<int> bases_x(k);
-  for(int j=0;j<k ;j++) 
-    bases_x[j] = 1 << max_mem_x[j];
-//printf("bases_x\n");
-//for(int j=0;j<max_mem_x.size();j++) printf("%d ",max_mem_x[j]); printf("\n");
-
-  d_NS.resize(d_I*d_S);
-  d_OS.resize(d_I*d_S);
-
-  std::vector<int> sx(k);
-  std::vector<int> nsx(k);
-  std::vector<int> tx(k);
-  std::vector<std::vector<int> > tb(k);
-  for(int j=0;j<k;j++)
-    tb[j].resize(max_mem+1);
-  std::vector<int> inb(k);
-  std::vector<int> outb(n);
-
-
-  for(int s=0;s<d_S;s++) {
-    dec2bases(s,bases_x,sx); // split s into k values, each representing on of 
the k shift registers
-//printf("state = %d \nstates = ",s);
-//for(int j=0;j<sx.size();j++) printf("%d ",sx[j]); printf("\n");
-    for(int i=0;i<d_I;i++) {
-      dec2base(i,2,inb); // input in binary
-//printf("input = %d \ninputs = ",i);
-//for(int j=0;j<inb.size();j++) printf("%d ",inb[j]); printf("\n");
-
-      // evaluate next state
-      for(int j=0;j<k;j++)
-        nsx[j] = (inb[j]*bases_x[j]+sx[j])/2; // next state (for each shift 
register) MSB first
-      d_NS[s*d_I+i]=bases2dec(nsx,bases_x); // collect all values into the new 
state
-
-      // evaluate transitions
-      for(int j=0;j<k;j++)
-        tx[j] = inb[j]*bases_x[j]+sx[j]; // transition (for each shift 
register)MSB first
-      for(int j=0;j<k;j++) {
-        dec2base(tx[j],2,tb[j]); // transition in binary
-//printf("transition = %d \ntransitions = ",tx[j]);
-//for(int m=0;m<tb[j].size();m++) printf("%d ",tb[j][m]); printf("\n");
-      }
-
-      // evaluate outputs
-      for(int nn=0;nn<n;nn++) {
-        outb[nn] = 0;
-        for(int j=0;j<k;j++) {
-          for(int m=0;m<max_mem+1;m++)
-            outb[nn] = (outb[nn] + Gb[j*n+nn][m]*tb[j][m]) % 2; // careful: 
polynomial 1+D ir represented as 110, not as 011
-//printf("output %d equals %d\n",nn,outb[nn]);
-        }
-      }
-      d_OS[s*d_I+i] = base2dec(outb,2);
-    }
-  }
-
-  generate_PS_PI();
-  generate_TM();
-}
-
-
-
-
-//######################################################################
-//# Automatically generate an FSM specification describing the 
-//# ISI for a channel
-//# of length ch_length and a modulation of size mod_size
-//######################################################################
-fsm::fsm(int mod_size, int ch_length)
-{
-  d_I=mod_size;
-  d_S=(int) (pow(1.0*d_I,1.0*ch_length-1)+0.5);
-  d_O=d_S*d_I;
-
-  d_NS.resize(d_I*d_S);
-  d_OS.resize(d_I*d_S);
-
-  for(int s=0;s<d_S;s++) {
-    for(int i=0;i<d_I;i++) { 
-      int t=i*d_S+s;
-      d_NS[s*d_I+i] = t/d_I;
-      d_OS[s*d_I+i] = t;
-    }
-  }
- 
-  generate_PS_PI();
-  generate_TM();
-}
-
-
-//######################################################################
-//# generate the PS and PI tables for later use
-//######################################################################
-void fsm::generate_PS_PI()
-{
-  d_PS.resize(d_I*d_S);
-  d_PI.resize(d_I*d_S);
-
-  for(int i=0;i<d_S;i++) {
-    int j=0;
-    for(int ii=0;ii<d_S;ii++) for(int jj=0;jj<d_I;jj++) {
-      if(d_NS[ii*d_I+jj]!=i) continue;
-      d_PS[i*d_I+j]=ii;
-      d_PI[i*d_I+j]=jj;
-      j++;
-    }
-  }
-}
-
-
-//######################################################################
-//# generate the termination matrices TMl and TMi for later use
-//######################################################################
-void fsm::generate_TM()
-{
-  d_TMi.resize(d_S*d_S);
-  d_TMl.resize(d_S*d_S);
-
-  for(int i=0;i<d_S*d_S;i++) {
-    d_TMi[i] = -1; // no meaning
-    d_TMl[i] = d_S; //infinity: you need at most S-1 steps
-    if (i/d_S == i%d_S)
-      d_TMl[i] = 0;
-  }
-
-  for(int s=0;s<d_S;s++) {
-    bool done = false;
-    int attempts = 0;
-    while (done == false && attempts < d_S-1) {
-      done = find_es(s);
-      attempts ++;
-    }
-    if (done == false)
-      //throw std::runtime_error ("fsm::generate_TM(): FSM appears to be 
disconnected\n");
-      printf("fsm::generate_TM(): FSM appears to be disconnected\n");
-  }
-}
-
-
-// find a path from any state to the ending state "es"
-bool fsm::find_es(int es)
-{
-  bool done = true;
-  for(int s=0;s<d_S;s++) {
-    if(d_TMl[s*d_S+es] < d_S) 
-      continue;
-    int minl=d_S;
-    int mini=-1;
-    for(int i=0;i<d_I;i++) {
-      if( 1 + d_TMl[d_NS[s*d_I+i]*d_S+es] < minl) {
-        minl = 1 + d_TMl[d_NS[s*d_I+i]*d_S+es];
-        mini = i;
-      }
-    }
-    if (mini != -1) {
-      d_TMl[s*d_S+es]=minl;
-      d_TMi[s*d_S+es]=mini;
-    }
-    else
-      done = false;
-  }
-  return done;
-}
-
-
-
-
-
-
-
-
-
-
-
-
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GNU Radio 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <cstdio>
+#include <stdexcept>
+#include <cmath>
+#include "base.h"
+#include "fsm.h"
+
+
+fsm::fsm()
+{
+  d_I=0;
+  d_S=0;
+  d_O=0;
+  d_NS.resize(0);
+  d_OS.resize(0);
+  d_PS.resize(0);
+  d_PI.resize(0);
+  d_TMi.resize(0);
+  d_TMl.resize(0);
+}
+
+fsm::fsm(const fsm &FSM)
+{
+  d_I=FSM.I();
+  d_S=FSM.S();
+  d_O=FSM.O();
+  d_NS=FSM.NS();
+  d_OS=FSM.OS();
+  d_PS=FSM.PS();
+  d_PI=FSM.PI();
+  d_TMi=FSM.TMi();
+  d_TMl=FSM.TMl();
+}
+
+fsm::fsm(int I, int S, int O, const std::vector<int> &NS, const 
std::vector<int> &OS)
+{
+  d_I=I;
+  d_S=S;
+  d_O=O;
+  d_NS=NS;
+  d_OS=OS;
+ 
+  generate_PS_PI();
+  generate_TM();
+}
+
+//######################################################################
+//# Read an FSM specification from a file.
+//# Format (hopefully will become more flexible in the future...):
+//# I S O (in the first line)
+//# blank line
+//# Next state matrix (S lines, each with I integers separated by spaces)
+//# blank line
+//# output symbol matrix (S lines, each with I integers separated by spaces)
+//# optional comments
+//######################################################################
+fsm::fsm(const char *name) 
+{
+  FILE *fsmfile;
+
+  if((fsmfile=fopen(name,"r"))==NULL) 
+    throw std::runtime_error ("fsm::fsm(const char *name): file open error\n");
+    //printf("file open error in fsm()\n");
+  
+  fscanf(fsmfile,"%d %d %d\n",&d_I,&d_S,&d_O);
+  d_NS.resize(d_I*d_S);
+  d_OS.resize(d_I*d_S);
+
+  for(int i=0;i<d_S;i++) {
+    for(int j=0;j<d_I;j++) fscanf(fsmfile,"%d",&(d_NS[i*d_I+j]));
+  }
+  for(int i=0;i<d_S;i++) {
+    for(int j=0;j<d_I;j++) fscanf(fsmfile,"%d",&(d_OS[i*d_I+j]));
+  }
+ 
+  generate_PS_PI();
+  generate_TM();
+}
+
+
+
+
+//######################################################################
+//# Automatically generate the FSM from the generator matrix
+//# of a (n,k) binary convolutional code
+//######################################################################
+fsm::fsm(int k, int n, const std::vector<int> &G)
+{
+
+  // calculate maximum memory requirements for each input stream
+  std::vector<int> max_mem_x(k,-1);
+  int max_mem = -1;
+  for(int i=0;i<k;i++) {
+    for(int j=0;j<n;j++) {
+      int mem = -1;
+      if(G[i*n+j]!=0)
+        mem=(int)(log(G[i*n+j])/log(2.0));
+      if(mem>max_mem_x[i])
+        max_mem_x[i]=mem;
+      if(mem>max_mem)
+        max_mem=mem;
+    }
+  }
+  
+//printf("max_mem_x\n");
+//for(int j=0;j<max_mem_x.size();j++) printf("%d ",max_mem_x[j]); printf("\n");
+
+  // calculate total memory requirements to set S
+  int sum_max_mem = 0;
+  for(int i=0;i<k;i++)
+    sum_max_mem += max_mem_x[i];
+
+//printf("sum_max_mem = %d\n",sum_max_mem);
+
+  d_I=1<<k;
+  d_S=1<<sum_max_mem;
+  d_O=1<<n;
+ 
+  // binary representation of the G matrix
+  std::vector<std::vector<int> > Gb(k*n);
+  for(int j=0;j<k*n;j++) {
+    Gb[j].resize(max_mem+1);
+    dec2base(G[j],2,Gb[j]);
+//printf("Gb\n");
+//for(int m=0;m<Gb[j].size();m++) printf("%d ",Gb[j][m]); printf("\n");
+  }
+
+  // alphabet size of each shift register 
+  std::vector<int> bases_x(k);
+  for(int j=0;j<k ;j++) 
+    bases_x[j] = 1 << max_mem_x[j];
+//printf("bases_x\n");
+//for(int j=0;j<max_mem_x.size();j++) printf("%d ",max_mem_x[j]); printf("\n");
+
+  d_NS.resize(d_I*d_S);
+  d_OS.resize(d_I*d_S);
+
+  std::vector<int> sx(k);
+  std::vector<int> nsx(k);
+  std::vector<int> tx(k);
+  std::vector<std::vector<int> > tb(k);
+  for(int j=0;j<k;j++)
+    tb[j].resize(max_mem+1);
+  std::vector<int> inb(k);
+  std::vector<int> outb(n);
+
+
+  for(int s=0;s<d_S;s++) {
+    dec2bases(s,bases_x,sx); // split s into k values, each representing on of 
the k shift registers
+//printf("state = %d \nstates = ",s);
+//for(int j=0;j<sx.size();j++) printf("%d ",sx[j]); printf("\n");
+    for(int i=0;i<d_I;i++) {
+      dec2base(i,2,inb); // input in binary
+//printf("input = %d \ninputs = ",i);
+//for(int j=0;j<inb.size();j++) printf("%d ",inb[j]); printf("\n");
+
+      // evaluate next state
+      for(int j=0;j<k;j++)
+        nsx[j] = (inb[j]*bases_x[j]+sx[j])/2; // next state (for each shift 
register) MSB first
+      d_NS[s*d_I+i]=bases2dec(nsx,bases_x); // collect all values into the new 
state
+
+      // evaluate transitions
+      for(int j=0;j<k;j++)
+        tx[j] = inb[j]*bases_x[j]+sx[j]; // transition (for each shift 
register)MSB first
+      for(int j=0;j<k;j++) {
+        dec2base(tx[j],2,tb[j]); // transition in binary
+//printf("transition = %d \ntransitions = ",tx[j]);
+//for(int m=0;m<tb[j].size();m++) printf("%d ",tb[j][m]); printf("\n");
+      }
+
+      // evaluate outputs
+      for(int nn=0;nn<n;nn++) {
+        outb[nn] = 0;
+        for(int j=0;j<k;j++) {
+          for(int m=0;m<max_mem+1;m++)
+            outb[nn] = (outb[nn] + Gb[j*n+nn][m]*tb[j][m]) % 2; // careful: 
polynomial 1+D ir represented as 110, not as 011
+//printf("output %d equals %d\n",nn,outb[nn]);
+        }
+      }
+      d_OS[s*d_I+i] = base2dec(outb,2);
+    }
+  }
+
+  generate_PS_PI();
+  generate_TM();
+}
+
+
+
+
+//######################################################################
+//# Automatically generate an FSM specification describing the 
+//# ISI for a channel
+//# of length ch_length and a modulation of size mod_size
+//######################################################################
+fsm::fsm(int mod_size, int ch_length)
+{
+  d_I=mod_size;
+  d_S=(int) (pow(1.0*d_I,1.0*ch_length-1)+0.5);
+  d_O=d_S*d_I;
+
+  d_NS.resize(d_I*d_S);
+  d_OS.resize(d_I*d_S);
+
+  for(int s=0;s<d_S;s++) {
+    for(int i=0;i<d_I;i++) { 
+      int t=i*d_S+s;
+      d_NS[s*d_I+i] = t/d_I;
+      d_OS[s*d_I+i] = t;
+    }
+  }
+ 
+  generate_PS_PI();
+  generate_TM();
+}
+
+
+//######################################################################
+//# generate the PS and PI tables for later use
+//######################################################################
+void fsm::generate_PS_PI()
+{
+  d_PS.resize(d_I*d_S);
+  d_PI.resize(d_I*d_S);
+
+  for(int i=0;i<d_S;i++) {
+    int j=0;
+    for(int ii=0;ii<d_S;ii++) for(int jj=0;jj<d_I;jj++) {
+      if(d_NS[ii*d_I+jj]!=i) continue;
+      d_PS[i*d_I+j]=ii;
+      d_PI[i*d_I+j]=jj;
+      j++;
+    }
+  }
+}
+
+
+//######################################################################
+//# generate the termination matrices TMl and TMi for later use
+//######################################################################
+void fsm::generate_TM()
+{
+  d_TMi.resize(d_S*d_S);
+  d_TMl.resize(d_S*d_S);
+
+  for(int i=0;i<d_S*d_S;i++) {
+    d_TMi[i] = -1; // no meaning
+    d_TMl[i] = d_S; //infinity: you need at most S-1 steps
+    if (i/d_S == i%d_S)
+      d_TMl[i] = 0;
+  }
+
+  for(int s=0;s<d_S;s++) {
+    bool done = false;
+    int attempts = 0;
+    while (done == false && attempts < d_S-1) {
+      done = find_es(s);
+      attempts ++;
+    }
+    if (done == false)
+      //throw std::runtime_error ("fsm::generate_TM(): FSM appears to be 
disconnected\n");
+      printf("fsm::generate_TM(): FSM appears to be disconnected\n");
+  }
+}
+
+
+// find a path from any state to the ending state "es"
+bool fsm::find_es(int es)
+{
+  bool done = true;
+  for(int s=0;s<d_S;s++) {
+    if(d_TMl[s*d_S+es] < d_S) 
+      continue;
+    int minl=d_S;
+    int mini=-1;
+    for(int i=0;i<d_I;i++) {
+      if( 1 + d_TMl[d_NS[s*d_I+i]*d_S+es] < minl) {
+        minl = 1 + d_TMl[d_NS[s*d_I+i]*d_S+es];
+        mini = i;
+      }
+    }
+    if (mini != -1) {
+      d_TMl[s*d_S+es]=minl;
+      d_TMi[s*d_S+es]=mini;
+    }
+    else
+      done = false;
+  }
+  return done;
+}
+
+
+
+
+
+
+
+
+
+
+
+


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/fsm.cc
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/fsm.h
===================================================================
--- gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/fsm.h 2006-08-23 
02:18:16 UTC (rev 3380)
+++ gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/fsm.h 2006-08-23 
02:38:53 UTC (rev 3381)
@@ -1,63 +1,63 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2002 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * GNU Radio 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING.  If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef INCLUDED_TRELLIS_FSM_H
-#define INCLUDED_TRELLIS_FSM_H
-
-#include <vector>
-
-/*!
- * \brief  FSM class
- */
-class fsm {
-private:
-  int d_I;
-  int d_S;
-  int d_O;
-  std::vector<int> d_NS;
-  std::vector<int> d_OS;
-  std::vector<int> d_PS;
-  std::vector<int> d_PI;
-  std::vector<int> d_TMi;
-  std::vector<int> d_TMl;
-  void generate_PS_PI ();
-  void generate_TM ();
-  bool find_es(int es);
-public:
-  fsm();
-  fsm(const fsm &FSM);
-  fsm(int I, int S, int O, const std::vector<int> &NS, const std::vector<int> 
&OS);
-  fsm(const char *name);
-  fsm(int k, int n, const std::vector<int> &G);
-  fsm(int mod_size, int ch_length);
-  int I () const { return d_I; }
-  int S () const { return d_S; }
-  int O () const { return d_O; }
-  const std::vector<int> & NS () const { return d_NS; }
-  const std::vector<int> & OS () const { return d_OS; }
-  const std::vector<int> & PS () const { return d_PS; }
-  const std::vector<int> & PI () const { return d_PI; }
-  const std::vector<int> & TMi () const { return d_TMi; }
-  const std::vector<int> & TMl () const { return d_TMl; }
-};
-
-#endif
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GNU Radio 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef INCLUDED_TRELLIS_FSM_H
+#define INCLUDED_TRELLIS_FSM_H
+
+#include <vector>
+
+/*!
+ * \brief  FSM class
+ */
+class fsm {
+private:
+  int d_I;
+  int d_S;
+  int d_O;
+  std::vector<int> d_NS;
+  std::vector<int> d_OS;
+  std::vector<int> d_PS;
+  std::vector<int> d_PI;
+  std::vector<int> d_TMi;
+  std::vector<int> d_TMl;
+  void generate_PS_PI ();
+  void generate_TM ();
+  bool find_es(int es);
+public:
+  fsm();
+  fsm(const fsm &FSM);
+  fsm(int I, int S, int O, const std::vector<int> &NS, const std::vector<int> 
&OS);
+  fsm(const char *name);
+  fsm(int k, int n, const std::vector<int> &G);
+  fsm(int mod_size, int ch_length);
+  int I () const { return d_I; }
+  int S () const { return d_S; }
+  int O () const { return d_O; }
+  const std::vector<int> & NS () const { return d_NS; }
+  const std::vector<int> & OS () const { return d_OS; }
+  const std::vector<int> & PS () const { return d_PS; }
+  const std::vector<int> & PI () const { return d_PI; }
+  const std::vector<int> & TMi () const { return d_TMi; }
+  const std::vector<int> & TMl () const { return d_TMl; }
+};
+
+#endif


Property changes on: gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/fsm.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/generate_all.py
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/generate_common.py
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/interleaver.cc
===================================================================
--- gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/interleaver.cc        
2006-08-23 02:18:16 UTC (rev 3380)
+++ gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/interleaver.cc        
2006-08-23 02:38:53 UTC (rev 3381)
@@ -1,108 +1,108 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2002 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * GNU Radio 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING.  If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <cstdlib> 
-#include <cstdio>
-#include <iostream>
-#include <stdexcept>
-#include <cmath>
-#include "quicksort_index.h"
-#include "interleaver.h"
-
-interleaver::interleaver()
-{
-  d_K=0;
-  d_INTER.resize(0);
-  d_DEINTER.resize(0);
-}
-
-interleaver::interleaver(const interleaver &INTERLEAVER)
-{
-  d_K=INTERLEAVER.K();
-  d_INTER=INTERLEAVER.INTER();
-  d_DEINTER=INTERLEAVER.DEINTER();
-}
-
-interleaver::interleaver(int K, const std::vector<int> &INTER)
-{
-  d_K=K;
-  d_INTER=INTER;
-  d_DEINTER.resize(d_K);
-  
-  // generate DEINTER table
-  for(int i=0;i<d_K;i++) {
-    d_DEINTER[d_INTER[i]]=i;
-  }
-}
-
-//######################################################################
-//# Read an INTERLEAVER specification from a file.
-//# Format (hopefully will become more flexible in the future...):
-//# K
-//# blank line
-//# list of space separated K integers from 0 to K-1 in appropriate order
-//# optional comments
-//######################################################################
-interleaver::interleaver(const char *name) 
-{
-  FILE *interleaverfile;
-
-  if((interleaverfile=fopen(name,"r"))==NULL) 
-    throw std::runtime_error ("file open error in interleaver()");
-    //printf("file open error in interleaver()\n");
-  
-  fscanf(interleaverfile,"%d\n",&d_K);
-  d_INTER.resize(d_K);
-  d_DEINTER.resize(d_K);
-
-  for(int i=0;i<d_K;i++) fscanf(interleaverfile,"%d",&(d_INTER[i]));
-  
-  // generate DEINTER table
-  for(int i=0;i<d_K;i++) {
-    d_DEINTER[d_INTER[i]]=i;
-  }
-}
-
-//######################################################################
-//# Generate a random interleaver
-//######################################################################
-interleaver::interleaver(int K, unsigned int seed)
-{
-  d_K=K;
-  d_INTER.resize(d_K);
-  d_DEINTER.resize(d_K);
-
-  srand(seed); 
-  std::vector<int> tmp(d_K);
-  for(int i=0;i<d_K;i++) {
-    d_INTER[i]=i;
-    tmp[i] = rand(); 
-  }
-  //quicksort_index <int> (tmp,d_INTER,0,d_K-1); got to resolve this...
-  quicksort_index1 (tmp,d_INTER,0,d_K-1);
-
-  // generate DEINTER table
-  for(int i=0;i<d_K;i++) {
-    d_DEINTER[d_INTER[i]]=i;
-  }
-}
-
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GNU Radio 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <cstdlib> 
+#include <cstdio>
+#include <iostream>
+#include <stdexcept>
+#include <cmath>
+#include "quicksort_index.h"
+#include "interleaver.h"
+
+interleaver::interleaver()
+{
+  d_K=0;
+  d_INTER.resize(0);
+  d_DEINTER.resize(0);
+}
+
+interleaver::interleaver(const interleaver &INTERLEAVER)
+{
+  d_K=INTERLEAVER.K();
+  d_INTER=INTERLEAVER.INTER();
+  d_DEINTER=INTERLEAVER.DEINTER();
+}
+
+interleaver::interleaver(int K, const std::vector<int> &INTER)
+{
+  d_K=K;
+  d_INTER=INTER;
+  d_DEINTER.resize(d_K);
+  
+  // generate DEINTER table
+  for(int i=0;i<d_K;i++) {
+    d_DEINTER[d_INTER[i]]=i;
+  }
+}
+
+//######################################################################
+//# Read an INTERLEAVER specification from a file.
+//# Format (hopefully will become more flexible in the future...):
+//# K
+//# blank line
+//# list of space separated K integers from 0 to K-1 in appropriate order
+//# optional comments
+//######################################################################
+interleaver::interleaver(const char *name) 
+{
+  FILE *interleaverfile;
+
+  if((interleaverfile=fopen(name,"r"))==NULL) 
+    throw std::runtime_error ("file open error in interleaver()");
+    //printf("file open error in interleaver()\n");
+  
+  fscanf(interleaverfile,"%d\n",&d_K);
+  d_INTER.resize(d_K);
+  d_DEINTER.resize(d_K);
+
+  for(int i=0;i<d_K;i++) fscanf(interleaverfile,"%d",&(d_INTER[i]));
+  
+  // generate DEINTER table
+  for(int i=0;i<d_K;i++) {
+    d_DEINTER[d_INTER[i]]=i;
+  }
+}
+
+//######################################################################
+//# Generate a random interleaver
+//######################################################################
+interleaver::interleaver(int K, unsigned int seed)
+{
+  d_K=K;
+  d_INTER.resize(d_K);
+  d_DEINTER.resize(d_K);
+
+  srand(seed); 
+  std::vector<int> tmp(d_K);
+  for(int i=0;i<d_K;i++) {
+    d_INTER[i]=i;
+    tmp[i] = rand(); 
+  }
+  //quicksort_index <int> (tmp,d_INTER,0,d_K-1); got to resolve this...
+  quicksort_index1 (tmp,d_INTER,0,d_K-1);
+
+  // generate DEINTER table
+  for(int i=0;i<d_K;i++) {
+    d_DEINTER[d_INTER[i]]=i;
+  }
+}
+


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/interleaver.cc
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/interleaver.h
===================================================================
--- gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/interleaver.h 
2006-08-23 02:18:16 UTC (rev 3380)
+++ gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/interleaver.h 
2006-08-23 02:38:53 UTC (rev 3381)
@@ -1,47 +1,47 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2002 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * GNU Radio 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING.  If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef INCLUDED_TRELLIS_INTERLEAVER_H
-#define INCLUDED_TRELLIS_INTERLEAVER_H
-
-#include <vector>
-
-/*!
- * \brief  INTERLEAVER class
- */
-class interleaver {
-private:
-  int d_K;
-  std::vector<int> d_INTER;
-  std::vector<int> d_DEINTER;
-public:
-  interleaver();
-  interleaver(const interleaver & INTERLEAVER);
-  interleaver(int K, const std::vector<int> & INTER);
-  interleaver(const char *name);
-  interleaver(int K, unsigned int seed);
-  int K () const { return d_K; }
-  const std::vector<int> & INTER () const { return d_INTER; }
-  const std::vector<int> & DEINTER () const { return d_DEINTER; }
-};
-
-#endif
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GNU Radio 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef INCLUDED_TRELLIS_INTERLEAVER_H
+#define INCLUDED_TRELLIS_INTERLEAVER_H
+
+#include <vector>
+
+/*!
+ * \brief  INTERLEAVER class
+ */
+class interleaver {
+private:
+  int d_K;
+  std::vector<int> d_INTER;
+  std::vector<int> d_DEINTER;
+public:
+  interleaver();
+  interleaver(const interleaver & INTERLEAVER);
+  interleaver(int K, const std::vector<int> & INTER);
+  interleaver(const char *name);
+  interleaver(int K, unsigned int seed);
+  int K () const { return d_K; }
+  const std::vector<int> & INTER () const { return d_INTER; }
+  const std::vector<int> & DEINTER () const { return d_DEINTER; }
+};
+
+#endif


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/interleaver.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/quicksort_index.cc
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/quicksort_index.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_calc_metric.cc
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_calc_metric.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_encoder_bb.cc
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_encoder_bb.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_encoder_bi.cc
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_encoder_bi.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_encoder_bs.cc
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_encoder_bs.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_encoder_ii.cc
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_encoder_ii.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_encoder_si.cc
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_encoder_si.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_encoder_ss.cc
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_encoder_ss.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_metric_type.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_metrics_c.cc
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_metrics_c.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_metrics_f.cc
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_metrics_f.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_metrics_i.cc
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_metrics_i.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_metrics_s.cc
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_metrics_s.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_permutation.cc
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_permutation.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_siso_f.cc
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_siso_f.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_siso_type.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_viterbi_b.cc
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_viterbi_b.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_viterbi_combined_b.cc
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_viterbi_combined_b.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_viterbi_combined_i.cc
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_viterbi_combined_i.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_viterbi_combined_s.cc
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_viterbi_combined_s.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_viterbi_i.cc
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_viterbi_i.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_viterbi_s.cc
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/lib/trellis_viterbi_s.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/python/Makefile.am
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/gr-trellis/src/python/qa_trellis.py
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/pmt/src/lib/generate_unv.py
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/usrp/fpga/toplevel/mrfm/mrfm.py
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: 
gnuradio/branches/developers/eb/mb/usrp/fpga/toplevel/mrfm/mrfm_fft.py
___________________________________________________________________
Name: svn:eol-style
   + native





reply via email to

[Prev in Thread] Current Thread [Next in Thread]