summaryrefslogtreecommitdiff
path: root/gr-trellis/src/lib/fsm.cc
diff options
context:
space:
mode:
authoranastas2009-03-24 13:11:18 +0000
committeranastas2009-03-24 13:11:18 +0000
commitd9a4ecedfcd777262cde70554d6e6a7b4f0657c0 (patch)
tree0ca1d4088cb31ac4e4ca7e08d9dc348aa737c417 /gr-trellis/src/lib/fsm.cc
parent4038332cdd92ab3050682e5d55a596aabb0ab806 (diff)
downloadgnuradio-d9a4ecedfcd777262cde70554d6e6a7b4f0657c0.tar.gz
gnuradio-d9a4ecedfcd777262cde70554d6e6a7b4f0657c0.tar.bz2
gnuradio-d9a4ecedfcd777262cde70554d6e6a7b4f0657c0.zip
added a radix-n fsm constructor
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10673 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gr-trellis/src/lib/fsm.cc')
-rw-r--r--gr-trellis/src/lib/fsm.cc42
1 files changed, 42 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
//######################################################################