diff options
author | anastas | 2008-11-13 15:24:59 +0000 |
---|---|---|
committer | anastas | 2008-11-13 15:24:59 +0000 |
commit | d2b06e6769d7500aa06239f693de8d6cb43eff29 (patch) | |
tree | 08ec8828eb1efbffbd1b07422047ed321786f6cf /gr-trellis/src | |
parent | 4f8ca94b8375ff482f43a143c0055d583986e3bf (diff) | |
download | gnuradio-d2b06e6769d7500aa06239f693de8d6cb43eff29.tar.gz gnuradio-d2b06e6769d7500aa06239f693de8d6cb43eff29.tar.bz2 gnuradio-d2b06e6769d7500aa06239f693de8d6cb43eff29.zip |
Several updates on gr-trellis: 1) new fsm constructor for a joint trellis, 2) Corresponding fsm file examples, 3) added set_TABLE method in viterbi_combined and metrics
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@9985 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gr-trellis/src')
-rw-r--r-- | gr-trellis/src/examples/fsm_files/joint_16_16.fsm | 523 | ||||
-rw-r--r-- | gr-trellis/src/examples/fsm_files/joint_4_16.fsm | 141 | ||||
-rw-r--r-- | gr-trellis/src/lib/fsm.cc | 29 | ||||
-rw-r--r-- | gr-trellis/src/lib/fsm.h | 1 | ||||
-rw-r--r-- | gr-trellis/src/lib/fsm.i | 1 | ||||
-rw-r--r-- | gr-trellis/src/lib/trellis_metrics_X.cc.t | 5 | ||||
-rw-r--r-- | gr-trellis/src/lib/trellis_metrics_X.h.t | 1 | ||||
-rw-r--r-- | gr-trellis/src/lib/trellis_metrics_X.i.t | 1 | ||||
-rw-r--r-- | gr-trellis/src/lib/trellis_viterbi_combined_XX.cc.t | 5 | ||||
-rw-r--r-- | gr-trellis/src/lib/trellis_viterbi_combined_XX.h.t | 1 | ||||
-rw-r--r-- | gr-trellis/src/lib/trellis_viterbi_combined_XX.i.t | 1 |
11 files changed, 708 insertions, 1 deletions
diff --git a/gr-trellis/src/examples/fsm_files/joint_16_16.fsm b/gr-trellis/src/examples/fsm_files/joint_16_16.fsm new file mode 100644 index 000000000..3dae314b6 --- /dev/null +++ b/gr-trellis/src/examples/fsm_files/joint_16_16.fsm @@ -0,0 +1,523 @@ +4 256 16 + +0 8 128 136 +0 8 128 136 +1 9 129 137 +1 9 129 137 +2 10 130 138 +2 10 130 138 +3 11 131 139 +3 11 131 139 +4 12 132 140 +4 12 132 140 +5 13 133 141 +5 13 133 141 +6 14 134 142 +6 14 134 142 +7 15 135 143 +7 15 135 143 +0 8 128 136 +0 8 128 136 +1 9 129 137 +1 9 129 137 +2 10 130 138 +2 10 130 138 +3 11 131 139 +3 11 131 139 +4 12 132 140 +4 12 132 140 +5 13 133 141 +5 13 133 141 +6 14 134 142 +6 14 134 142 +7 15 135 143 +7 15 135 143 +16 24 144 152 +16 24 144 152 +17 25 145 153 +17 25 145 153 +18 26 146 154 +18 26 146 154 +19 27 147 155 +19 27 147 155 +20 28 148 156 +20 28 148 156 +21 29 149 157 +21 29 149 157 +22 30 150 158 +22 30 150 158 +23 31 151 159 +23 31 151 159 +16 24 144 152 +16 24 144 152 +17 25 145 153 +17 25 145 153 +18 26 146 154 +18 26 146 154 +19 27 147 155 +19 27 147 155 +20 28 148 156 +20 28 148 156 +21 29 149 157 +21 29 149 157 +22 30 150 158 +22 30 150 158 +23 31 151 159 +23 31 151 159 +32 40 160 168 +32 40 160 168 +33 41 161 169 +33 41 161 169 +34 42 162 170 +34 42 162 170 +35 43 163 171 +35 43 163 171 +36 44 164 172 +36 44 164 172 +37 45 165 173 +37 45 165 173 +38 46 166 174 +38 46 166 174 +39 47 167 175 +39 47 167 175 +32 40 160 168 +32 40 160 168 +33 41 161 169 +33 41 161 169 +34 42 162 170 +34 42 162 170 +35 43 163 171 +35 43 163 171 +36 44 164 172 +36 44 164 172 +37 45 165 173 +37 45 165 173 +38 46 166 174 +38 46 166 174 +39 47 167 175 +39 47 167 175 +48 56 176 184 +48 56 176 184 +49 57 177 185 +49 57 177 185 +50 58 178 186 +50 58 178 186 +51 59 179 187 +51 59 179 187 +52 60 180 188 +52 60 180 188 +53 61 181 189 +53 61 181 189 +54 62 182 190 +54 62 182 190 +55 63 183 191 +55 63 183 191 +48 56 176 184 +48 56 176 184 +49 57 177 185 +49 57 177 185 +50 58 178 186 +50 58 178 186 +51 59 179 187 +51 59 179 187 +52 60 180 188 +52 60 180 188 +53 61 181 189 +53 61 181 189 +54 62 182 190 +54 62 182 190 +55 63 183 191 +55 63 183 191 +64 72 192 200 +64 72 192 200 +65 73 193 201 +65 73 193 201 +66 74 194 202 +66 74 194 202 +67 75 195 203 +67 75 195 203 +68 76 196 204 +68 76 196 204 +69 77 197 205 +69 77 197 205 +70 78 198 206 +70 78 198 206 +71 79 199 207 +71 79 199 207 +64 72 192 200 +64 72 192 200 +65 73 193 201 +65 73 193 201 +66 74 194 202 +66 74 194 202 +67 75 195 203 +67 75 195 203 +68 76 196 204 +68 76 196 204 +69 77 197 205 +69 77 197 205 +70 78 198 206 +70 78 198 206 +71 79 199 207 +71 79 199 207 +80 88 208 216 +80 88 208 216 +81 89 209 217 +81 89 209 217 +82 90 210 218 +82 90 210 218 +83 91 211 219 +83 91 211 219 +84 92 212 220 +84 92 212 220 +85 93 213 221 +85 93 213 221 +86 94 214 222 +86 94 214 222 +87 95 215 223 +87 95 215 223 +80 88 208 216 +80 88 208 216 +81 89 209 217 +81 89 209 217 +82 90 210 218 +82 90 210 218 +83 91 211 219 +83 91 211 219 +84 92 212 220 +84 92 212 220 +85 93 213 221 +85 93 213 221 +86 94 214 222 +86 94 214 222 +87 95 215 223 +87 95 215 223 +96 104 224 232 +96 104 224 232 +97 105 225 233 +97 105 225 233 +98 106 226 234 +98 106 226 234 +99 107 227 235 +99 107 227 235 +100 108 228 236 +100 108 228 236 +101 109 229 237 +101 109 229 237 +102 110 230 238 +102 110 230 238 +103 111 231 239 +103 111 231 239 +96 104 224 232 +96 104 224 232 +97 105 225 233 +97 105 225 233 +98 106 226 234 +98 106 226 234 +99 107 227 235 +99 107 227 235 +100 108 228 236 +100 108 228 236 +101 109 229 237 +101 109 229 237 +102 110 230 238 +102 110 230 238 +103 111 231 239 +103 111 231 239 +112 120 240 248 +112 120 240 248 +113 121 241 249 +113 121 241 249 +114 122 242 250 +114 122 242 250 +115 123 243 251 +115 123 243 251 +116 124 244 252 +116 124 244 252 +117 125 245 253 +117 125 245 253 +118 126 246 254 +118 126 246 254 +119 127 247 255 +119 127 247 255 +112 120 240 248 +112 120 240 248 +113 121 241 249 +113 121 241 249 +114 122 242 250 +114 122 242 250 +115 123 243 251 +115 123 243 251 +116 124 244 252 +116 124 244 252 +117 125 245 253 +117 125 245 253 +118 126 246 254 +118 126 246 254 +119 127 247 255 +119 127 247 255 + +0 3 12 15 +3 0 15 12 +1 2 13 14 +2 1 14 13 +1 2 13 14 +2 1 14 13 +0 3 12 15 +3 0 15 12 +2 1 14 13 +1 2 13 14 +3 0 15 12 +0 3 12 15 +3 0 15 12 +0 3 12 15 +2 1 14 13 +1 2 13 14 +12 15 0 3 +15 12 3 0 +13 14 1 2 +14 13 2 1 +13 14 1 2 +14 13 2 1 +12 15 0 3 +15 12 3 0 +14 13 2 1 +13 14 1 2 +15 12 3 0 +12 15 0 3 +15 12 3 0 +12 15 0 3 +14 13 2 1 +13 14 1 2 +4 7 8 11 +7 4 11 8 +5 6 9 10 +6 5 10 9 +5 6 9 10 +6 5 10 9 +4 7 8 11 +7 4 11 8 +6 5 10 9 +5 6 9 10 +7 4 11 8 +4 7 8 11 +7 4 11 8 +4 7 8 11 +6 5 10 9 +5 6 9 10 +8 11 4 7 +11 8 7 4 +9 10 5 6 +10 9 6 5 +9 10 5 6 +10 9 6 5 +8 11 4 7 +11 8 7 4 +10 9 6 5 +9 10 5 6 +11 8 7 4 +8 11 4 7 +11 8 7 4 +8 11 4 7 +10 9 6 5 +9 10 5 6 +4 7 8 11 +7 4 11 8 +5 6 9 10 +6 5 10 9 +5 6 9 10 +6 5 10 9 +4 7 8 11 +7 4 11 8 +6 5 10 9 +5 6 9 10 +7 4 11 8 +4 7 8 11 +7 4 11 8 +4 7 8 11 +6 5 10 9 +5 6 9 10 +8 11 4 7 +11 8 7 4 +9 10 5 6 +10 9 6 5 +9 10 5 6 +10 9 6 5 +8 11 4 7 +11 8 7 4 +10 9 6 5 +9 10 5 6 +11 8 7 4 +8 11 4 7 +11 8 7 4 +8 11 4 7 +10 9 6 5 +9 10 5 6 +0 3 12 15 +3 0 15 12 +1 2 13 14 +2 1 14 13 +1 2 13 14 +2 1 14 13 +0 3 12 15 +3 0 15 12 +2 1 14 13 +1 2 13 14 +3 0 15 12 +0 3 12 15 +3 0 15 12 +0 3 12 15 +2 1 14 13 +1 2 13 14 +12 15 0 3 +15 12 3 0 +13 14 1 2 +14 13 2 1 +13 14 1 2 +14 13 2 1 +12 15 0 3 +15 12 3 0 +14 13 2 1 +13 14 1 2 +15 12 3 0 +12 15 0 3 +15 12 3 0 +12 15 0 3 +14 13 2 1 +13 14 1 2 +8 11 4 7 +11 8 7 4 +9 10 5 6 +10 9 6 5 +9 10 5 6 +10 9 6 5 +8 11 4 7 +11 8 7 4 +10 9 6 5 +9 10 5 6 +11 8 7 4 +8 11 4 7 +11 8 7 4 +8 11 4 7 +10 9 6 5 +9 10 5 6 +4 7 8 11 +7 4 11 8 +5 6 9 10 +6 5 10 9 +5 6 9 10 +6 5 10 9 +4 7 8 11 +7 4 11 8 +6 5 10 9 +5 6 9 10 +7 4 11 8 +4 7 8 11 +7 4 11 8 +4 7 8 11 +6 5 10 9 +5 6 9 10 +12 15 0 3 +15 12 3 0 +13 14 1 2 +14 13 2 1 +13 14 1 2 +14 13 2 1 +12 15 0 3 +15 12 3 0 +14 13 2 1 +13 14 1 2 +15 12 3 0 +12 15 0 3 +15 12 3 0 +12 15 0 3 +14 13 2 1 +13 14 1 2 +0 3 12 15 +3 0 15 12 +1 2 13 14 +2 1 14 13 +1 2 13 14 +2 1 14 13 +0 3 12 15 +3 0 15 12 +2 1 14 13 +1 2 13 14 +3 0 15 12 +0 3 12 15 +3 0 15 12 +0 3 12 15 +2 1 14 13 +1 2 13 14 +12 15 0 3 +15 12 3 0 +13 14 1 2 +14 13 2 1 +13 14 1 2 +14 13 2 1 +12 15 0 3 +15 12 3 0 +14 13 2 1 +13 14 1 2 +15 12 3 0 +12 15 0 3 +15 12 3 0 +12 15 0 3 +14 13 2 1 +13 14 1 2 +0 3 12 15 +3 0 15 12 +1 2 13 14 +2 1 14 13 +1 2 13 14 +2 1 14 13 +0 3 12 15 +3 0 15 12 +2 1 14 13 +1 2 13 14 +3 0 15 12 +0 3 12 15 +3 0 15 12 +0 3 12 15 +2 1 14 13 +1 2 13 14 +8 11 4 7 +11 8 7 4 +9 10 5 6 +10 9 6 5 +9 10 5 6 +10 9 6 5 +8 11 4 7 +11 8 7 4 +10 9 6 5 +9 10 5 6 +11 8 7 4 +8 11 4 7 +11 8 7 4 +8 11 4 7 +10 9 6 5 +9 10 5 6 +4 7 8 11 +7 4 11 8 +5 6 9 10 +6 5 10 9 +5 6 9 10 +6 5 10 9 +4 7 8 11 +7 4 11 8 +6 5 10 9 +5 6 9 10 +7 4 11 8 +4 7 8 11 +7 4 11 8 +4 7 8 11 +6 5 10 9 +5 6 9 10 + +This is the joint trellis of two trellises described in awgn1o2_16.fsm +It is useful for application of joint decoding... +It can be generated in python as follows: +> import trellis +> f1=trellis.fsm('awgn1o2_16.fsm') +> f=trellis.fsm(f1,f1) +> f.write_fsm_txt('joint_16_16.fsm') diff --git a/gr-trellis/src/examples/fsm_files/joint_4_16.fsm b/gr-trellis/src/examples/fsm_files/joint_4_16.fsm new file mode 100644 index 000000000..8f2cdab81 --- /dev/null +++ b/gr-trellis/src/examples/fsm_files/joint_4_16.fsm @@ -0,0 +1,141 @@ +4 64 16 + +0 8 32 40 +0 8 32 40 +1 9 33 41 +1 9 33 41 +2 10 34 42 +2 10 34 42 +3 11 35 43 +3 11 35 43 +4 12 36 44 +4 12 36 44 +5 13 37 45 +5 13 37 45 +6 14 38 46 +6 14 38 46 +7 15 39 47 +7 15 39 47 +0 8 32 40 +0 8 32 40 +1 9 33 41 +1 9 33 41 +2 10 34 42 +2 10 34 42 +3 11 35 43 +3 11 35 43 +4 12 36 44 +4 12 36 44 +5 13 37 45 +5 13 37 45 +6 14 38 46 +6 14 38 46 +7 15 39 47 +7 15 39 47 +16 24 48 56 +16 24 48 56 +17 25 49 57 +17 25 49 57 +18 26 50 58 +18 26 50 58 +19 27 51 59 +19 27 51 59 +20 28 52 60 +20 28 52 60 +21 29 53 61 +21 29 53 61 +22 30 54 62 +22 30 54 62 +23 31 55 63 +23 31 55 63 +16 24 48 56 +16 24 48 56 +17 25 49 57 +17 25 49 57 +18 26 50 58 +18 26 50 58 +19 27 51 59 +19 27 51 59 +20 28 52 60 +20 28 52 60 +21 29 53 61 +21 29 53 61 +22 30 54 62 +22 30 54 62 +23 31 55 63 +23 31 55 63 + +0 3 12 15 +3 0 15 12 +1 2 13 14 +2 1 14 13 +1 2 13 14 +2 1 14 13 +0 3 12 15 +3 0 15 12 +2 1 14 13 +1 2 13 14 +3 0 15 12 +0 3 12 15 +3 0 15 12 +0 3 12 15 +2 1 14 13 +1 2 13 14 +12 15 0 3 +15 12 3 0 +13 14 1 2 +14 13 2 1 +13 14 1 2 +14 13 2 1 +12 15 0 3 +15 12 3 0 +14 13 2 1 +13 14 1 2 +15 12 3 0 +12 15 0 3 +15 12 3 0 +12 15 0 3 +14 13 2 1 +13 14 1 2 +4 7 8 11 +7 4 11 8 +5 6 9 10 +6 5 10 9 +5 6 9 10 +6 5 10 9 +4 7 8 11 +7 4 11 8 +6 5 10 9 +5 6 9 10 +7 4 11 8 +4 7 8 11 +7 4 11 8 +4 7 8 11 +6 5 10 9 +5 6 9 10 +8 11 4 7 +11 8 7 4 +9 10 5 6 +10 9 6 5 +9 10 5 6 +10 9 6 5 +8 11 4 7 +11 8 7 4 +10 9 6 5 +9 10 5 6 +11 8 7 4 +8 11 4 7 +11 8 7 4 +8 11 4 7 +10 9 6 5 +9 10 5 6 + +This is the joint trellis of two trellises described in awgn1o2_4.fsm and awgn1o2_16.fsm +It is useful for application of joint decoding... +It can be generated in python as follows: +> import trellis +> f1=trellis.fsm('awgn1o2_4.fsm') +> f2=trellis.fsm('awgn1o2_16.fsm') +> f=trellis.fsm(f1,f2) +> f.write_fsm_txt('joint_4_16.fsm') + diff --git a/gr-trellis/src/lib/fsm.cc b/gr-trellis/src/lib/fsm.cc index cddb7e665..50598a94c 100644 --- a/gr-trellis/src/lib/fsm.cc +++ b/gr-trellis/src/lib/fsm.cc @@ -240,6 +240,35 @@ fsm::fsm(int mod_size, int ch_length) //###################################################################### +//# Automatically generate an FSM specification describing the +//# the joint trellis of fsm1 and fsm2 +//###################################################################### +fsm::fsm(const fsm &FSM1, const fsm &FSM2) +{ + d_I=FSM1.I()*FSM2.I(); + d_S=FSM1.S()*FSM2.S(); + d_O=FSM1.O()*FSM2.O(); + + 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 s1=s/FSM2.S(); + int s2=s%FSM2.S(); + int i1=i/FSM2.I(); + int i2=i%FSM2.I(); + d_NS[s*d_I+i] = FSM1.NS()[s1 * FSM1.I() + i1] * FSM2.S() + FSM2.NS()[s2 * FSM2.I() + i2]; + d_OS[s*d_I+i] = FSM1.OS()[s1 * FSM1.I() + i1] * FSM2.O() + FSM2.OS()[s2 * FSM2.I() + i2]; + } + } + + generate_PS_PI(); + generate_TM(); +} + + +//###################################################################### //# generate the PS and PI tables for later use //###################################################################### void fsm::generate_PS_PI() diff --git a/gr-trellis/src/lib/fsm.h b/gr-trellis/src/lib/fsm.h index e015a37fb..e9ebb91ec 100644 --- a/gr-trellis/src/lib/fsm.h +++ b/gr-trellis/src/lib/fsm.h @@ -50,6 +50,7 @@ public: fsm(const char *name); fsm(int k, int n, const std::vector<int> &G); fsm(int mod_size, int ch_length); + fsm(const fsm &FSM1, const fsm &FSM2); 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 b566f8aa3..ac00d40e3 100644 --- a/gr-trellis/src/lib/fsm.i +++ b/gr-trellis/src/lib/fsm.i @@ -40,6 +40,7 @@ public: fsm(const char *name); fsm(int k, int n, const std::vector<int> &G); fsm(int mod_size, int ch_length); + fsm(const fsm &FSM1, const fsm &FSM2); 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/trellis_metrics_X.cc.t b/gr-trellis/src/lib/trellis_metrics_X.cc.t index 64aa3edd8..bced13c0c 100644 --- a/gr-trellis/src/lib/trellis_metrics_X.cc.t +++ b/gr-trellis/src/lib/trellis_metrics_X.cc.t @@ -54,7 +54,10 @@ trellis_make_@BASE_NAME@ (int O, int D, const std::vector<@I_TYPE@> &TABLE, tre set_output_multiple ((int)d_O); } - +void @NAME@::set_TABLE (const std::vector<@I_TYPE@> &table) +{ + d_TABLE = table; +} void diff --git a/gr-trellis/src/lib/trellis_metrics_X.h.t b/gr-trellis/src/lib/trellis_metrics_X.h.t index a076bb600..c46740a54 100644 --- a/gr-trellis/src/lib/trellis_metrics_X.h.t +++ b/gr-trellis/src/lib/trellis_metrics_X.h.t @@ -53,6 +53,7 @@ public: int D () const { return d_D; } trellis_metric_type_t TYPE () const { return d_TYPE; } std::vector<@I_TYPE@> TABLE () const { return d_TABLE; } + void set_TABLE (const std::vector<@I_TYPE@> &table); void forecast (int noutput_items, gr_vector_int &ninput_items_required); int general_work (int noutput_items, diff --git a/gr-trellis/src/lib/trellis_metrics_X.i.t b/gr-trellis/src/lib/trellis_metrics_X.i.t index d1c63429e..50aa7a767 100644 --- a/gr-trellis/src/lib/trellis_metrics_X.i.t +++ b/gr-trellis/src/lib/trellis_metrics_X.i.t @@ -35,5 +35,6 @@ public: int O () const { return d_O; } int D () const { return d_D; } trellis_metric_type_t TYPE () const { return d_TYPE; } + void set_TABLE (const std::vector<@I_TYPE@> &table); std::vector<@I_TYPE@> TABLE () const { return d_TABLE; } }; diff --git a/gr-trellis/src/lib/trellis_viterbi_combined_XX.cc.t b/gr-trellis/src/lib/trellis_viterbi_combined_XX.cc.t index b7ab48faa..e343a4965 100644 --- a/gr-trellis/src/lib/trellis_viterbi_combined_XX.cc.t +++ b/gr-trellis/src/lib/trellis_viterbi_combined_XX.cc.t @@ -71,6 +71,11 @@ trellis_make_@BASE_NAME@ ( } +void @NAME@::set_TABLE(const std::vector<@I_TYPE@> &table) +{ + d_TABLE = table; +} + void @NAME@::forecast (int noutput_items, gr_vector_int &ninput_items_required) { diff --git a/gr-trellis/src/lib/trellis_viterbi_combined_XX.h.t b/gr-trellis/src/lib/trellis_viterbi_combined_XX.h.t index 7a7850ff5..ae5ccf841 100644 --- a/gr-trellis/src/lib/trellis_viterbi_combined_XX.h.t +++ b/gr-trellis/src/lib/trellis_viterbi_combined_XX.h.t @@ -82,6 +82,7 @@ public: std::vector<@I_TYPE@> TABLE () const { return d_TABLE; } trellis_metric_type_t TYPE () const { return d_TYPE; } //std::vector<int> trace () const { return d_trace; } + void set_TABLE (const std::vector<@I_TYPE@> &table); void forecast (int noutput_items, gr_vector_int &ninput_items_required); int general_work (int noutput_items, diff --git a/gr-trellis/src/lib/trellis_viterbi_combined_XX.i.t b/gr-trellis/src/lib/trellis_viterbi_combined_XX.i.t index 33af6e8bb..633ded770 100644 --- a/gr-trellis/src/lib/trellis_viterbi_combined_XX.i.t +++ b/gr-trellis/src/lib/trellis_viterbi_combined_XX.i.t @@ -55,4 +55,5 @@ public: std::vector<@I_TYPE@> TABLE () const { return d_TABLE; } trellis_metric_type_t TYPE () const { return d_TYPE; } //std::vector<short> trace () const { return d_trace; } + void set_TABLE (const std::vector<@I_TYPE@> &table); }; |