summaryrefslogtreecommitdiff
path: root/gr-trellis/src/lib/fsm.cc
diff options
context:
space:
mode:
authoranastas2007-02-04 23:09:12 +0000
committeranastas2007-02-04 23:09:12 +0000
commit82a5715de7e2ad1448ab98cd7081c8cca5b7e763 (patch)
tree47a9789c714ec5d9be790a5cc285294a527692ce /gr-trellis/src/lib/fsm.cc
parent6bfcea09c4fe36804294f96131342aa80a854311 (diff)
downloadgnuradio-82a5715de7e2ad1448ab98cd7081c8cca5b7e763.tar.gz
gnuradio-82a5715de7e2ad1448ab98cd7081c8cca5b7e763.tar.bz2
gnuradio-82a5715de7e2ad1448ab98cd7081c8cca5b7e763.zip
added support for irregular FSMs
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@4371 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gr-trellis/src/lib/fsm.cc')
-rw-r--r--gr-trellis/src/lib/fsm.cc18
1 files changed, 12 insertions, 6 deletions
diff --git a/gr-trellis/src/lib/fsm.cc b/gr-trellis/src/lib/fsm.cc
index 22f7772b3..6e3933894 100644
--- a/gr-trellis/src/lib/fsm.cc
+++ b/gr-trellis/src/lib/fsm.cc
@@ -47,7 +47,7 @@ fsm::fsm(const fsm &FSM)
d_O=FSM.O();
d_NS=FSM.NS();
d_OS=FSM.OS();
- d_PS=FSM.PS();
+ d_PS=FSM.PS(); // is this going to make a deep copy?
d_PI=FSM.PI();
d_TMi=FSM.TMi();
d_TMl=FSM.TMl();
@@ -241,17 +241,21 @@ fsm::fsm(int mod_size, int ch_length)
//######################################################################
void fsm::generate_PS_PI()
{
- d_PS.resize(d_I*d_S);
- d_PI.resize(d_I*d_S);
+ d_PS.resize(d_S);
+ d_PI.resize(d_S);
for(int i=0;i<d_S;i++) {
+ d_PS[i].resize(d_I*d_S); // max possible size
+ d_PI[i].resize(d_I*d_S);
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;
+ d_PS[i][j]=ii;
+ d_PI[i][j]=jj;
j++;
}
+ d_PS[i].resize(j);
+ d_PI[i].resize(j);
}
}
@@ -278,9 +282,11 @@ void fsm::generate_TM()
done = find_es(s);
attempts ++;
}
- if (done == false)
+ 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");
+ printf("state %d cannot be reached from all other states\n",s);
+ }
}
}