summaryrefslogtreecommitdiff
path: root/gr-trellis/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'gr-trellis/src/lib')
-rw-r--r--gr-trellis/src/lib/fsm.cc42
-rw-r--r--gr-trellis/src/lib/fsm.h1
-rw-r--r--gr-trellis/src/lib/fsm.i1
3 files changed, 44 insertions, 0 deletions
diff --git a/gr-trellis/src/lib/fsm.cc b/gr-trellis/src/lib/fsm.cc
index 550674ad5..c65b13456 100644
--- a/gr-trellis/src/lib/fsm.cc
+++ b/gr-trellis/src/lib/fsm.cc
@@ -315,6 +315,48 @@ fsm::fsm(const fsm &FSM1, const fsm &FSM2)
}
+
+
+//######################################################################
+//# Generate a new FSM representing n stages through the original FSM
+//# AKA radix-n FSM
+//######################################################################
+fsm::fsm(const fsm &FSM, int n)
+{
+ d_I=(int) (pow(1.0*FSM.I(),1.0*n)+0.5);
+ d_S=FSM.S();
+ d_O=(int) (pow(1.0*FSM.O(),1.0*n)+0.5);
+
+ 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++ ) {
+ std::vector<int> ii(n);
+ dec2base(i,FSM.I(),ii);
+ std::vector<int> oo(n);
+ int ns=s;
+ for(int k=0;k<n;k++) {
+ oo[k]=FSM.OS()[ns*FSM.I()+ii[k]];
+ ns=FSM.NS()[ns*FSM.I()+ii[k]];
+ }
+ d_NS[s*d_I+i]=ns;
+ d_OS[s*d_I+i]=base2dec(oo,FSM.O());
+ }
+ }
+
+ generate_PS_PI();
+ generate_TM();
+}
+
+
+
+
+
+
+
+
+
//######################################################################
//# generate the PS and PI tables for later use
//######################################################################
diff --git a/gr-trellis/src/lib/fsm.h b/gr-trellis/src/lib/fsm.h
index b91dc2ab1..0a90b2cd3 100644
--- a/gr-trellis/src/lib/fsm.h
+++ b/gr-trellis/src/lib/fsm.h
@@ -52,6 +52,7 @@ public:
fsm(int mod_size, int ch_length);
fsm(int P, int M, int L);
fsm(const fsm &FSM1, const fsm &FSM2);
+ fsm(const fsm &FSM, int n);
int I () const { return d_I; }
int S () const { return d_S; }
int O () const { return d_O; }
diff --git a/gr-trellis/src/lib/fsm.i b/gr-trellis/src/lib/fsm.i
index e9db804a0..1e9c7ad8f 100644
--- a/gr-trellis/src/lib/fsm.i
+++ b/gr-trellis/src/lib/fsm.i
@@ -42,6 +42,7 @@ public:
fsm(int mod_size, int ch_length);
fsm(int P, int M, int L);
fsm(const fsm &FSM1, const fsm &FSM2);
+ fsm(const fsm &FSM, int n);
int I () const { return d_I; }
int S () const { return d_S; }
int O () const { return d_O; }