root / gr-trellis / src / lib / generate_common.py @ e9a82163
History | View | Annotate | Download (1.6 kB)
| 1 | #!/usr/bin/env python
|
|---|---|
| 2 | #
|
| 3 | # Copyright 2004 Free Software Foundation, Inc.
|
| 4 | #
|
| 5 | # This file is part of GNU Radio
|
| 6 | #
|
| 7 | # GNU Radio is free software; you can redistribute it and/or modify
|
| 8 | # it under the terms of the GNU General Public License as published by
|
| 9 | # the Free Software Foundation; either version 2, or (at your option)
|
| 10 | # any later version.
|
| 11 | #
|
| 12 | # GNU Radio is distributed in the hope that it will be useful,
|
| 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 15 | # GNU General Public License for more details.
|
| 16 | #
|
| 17 | # You should have received a copy of the GNU General Public License
|
| 18 | # along with GNU Radio; see the file COPYING. If not, write to
|
| 19 | # the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
| 20 | # Boston, MA 02111-1307, USA.
|
| 21 | #
|
| 22 | |
| 23 | from build_utils import expand_template, standard_dict |
| 24 | from build_utils_codes import * |
| 25 | |
| 26 | import re |
| 27 | |
| 28 | |
| 29 | # regular blocks
|
| 30 | other_roots = [ |
| 31 | 'trellis_encoder_XX',
|
| 32 | 'trellis_metrics_X',
|
| 33 | 'trellis_viterbi_X',
|
| 34 | 'trellis_viterbi_combined_X',
|
| 35 | ] |
| 36 | other_signatures = ( |
| 37 | ['bb','bs','bi','ss','si','ii'], |
| 38 | ['f','c'], |
| 39 | ['b','s','i'], |
| 40 | ['b','s','i'], |
| 41 | ) |
| 42 | |
| 43 | |
| 44 | |
| 45 | def expand_h_cc_i (root, sig): |
| 46 | # root looks like 'gr_vector_sink_X'
|
| 47 | name = re.sub ('X+', sig, root)
|
| 48 | d = standard_dict (name, sig) |
| 49 | expand_template (d, root + '.h.t')
|
| 50 | expand_template (d, root + '.cc.t')
|
| 51 | expand_template (d, root + '.i.t')
|
| 52 | |
| 53 | |
| 54 | def generate (): |
| 55 | i=0
|
| 56 | for r in other_roots : |
| 57 | for s in other_signatures[i]: |
| 58 | expand_h_cc_i (r, s) |
| 59 | i=i+1
|
| 60 | |
| 61 | |
| 62 | |
| 63 | if __name__ == '__main__': |
| 64 | generate () |
| 65 | |
| 66 |