diff options
author | Josh Blum | 2011-09-28 22:16:41 -0700 |
---|---|---|
committer | Josh Blum | 2011-09-28 22:16:41 -0700 |
commit | 3f7db0afa99caeecb18428d7514dadd380d88d56 (patch) | |
tree | b513683057e96d03ff8138100d6059d80e7b3265 | |
parent | 60fd23a703bb16065717159bdd5ec9edf03d7302 (diff) | |
parent | 9e73c4e8372bc581d686d5e82a808894d41523ec (diff) | |
download | gnuradio-3f7db0afa99caeecb18428d7514dadd380d88d56.tar.gz gnuradio-3f7db0afa99caeecb18428d7514dadd380d88d56.tar.bz2 gnuradio-3f7db0afa99caeecb18428d7514dadd380d88d56.zip |
Merge branch 'next' into digital
Conflicts:
gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h
gnuradio-core/src/lib/general/general.i
gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.cc
gnuradio-core/src/lib/general/gr_pll_freqdet_cf.cc
gnuradio-core/src/lib/general/gr_pll_refout_cc.cc
gnuradio-core/src/python/gnuradio/gr/qa_pll_carriertracking.py
gnuradio-core/src/python/gnuradio/gr/qa_pll_freqdet.py
gnuradio-core/src/python/gnuradio/gr/qa_pll_refout.py
132 files changed, 7450 insertions, 1198 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 2536a9731..ddd51f8d7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,6 +41,18 @@ LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) INCLUDE(GrVersion) #setup version info ######################################################################## +# Import executables from a native build (for cross compiling) +# http://www.vtk.org/Wiki/CMake_Cross_Compiling#Using_executables_in_the_build_created_during_the_build +######################################################################## +IF(IMPORT_EXECUTABLES) + INCLUDE(${IMPORT_EXECUTABLES}) +ENDIF(IMPORT_EXECUTABLES) + +#set file that the native build will fill with exports +SET(EXPORT_FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake) +FILE(WRITE ${EXPORT_FILE}) #blank the file (subdirs will append) + +######################################################################## # Compiler specific setup ######################################################################## IF(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32) diff --git a/cmake/Modules/FindCppUnit.cmake b/cmake/Modules/FindCppUnit.cmake index f986f35c6..a936bc546 100644 --- a/cmake/Modules/FindCppUnit.cmake +++ b/cmake/Modules/FindCppUnit.cmake @@ -1,34 +1,36 @@ # http://www.cmake.org/pipermail/cmake/2006-October/011446.html +# Modified to use pkg config and use standard var names + # # Find the CppUnit includes and library # # This module defines -# CPPUNIT_INCLUDE_DIRS, where to find tiff.h, etc. +# CPPUNIT_INCLUDE_DIR, where to find tiff.h, etc. # CPPUNIT_LIBRARIES, the libraries to link against to use CppUnit. # CPPUNIT_FOUND, If false, do not try to use CppUnit. INCLUDE(FindPkgConfig) -PKG_CHECK_MODULES(CPPUNIT "cppunit") -LIST(APPEND CPPUNIT_LIBRARIES ${CMAKE_DL_LIBS}) -IF(NOT CPPUNIT_FOUND) +PKG_CHECK_MODULES(PC_CPPUNIT "cppunit" QUIET) -FIND_PATH(CPPUNIT_INCLUDE_DIRS cppunit/TestCase.h - /usr/local/include - /usr/include +FIND_PATH(CPPUNIT_INCLUDE_DIRS + NAMES cppunit/TestCase.h + HINTS ${PC_CPPUNIT_INCLUDE_DIRS} + PATHS + /usr/local/include + /usr/include ) -FIND_LIBRARY(CPPUNIT_LIBRARIES cppunit - ${CPPUNIT_INCLUDE_DIRS}/../lib - /usr/local/lib - /usr/lib) +FIND_LIBRARY(CPPUNIT_LIBRARIES + NAMES cppunit + HINTS ${PC_CPPUNIT_LIBRARIES} + PATHS + ${CPPUNIT_INCLUDE_DIRS}/../lib + /usr/local/lib + /usr/lib +) -IF(CPPUNIT_INCLUDE_DIRS) - IF(CPPUNIT_LIBRARIES) - SET(CPPUNIT_FOUND "YES") - SET(CPPUNIT_LIBRARIES ${CPPUNIT_LIBRARIES} ${CMAKE_DL_LIBS}) - ENDIF(CPPUNIT_LIBRARIES) -ENDIF(CPPUNIT_INCLUDE_DIRS) +LIST(APPEND CPPUNIT_LIBRARIES ${CMAKE_DL_LIBS}) INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(CPPUNIT DEFAULT_MSG CPPUNIT_LIBRARIES CPPUNIT_INCLUDE_DIRS) -ENDIF(NOT CPPUNIT_FOUND) +MARK_AS_ADVANCED(CPPUNIT_LIBRARIES CPPUNIT_INCLUDE_DIRS) diff --git a/cmake/Modules/FindFFTW3f.cmake b/cmake/Modules/FindFFTW3f.cmake index d84bb37a8..e8b581aed 100644 --- a/cmake/Modules/FindFFTW3f.cmake +++ b/cmake/Modules/FindFFTW3f.cmake @@ -1,14 +1,16 @@ # http://tim.klingt.org/code/projects/supernova/repository/revisions/d336dd6f400e381bcfd720e96139656de0c53b6a/entry/cmake_modules/FindFFTW3f.cmake +# Modified to use pkg config and use standard var names + # Find single-precision (float) version of FFTW3 INCLUDE(FindPkgConfig) -PKG_CHECK_MODULES(FFTW3F "fftw3f >= 3.0") -IF(NOT FFTW3F_FOUND) +PKG_CHECK_MODULES(PC_FFTW3F "fftw3f >= 3.0" QUIET) FIND_PATH( FFTW3F_INCLUDE_DIRS NAMES fftw3.h HINTS $ENV{FFTW3_DIR}/include + ${PC_FFTW3F_INCLUDE_DIRS} PATHS /usr/local/include /usr/include ) @@ -17,16 +19,11 @@ FIND_LIBRARY( FFTW3F_LIBRARIES NAMES fftw3f libfftw3f HINTS $ENV{FFTW3_DIR}/lib + ${PC_FFTW3F_LIBRARIES} PATHS /usr/local/lib /usr/lib ) -SET(FFTW3F_FOUND "NO") - -IF( FFTW3F_INCLUDE_DIRS AND FFTW3F_LIBRARIES ) - SET(FFTW3F_FOUND "YES") -ENDIF() - INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFTW3F DEFAULT_MSG FFTW3F_LIBRARIES FFTW3F_INCLUDE_DIRS) -ENDIF(NOT FFTW3F_FOUND) +MARK_AS_ADVANCED(FFTW3F_LIBRARIES FFTW3F_INCLUDE_DIRS) diff --git a/cmake/Modules/FindGSL.cmake b/cmake/Modules/FindGSL.cmake index 48fd0077f..6d7155284 100644 --- a/cmake/Modules/FindGSL.cmake +++ b/cmake/Modules/FindGSL.cmake @@ -26,10 +26,10 @@ set( GSL_CBLAS_FOUND OFF ) # Windows, but not for Cygwin and MSys where gsl-config is available if( WIN32 AND NOT CYGWIN AND NOT MSYS ) # look for headers - find_path( GSL_INCLUDE_DIR + find_path( GSL_INCLUDE_DIRS NAMES gsl/gsl_cdf.h gsl/gsl_randist.h ) - if( GSL_INCLUDE_DIR ) + if( GSL_INCLUDE_DIRS ) # look for gsl library find_library( GSL_LIBRARY NAMES gsl @@ -49,13 +49,13 @@ if( WIN32 AND NOT CYGWIN AND NOT MSYS ) endif( GSL_CBLAS_LIBRARY ) set( GSL_LIBRARIES ${GSL_LIBRARY} ${GSL_CBLAS_LIBRARY} ) - endif( GSL_INCLUDE_DIR ) + endif( GSL_INCLUDE_DIRS ) - #mark_as_advanced( - # GSL_INCLUDE_DIR - # GSL_LIBRARY - # GSL_CBLAS_LIBRARY - #) + mark_as_advanced( + GSL_INCLUDE_DIRS + GSL_LIBRARIES + GSL_CBLAS_LIBRARIES + ) else( WIN32 AND NOT CYGWIN AND NOT MSYS ) if( UNIX OR MSYS ) find_program( GSL_CONFIG_EXECUTABLE gsl-config @@ -138,6 +138,9 @@ else( GSL_FOUND ) endif( GSL_FIND_REQUIRED ) endif( GSL_FOUND ) +#needed for gsl windows port but safe to always define +LIST(APPEND GSL_DEFINITIONS "-DGSL_DLL") + INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(GSL DEFAULT_MSG GSL_LIBRARIES GSL_INCLUDE_DIRS) ENDIF(NOT GSL_FOUND) diff --git a/cmake/Modules/FindUHD.cmake b/cmake/Modules/FindUHD.cmake index 7e9f70aa9..0f0cc601b 100644 --- a/cmake/Modules/FindUHD.cmake +++ b/cmake/Modules/FindUHD.cmake @@ -1,11 +1,15 @@ +######################################################################## +# Find the library for the USRP Hardware Driver +######################################################################## + INCLUDE(FindPkgConfig) -PKG_CHECK_MODULES(UHD uhd) -IF(NOT UHD_FOUND) +PKG_CHECK_MODULES(PC_UHD uhd QUIET) FIND_PATH( UHD_INCLUDE_DIRS NAMES uhd/config.hpp HINTS $ENV{UHD_DIR}/include + ${PC_UHD_INCLUDE_DIRS} PATHS /usr/local/include /usr/include ) @@ -14,11 +18,11 @@ FIND_LIBRARY( UHD_LIBRARIES NAMES uhd HINTS $ENV{UHD_DIR}/lib + ${PC_UHD_LIBRARIES} PATHS /usr/local/lib /usr/lib ) INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(UHD DEFAULT_MSG UHD_LIBRARIES UHD_INCLUDE_DIRS) - -ENDIF(NOT UHD_FOUND) +MARK_AS_ADVANCED(UHD_LIBRARIES UHD_INCLUDE_DIRS) diff --git a/cmake/Modules/GrComponent.cmake b/cmake/Modules/GrComponent.cmake index 8a94e219a..cbae1c4ff 100644 --- a/cmake/Modules/GrComponent.cmake +++ b/cmake/Modules/GrComponent.cmake @@ -25,6 +25,13 @@ SET(__INCLUDED_GR_COMPONENT_CMAKE TRUE) SET(_gr_enabled_components "" CACHE INTERNAL "" FORCE) SET(_gr_disabled_components "" CACHE INTERNAL "" FORCE) +IF(NOT DEFINED ENABLE_DEFAULT) + SET(ENABLE_DEFAULT ON) + MESSAGE(STATUS "") + MESSAGE(STATUS "The build system will automatically enable all components.") + MESSAGE(STATUS "Use -DENABLE_DEFAULT=OFF to disable components by default.") +ENDIF() + ######################################################################## # Register a component into the system # - name: canonical component name @@ -40,7 +47,7 @@ FUNCTION(GR_REGISTER_COMPONENT name var) ENDFOREACH(dep) #setup the dependent option for this component - CMAKE_DEPENDENT_OPTION(${var} "enable ${name} support" ON "${ARGN}" OFF) + CMAKE_DEPENDENT_OPTION(${var} "enable ${name} support" ${ENABLE_DEFAULT} "${ARGN}" OFF) SET(${var}_ "${${var}}" CACHE INTERNAL "" FORCE) #append the component into one of the lists diff --git a/cmake/Modules/GrPython.cmake b/cmake/Modules/GrPython.cmake index f54dbc9ba..b33c2fe62 100644 --- a/cmake/Modules/GrPython.cmake +++ b/cmake/Modules/GrPython.cmake @@ -51,6 +51,18 @@ ENDIF(PYTHON_EXECUTABLE) #make the path to the executable appear in the cmake gui SET(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "python interpreter") +#make sure we can use -B with python (introduced in 2.6) +IF(PYTHON_EXECUTABLE) + EXECUTE_PROCESS( + COMMAND ${PYTHON_EXECUTABLE} -B -c "" + OUTPUT_QUIET ERROR_QUIET + RESULT_VARIABLE PYTHON_HAS_DASH_B_RESULT + ) + IF(PYTHON_HAS_DASH_B_RESULT EQUAL 0) + SET(PYTHON_DASH_B "-B") + ENDIF() +ENDIF(PYTHON_EXECUTABLE) + ######################################################################## # Check for the existence of a python module: # - desc a string description of the check diff --git a/cmake/Modules/GrTest.cmake b/cmake/Modules/GrTest.cmake index e9e2a0c2e..8a73de3ce 100644 --- a/cmake/Modules/GrTest.cmake +++ b/cmake/Modules/GrTest.cmake @@ -33,7 +33,6 @@ SET(__INCLUDED_GR_TEST_CMAKE TRUE) ######################################################################## FUNCTION(GR_ADD_TEST test_name) - IF(WIN32) #Ensure that the build exe also appears in the PATH. LIST(APPEND GR_TEST_TARGET_DEPS ${ARGN}) @@ -50,6 +49,7 @@ FUNCTION(GR_ADD_TEST test_name) ENDIF(location) ENDFOREACH(target) + IF(WIN32) #SWIG generates the python library files into a subdirectory. #Therefore, we must append this subdirectory into PYTHONPATH. #Only do this for the python directories matching the following: @@ -74,15 +74,19 @@ FUNCTION(GR_ADD_TEST test_name) #SET_TESTS_PROPERTIES(${test_name} PROPERTIES ENVIRONMENT "${environs}") IF(UNIX) + SET(LD_PATH_VAR "LD_LIBRARY_PATH") + IF(APPLE) + SET(LD_PATH_VAR "DYLD_LIBRARY_PATH") + ENDIF() + SET(binpath "${CMAKE_CURRENT_BINARY_DIR}:$PATH") - #set both LD and DYLD paths to cover multiple UNIX OS library paths - LIST(APPEND libpath "$LD_LIBRARY_PATH" "$DYLD_LIBRARY_PATH") + LIST(APPEND libpath "$${LD_PATH_VAR}") LIST(APPEND pypath "$PYTHONPATH") #replace list separator with the path separator STRING(REPLACE ";" ":" libpath "${libpath}") STRING(REPLACE ";" ":" pypath "${pypath}") - LIST(APPEND environs "PATH=${binpath}" "LD_LIBRARY_PATH=${libpath}" "DYLD_LIBRARY_PATH=${libpath}" "PYTHONPATH=${pypath}") + LIST(APPEND environs "PATH=${binpath}" "${LD_PATH_VAR}=${libpath}" "PYTHONPATH=${pypath}") #generate a bat file that sets the environment and runs the test FIND_PROGRAM(SHELL sh) diff --git a/config/grc_gnuradio_examples.m4 b/config/grc_gnuradio_examples.m4 index 780c072c7..f5d94318e 100644 --- a/config/grc_gnuradio_examples.m4 +++ b/config/grc_gnuradio_examples.m4 @@ -39,6 +39,7 @@ AC_DEFUN([GRC_GNURADIO_EXAMPLES],[ gnuradio-examples/python/network/Makefile \ gnuradio-examples/python/ofdm/Makefile \ gnuradio-examples/python/pfb/Makefile \ + gnuradio-examples/python/tags/Makefile \ gnuradio-examples/python/usrp/Makefile \ gnuradio-examples/python/usrp2/Makefile \ gnuradio-examples/waveforms/Makefile \ diff --git a/config/grc_gr_qtgui.m4 b/config/grc_gr_qtgui.m4 index ddb7c7ca9..2204e49ae 100644 --- a/config/grc_gr_qtgui.m4 +++ b/config/grc_gr_qtgui.m4 @@ -83,6 +83,7 @@ AC_DEFUN([GRC_GR_QTGUI],[ gr-qtgui/Makefile \ gr-qtgui/gnuradio-qtgui.pc \ gr-qtgui/apps/Makefile \ + gr-qtgui/examples/Makefile \ gr-qtgui/grc/Makefile \ gr-qtgui/lib/Makefile \ gr-qtgui/python/Makefile \ diff --git a/config/grc_gr_trellis.m4 b/config/grc_gr_trellis.m4 index 963d5af79..57c75bf51 100644 --- a/config/grc_gr_trellis.m4 +++ b/config/grc_gr_trellis.m4 @@ -28,6 +28,7 @@ AC_DEFUN([GRC_GR_TRELLIS],[ gr-trellis/Makefile \ gr-trellis/gnuradio-trellis.pc \ gr-trellis/doc/Makefile \ + gr-trellis/grc/Makefile \ gr-trellis/src/Makefile \ gr-trellis/src/lib/Makefile \ gr-trellis/src/lib/run_guile_tests \ diff --git a/gnuradio-core/CMakeLists.txt b/gnuradio-core/CMakeLists.txt index b72bf70d6..780770bb8 100644 --- a/gnuradio-core/CMakeLists.txt +++ b/gnuradio-core/CMakeLists.txt @@ -49,19 +49,19 @@ INCLUDE(GrMiscUtils) GR_SET_GLOBAL(GNURADIO_CORE_INCLUDE_DIRS ${GRUEL_INCLUDE_DIRS} #headers depend on gruel ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/runtime - ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/general ${CMAKE_CURRENT_BINARY_DIR}/src/lib/general - ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/gengen + ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/general ${CMAKE_CURRENT_BINARY_DIR}/src/lib/gengen - ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/filter + ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/gengen ${CMAKE_CURRENT_BINARY_DIR}/src/lib/filter + ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/filter ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/missing ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/reed-solomon ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/viterbi ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/io ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/g72x - ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/swig ${CMAKE_CURRENT_BINARY_DIR}/src/lib/swig + ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/swig ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/hier ) diff --git a/gnuradio-core/src/lib/CMakeLists.txt b/gnuradio-core/src/lib/CMakeLists.txt index 10752ecd8..c3ce5a145 100644 --- a/gnuradio-core/src/lib/CMakeLists.txt +++ b/gnuradio-core/src/lib/CMakeLists.txt @@ -46,7 +46,7 @@ INCLUDE_DIRECTORIES(${GNURADIO_CORE_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) -ADD_DEFINITIONS(-DGSL_DLL) #needed for gsl windows port but safe to always define +ADD_DEFINITIONS(${GSL_DEFINITIONS}) INCLUDE_DIRECTORIES(${GSL_INCLUDE_DIRS}) LINK_DIRECTORIES(${GSL_LIBRARY_DIRS}) @@ -63,6 +63,11 @@ LIST(APPEND gnuradio_core_libs ${FFTW3F_LIBRARIES} ) +#need to link with librt on ubuntu 11.10 for shm_* +IF(LINUX) + LIST(APPEND gnuradio_core_libs rt) +ENDIF() + ADD_LIBRARY(gnuradio-core SHARED ${gnuradio_core_sources}) TARGET_LINK_LIBRARIES(gnuradio-core ${gnuradio_core_libs}) SET_TARGET_PROPERTIES(gnuradio-core PROPERTIES DEFINE_SYMBOL "gnuradio_core_EXPORTS") diff --git a/gnuradio-core/src/lib/filter/CMakeLists.txt b/gnuradio-core/src/lib/filter/CMakeLists.txt index 2c060de80..551715467 100644 --- a/gnuradio-core/src/lib/filter/CMakeLists.txt +++ b/gnuradio-core/src/lib/filter/CMakeLists.txt @@ -27,9 +27,15 @@ FOREACH(gr_core_filter_asm ${gr_core_filter_asms}) SET_PROPERTY(SOURCE ${gr_core_filter_asm} PROPERTY LANGUAGE C) ENDFOREACH(gr_core_filter_asm) -#uname -p says i386, but we know better when its x86 apple -IF(APPLE AND "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i386") - SET(CMAKE_SYSTEM_PROCESSOR "x86_64") +#detect 32 or 64 bit compiler +IF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(i.86|x86|x86_64)$") + include(CheckTypeSize) + check_type_size("void*" SIZEOF_VOID_P BUILTIN_TYPES_ONLY) + if (${SIZEOF_VOID_P} EQUAL 8) + set(CMAKE_SYSTEM_PROCESSOR_x86 64) + else() + set(CMAKE_SYSTEM_PROCESSOR_x86 32) + endif() ENDIF() ######################################################################## @@ -44,7 +50,7 @@ ENDIF() # - This way the targets would depend only on their sources. ######################################################################## EXECUTE_PROCESS( - COMMAND ${PYTHON_EXECUTABLE} -c " + COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} -c " import os, sys sys.path.append('${GR_CORE_PYTHONPATH}') sys.path.append('${CMAKE_CURRENT_SOURCE_DIR}') @@ -108,10 +114,11 @@ ADD_CUSTOM_COMMAND( ${generated_filter_includes} ${generated_filter_swigs} DEPENDS ${generated_filter_deps} - COMMAND ${PYTHON_EXECUTABLE} -B -c - \"import os, sys\;sys.path.append('${GR_CORE_PYTHONPATH}')\;sys.path.append('${CMAKE_CURRENT_SOURCE_DIR}')\;os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}'\;from generate_all import generate_all\;generate_all()\" + COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} -c + "import os, sys;sys.path.append('${GR_CORE_PYTHONPATH}');sys.path.append('${CMAKE_CURRENT_SOURCE_DIR}');os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}';from generate_all import generate_all;generate_all()" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "generating filter files" + VERBATIM ) ADD_CUSTOM_TARGET(filter_generated DEPENDS @@ -132,7 +139,7 @@ IF(MSVC) ${CMAKE_CURRENT_SOURCE_DIR}/qa_dotprod_generic.cc ) ELSE(MSVC) -IF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(i.86|x86|x86_64)$") +IF(CMAKE_SYSTEM_PROCESSOR_x86) LIST(APPEND gnuradio_core_sources ${CMAKE_CURRENT_SOURCE_DIR}/sysconfig_x86.cc ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_sysconfig_x86.cc @@ -157,9 +164,9 @@ IF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(i.86|x86|x86_64)$") ${CMAKE_CURRENT_SOURCE_DIR}/qa_complex_dotprod_x86.cc ${CMAKE_CURRENT_SOURCE_DIR}/qa_ccomplex_dotprod_x86.cc ) -ENDIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(i.86|x86|x86_64)$") +ENDIF() -IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") +IF(CMAKE_SYSTEM_PROCESSOR_x86 AND ${CMAKE_SYSTEM_PROCESSOR_x86} EQUAL 64) LIST(APPEND gnuradio_core_sources ${CMAKE_CURRENT_SOURCE_DIR}/float_dotprod_sse64.S ${CMAKE_CURRENT_SOURCE_DIR}/float_dotprod_3dnow64.S @@ -173,7 +180,7 @@ IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") ${CMAKE_CURRENT_SOURCE_DIR}/fcomplex_dotprod_sse64.S ${CMAKE_CURRENT_SOURCE_DIR}/short_dotprod_mmx64.S ) -ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(i.86|x86)$") +ELSEIF(CMAKE_SYSTEM_PROCESSOR_x86 AND ${CMAKE_SYSTEM_PROCESSOR_x86} EQUAL 32) LIST(APPEND gnuradio_core_sources ${CMAKE_CURRENT_SOURCE_DIR}/float_dotprod_sse.S ${CMAKE_CURRENT_SOURCE_DIR}/float_dotprod_3dnow.S @@ -212,14 +219,14 @@ ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm") LIST(APPEND test_gnuradio_core_sources ${CMAKE_CURRENT_SOURCE_DIR}/qa_dotprod_armv7_a.cc ) -ELSE(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") +ELSE() LIST(APPEND gnuradio_core_sources ${CMAKE_CURRENT_SOURCE_DIR}/sysconfig_generic.cc ) LIST(APPEND test_gnuradio_core_sources ${CMAKE_CURRENT_SOURCE_DIR}/qa_dotprod_generic.cc ) -ENDIF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") +ENDIF() ENDIF(MSVC) ######################################################################## diff --git a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h index 2eae11807..0fd8ba35b 100644 --- a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h +++ b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h @@ -124,6 +124,7 @@ class GR_CORE_API gr_pfb_clock_sync_ccf : public gr_block * \param init_phase (float) The initial phase to look at, or which filter to start * with (default = 0). * \param max_rate_deviation (float) Distance from 0 d_rate can get (default = 1.5). + * \param osps (int) The number of output samples per symbol (default=1). * */ friend GR_CORE_API gr_pfb_clock_sync_ccf_sptr gr_make_pfb_clock_sync_ccf (double sps, float loop_bw, diff --git a/gnuradio-core/src/lib/general/CMakeLists.txt b/gnuradio-core/src/lib/general/CMakeLists.txt index cb3f0da4b..ab6201de1 100644 --- a/gnuradio-core/src/lib/general/CMakeLists.txt +++ b/gnuradio-core/src/lib/general/CMakeLists.txt @@ -289,6 +289,7 @@ SET(gr_core_general_triple_threats gr_annotator_alltoall gr_annotator_1to1 gr_burst_tagger + gr_correlate_access_code_tag_bb ) FOREACH(file_tt ${gr_core_general_triple_threats}) diff --git a/gnuradio-core/src/lib/general/Makefile.am b/gnuradio-core/src/lib/general/Makefile.am index fe545f98c..e389e05e1 100644 --- a/gnuradio-core/src/lib/general/Makefile.am +++ b/gnuradio-core/src/lib/general/Makefile.am @@ -172,7 +172,8 @@ libgeneral_la_SOURCES = \ gr_probe_density_b.cc \ gr_annotator_alltoall.cc \ gr_annotator_1to1.cc \ - gr_burst_tagger.cc + gr_burst_tagger.cc \ + gr_correlate_access_code_tag_bb.cc libgeneral_qa_la_SOURCES = \ qa_general.cc \ @@ -338,7 +339,8 @@ grinclude_HEADERS = \ gr_probe_density_b.h \ gr_annotator_alltoall.h \ gr_annotator_1to1.h \ - gr_burst_tagger.h + gr_burst_tagger.h \ + gr_correlate_access_code_tag_bb.h noinst_HEADERS = \ qa_general.h \ @@ -474,4 +476,5 @@ swiginclude_HEADERS = \ gr_probe_density_b.i \ gr_annotator_alltoall.i \ gr_annotator_1to1.i \ - gr_burst_tagger.i + gr_burst_tagger.i \ + gr_correlate_access_code_tag_bb.i diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i index e965eea64..107f5c9ea 100644 --- a/gnuradio-core/src/lib/general/general.i +++ b/gnuradio-core/src/lib/general/general.i @@ -138,6 +138,7 @@ #include <gr_annotator_1to1.h> #include <gr_burst_tagger.h> #include <gr_cpm.h> +#include <gr_correlate_access_code_tag_bb.h> %} %include "gri_control_loop.i" @@ -256,3 +257,4 @@ %include "gr_annotator_1to1.i" %include "gr_burst_tagger.i" %include "gr_cpm.i" +%include "gr_correlate_access_code_tag_bb.i" diff --git a/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.cc b/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.cc new file mode 100644 index 000000000..23311f7a4 --- /dev/null +++ b/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.cc @@ -0,0 +1,129 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2006,2010,2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <gr_correlate_access_code_tag_bb.h> +#include <gr_io_signature.h> +#include <stdexcept> +#include <gr_count_bits.h> +#include <cstdio> +#include <iostream> + +#define VERBOSE 0 + + +gr_correlate_access_code_tag_bb_sptr +gr_make_correlate_access_code_tag_bb (const std::string &access_code, int threshold, const std::string &tag_name) +{ + return gnuradio::get_initial_sptr(new gr_correlate_access_code_tag_bb (access_code, threshold, tag_name)); +} + + +gr_correlate_access_code_tag_bb::gr_correlate_access_code_tag_bb ( + const std::string &access_code, int threshold, const std::string &tag_name) + : gr_sync_block ("correlate_access_code_tag_bb", + gr_make_io_signature (1, 1, sizeof(char)), + gr_make_io_signature (1, 1, sizeof(char))), + d_data_reg(0), d_mask(0), d_len(0), + d_threshold(threshold) + +{ + if (!set_access_code(access_code)){ + fprintf(stderr, "gr_correlate_access_code_tag_bb: access_code is > 64 bits\n"); + throw std::out_of_range ("access_code is > 64 bits"); + } + + std::stringstream str; + str << name() << unique_id(); + d_me = pmt::pmt_string_to_symbol(str.str()); + d_key = pmt::pmt_string_to_symbol(tag_name); +} + +gr_correlate_access_code_tag_bb::~gr_correlate_access_code_tag_bb () +{ +} + +bool +gr_correlate_access_code_tag_bb::set_access_code( + const std::string &access_code) +{ + d_len = access_code.length(); // # of bytes in string + if (d_len > 64) + return false; + + // set len top bits to 1. + d_mask = ((~0ULL) >> (64 - d_len)) << (64 - d_len); + + d_access_code = 0; + for (unsigned i=0; i < 64; i++){ + d_access_code <<= 1; + if (i < d_len) + d_access_code |= access_code[i] & 1; // look at LSB only + } + + return true; +} + +int +gr_correlate_access_code_tag_bb::work (int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + const unsigned char *in = (const unsigned char *) input_items[0]; + unsigned char *out = (unsigned char *) output_items[0]; + + uint64_t abs_out_sample_cnt = nitems_written(0); + + for (int i = 0; i < noutput_items; i++){ + + out[i] = in[i]; + + // compute hamming distance between desired access code and current data + unsigned long long wrong_bits = 0; + unsigned int nwrong = d_threshold+1; + int new_flag = 0; + + wrong_bits = (d_data_reg ^ d_access_code) & d_mask; + nwrong = gr_count_bits64(wrong_bits); + + // test for access code with up to threshold errors + new_flag = (nwrong <= d_threshold); + + // shift in new data and new flag + d_data_reg = (d_data_reg << 1) | (in[i] & 0x1); + if (new_flag) { + if(VERBOSE) std::cout << "writing tag at sample " << abs_out_sample_cnt + i << std::endl; + add_item_tag(0, //stream ID + abs_out_sample_cnt + i - 64 + d_len, //sample + d_key, //frame info + pmt::pmt_t(), //data (unused) + d_me //block src id + ); + } + } + + return noutput_items; +} + diff --git a/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.h b/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.h new file mode 100644 index 000000000..e543f5cfb --- /dev/null +++ b/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.h @@ -0,0 +1,87 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2006,2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_gr_correlate_access_code_tag_bb_H +#define INCLUDED_gr_correlate_access_code_tag_bb_H + +#include <gr_core_api.h> +#include <gr_sync_block.h> +#include <string> + +class gr_correlate_access_code_tag_bb; +typedef boost::shared_ptr<gr_correlate_access_code_tag_bb> gr_correlate_access_code_tag_bb_sptr; + +/*! + * \param access_code is represented with 1 byte per bit, e.g., "010101010111000100" + * \param threshold maximum number of bits that may be wrong + * \param tag_name key of the tag inserted into the tag stream + */ +GR_CORE_API gr_correlate_access_code_tag_bb_sptr +gr_make_correlate_access_code_tag_bb (const std::string &access_code, int threshold, + const std::string &tag_name); + +/*! + * \brief Examine input for specified access code, one bit at a time. + * \ingroup sync_blk + * + * input: stream of bits, 1 bit per input byte (data in LSB) + * output: unaltered stream of bits (plus tags) + * + * This block annotates the input stream with tags. The tags have key + * name [tag_name], specified in the constructor. Used for searching + * an input data stream for preambles, etc. + */ +class GR_CORE_API gr_correlate_access_code_tag_bb : public gr_sync_block +{ + friend GR_CORE_API gr_correlate_access_code_tag_bb_sptr + gr_make_correlate_access_code_tag_bb (const std::string &access_code, int threshold, + const std::string &tag_name); + private: + unsigned long long d_access_code; // access code to locate start of packet + // access code is left justified in the word + unsigned long long d_data_reg; // used to look for access_code + unsigned long long d_mask; // masks access_code bits (top N bits are set where + // N is the number of bits in the access code) + unsigned int d_threshold; // how many bits may be wrong in sync vector + unsigned int d_len; //the length of the access code + + pmt::pmt_t d_key, d_me; //d_key is the tag name, d_me is the block name + unique ID + + protected: + gr_correlate_access_code_tag_bb(const std::string &access_code, int threshold, + const std::string &tag_name); + + public: + ~gr_correlate_access_code_tag_bb(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + + + /*! + * \param access_code is represented with 1 byte per bit, e.g., "010101010111000100" + */ + bool set_access_code (const std::string &access_code); +}; + +#endif /* INCLUDED_gr_correlate_access_code_tag_bb_H */ diff --git a/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.i b/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.i new file mode 100644 index 000000000..fb832194d --- /dev/null +++ b/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.i @@ -0,0 +1,60 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +GR_SWIG_BLOCK_MAGIC(gr,correlate_access_code_tag_bb); + +/*! + * \param access_code is represented with 1 byte per bit, e.g., "010101010111000100" + * \param threshold maximum number of bits that may be wrong + */ +gr_correlate_access_code_tag_bb_sptr +gr_make_correlate_access_code_tag_bb (const std::string &access_code, int threshold, const std::string &tag_name) + throw(std::out_of_range); + +/*! + * \brief Examine input for specified access code, one bit at a time. + * \ingroup block + * + * input: stream of bits, 1 bit per input byte (data in LSB) + * output: stream of bits, 2 bits per output byte (data in LSB, flag in next higher bit) + * + * Each output byte contains two valid bits, the data bit, and the + * flag bit. The LSB (bit 0) is the data bit, and is the original + * input data, delayed 64 bits. Bit 1 is the + * flag bit and is 1 if the corresponding data bit is the first data + * bit following the access code. Otherwise the flag bit is 0. + */ +class gr_correlate_access_code_tag_bb : public gr_sync_block +{ + friend gr_correlate_access_code_tag_bb_sptr + gr_make_correlate_access_code_tag_bb (const std::string &access_code, int threshold, const std::string &tag_name); + protected: + gr_correlate_access_code_tag_bb(const std::string &access_code, int threshold, const std::string &tag_name); + + public: + ~gr_correlate_access_code_tag_bb(); + + /*! + * \param access_code is represented with 1 byte per bit, e.g., "010101010111000100" + */ + bool set_access_code (const std::string &access_code); +}; diff --git a/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc b/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc index 85495e277..8bccefa95 100644 --- a/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc +++ b/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc @@ -40,6 +40,12 @@ gr_keep_one_in_n::gr_keep_one_in_n (size_t item_size, int n) gr_make_io_signature (1, 1, item_size)), d_count(n) { + // To avoid bad behavior with using set_relative_rate in this block with + // VERY large values of n, we will keep track of things ourselves. Using + // this to turn off automatic tag propagation, which will be handled + // locally in general_work(). + set_tag_propagation_policy(TPP_DONT); + set_n(n); } @@ -52,7 +58,10 @@ gr_keep_one_in_n::set_n(int n) d_n = n; d_count = n; - set_relative_rate(1.0 / (float)n); + // keep our internal understanding of the relative rate of this block + // don't set the relative rate, though, and we will handle our own + // tag propagation. + d_decim_rate = 1.0/(float)d_n; } int @@ -80,6 +89,19 @@ gr_keep_one_in_n::general_work (int noutput_items, ni++; } + // Because we have set TPP_DONT, we have to propagate the tags here manually. + // Adjustment of the tag sample value is done using the float d_decim_rate. + std::vector<pmt::pmt_t> tags; + std::vector<pmt::pmt_t>::iterator t; + get_tags_in_range(tags, 0, nitems_read(0), nitems_read(0)+ni); + for(t = tags.begin(); t != tags.end(); t++) { + uint64_t newcount = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*t, 0)); + add_item_tag(0, newcount * d_decim_rate, + pmt::pmt_tuple_ref(*t, 1), + pmt::pmt_tuple_ref(*t, 2), + pmt::pmt_tuple_ref(*t, 3)); + } + consume_each (ni); return no; } diff --git a/gnuradio-core/src/lib/general/gr_keep_one_in_n.h b/gnuradio-core/src/lib/general/gr_keep_one_in_n.h index f12a7a0f1..c32ed2a26 100644 --- a/gnuradio-core/src/lib/general/gr_keep_one_in_n.h +++ b/gnuradio-core/src/lib/general/gr_keep_one_in_n.h @@ -44,6 +44,7 @@ class GR_CORE_API gr_keep_one_in_n : public gr_block int d_n; int d_count; + float d_decim_rate; protected: gr_keep_one_in_n (size_t item_size, int n); diff --git a/gnuradio-core/src/lib/gengen/CMakeLists.txt b/gnuradio-core/src/lib/gengen/CMakeLists.txt index a06a61e6d..a223d291f 100644 --- a/gnuradio-core/src/lib/gengen/CMakeLists.txt +++ b/gnuradio-core/src/lib/gengen/CMakeLists.txt @@ -22,148 +22,121 @@ ######################################################################## ######################################################################## -# Generate the makefile.gen, then extract its sources: -# This is a round-about way to extract the sources, -# but it requires minimum changed to the python utils. -# -# The recommended way to do this: -# - Make a generation macro that registers the sources command. -# - List the generation macro with each templated source file. -# - Create a python script (very generic) to perform generation. -# - This way the targets would depend only on their sources. +# generate the python helper script which calls into the build utils ######################################################################## -EXECUTE_PROCESS( - COMMAND ${PYTHON_EXECUTABLE} -c " -import os, sys +FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py " +#!${PYTHON_EXECUTABLE} + +import sys, os, re sys.path.append('${GR_CORE_PYTHONPATH}') -sys.path.append('${CMAKE_CURRENT_SOURCE_DIR}') os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}' -os.environ['gendir'] = '${CMAKE_CURRENT_BINARY_DIR}' -os.environ['do_makefile'] = '1' -os.environ['do_sources'] = '0' -from generate_all import generate_all -generate_all() - " WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} -) +os.chdir('${CMAKE_CURRENT_BINARY_DIR}') -MACRO(GEGEN_GEN_EXTRACT outvar ext) - EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import os; print ';'.join( - map(lambda x: os.path.join('${CMAKE_CURRENT_BINARY_DIR}', x.replace('\\\\', '').strip()), - filter(lambda f: '${ext}' in f, open('${CMAKE_CURRENT_BINARY_DIR}/Makefile.gen').readlines() - )))" OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE ${outvar}) - FILE(TO_CMAKE_PATH "${${outvar}}" ${outvar}) -ENDMACRO(GEGEN_GEN_EXTRACT) - -GEGEN_GEN_EXTRACT(generated_gengen_sources ".cc") -GEGEN_GEN_EXTRACT(generated_gengen_includes ".h") -GEGEN_GEN_EXTRACT(generated_gengen_swigs ".i") - -#TODO simplify this list with a triple-threat for loop -SET(generated_gengen_deps - ${CMAKE_CURRENT_SOURCE_DIR}/generate_all.py - ${CMAKE_CURRENT_SOURCE_DIR}/generate_common.py - ${CMAKE_CURRENT_SOURCE_DIR}/gr_add_XX.cc.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_add_XX.h.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_add_XX.i.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_add_const_XX.cc.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_add_const_XX.h.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_add_const_XX.i.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_add_const_vXX.cc.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_add_const_vXX.h.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_add_const_vXX.i.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_argmax_XX.cc.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_argmax_XX.h.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_argmax_XX.i.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_chunks_to_symbols_XX.cc.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_chunks_to_symbols_XX.h.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_chunks_to_symbols_XX.i.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_divide_XX.cc.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_divide_XX.h.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_divide_XX.i.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_integrate_XX.cc.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_integrate_XX.h.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_integrate_XX.i.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_max_XX.cc.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_max_XX.h.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_max_XX.i.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_multiply_XX.cc.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_multiply_XX.h.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_multiply_XX.i.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_multiply_const_XX.cc.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_multiply_const_XX.h.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_multiply_const_XX.i.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_multiply_const_vXX.cc.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_multiply_const_vXX.h.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_multiply_const_vXX.i.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_mute_XX.cc.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_mute_XX.h.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_mute_XX.i.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_noise_source_X.cc.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_noise_source_X.h.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_noise_source_X.i.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_packed_to_unpacked_XX.cc.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_packed_to_unpacked_XX.h.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_packed_to_unpacked_XX.i.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_peak_detector_XX.cc.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_peak_detector_XX.h.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_peak_detector_XX.i.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_sample_and_hold_XX.cc.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_sample_and_hold_XX.h.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_sample_and_hold_XX.i.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_sig_source_X.cc.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_sig_source_X.h.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_sig_source_X.i.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_sub_XX.cc.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_sub_XX.h.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_sub_XX.i.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_unpacked_to_packed_XX.cc.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_unpacked_to_packed_XX.h.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_unpacked_to_packed_XX.i.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_vector_source_X.cc.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_vector_source_X.h.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_vector_source_X.i.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_vector_sink_X.cc.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_vector_sink_X.h.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_vector_sink_X.i.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_xor_XX.cc.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_xor_XX.h.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_xor_XX.i.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_and_XX.cc.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_and_XX.h.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_and_XX.i.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_and_const_XX.cc.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_and_const_XX.h.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_and_const_XX.i.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_or_XX.cc.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_or_XX.h.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_or_XX.i.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_not_XX.cc.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_not_XX.h.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_not_XX.i.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_moving_average_XX.cc.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_moving_average_XX.h.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_moving_average_XX.i.t -) +if __name__ == '__main__': + import build_utils + root, inp = sys.argv[1:3] + for sig in sys.argv[3:]: + name = re.sub ('X+', sig, root) + d = build_utils.standard_dict(name, sig) + build_utils.expand_template(d, inp) -ADD_CUSTOM_COMMAND( - OUTPUT - ${generated_gengen_sources} - ${generated_gengen_includes} - ${generated_gengen_swigs} - DEPENDS ${generated_gengen_deps} - COMMAND ${PYTHON_EXECUTABLE} -B -c - \"import os, sys\;sys.path.append('${GR_CORE_PYTHONPATH}')\;sys.path.append('${CMAKE_CURRENT_SOURCE_DIR}')\;os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}'\;from generate_all import generate_all\;generate_all()\" - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMENT "generating gengen files" -) +") + +######################################################################## +# generation helper macro to generate various files from template +######################################################################## +MACRO(expand_h_cc_i root) + + FOREACH(ext h cc i) + #make a list of all the generated files + UNSET(expanded_files_${ext}) + FOREACH(sig ${ARGN}) + STRING(REGEX REPLACE "X+" ${sig} name ${root}) + LIST(APPEND expanded_files_${ext} ${CMAKE_CURRENT_BINARY_DIR}/${name}.${ext}) + ENDFOREACH(sig) + + #create a command to generate the files + ADD_CUSTOM_COMMAND( + OUTPUT ${expanded_files_${ext}} + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.${ext}.t + COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} + ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py + ${root} ${root}.${ext}.t ${ARGN} + ) + ENDFOREACH(ext) + + #make source files depends on headers to force generation + SET_SOURCE_FILES_PROPERTIES(${expanded_files_cc} + PROPERTIES OBJECT_DEPENDS "${expanded_files_h}" + ) + + #install rules for the generated cc, h, and i files + LIST(APPEND generated_gengen_sources ${expanded_files_cc}) + LIST(APPEND generated_gengen_includes ${expanded_files_h}) + LIST(APPEND generated_gengen_swigs ${expanded_files_i}) + +ENDMACRO(expand_h_cc_i) + +######################################################################## +# Invoke macro to generate various sources +######################################################################## +expand_h_cc_i(gr_vector_source_X b s i f c) +expand_h_cc_i(gr_vector_sink_X b s i f c) +expand_h_cc_i(gr_noise_source_X s i f c) +expand_h_cc_i(gr_sig_source_X s i f c) + +expand_h_cc_i(gr_add_const_XX ss ii ff cc sf) +expand_h_cc_i(gr_multiply_const_XX ss ii ff cc) +expand_h_cc_i(gr_add_XX ss ii ff cc) +expand_h_cc_i(gr_sub_XX ss ii ff cc) +expand_h_cc_i(gr_multiply_XX ss ii ff cc) +expand_h_cc_i(gr_divide_XX ss ii ff cc) +expand_h_cc_i(gr_mute_XX ss ii ff cc) +expand_h_cc_i(gr_add_const_vXX ss ii ff cc) +expand_h_cc_i(gr_multiply_const_vXX ss ii ff cc) +expand_h_cc_i(gr_integrate_XX ss ii ff cc) +expand_h_cc_i(gr_moving_average_XX ss ii ff cc) + +expand_h_cc_i(gr_chunks_to_symbols_XX bf bc sf sc if ic) +expand_h_cc_i(gr_unpacked_to_packed_XX bb ss ii) +expand_h_cc_i(gr_packed_to_unpacked_XX bb ss ii) +expand_h_cc_i(gr_xor_XX bb ss ii) +expand_h_cc_i(gr_and_XX bb ss ii) +expand_h_cc_i(gr_and_const_XX bb ss ii) +expand_h_cc_i(gr_or_XX bb ss ii) +expand_h_cc_i(gr_not_XX bb ss ii) +expand_h_cc_i(gr_sample_and_hold_XX bb ss ii ff) +expand_h_cc_i(gr_argmax_XX fs is ss) +expand_h_cc_i(gr_max_XX ff ii ss) +expand_h_cc_i(gr_peak_detector_XX fb ib sb) ADD_CUSTOM_TARGET(gengen_generated DEPENDS - ${generated_gengen_sources} ${generated_gengen_includes} ${generated_gengen_swigs} ) ######################################################################## +# Create the master gengen swig include files +######################################################################## +FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/gengen_generated.i " +// +// This file is machine generated. All edits will be overwritten +// +") + +FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/gengen_generated.i "%{\n") +FOREACH(swig_file ${generated_gengen_swigs}) + GET_FILENAME_COMPONENT(name ${swig_file} NAME_WE) + FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/gengen_generated.i "#include<${name}.h>\n") +ENDFOREACH(swig_file) +FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/gengen_generated.i "%}\n") + +FOREACH(swig_file ${generated_gengen_swigs}) + GET_FILENAME_COMPONENT(name ${swig_file} NAME) + FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/gengen_generated.i "%include<${name}>\n") +ENDFOREACH(swig_file) + +######################################################################## # Handle the generated sources + a few non-generated ones ######################################################################## LIST(APPEND gnuradio_core_sources diff --git a/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc b/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc index 91618bad6..67184b9c5 100644 --- a/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc +++ b/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc @@ -183,7 +183,8 @@ gr_tagged_file_sink::work (int noutput_items, //std::cout << "Found end of burst: " // << idx_stop << ", " << N << std::endl; - int count = fwrite (&inbuf[d_itemsize*idx], d_itemsize, idx_stop-idx, d_handle); + int count = fwrite (&inbuf[d_itemsize*idx], d_itemsize, + idx_stop-idx, d_handle); if (count == 0) { if(ferror(d_handle)) { perror("gr_tagged_file_sink: error writing file"); @@ -200,7 +201,8 @@ gr_tagged_file_sink::work (int noutput_items, } } if(d_state == IN_BURST) { - int count = fwrite (&inbuf[idx], d_itemsize, noutput_items-idx, d_handle); + int count = fwrite (&inbuf[d_itemsize*idx], d_itemsize, + noutput_items-idx, d_handle); if (count == 0) { if(ferror(d_handle)) { perror("gr_tagged_file_sink: error writing file"); diff --git a/gnuradio-core/src/lib/swig/CMakeLists.txt b/gnuradio-core/src/lib/swig/CMakeLists.txt index c46b720c5..0d10245bf 100644 --- a/gnuradio-core/src/lib/swig/CMakeLists.txt +++ b/gnuradio-core/src/lib/swig/CMakeLists.txt @@ -42,15 +42,41 @@ SET(GR_SWIG_LIBRARIES gnuradio-core) # smaller pieces for the compiler to digest. prior to this change, on # X86_64, g++'s resident set size was 650MB! # ---------------------------------------------------------------- +FILE(GLOB GR_SWIG_SOURCE_DEPS + "${CMAKE_SOURCE_DIR}/gnuradio-core/src/lib/runtime/*.i" + "${CMAKE_SOURCE_DIR}/gnuradio-core/src/lib/runtime/*.h" +) GR_SWIG_MAKE(gnuradio_core_runtime gnuradio_core_runtime.i) +UNSET(GR_SWIG_SOURCE_DEPS) + +FILE(GLOB GR_SWIG_SOURCE_DEPS + "${CMAKE_SOURCE_DIR}/gnuradio-core/src/lib/general/*.i" + "${CMAKE_SOURCE_DIR}/gnuradio-core/src/lib/general/*.h" +) GR_SWIG_MAKE(gnuradio_core_general gnuradio_core_general.i) +UNSET(GR_SWIG_SOURCE_DEPS) + SET(GR_SWIG_TARGET_DEPS gengen_generated) GR_SWIG_MAKE(gnuradio_core_gengen gnuradio_core_gengen.i) +UNSET(GR_SWIG_TARGET_DEPS) + SET(GR_SWIG_TARGET_DEPS filter_generated) GR_SWIG_MAKE(gnuradio_core_filter gnuradio_core_filter.i) UNSET(GR_SWIG_TARGET_DEPS) + +FILE(GLOB GR_SWIG_SOURCE_DEPS + "${CMAKE_SOURCE_DIR}/gnuradio-core/src/lib/io/*.i" + "${CMAKE_SOURCE_DIR}/gnuradio-core/src/lib/io/*.h" +) GR_SWIG_MAKE(gnuradio_core_io gnuradio_core_io.i) +UNSET(GR_SWIG_SOURCE_DEPS) + +FILE(GLOB GR_SWIG_SOURCE_DEPS + "${CMAKE_SOURCE_DIR}/gnuradio-core/src/lib/hier/*.i" + "${CMAKE_SOURCE_DIR}/gnuradio-core/src/lib/hier/*.h" +) GR_SWIG_MAKE(gnuradio_core_hier gnuradio_core_hier.i) +UNSET(GR_SWIG_SOURCE_DEPS) GR_SWIG_INSTALL(TARGETS gnuradio_core_runtime diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/logpwrfft.py b/gnuradio-core/src/python/gnuradio/blks2impl/logpwrfft.py index 200c4cfbe..6f7fc520f 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/logpwrfft.py +++ b/gnuradio-core/src/python/gnuradio/blks2impl/logpwrfft.py @@ -54,13 +54,13 @@ class _logpwrfft_base(gr.hier_block2): fft = self._fft_block[0](fft_size, True, fft_window) window_power = sum(map(lambda x: x*x, fft_window)) - c2mag = gr.complex_to_mag(fft_size) + c2magsq = gr.complex_to_mag_squared(fft_size) self._avg = gr.single_pole_iir_filter_ff(1.0, fft_size) - self._log = gr.nlog10_ff(20, fft_size, + self._log = gr.nlog10_ff(10, fft_size, -20*math.log10(fft_size) # Adjust for number of bins -10*math.log10(window_power/fft_size) # Adjust for windowing loss - -20*math.log10(ref_scale/2)+3.0) # Adjust for reference scale - self.connect(self, self._sd, fft, c2mag, self._avg, self._log, self) + -20*math.log10(ref_scale/2)) # Adjust for reference scale + self.connect(self, self._sd, fft, c2magsq, self._avg, self._log, self) self._average = average self._avg_alpha = avg_alpha diff --git a/gnuradio-core/src/python/gnuradio/vocoder/.gitignore b/gnuradio-core/src/python/gnuradio/vocoder/.gitignore new file mode 100644 index 000000000..b336cc7ce --- /dev/null +++ b/gnuradio-core/src/python/gnuradio/vocoder/.gitignore @@ -0,0 +1,2 @@ +/Makefile +/Makefile.in diff --git a/gnuradio-examples/grc/trellis/interference_cancellation.grc b/gnuradio-examples/grc/trellis/interference_cancellation.grc index e93babd78..7674b4bf1 100644 --- a/gnuradio-examples/grc/trellis/interference_cancellation.grc +++ b/gnuradio-examples/grc/trellis/interference_cancellation.grc @@ -1,6 +1,6 @@ <?xml version='1.0' encoding='ASCII'?> <flow_graph> - <timestamp>Thu Mar 19 11:22:40 2009</timestamp> + <timestamp>Wed Aug 31 17:40:25 2011</timestamp> <block> <key>options</key> <param> @@ -36,6 +36,14 @@ <value>Custom</value> </param> <param> + <key>run_options</key> + <value>prompt</value> + </param> + <param> + <key>run</key> + <value>True</value> + </param> + <param> <key>realtime_scheduling</key> <value></value> </param> @@ -79,18 +87,22 @@ <value>100</value> </param> <param> - <key>slider_length</key> - <value>200</value> + <key>style</key> + <value>wx.SL_HORIZONTAL</value> </param> <param> - <key>slider_type</key> - <value>horizontal</value> + <key>converver</key> + <value>float_converter</value> </param> <param> <key>grid_pos</key> <value></value> </param> <param> + <key>notebook</key> + <value></value> + </param> + <param> <key>_coordinate</key> <value>(243, 11)</value> </param> @@ -130,18 +142,22 @@ <value>100</value> </param> <param> - <key>slider_length</key> - <value>200</value> + <key>style</key> + <value>wx.SL_HORIZONTAL</value> </param> <param> - <key>slider_type</key> - <value>horizontal</value> + <key>converver</key> + <value>float_converter</value> </param> <param> <key>grid_pos</key> <value></value> </param> <param> + <key>notebook</key> + <value></value> + </param> + <param> <key>_coordinate</key> <value>(447, 14)</value> </param> @@ -213,41 +229,6 @@ </param> </block> <block> - <key>gr_chunks_to_symbols_xx</key> - <param> - <key>id</key> - <value>gr_chunks_to_symbols_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>in_type</key> - <value>short</value> - </param> - <param> - <key>out_type</key> - <value>complex</value> - </param> - <param> - <key>symbol_table</key> - <value>1,1j,-1j,-1</value> - </param> - <param> - <key>dimension</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(665, 187)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> <key>gr_multiply_const_vxx</key> <param> <key>id</key> @@ -344,6 +325,10 @@ <value>1</value> </param> <param> + <key>num_ports</key> + <value>1</value> + </param> + <param> <key>_coordinate</key> <value>(660, 311)</value> </param> @@ -638,6 +623,10 @@ <value>1</value> </param> <param> + <key>num_ports</key> + <value>1</value> + </param> + <param> <key>_coordinate</key> <value>(405, 998)</value> </param> @@ -816,6 +805,10 @@ <value>1</value> </param> <param> + <key>num_ports</key> + <value>1</value> + </param> + <param> <key>_coordinate</key> <value>(420, 1368)</value> </param> @@ -968,10 +961,10 @@ </param> </block> <block> - <key>wxgui_numbersink2</key> + <key>trellis_encoder_xx</key> <param> <key>id</key> - <value>wxgui_numbersink2_2</value> + <value>trellis_encoder_xx_1</value> </param> <param> <key>_enabled</key> @@ -979,71 +972,74 @@ </param> <param> <key>type</key> - <value>float</value> + <value>ss</value> </param> <param> - <key>title</key> - <value>BER 2 (raw)</value> + <key>fsm_args</key> + <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm"</value> </param> <param> - <key>units</key> - <value>BER</value> + <key>init_state</key> + <value>0</value> </param> <param> - <key>samp_rate</key> - <value>R</value> + <key>_coordinate</key> + <value>(336, 311)</value> </param> <param> - <key>base_value</key> - <value>0.0</value> + <key>_rotation</key> + <value>0</value> </param> + </block> + <block> + <key>trellis_viterbi_combined_xx</key> <param> - <key>min_value</key> - <value>0</value> + <key>id</key> + <value>trellis_viterbi_combined_xx_1</value> </param> <param> - <key>max_value</key> - <value>1.0</value> + <key>_enabled</key> + <value>True</value> </param> <param> - <key>factor</key> - <value>1.0</value> + <key>type</key> + <value>c</value> </param> <param> - <key>decimal_places</key> - <value>6</value> + <key>out_type</key> + <value>s</value> </param> <param> - <key>ref_level</key> - <value>0</value> + <key>fsm_args</key> + <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm"</value> </param> <param> - <key>number_rate</key> - <value>15</value> + <key>block_size</key> + <value>1000</value> </param> <param> - <key>peak_hold</key> - <value>False</value> + <key>init_state</key> + <value>-1</value> </param> <param> - <key>average</key> - <value>False</value> + <key>final_state</key> + <value>-1</value> </param> <param> - <key>avg_alpha</key> - <value>0.001</value> + <key>dim</key> + <value>1</value> </param> <param> - <key>show_gauge</key> - <value>True</value> + <key>table</key> + <value>alpha**0.5*1,alpha**0.5*1j,alpha**0.5*(-1j),alpha**0.5*(-1)</value> </param> <param> - <key>grid_pos</key> - <value>0,1,1,1</value> + <key>metric_type</key> + <value>trellis.TRELLIS_EUCLIDEAN</value> </param> <param> <key>_coordinate</key> - <value>(1260, 659)</value> + <value>(79, 501)</value> </param> <param> <key>_rotation</key> @@ -1051,10 +1047,10 @@ </param> </block> <block> - <key>wxgui_numbersink2</key> + <key>trellis_viterbi_combined_xx</key> <param> <key>id</key> - <value>wxgui_numbersink2_3</value> + <value>trellis_viterbi_combined_xx_2</value> </param> <param> <key>_enabled</key> @@ -1062,71 +1058,74 @@ </param> <param> <key>type</key> - <value>float</value> + <value>c</value> </param> <param> - <key>title</key> - <value>BER 2 (after cancelling user 1)</value> + <key>out_type</key> + <value>s</value> </param> <param> - <key>units</key> - <value>BER</value> + <key>fsm_args</key> + <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm"</value> </param> <param> - <key>samp_rate</key> - <value>R</value> + <key>block_size</key> + <value>1000</value> </param> <param> - <key>base_value</key> - <value>0.0</value> + <key>init_state</key> + <value>-1</value> </param> <param> - <key>min_value</key> - <value>0</value> + <key>final_state</key> + <value>-1</value> </param> <param> - <key>max_value</key> - <value>1.0</value> + <key>dim</key> + <value>1</value> </param> <param> - <key>factor</key> - <value>1.0</value> + <key>table</key> + <value>(1-alpha)**0.5*1,(1-alpha)**0.5*1j,(1-alpha)**0.5*(-1j),(1-alpha)**0.5*(-1)</value> </param> <param> - <key>decimal_places</key> - <value>6</value> + <key>metric_type</key> + <value>trellis.TRELLIS_EUCLIDEAN</value> </param> <param> - <key>ref_level</key> - <value>0</value> + <key>_coordinate</key> + <value>(82, 766)</value> </param> <param> - <key>number_rate</key> - <value>15</value> + <key>_rotation</key> + <value>0</value> </param> + </block> + <block> + <key>trellis_encoder_xx</key> <param> - <key>peak_hold</key> - <value>False</value> + <key>id</key> + <value>trellis_encoder_xx_2</value> </param> <param> - <key>average</key> - <value>False</value> + <key>_enabled</key> + <value>True</value> </param> <param> - <key>avg_alpha</key> - <value>0.001</value> + <key>type</key> + <value>ss</value> </param> <param> - <key>show_gauge</key> - <value>True</value> + <key>fsm_args</key> + <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm"</value> </param> <param> - <key>grid_pos</key> - <value>1,1,1,1</value> + <key>init_state</key> + <value>0</value> </param> <param> <key>_coordinate</key> - <value>(1262, 1020)</value> + <value>(89, 998)</value> </param> <param> <key>_rotation</key> @@ -1134,10 +1133,10 @@ </param> </block> <block> - <key>wxgui_numbersink2</key> + <key>trellis_viterbi_combined_xx</key> <param> <key>id</key> - <value>wxgui_numbersink2_3_0</value> + <value>trellis_viterbi_combined_xx_0</value> </param> <param> <key>_enabled</key> @@ -1145,71 +1144,74 @@ </param> <param> <key>type</key> - <value>float</value> + <value>c</value> </param> <param> - <key>title</key> - <value>BER 1 (after cancelling user 2)</value> + <key>out_type</key> + <value>s</value> </param> <param> - <key>units</key> - <value>BER</value> + <key>fsm_args</key> + <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm"</value> </param> <param> - <key>samp_rate</key> - <value>R</value> + <key>block_size</key> + <value>1000</value> </param> <param> - <key>base_value</key> - <value>0.0</value> + <key>init_state</key> + <value>-1</value> </param> <param> - <key>min_value</key> - <value>0</value> + <key>final_state</key> + <value>-1</value> </param> <param> - <key>max_value</key> - <value>1.0</value> + <key>dim</key> + <value>1</value> </param> <param> - <key>factor</key> - <value>1.0</value> + <key>table</key> + <value>(1-alpha)**0.5*1,(1-alpha)**0.5*1j,(1-alpha)**0.5*(-1j),(1-alpha)**0.5*(-1)</value> </param> <param> - <key>decimal_places</key> - <value>6</value> + <key>metric_type</key> + <value>trellis.TRELLIS_EUCLIDEAN</value> </param> <param> - <key>ref_level</key> - <value>0</value> + <key>_coordinate</key> + <value>(83, 1111)</value> </param> <param> - <key>number_rate</key> - <value>15</value> + <key>_rotation</key> + <value>0</value> </param> + </block> + <block> + <key>trellis_encoder_xx</key> <param> - <key>peak_hold</key> - <value>False</value> + <key>id</key> + <value>trellis_encoder_xx_2_0</value> </param> <param> - <key>average</key> - <value>False</value> + <key>_enabled</key> + <value>True</value> </param> <param> - <key>avg_alpha</key> - <value>0.001</value> + <key>type</key> + <value>ss</value> </param> <param> - <key>show_gauge</key> - <value>True</value> + <key>fsm_args</key> + <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm"</value> </param> <param> - <key>grid_pos</key> - <value>1,0,1,1</value> + <key>init_state</key> + <value>0</value> </param> <param> <key>_coordinate</key> - <value>(1269, 1417)</value> + <value>(105, 1367)</value> </param> <param> <key>_rotation</key> @@ -1217,53 +1219,54 @@ </param> </block> <block> - <key>variable</key> + <key>trellis_viterbi_combined_xx</key> <param> <key>id</key> - <value>R</value> + <value>trellis_viterbi_combined_xx_0_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>value</key> - <value>10e3</value> + <key>type</key> + <value>c</value> </param> <param> - <key>_coordinate</key> - <value>(748, 12)</value> + <key>out_type</key> + <value>s</value> </param> <param> - <key>_rotation</key> - <value>0</value> + <key>fsm_args</key> + <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm"</value> </param> - </block> - <block> - <key>trellis_encoder_xx</key> <param> - <key>id</key> - <value>trellis_encoder_xx_0</value> + <key>block_size</key> + <value>1000</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>init_state</key> + <value>-1</value> </param> <param> - <key>type</key> - <value>ss</value> + <key>final_state</key> + <value>-1</value> </param> <param> - <key>fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm"</value> + <key>dim</key> + <value>1</value> </param> <param> - <key>init_state</key> - <value>0</value> + <key>table</key> + <value>alpha**0.5*1,alpha**0.5*1j,alpha**0.5*(-1j),alpha**0.5*(-1)</value> + </param> + <param> + <key>metric_type</key> + <value>trellis.TRELLIS_EUCLIDEAN</value> </param> <param> <key>_coordinate</key> - <value>(334, 190)</value> + <value>(75, 1495)</value> </param> <param> <key>_rotation</key> @@ -1271,10 +1274,10 @@ </param> </block> <block> - <key>trellis_encoder_xx</key> + <key>gr_add_xx</key> <param> <key>id</key> - <value>trellis_encoder_xx_1</value> + <value>gr_add_xx_1</value> </param> <param> <key>_enabled</key> @@ -1282,19 +1285,19 @@ </param> <param> <key>type</key> - <value>ss</value> + <value>complex</value> </param> <param> - <key>fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm"</value> + <key>num_inputs</key> + <value>2</value> </param> <param> - <key>init_state</key> - <value>0</value> + <key>vlen</key> + <value>1</value> </param> <param> <key>_coordinate</key> - <value>(336, 311)</value> + <value>(1400, 262)</value> </param> <param> <key>_rotation</key> @@ -1302,10 +1305,10 @@ </param> </block> <block> - <key>trellis_viterbi_combined_xx</key> + <key>wxgui_scopesink2</key> <param> <key>id</key> - <value>trellis_viterbi_combined_xx_1</value> + <value>wxgui_scopesink2_0</value> </param> <param> <key>_enabled</key> @@ -1313,43 +1316,63 @@ </param> <param> <key>type</key> - <value>c</value> + <value>complex</value> </param> <param> - <key>out_type</key> - <value>s</value> + <key>title</key> + <value>Scope Plot</value> </param> <param> - <key>fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm"</value> + <key>samp_rate</key> + <value>R</value> </param> <param> - <key>block_size</key> - <value>1000</value> + <key>v_scale</key> + <value>0</value> </param> <param> - <key>init_state</key> - <value>-1</value> + <key>v_offset</key> + <value>0</value> </param> <param> - <key>final_state</key> - <value>-1</value> + <key>t_scale</key> + <value>0</value> </param> <param> - <key>dim</key> + <key>ac_couple</key> + <value>False</value> + </param> + <param> + <key>xy_mode</key> + <value>True</value> + </param> + <param> + <key>num_inputs</key> <value>1</value> </param> <param> - <key>table</key> - <value>alpha**0.5*1,alpha**0.5*1j,alpha**0.5*(-1j),alpha**0.5*(-1)</value> + <key>win_size</key> + <value></value> </param> <param> - <key>metric_type</key> - <value>trellis.TRELLIS_EUCLIDEAN</value> + <key>grid_pos</key> + <value></value> + </param> + <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>trig_mode</key> + <value>gr.gr_TRIG_MODE_AUTO</value> + </param> + <param> + <key>y_axis_label</key> + <value>Counts</value> </param> <param> <key>_coordinate</key> - <value>(79, 501)</value> + <value>(1533, 149)</value> </param> <param> <key>_rotation</key> @@ -1357,54 +1380,53 @@ </param> </block> <block> - <key>trellis_viterbi_combined_xx</key> + <key>variable</key> <param> <key>id</key> - <value>trellis_viterbi_combined_xx_2</value> + <value>prefix</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> - <value>c</value> - </param> - <param> - <key>out_type</key> - <value>s</value> + <key>value</key> + <value>"/n/harrisville/x/anastas/gnuradio_trunk/"</value> </param> <param> - <key>fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm"</value> + <key>_coordinate</key> + <value>(871, 14)</value> </param> <param> - <key>block_size</key> - <value>1000</value> + <key>_rotation</key> + <value>0</value> </param> + </block> + <block> + <key>trellis_encoder_xx</key> <param> - <key>init_state</key> - <value>-1</value> + <key>id</key> + <value>trellis_encoder_xx_0</value> </param> <param> - <key>final_state</key> - <value>-1</value> + <key>_enabled</key> + <value>True</value> </param> <param> - <key>dim</key> - <value>1</value> + <key>type</key> + <value>ss</value> </param> <param> - <key>table</key> - <value>(1-alpha)**0.5*1,(1-alpha)**0.5*1j,(1-alpha)**0.5*(-1j),(1-alpha)**0.5*(-1)</value> + <key>fsm_args</key> + <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm"</value> </param> <param> - <key>metric_type</key> - <value>trellis.TRELLIS_EUCLIDEAN</value> + <key>init_state</key> + <value>0</value> </param> <param> <key>_coordinate</key> - <value>(82, 766)</value> + <value>(340, 187)</value> </param> <param> <key>_rotation</key> @@ -1412,10 +1434,10 @@ </param> </block> <block> - <key>trellis_encoder_xx</key> + <key>gr_throttle</key> <param> <key>id</key> - <value>trellis_encoder_xx_2</value> + <value>gr_throttle_0</value> </param> <param> <key>_enabled</key> @@ -1423,19 +1445,19 @@ </param> <param> <key>type</key> - <value>ss</value> + <value>short</value> </param> <param> - <key>fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm"</value> + <key>samples_per_second</key> + <value>R</value> </param> <param> - <key>init_state</key> - <value>0</value> + <key>vlen</key> + <value>1</value> </param> <param> <key>_coordinate</key> - <value>(89, 998)</value> + <value>(534, 149)</value> </param> <param> <key>_rotation</key> @@ -1443,54 +1465,61 @@ </param> </block> <block> - <key>trellis_viterbi_combined_xx</key> + <key>gr_chunks_to_symbols_xx</key> <param> <key>id</key> - <value>trellis_viterbi_combined_xx_0</value> + <value>gr_chunks_to_symbols_xx_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> - <value>c</value> + <key>in_type</key> + <value>short</value> </param> <param> <key>out_type</key> - <value>s</value> + <value>complex</value> </param> <param> - <key>fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm"</value> + <key>symbol_table</key> + <value>1,1j,-1j,-1</value> </param> <param> - <key>block_size</key> - <value>1000</value> + <key>dimension</key> + <value>1</value> </param> <param> - <key>init_state</key> - <value>-1</value> + <key>num_ports</key> + <value>1</value> </param> <param> - <key>final_state</key> - <value>-1</value> + <key>_coordinate</key> + <value>(682, 186)</value> </param> <param> - <key>dim</key> - <value>1</value> + <key>_rotation</key> + <value>0</value> </param> + </block> + <block> + <key>variable</key> <param> - <key>table</key> - <value>(1-alpha)**0.5*1,(1-alpha)**0.5*1j,(1-alpha)**0.5*(-1j),(1-alpha)**0.5*(-1)</value> + <key>id</key> + <value>R</value> </param> <param> - <key>metric_type</key> - <value>trellis.TRELLIS_EUCLIDEAN</value> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>100e3</value> </param> <param> <key>_coordinate</key> - <value>(83, 1111)</value> + <value>(748, 12)</value> </param> <param> <key>_rotation</key> @@ -1498,10 +1527,10 @@ </param> </block> <block> - <key>trellis_encoder_xx</key> + <key>wxgui_numbersink2</key> <param> <key>id</key> - <value>trellis_encoder_xx_2_0</value> + <value>wxgui_numbersink2_0</value> </param> <param> <key>_enabled</key> @@ -1509,74 +1538,75 @@ </param> <param> <key>type</key> - <value>ss</value> + <value>float</value> </param> <param> - <key>fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm"</value> + <key>title</key> + <value>BER 1 (raw)</value> </param> <param> - <key>init_state</key> - <value>0</value> + <key>units</key> + <value>BER</value> </param> <param> - <key>_coordinate</key> - <value>(105, 1367)</value> + <key>samp_rate</key> + <value>R</value> </param> <param> - <key>_rotation</key> + <key>min_value</key> <value>0</value> </param> - </block> - <block> - <key>trellis_viterbi_combined_xx</key> <param> - <key>id</key> - <value>trellis_viterbi_combined_xx_0_0</value> + <key>max_value</key> + <value>1</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>factor</key> + <value>1.0</value> </param> <param> - <key>type</key> - <value>c</value> + <key>decimal_places</key> + <value>6</value> </param> <param> - <key>out_type</key> - <value>s</value> + <key>ref_level</key> + <value>0</value> </param> <param> - <key>fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm"</value> + <key>number_rate</key> + <value>15</value> </param> <param> - <key>block_size</key> - <value>1000</value> + <key>peak_hold</key> + <value>False</value> </param> <param> - <key>init_state</key> - <value>-1</value> + <key>average</key> + <value>True</value> </param> <param> - <key>final_state</key> - <value>-1</value> + <key>avg_alpha</key> + <value>0.001</value> </param> <param> - <key>dim</key> - <value>1</value> + <key>show_gauge</key> + <value>True</value> </param> <param> - <key>table</key> - <value>alpha**0.5*1,alpha**0.5*1j,alpha**0.5*(-1j),alpha**0.5*(-1)</value> + <key>win_size</key> + <value></value> </param> <param> - <key>metric_type</key> - <value>trellis.TRELLIS_EUCLIDEAN</value> + <key>grid_pos</key> + <value>0,0,1,1</value> + </param> + <param> + <key>notebook</key> + <value></value> </param> <param> <key>_coordinate</key> - <value>(75, 1495)</value> + <value>(1267, 410)</value> </param> <param> <key>_rotation</key> @@ -1584,53 +1614,86 @@ </param> </block> <block> - <key>variable</key> + <key>wxgui_numbersink2</key> <param> <key>id</key> - <value>prefix</value> + <value>wxgui_numbersink2_2</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>value</key> - <value>"../../../"</value> + <key>type</key> + <value>float</value> </param> <param> - <key>_coordinate</key> - <value>(871, 14)</value> + <key>title</key> + <value>BER 2 (raw)</value> </param> <param> - <key>_rotation</key> + <key>units</key> + <value>BER</value> + </param> + <param> + <key>samp_rate</key> + <value>R</value> + </param> + <param> + <key>min_value</key> <value>0</value> </param> - </block> - <block> - <key>gr_add_xx</key> <param> - <key>id</key> - <value>gr_add_xx_1</value> + <key>max_value</key> + <value>1.0</value> </param> <param> - <key>_enabled</key> + <key>factor</key> + <value>1.0</value> + </param> + <param> + <key>decimal_places</key> + <value>6</value> + </param> + <param> + <key>ref_level</key> + <value>0</value> + </param> + <param> + <key>number_rate</key> + <value>15</value> + </param> + <param> + <key>peak_hold</key> + <value>False</value> + </param> + <param> + <key>average</key> <value>True</value> </param> <param> - <key>type</key> - <value>complex</value> + <key>avg_alpha</key> + <value>0.001</value> </param> <param> - <key>num_inputs</key> - <value>2</value> + <key>show_gauge</key> + <value>True</value> </param> <param> - <key>vlen</key> - <value>1</value> + <key>win_size</key> + <value></value> + </param> + <param> + <key>grid_pos</key> + <value>0,1,1,1</value> + </param> + <param> + <key>notebook</key> + <value></value> </param> <param> <key>_coordinate</key> - <value>(1400, 262)</value> + <value>(1260, 659)</value> </param> <param> <key>_rotation</key> @@ -1641,7 +1704,7 @@ <key>wxgui_numbersink2</key> <param> <key>id</key> - <value>wxgui_numbersink2_0</value> + <value>wxgui_numbersink2_3</value> </param> <param> <key>_enabled</key> @@ -1653,7 +1716,7 @@ </param> <param> <key>title</key> - <value>BER 1 (raw)</value> + <value>BER 2 (after cancelling user 1)</value> </param> <param> <key>units</key> @@ -1664,16 +1727,12 @@ <value>R</value> </param> <param> - <key>base_value</key> - <value>0.0</value> - </param> - <param> <key>min_value</key> <value>0</value> </param> <param> <key>max_value</key> - <value>1</value> + <value>1.0</value> </param> <param> <key>factor</key> @@ -1697,7 +1756,7 @@ </param> <param> <key>average</key> - <value>False</value> + <value>True</value> </param> <param> <key>avg_alpha</key> @@ -1708,12 +1767,20 @@ <value>True</value> </param> <param> + <key>win_size</key> + <value></value> + </param> + <param> <key>grid_pos</key> - <value>0,0,1,1</value> + <value>1,1,1,1</value> + </param> + <param> + <key>notebook</key> + <value></value> </param> <param> <key>_coordinate</key> - <value>(1267, 410)</value> + <value>(1262, 1020)</value> </param> <param> <key>_rotation</key> @@ -1721,10 +1788,10 @@ </param> </block> <block> - <key>wxgui_scopesink2</key> + <key>wxgui_numbersink2</key> <param> <key>id</key> - <value>wxgui_scopesink2_0</value> + <value>wxgui_numbersink2_3_0</value> </param> <param> <key>_enabled</key> @@ -1732,43 +1799,75 @@ </param> <param> <key>type</key> - <value>complex</value> + <value>float</value> </param> <param> <key>title</key> - <value>Scope Plot</value> + <value>BER 1 (after cancelling user 2)</value> + </param> + <param> + <key>units</key> + <value>BER</value> </param> <param> <key>samp_rate</key> <value>R</value> </param> <param> - <key>v_scale</key> + <key>min_value</key> <value>0</value> </param> <param> - <key>t_scale</key> + <key>max_value</key> + <value>1.0</value> + </param> + <param> + <key>factor</key> + <value>1.0</value> + </param> + <param> + <key>decimal_places</key> + <value>6</value> + </param> + <param> + <key>ref_level</key> <value>0</value> </param> <param> - <key>ac_couple</key> + <key>number_rate</key> + <value>15</value> + </param> + <param> + <key>peak_hold</key> <value>False</value> </param> <param> - <key>xy_mode</key> + <key>average</key> <value>True</value> </param> <param> - <key>num_inputs</key> - <value>1</value> + <key>avg_alpha</key> + <value>0.001</value> + </param> + <param> + <key>show_gauge</key> + <value>True</value> + </param> + <param> + <key>win_size</key> + <value></value> </param> <param> <key>grid_pos</key> + <value>1,0,1,1</value> + </param> + <param> + <key>notebook</key> <value></value> </param> <param> <key>_coordinate</key> - <value>(1533, 149)</value> + <value>(1269, 1417)</value> </param> <param> <key>_rotation</key> @@ -1782,12 +1881,6 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>trellis_encoder_xx_0</source_block_id> - <sink_block_id>gr_chunks_to_symbols_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> <source_block_id>trellis_encoder_xx_1</source_block_id> <sink_block_id>gr_chunks_to_symbols_xx_1</sink_block_id> <source_key>0</source_key> @@ -2069,4 +2162,16 @@ <source_key>0</source_key> <sink_key>0</sink_key> </connection> + <connection> + <source_block_id>trellis_encoder_xx_0</source_block_id> + <sink_block_id>gr_throttle_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_throttle_0</source_block_id> + <sink_block_id>gr_chunks_to_symbols_xx_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> </flow_graph> diff --git a/gnuradio-examples/grc/trellis/pccc.grc b/gnuradio-examples/grc/trellis/pccc.grc new file mode 100644 index 000000000..c3111c321 --- /dev/null +++ b/gnuradio-examples/grc/trellis/pccc.grc @@ -0,0 +1,832 @@ +<?xml version='1.0' encoding='ASCII'?> +<flow_graph> + <timestamp>Thu Sep 1 12:53:13 2011</timestamp> + <block> + <key>options</key> + <param> + <key>id</key> + <value>sccc1</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>title</key> + <value>Serially Concatenated Convolutional Code</value> + </param> + <param> + <key>author</key> + <value>AA</value> + </param> + <param> + <key>description</key> + <value>gnuradio flow graph</value> + </param> + <param> + <key>window_size</key> + <value>2048, 2048</value> + </param> + <param> + <key>generate_options</key> + <value>wx_gui</value> + </param> + <param> + <key>category</key> + <value>Custom</value> + </param> + <param> + <key>run_options</key> + <value>prompt</value> + </param> + <param> + <key>run</key> + <value>True</value> + </param> + <param> + <key>realtime_scheduling</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(10, 10)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>noisevar</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>10**(-snr_db/10)</value> + </param> + <param> + <key>_coordinate</key> + <value>(389, 15)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>prefix</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>"/n/harrisville/x/anastas/gnuradio_trunk/"</value> + </param> + <param> + <key>_coordinate</key> + <value>(590, 15)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>block</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>1000</value> + </param> + <param> + <key>_coordinate</key> + <value>(764, 16)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_slider</key> + <param> + <key>id</key> + <value>snr_db</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>label</key> + <value>SNR (dB)</value> + </param> + <param> + <key>value</key> + <value>5</value> + </param> + <param> + <key>min</key> + <value>-10</value> + </param> + <param> + <key>max</key> + <value>10</value> + </param> + <param> + <key>num_steps</key> + <value>100</value> + </param> + <param> + <key>style</key> + <value>wx.SL_HORIZONTAL</value> + </param> + <param> + <key>converver</key> + <value>float_converter</value> + </param> + <param> + <key>grid_pos</key> + <value></value> + </param> + <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(229, 13)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_multiply_xx</key> + <param> + <key>id</key> + <value>gr_multiply_xx_2_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>short</value> + </param> + <param> + <key>num_inputs</key> + <value>2</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(392, 591)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_short_to_float</key> + <param> + <key>id</key> + <value>gr_short_to_float_1_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(535, 609)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>wxgui_numbersink2</key> + <param> + <key>id</key> + <value>wxgui_numbersink2_3_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>title</key> + <value>BER</value> + </param> + <param> + <key>units</key> + <value>BER</value> + </param> + <param> + <key>samp_rate</key> + <value>R</value> + </param> + <param> + <key>min_value</key> + <value>0</value> + </param> + <param> + <key>max_value</key> + <value>1.0</value> + </param> + <param> + <key>factor</key> + <value>1.0</value> + </param> + <param> + <key>decimal_places</key> + <value>6</value> + </param> + <param> + <key>ref_level</key> + <value>0</value> + </param> + <param> + <key>number_rate</key> + <value>15</value> + </param> + <param> + <key>peak_hold</key> + <value>False</value> + </param> + <param> + <key>average</key> + <value>True</value> + </param> + <param> + <key>avg_alpha</key> + <value>0.001</value> + </param> + <param> + <key>show_gauge</key> + <value>True</value> + </param> + <param> + <key>win_size</key> + <value></value> + </param> + <param> + <key>grid_pos</key> + <value>1,0,1,1</value> + </param> + <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(713, 426)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_noise_source_x</key> + <param> + <key>id</key> + <value>gr_noise_source_x_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>noise_type</key> + <value>gr.GR_GAUSSIAN</value> + </param> + <param> + <key>amp</key> + <value>noisevar</value> + </param> + <param> + <key>seed</key> + <value>42</value> + </param> + <param> + <key>_coordinate</key> + <value>(672, 290)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>wxgui_scopesink2</key> + <param> + <key>id</key> + <value>wxgui_scopesink2_0</value> + </param> + <param> + <key>_enabled</key> + <value>False</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>title</key> + <value>Scope Plot</value> + </param> + <param> + <key>samp_rate</key> + <value>R</value> + </param> + <param> + <key>v_scale</key> + <value>0</value> + </param> + <param> + <key>v_offset</key> + <value>0</value> + </param> + <param> + <key>t_scale</key> + <value>0</value> + </param> + <param> + <key>ac_couple</key> + <value>False</value> + </param> + <param> + <key>xy_mode</key> + <value>False</value> + </param> + <param> + <key>num_inputs</key> + <value>1</value> + </param> + <param> + <key>win_size</key> + <value></value> + </param> + <param> + <key>grid_pos</key> + <value></value> + </param> + <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>trig_mode</key> + <value>gr.gr_TRIG_MODE_AUTO</value> + </param> + <param> + <key>y_axis_label</key> + <value>Counts</value> + </param> + <param> + <key>_coordinate</key> + <value>(952, 73)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>random_source_x</key> + <param> + <key>id</key> + <value>random_source_x_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>short</value> + </param> + <param> + <key>min</key> + <value>0</value> + </param> + <param> + <key>max</key> + <value>2</value> + </param> + <param> + <key>num_samps</key> + <value>1000</value> + </param> + <param> + <key>repeat</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(21, 170)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_throttle</key> + <param> + <key>id</key> + <value>gr_throttle_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>short</value> + </param> + <param> + <key>samples_per_second</key> + <value>R</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(517, 103)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_chunks_to_symbols_xx</key> + <param> + <key>id</key> + <value>gr_chunks_to_symbols_xx_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>in_type</key> + <value>short</value> + </param> + <param> + <key>out_type</key> + <value>float</value> + </param> + <param> + <key>symbol_table</key> + <value>-7,0, -5,0, -3,0, -1,0, 1,0, 3,0, 5,0, 7,0, 0,-7,0, -5,0, -3,0, -1,0, 1,0, 3,0, 5,0, 7</value> + </param> + <param> + <key>dimension</key> + <value>2</value> + </param> + <param> + <key>num_ports</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(551, 184)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>trellis_pccc_encoder_xx</key> + <param> + <key>id</key> + <value>trellis_pccc_encoder_xx_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>ss</value> + </param> + <param> + <key>o_fsm_args</key> + <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_4.fsm"</value> + </param> + <param> + <key>o_init_state</key> + <value>0</value> + </param> + <param> + <key>i_fsm_args</key> + <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_4.fsm"</value> + </param> + <param> + <key>i_init_state</key> + <value>0</value> + </param> + <param> + <key>interleaver_args</key> + <value>trellis.interleaver(block,666)</value> + </param> + <param> + <key>bl</key> + <value>block</value> + </param> + <param> + <key>_coordinate</key> + <value>(236, 147)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>R</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>100e3</value> + </param> + <param> + <key>_coordinate</key> + <value>(482, 17)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_add_xx</key> + <param> + <key>id</key> + <value>gr_add_xx_1</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>num_inputs</key> + <value>2</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(951, 256)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>trellis_pccc_decoder_combined_xx</key> + <param> + <key>id</key> + <value>trellis_pccc_decoder_combined_xx_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>f</value> + </param> + <param> + <key>out_type</key> + <value>s</value> + </param> + <param> + <key>o_fsm_args</key> + <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_4.fsm"</value> + </param> + <param> + <key>o_init_state</key> + <value>0</value> + </param> + <param> + <key>o_final_state</key> + <value>-1</value> + </param> + <param> + <key>i_fsm_args</key> + <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_4.fsm"</value> + </param> + <param> + <key>i_init_state</key> + <value>0</value> + </param> + <param> + <key>i_final_state</key> + <value>-1</value> + </param> + <param> + <key>interleaver</key> + <value>trellis.interleaver(block,666)</value> + </param> + <param> + <key>block_size</key> + <value>block</value> + </param> + <param> + <key>iterations</key> + <value>10</value> + </param> + <param> + <key>dim</key> + <value>2</value> + </param> + <param> + <key>table</key> + <value>-7,0, -5,0, -3,0, -1,0, 1,0, 3,0, 5,0, 7,0, 0,-7,0, -5,0, -3,0, -1,0, 1,0, 3,0, 5,0, 7</value> + </param> + <param> + <key>metric_type</key> + <value>trellis.TRELLIS_EUCLIDEAN</value> + </param> + <param> + <key>siso_type</key> + <value>trellis.TRELLIS_MIN_SUM</value> + </param> + <param> + <key>scaling</key> + <value>1.0</value> + </param> + <param> + <key>_coordinate</key> + <value>(196, 274)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_sub_xx</key> + <param> + <key>id</key> + <value>gr_sub_xx_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>short</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>num_inputs</key> + <value>2</value> + </param> + <param> + <key>_coordinate</key> + <value>(217, 597)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <connection> + <source_block_id>random_source_x_0</source_block_id> + <sink_block_id>gr_sub_xx_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_throttle_0</source_block_id> + <sink_block_id>gr_chunks_to_symbols_xx_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_add_xx_1</source_block_id> + <sink_block_id>wxgui_scopesink2_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_noise_source_x_0</source_block_id> + <sink_block_id>gr_add_xx_1</sink_block_id> + <source_key>0</source_key> + <sink_key>1</sink_key> + </connection> + <connection> + <source_block_id>gr_chunks_to_symbols_xx_0</source_block_id> + <sink_block_id>gr_add_xx_1</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_multiply_xx_2_0</source_block_id> + <sink_block_id>gr_short_to_float_1_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_short_to_float_1_0</source_block_id> + <sink_block_id>wxgui_numbersink2_3_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_sub_xx_0</source_block_id> + <sink_block_id>gr_multiply_xx_2_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_sub_xx_0</source_block_id> + <sink_block_id>gr_multiply_xx_2_0</sink_block_id> + <source_key>0</source_key> + <sink_key>1</sink_key> + </connection> + <connection> + <source_block_id>random_source_x_0</source_block_id> + <sink_block_id>trellis_pccc_encoder_xx_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>trellis_pccc_encoder_xx_0</source_block_id> + <sink_block_id>gr_throttle_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_add_xx_1</source_block_id> + <sink_block_id>trellis_pccc_decoder_combined_xx_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>trellis_pccc_decoder_combined_xx_0</source_block_id> + <sink_block_id>gr_sub_xx_0</sink_block_id> + <source_key>0</source_key> + <sink_key>1</sink_key> + </connection> +</flow_graph> diff --git a/gnuradio-examples/grc/trellis/pccc1.grc b/gnuradio-examples/grc/trellis/pccc1.grc new file mode 100644 index 000000000..15a63707e --- /dev/null +++ b/gnuradio-examples/grc/trellis/pccc1.grc @@ -0,0 +1,857 @@ +<?xml version='1.0' encoding='ASCII'?> +<flow_graph> + <timestamp>Wed Aug 31 20:34:39 2011</timestamp> + <block> + <key>options</key> + <param> + <key>id</key> + <value>sccc1</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>title</key> + <value>Serially Concatenated Convolutional Code</value> + </param> + <param> + <key>author</key> + <value>AA</value> + </param> + <param> + <key>description</key> + <value>gnuradio flow graph</value> + </param> + <param> + <key>window_size</key> + <value>2048, 2048</value> + </param> + <param> + <key>generate_options</key> + <value>wx_gui</value> + </param> + <param> + <key>category</key> + <value>Custom</value> + </param> + <param> + <key>run_options</key> + <value>prompt</value> + </param> + <param> + <key>run</key> + <value>True</value> + </param> + <param> + <key>realtime_scheduling</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(10, 10)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>noisevar</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>10**(-snr_db/10)</value> + </param> + <param> + <key>_coordinate</key> + <value>(389, 15)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>prefix</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>"/n/harrisville/x/anastas/gnuradio_trunk/"</value> + </param> + <param> + <key>_coordinate</key> + <value>(590, 15)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>block</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>1000</value> + </param> + <param> + <key>_coordinate</key> + <value>(764, 16)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_slider</key> + <param> + <key>id</key> + <value>snr_db</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>label</key> + <value>SNR (dB)</value> + </param> + <param> + <key>value</key> + <value>5</value> + </param> + <param> + <key>min</key> + <value>-10</value> + </param> + <param> + <key>max</key> + <value>10</value> + </param> + <param> + <key>num_steps</key> + <value>100</value> + </param> + <param> + <key>style</key> + <value>wx.SL_HORIZONTAL</value> + </param> + <param> + <key>converver</key> + <value>float_converter</value> + </param> + <param> + <key>grid_pos</key> + <value></value> + </param> + <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(229, 13)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_multiply_xx</key> + <param> + <key>id</key> + <value>gr_multiply_xx_2_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>short</value> + </param> + <param> + <key>num_inputs</key> + <value>2</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(392, 591)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_short_to_float</key> + <param> + <key>id</key> + <value>gr_short_to_float_1_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(535, 609)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>wxgui_numbersink2</key> + <param> + <key>id</key> + <value>wxgui_numbersink2_3_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>title</key> + <value>BER</value> + </param> + <param> + <key>units</key> + <value>BER</value> + </param> + <param> + <key>samp_rate</key> + <value>R</value> + </param> + <param> + <key>min_value</key> + <value>0</value> + </param> + <param> + <key>max_value</key> + <value>1.0</value> + </param> + <param> + <key>factor</key> + <value>1.0</value> + </param> + <param> + <key>decimal_places</key> + <value>6</value> + </param> + <param> + <key>ref_level</key> + <value>0</value> + </param> + <param> + <key>number_rate</key> + <value>15</value> + </param> + <param> + <key>peak_hold</key> + <value>False</value> + </param> + <param> + <key>average</key> + <value>True</value> + </param> + <param> + <key>avg_alpha</key> + <value>0.001</value> + </param> + <param> + <key>show_gauge</key> + <value>True</value> + </param> + <param> + <key>win_size</key> + <value></value> + </param> + <param> + <key>grid_pos</key> + <value>1,0,1,1</value> + </param> + <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(713, 426)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_noise_source_x</key> + <param> + <key>id</key> + <value>gr_noise_source_x_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>noise_type</key> + <value>gr.GR_GAUSSIAN</value> + </param> + <param> + <key>amp</key> + <value>noisevar</value> + </param> + <param> + <key>seed</key> + <value>42</value> + </param> + <param> + <key>_coordinate</key> + <value>(672, 290)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_add_xx</key> + <param> + <key>id</key> + <value>gr_add_xx_1</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>num_inputs</key> + <value>2</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(951, 256)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>wxgui_scopesink2</key> + <param> + <key>id</key> + <value>wxgui_scopesink2_0</value> + </param> + <param> + <key>_enabled</key> + <value>False</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>title</key> + <value>Scope Plot</value> + </param> + <param> + <key>samp_rate</key> + <value>R</value> + </param> + <param> + <key>v_scale</key> + <value>0</value> + </param> + <param> + <key>v_offset</key> + <value>0</value> + </param> + <param> + <key>t_scale</key> + <value>0</value> + </param> + <param> + <key>ac_couple</key> + <value>False</value> + </param> + <param> + <key>xy_mode</key> + <value>False</value> + </param> + <param> + <key>num_inputs</key> + <value>1</value> + </param> + <param> + <key>win_size</key> + <value></value> + </param> + <param> + <key>grid_pos</key> + <value></value> + </param> + <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>trig_mode</key> + <value>gr.gr_TRIG_MODE_AUTO</value> + </param> + <param> + <key>y_axis_label</key> + <value>Counts</value> + </param> + <param> + <key>_coordinate</key> + <value>(952, 73)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>random_source_x</key> + <param> + <key>id</key> + <value>random_source_x_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>short</value> + </param> + <param> + <key>min</key> + <value>0</value> + </param> + <param> + <key>max</key> + <value>2</value> + </param> + <param> + <key>num_samps</key> + <value>1000</value> + </param> + <param> + <key>repeat</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(21, 170)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_throttle</key> + <param> + <key>id</key> + <value>gr_throttle_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>short</value> + </param> + <param> + <key>samples_per_second</key> + <value>R</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(517, 103)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_sub_xx</key> + <param> + <key>id</key> + <value>gr_sub_xx_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>short</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>num_inputs</key> + <value>2</value> + </param> + <param> + <key>_coordinate</key> + <value>(217, 597)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_chunks_to_symbols_xx</key> + <param> + <key>id</key> + <value>gr_chunks_to_symbols_xx_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>in_type</key> + <value>short</value> + </param> + <param> + <key>out_type</key> + <value>float</value> + </param> + <param> + <key>symbol_table</key> + <value>-7,0, -5,0, -3,0, -1,0, 1,0, 3,0, 5,0, 7,0, 0,-7,0, -5,0, -3,0, -1,0, 1,0, 3,0, 5,0, 7</value> + </param> + <param> + <key>dimension</key> + <value>2</value> + </param> + <param> + <key>num_ports</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(551, 184)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>trellis_pccc_encoder_xx</key> + <param> + <key>id</key> + <value>trellis_pccc_encoder_xx_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>ss</value> + </param> + <param> + <key>o_fsm_args</key> + <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_4.fsm"</value> + </param> + <param> + <key>o_init_state</key> + <value>0</value> + </param> + <param> + <key>i_fsm_args</key> + <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_4.fsm"</value> + </param> + <param> + <key>i_init_state</key> + <value>0</value> + </param> + <param> + <key>interleaver_args</key> + <value>trellis.interleaver(block,666)</value> + </param> + <param> + <key>bl</key> + <value>block</value> + </param> + <param> + <key>_coordinate</key> + <value>(236, 147)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>trellis_pccc_decoder_x</key> + <param> + <key>id</key> + <value>trellis_pccc_decoder_x_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>out_type</key> + <value>s</value> + </param> + <param> + <key>o_fsm_args</key> + <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_4.fsm"</value> + </param> + <param> + <key>o_init_state</key> + <value>0</value> + </param> + <param> + <key>o_final_state</key> + <value>-1</value> + </param> + <param> + <key>i_fsm_args</key> + <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_4.fsm"</value> + </param> + <param> + <key>i_init_state</key> + <value>0</value> + </param> + <param> + <key>i_final_state</key> + <value>-1</value> + </param> + <param> + <key>interleaver</key> + <value>trellis.interleaver(block,666)</value> + </param> + <param> + <key>block_size</key> + <value>block</value> + </param> + <param> + <key>iterations</key> + <value>10</value> + </param> + <param> + <key>siso_type</key> + <value>trellis.TRELLIS_MIN_SUM</value> + </param> + <param> + <key>_coordinate</key> + <value>(357, 304)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>trellis_metrics_x</key> + <param> + <key>id</key> + <value>trellis_metrics_x_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>f</value> + </param> + <param> + <key>card</key> + <value>16</value> + </param> + <param> + <key>dim</key> + <value>2</value> + </param> + <param> + <key>table</key> + <value>-7,0, -5,0, -3,0, -1,0, 1,0, 3,0, 5,0, 7,0, 0,-7,0, -5,0, -3,0, -1,0, 1,0, 3,0, 5,0, 7</value> + </param> + <param> + <key>metric_type</key> + <value>trellis.TRELLIS_EUCLIDEAN</value> + </param> + <param> + <key>_coordinate</key> + <value>(58, 354)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>R</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>100e3</value> + </param> + <param> + <key>_coordinate</key> + <value>(482, 17)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <connection> + <source_block_id>random_source_x_0</source_block_id> + <sink_block_id>gr_sub_xx_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_throttle_0</source_block_id> + <sink_block_id>gr_chunks_to_symbols_xx_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_add_xx_1</source_block_id> + <sink_block_id>wxgui_scopesink2_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_noise_source_x_0</source_block_id> + <sink_block_id>gr_add_xx_1</sink_block_id> + <source_key>0</source_key> + <sink_key>1</sink_key> + </connection> + <connection> + <source_block_id>gr_chunks_to_symbols_xx_0</source_block_id> + <sink_block_id>gr_add_xx_1</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_multiply_xx_2_0</source_block_id> + <sink_block_id>gr_short_to_float_1_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_short_to_float_1_0</source_block_id> + <sink_block_id>wxgui_numbersink2_3_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_sub_xx_0</source_block_id> + <sink_block_id>gr_multiply_xx_2_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_sub_xx_0</source_block_id> + <sink_block_id>gr_multiply_xx_2_0</sink_block_id> + <source_key>0</source_key> + <sink_key>1</sink_key> + </connection> + <connection> + <source_block_id>gr_add_xx_1</source_block_id> + <sink_block_id>trellis_metrics_x_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>random_source_x_0</source_block_id> + <sink_block_id>trellis_pccc_encoder_xx_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>trellis_pccc_encoder_xx_0</source_block_id> + <sink_block_id>gr_throttle_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>trellis_metrics_x_0</source_block_id> + <sink_block_id>trellis_pccc_decoder_x_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>trellis_pccc_decoder_x_0</source_block_id> + <sink_block_id>gr_sub_xx_0</sink_block_id> + <source_key>0</source_key> + <sink_key>1</sink_key> + </connection> +</flow_graph> diff --git a/gnuradio-examples/grc/trellis/readme.txt b/gnuradio-examples/grc/trellis/readme.txt index d620fd628..9c7363af8 100644 --- a/gnuradio-examples/grc/trellis/readme.txt +++ b/gnuradio-examples/grc/trellis/readme.txt @@ -1,5 +1,7 @@ -This is an example of using gr-trellis in grc. +These are examples of using gr-trellis in grc. +INTERFERENCE CANCELLATION +------------------------- Two users are transmitting simultaneously using convolutionally encoded QPSK, each with power P1=alpha*P and P2=(1-alpha)*P. The combined signal is observed in noise and four different receivers are considered: 1) A viterbi decoder decoding user 1 assuming user 2 is noise @@ -13,4 +15,18 @@ The combined signal is observed in noise and four different receivers are consid You can change the signal to noise ratio P/sigma^2 and the allocation of power to the two users, alpha. + +Serially Concatenated Convolutional Codes +----------------------------------------- +An SCCC can be defined by an outer and an inner FSM together with an interleaver +and a modulation type. You can change the SNR and observe the estimated BER. +In sccc.grc the decoding and metric calculation are combined; in sccc1.grc they are separate. + +Parallel Concatenated Convolutional Codes +----------------------------------------- +A PCCC can be defined by two FSMs together with an interleaver +and a modulation type. You can change the SNR and observe the estimated BER. +In pccc1.grc the decoding and metric calculation are separate. + + Enjoy. diff --git a/gnuradio-examples/grc/trellis/sccc.grc b/gnuradio-examples/grc/trellis/sccc.grc new file mode 100644 index 000000000..e8f656f63 --- /dev/null +++ b/gnuradio-examples/grc/trellis/sccc.grc @@ -0,0 +1,832 @@ +<?xml version='1.0' encoding='ASCII'?> +<flow_graph> + <timestamp>Wed Aug 31 19:57:09 2011</timestamp> + <block> + <key>options</key> + <param> + <key>id</key> + <value>sccc</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>title</key> + <value>Serially Concatenated Convolutional Code</value> + </param> + <param> + <key>author</key> + <value>AA</value> + </param> + <param> + <key>description</key> + <value>gnuradio flow graph</value> + </param> + <param> + <key>window_size</key> + <value>2048, 2048</value> + </param> + <param> + <key>generate_options</key> + <value>wx_gui</value> + </param> + <param> + <key>category</key> + <value>Custom</value> + </param> + <param> + <key>run_options</key> + <value>prompt</value> + </param> + <param> + <key>run</key> + <value>True</value> + </param> + <param> + <key>realtime_scheduling</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(10, 10)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>noisevar</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>10**(-snr_db/10)</value> + </param> + <param> + <key>_coordinate</key> + <value>(389, 15)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>random_source_x</key> + <param> + <key>id</key> + <value>random_source_x_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>short</value> + </param> + <param> + <key>min</key> + <value>0</value> + </param> + <param> + <key>max</key> + <value>2</value> + </param> + <param> + <key>num_samps</key> + <value>1000</value> + </param> + <param> + <key>repeat</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(21, 170)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>prefix</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>"/n/harrisville/x/anastas/gnuradio_trunk/"</value> + </param> + <param> + <key>_coordinate</key> + <value>(590, 15)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>block</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>1000</value> + </param> + <param> + <key>_coordinate</key> + <value>(764, 16)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_add_xx</key> + <param> + <key>id</key> + <value>gr_add_xx_1</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>num_inputs</key> + <value>2</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(951, 256)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_sub_xx</key> + <param> + <key>id</key> + <value>gr_sub_xx_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>short</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>num_inputs</key> + <value>2</value> + </param> + <param> + <key>_coordinate</key> + <value>(445, 517)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_multiply_xx</key> + <param> + <key>id</key> + <value>gr_multiply_xx_2_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>short</value> + </param> + <param> + <key>num_inputs</key> + <value>2</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(228.25, 798.39170361874085)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_short_to_float</key> + <param> + <key>id</key> + <value>gr_short_to_float_1_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(416, 815)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_slider</key> + <param> + <key>id</key> + <value>snr_db</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>label</key> + <value>SNR (dB)</value> + </param> + <param> + <key>value</key> + <value>5</value> + </param> + <param> + <key>min</key> + <value>-10</value> + </param> + <param> + <key>max</key> + <value>10</value> + </param> + <param> + <key>num_steps</key> + <value>100</value> + </param> + <param> + <key>style</key> + <value>wx.SL_HORIZONTAL</value> + </param> + <param> + <key>converver</key> + <value>float_converter</value> + </param> + <param> + <key>grid_pos</key> + <value></value> + </param> + <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(229, 13)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>R</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>10e3</value> + </param> + <param> + <key>_coordinate</key> + <value>(482, 17)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>wxgui_scopesink2</key> + <param> + <key>id</key> + <value>wxgui_scopesink2_0</value> + </param> + <param> + <key>_enabled</key> + <value>False</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>title</key> + <value>Scope Plot</value> + </param> + <param> + <key>samp_rate</key> + <value>R</value> + </param> + <param> + <key>v_scale</key> + <value>0</value> + </param> + <param> + <key>v_offset</key> + <value>0</value> + </param> + <param> + <key>t_scale</key> + <value>0</value> + </param> + <param> + <key>ac_couple</key> + <value>False</value> + </param> + <param> + <key>xy_mode</key> + <value>True</value> + </param> + <param> + <key>num_inputs</key> + <value>1</value> + </param> + <param> + <key>win_size</key> + <value></value> + </param> + <param> + <key>grid_pos</key> + <value></value> + </param> + <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>trig_mode</key> + <value>gr.gr_TRIG_MODE_AUTO</value> + </param> + <param> + <key>y_axis_label</key> + <value>Counts</value> + </param> + <param> + <key>_coordinate</key> + <value>(952, 73)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_throttle</key> + <param> + <key>id</key> + <value>gr_throttle_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>short</value> + </param> + <param> + <key>samples_per_second</key> + <value>R</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(514, 105)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_chunks_to_symbols_xx</key> + <param> + <key>id</key> + <value>gr_chunks_to_symbols_xx_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>in_type</key> + <value>short</value> + </param> + <param> + <key>out_type</key> + <value>complex</value> + </param> + <param> + <key>symbol_table</key> + <value>1,0,1j,0,-1j,0,-1,0, 0,1,0,1j,0,-1j,0,-1</value> + </param> + <param> + <key>dimension</key> + <value>2</value> + </param> + <param> + <key>num_ports</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(551, 184)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_noise_source_x</key> + <param> + <key>id</key> + <value>gr_noise_source_x_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>noise_type</key> + <value>gr.GR_GAUSSIAN</value> + </param> + <param> + <key>amp</key> + <value>noisevar</value> + </param> + <param> + <key>seed</key> + <value>42</value> + </param> + <param> + <key>_coordinate</key> + <value>(672, 290)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>trellis_sccc_encoder_xx</key> + <param> + <key>id</key> + <value>trellis_sccc_encoder_xx_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>ss</value> + </param> + <param> + <key>o_fsm_args</key> + <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_4.fsm"</value> + </param> + <param> + <key>o_init_state</key> + <value>0</value> + </param> + <param> + <key>i_fsm_args</key> + <value>prefix+"gr-trellis/src/examples/fsm_files/awgn2o3_4.fsm"</value> + </param> + <param> + <key>i_init_state</key> + <value>0</value> + </param> + <param> + <key>interleaver_args</key> + <value>trellis.interleaver(block,666)</value> + </param> + <param> + <key>bl</key> + <value>block</value> + </param> + <param> + <key>_coordinate</key> + <value>(242, 154)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>wxgui_numbersink2</key> + <param> + <key>id</key> + <value>wxgui_numbersink2_3_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>title</key> + <value>BER</value> + </param> + <param> + <key>units</key> + <value>BER</value> + </param> + <param> + <key>samp_rate</key> + <value>R</value> + </param> + <param> + <key>min_value</key> + <value>0</value> + </param> + <param> + <key>max_value</key> + <value>1.0</value> + </param> + <param> + <key>factor</key> + <value>1.0</value> + </param> + <param> + <key>decimal_places</key> + <value>6</value> + </param> + <param> + <key>ref_level</key> + <value>0</value> + </param> + <param> + <key>number_rate</key> + <value>15</value> + </param> + <param> + <key>peak_hold</key> + <value>False</value> + </param> + <param> + <key>average</key> + <value>True</value> + </param> + <param> + <key>avg_alpha</key> + <value>0.001</value> + </param> + <param> + <key>show_gauge</key> + <value>True</value> + </param> + <param> + <key>win_size</key> + <value></value> + </param> + <param> + <key>grid_pos</key> + <value>1,0,1,1</value> + </param> + <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(688, 572)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>trellis_sccc_decoder_combined_xx</key> + <param> + <key>id</key> + <value>trellis_sccc_decoder_combined_xx_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>c</value> + </param> + <param> + <key>out_type</key> + <value>s</value> + </param> + <param> + <key>o_fsm_args</key> + <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_4.fsm"</value> + </param> + <param> + <key>o_init_state</key> + <value>0</value> + </param> + <param> + <key>o_final_state</key> + <value>-1</value> + </param> + <param> + <key>i_fsm_args</key> + <value>prefix+"gr-trellis/src/examples/fsm_files/awgn2o3_4.fsm"</value> + </param> + <param> + <key>i_init_state</key> + <value>0</value> + </param> + <param> + <key>i_final_state</key> + <value>-1</value> + </param> + <param> + <key>interleaver</key> + <value>trellis.interleaver(block,666)</value> + </param> + <param> + <key>block_size</key> + <value>block</value> + </param> + <param> + <key>iterations</key> + <value>5</value> + </param> + <param> + <key>dim</key> + <value>2</value> + </param> + <param> + <key>table</key> + <value>1,0,1j,0,-1j,0,-1,0, 0,1,0,1j,0,-1j,0,-1</value> + </param> + <param> + <key>metric_type</key> + <value>trellis.TRELLIS_EUCLIDEAN</value> + </param> + <param> + <key>siso_type</key> + <value>trellis.TRELLIS_SUM_PRODUCT</value> + </param> + <param> + <key>scaling</key> + <value>1.0</value> + </param> + <param> + <key>_coordinate</key> + <value>(159, 335)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <connection> + <source_block_id>random_source_x_0</source_block_id> + <sink_block_id>gr_sub_xx_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_throttle_0</source_block_id> + <sink_block_id>gr_chunks_to_symbols_xx_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_add_xx_1</source_block_id> + <sink_block_id>wxgui_scopesink2_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_noise_source_x_0</source_block_id> + <sink_block_id>gr_add_xx_1</sink_block_id> + <source_key>0</source_key> + <sink_key>1</sink_key> + </connection> + <connection> + <source_block_id>gr_chunks_to_symbols_xx_0</source_block_id> + <sink_block_id>gr_add_xx_1</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>random_source_x_0</source_block_id> + <sink_block_id>trellis_sccc_encoder_xx_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>trellis_sccc_encoder_xx_0</source_block_id> + <sink_block_id>gr_throttle_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_add_xx_1</source_block_id> + <sink_block_id>trellis_sccc_decoder_combined_xx_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>trellis_sccc_decoder_combined_xx_0</source_block_id> + <sink_block_id>gr_sub_xx_0</sink_block_id> + <source_key>0</source_key> + <sink_key>1</sink_key> + </connection> + <connection> + <source_block_id>gr_multiply_xx_2_0</source_block_id> + <sink_block_id>gr_short_to_float_1_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_short_to_float_1_0</source_block_id> + <sink_block_id>wxgui_numbersink2_3_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_sub_xx_0</source_block_id> + <sink_block_id>gr_multiply_xx_2_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_sub_xx_0</source_block_id> + <sink_block_id>gr_multiply_xx_2_0</sink_block_id> + <source_key>0</source_key> + <sink_key>1</sink_key> + </connection> +</flow_graph> diff --git a/gnuradio-examples/grc/trellis/sccc1.grc b/gnuradio-examples/grc/trellis/sccc1.grc new file mode 100644 index 000000000..0be59d0c4 --- /dev/null +++ b/gnuradio-examples/grc/trellis/sccc1.grc @@ -0,0 +1,857 @@ +<?xml version='1.0' encoding='ASCII'?> +<flow_graph> + <timestamp>Wed Aug 31 20:09:23 2011</timestamp> + <block> + <key>options</key> + <param> + <key>id</key> + <value>sccc1</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>title</key> + <value>Serially Concatenated Convolutional Code</value> + </param> + <param> + <key>author</key> + <value>AA</value> + </param> + <param> + <key>description</key> + <value>gnuradio flow graph</value> + </param> + <param> + <key>window_size</key> + <value>2048, 2048</value> + </param> + <param> + <key>generate_options</key> + <value>wx_gui</value> + </param> + <param> + <key>category</key> + <value>Custom</value> + </param> + <param> + <key>run_options</key> + <value>prompt</value> + </param> + <param> + <key>run</key> + <value>True</value> + </param> + <param> + <key>realtime_scheduling</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(10, 10)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>noisevar</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>10**(-snr_db/10)</value> + </param> + <param> + <key>_coordinate</key> + <value>(389, 15)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>random_source_x</key> + <param> + <key>id</key> + <value>random_source_x_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>short</value> + </param> + <param> + <key>min</key> + <value>0</value> + </param> + <param> + <key>max</key> + <value>2</value> + </param> + <param> + <key>num_samps</key> + <value>1000</value> + </param> + <param> + <key>repeat</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(21, 170)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>prefix</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>"/n/harrisville/x/anastas/gnuradio_trunk/"</value> + </param> + <param> + <key>_coordinate</key> + <value>(590, 15)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>block</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>1000</value> + </param> + <param> + <key>_coordinate</key> + <value>(764, 16)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_slider</key> + <param> + <key>id</key> + <value>snr_db</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>label</key> + <value>SNR (dB)</value> + </param> + <param> + <key>value</key> + <value>5</value> + </param> + <param> + <key>min</key> + <value>-10</value> + </param> + <param> + <key>max</key> + <value>10</value> + </param> + <param> + <key>num_steps</key> + <value>100</value> + </param> + <param> + <key>style</key> + <value>wx.SL_HORIZONTAL</value> + </param> + <param> + <key>converver</key> + <value>float_converter</value> + </param> + <param> + <key>grid_pos</key> + <value></value> + </param> + <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(229, 13)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>R</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>10e3</value> + </param> + <param> + <key>_coordinate</key> + <value>(482, 17)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>trellis_sccc_encoder_xx</key> + <param> + <key>id</key> + <value>trellis_sccc_encoder_xx_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>ss</value> + </param> + <param> + <key>o_fsm_args</key> + <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_4.fsm"</value> + </param> + <param> + <key>o_init_state</key> + <value>0</value> + </param> + <param> + <key>i_fsm_args</key> + <value>prefix+"gr-trellis/src/examples/fsm_files/awgn2o3_4.fsm"</value> + </param> + <param> + <key>i_init_state</key> + <value>0</value> + </param> + <param> + <key>interleaver_args</key> + <value>trellis.interleaver(block,666)</value> + </param> + <param> + <key>bl</key> + <value>block</value> + </param> + <param> + <key>_coordinate</key> + <value>(242, 154)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>trellis_sccc_decoder_x</key> + <param> + <key>id</key> + <value>trellis_sccc_decoder_x_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>out_type</key> + <value>s</value> + </param> + <param> + <key>o_fsm_args</key> + <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_4.fsm"</value> + </param> + <param> + <key>o_init_state</key> + <value>0</value> + </param> + <param> + <key>o_final_state</key> + <value>-1</value> + </param> + <param> + <key>i_fsm_args</key> + <value>prefix+"gr-trellis/src/examples/fsm_files/awgn2o3_4.fsm"</value> + </param> + <param> + <key>i_init_state</key> + <value>0</value> + </param> + <param> + <key>i_final_state</key> + <value>-1</value> + </param> + <param> + <key>interleaver</key> + <value>trellis.interleaver(block,666)</value> + </param> + <param> + <key>block_size</key> + <value>block</value> + </param> + <param> + <key>iterations</key> + <value>10</value> + </param> + <param> + <key>siso_type</key> + <value>trellis.TRELLIS_MIN_SUM</value> + </param> + <param> + <key>_coordinate</key> + <value>(333, 305)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_sub_xx</key> + <param> + <key>id</key> + <value>gr_sub_xx_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>short</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>num_inputs</key> + <value>2</value> + </param> + <param> + <key>_coordinate</key> + <value>(217, 597)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_multiply_xx</key> + <param> + <key>id</key> + <value>gr_multiply_xx_2_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>short</value> + </param> + <param> + <key>num_inputs</key> + <value>2</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(392, 591)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_short_to_float</key> + <param> + <key>id</key> + <value>gr_short_to_float_1_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(535, 609)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>wxgui_numbersink2</key> + <param> + <key>id</key> + <value>wxgui_numbersink2_3_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>title</key> + <value>BER</value> + </param> + <param> + <key>units</key> + <value>BER</value> + </param> + <param> + <key>samp_rate</key> + <value>R</value> + </param> + <param> + <key>min_value</key> + <value>0</value> + </param> + <param> + <key>max_value</key> + <value>1.0</value> + </param> + <param> + <key>factor</key> + <value>1.0</value> + </param> + <param> + <key>decimal_places</key> + <value>6</value> + </param> + <param> + <key>ref_level</key> + <value>0</value> + </param> + <param> + <key>number_rate</key> + <value>15</value> + </param> + <param> + <key>peak_hold</key> + <value>False</value> + </param> + <param> + <key>average</key> + <value>True</value> + </param> + <param> + <key>avg_alpha</key> + <value>0.001</value> + </param> + <param> + <key>show_gauge</key> + <value>True</value> + </param> + <param> + <key>win_size</key> + <value></value> + </param> + <param> + <key>grid_pos</key> + <value>1,0,1,1</value> + </param> + <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(713, 426)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_noise_source_x</key> + <param> + <key>id</key> + <value>gr_noise_source_x_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>noise_type</key> + <value>gr.GR_GAUSSIAN</value> + </param> + <param> + <key>amp</key> + <value>noisevar</value> + </param> + <param> + <key>seed</key> + <value>42</value> + </param> + <param> + <key>_coordinate</key> + <value>(672, 290)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_add_xx</key> + <param> + <key>id</key> + <value>gr_add_xx_1</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>num_inputs</key> + <value>2</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(951, 256)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>trellis_metrics_x</key> + <param> + <key>id</key> + <value>trellis_metrics_x_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>f</value> + </param> + <param> + <key>card</key> + <value>8</value> + </param> + <param> + <key>dim</key> + <value>1</value> + </param> + <param> + <key>table</key> + <value>-7, -5, -3, -1, 1, 3, 5, 7</value> + </param> + <param> + <key>metric_type</key> + <value>trellis.TRELLIS_EUCLIDEAN</value> + </param> + <param> + <key>_coordinate</key> + <value>(58, 354)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_throttle</key> + <param> + <key>id</key> + <value>gr_throttle_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>short</value> + </param> + <param> + <key>samples_per_second</key> + <value>R</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(517, 103)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>wxgui_scopesink2</key> + <param> + <key>id</key> + <value>wxgui_scopesink2_0</value> + </param> + <param> + <key>_enabled</key> + <value>False</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>title</key> + <value>Scope Plot</value> + </param> + <param> + <key>samp_rate</key> + <value>R</value> + </param> + <param> + <key>v_scale</key> + <value>0</value> + </param> + <param> + <key>v_offset</key> + <value>0</value> + </param> + <param> + <key>t_scale</key> + <value>0</value> + </param> + <param> + <key>ac_couple</key> + <value>False</value> + </param> + <param> + <key>xy_mode</key> + <value>False</value> + </param> + <param> + <key>num_inputs</key> + <value>1</value> + </param> + <param> + <key>win_size</key> + <value></value> + </param> + <param> + <key>grid_pos</key> + <value></value> + </param> + <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>trig_mode</key> + <value>gr.gr_TRIG_MODE_AUTO</value> + </param> + <param> + <key>y_axis_label</key> + <value>Counts</value> + </param> + <param> + <key>_coordinate</key> + <value>(952, 73)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_chunks_to_symbols_xx</key> + <param> + <key>id</key> + <value>gr_chunks_to_symbols_xx_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>in_type</key> + <value>short</value> + </param> + <param> + <key>out_type</key> + <value>float</value> + </param> + <param> + <key>symbol_table</key> + <value>-7, -5, -3, -1, 1, 3, 5, 7</value> + </param> + <param> + <key>dimension</key> + <value>1</value> + </param> + <param> + <key>num_ports</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(551, 184)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <connection> + <source_block_id>random_source_x_0</source_block_id> + <sink_block_id>gr_sub_xx_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_throttle_0</source_block_id> + <sink_block_id>gr_chunks_to_symbols_xx_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_add_xx_1</source_block_id> + <sink_block_id>wxgui_scopesink2_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_noise_source_x_0</source_block_id> + <sink_block_id>gr_add_xx_1</sink_block_id> + <source_key>0</source_key> + <sink_key>1</sink_key> + </connection> + <connection> + <source_block_id>gr_chunks_to_symbols_xx_0</source_block_id> + <sink_block_id>gr_add_xx_1</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>random_source_x_0</source_block_id> + <sink_block_id>trellis_sccc_encoder_xx_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>trellis_sccc_encoder_xx_0</source_block_id> + <sink_block_id>gr_throttle_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_multiply_xx_2_0</source_block_id> + <sink_block_id>gr_short_to_float_1_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_short_to_float_1_0</source_block_id> + <sink_block_id>wxgui_numbersink2_3_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_sub_xx_0</source_block_id> + <sink_block_id>gr_multiply_xx_2_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_sub_xx_0</source_block_id> + <sink_block_id>gr_multiply_xx_2_0</sink_block_id> + <source_key>0</source_key> + <sink_key>1</sink_key> + </connection> + <connection> + <source_block_id>gr_add_xx_1</source_block_id> + <sink_block_id>trellis_metrics_x_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>trellis_metrics_x_0</source_block_id> + <sink_block_id>trellis_sccc_decoder_x_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>trellis_sccc_decoder_x_0</source_block_id> + <sink_block_id>gr_sub_xx_0</sink_block_id> + <source_key>0</source_key> + <sink_key>1</sink_key> + </connection> +</flow_graph> diff --git a/gnuradio-examples/python/Makefile.am b/gnuradio-examples/python/Makefile.am index eba4c14ab..3f1977e74 100644 --- a/gnuradio-examples/python/Makefile.am +++ b/gnuradio-examples/python/Makefile.am @@ -31,5 +31,6 @@ SUBDIRS = \ network \ ofdm \ pfb \ + tags \ usrp \ usrp2 diff --git a/gnuradio-examples/python/ofdm/gr_plot_ofdm.py b/gnuradio-examples/python/ofdm/gr_plot_ofdm.py index e3b347189..b24855148 100755 --- a/gnuradio-examples/python/ofdm/gr_plot_ofdm.py +++ b/gnuradio-examples/python/ofdm/gr_plot_ofdm.py @@ -20,14 +20,24 @@ # Boston, MA 02110-1301, USA. # -import scipy, pylab, math -import struct, sys -from pylab import * -from matplotlib.font_manager import fontManager, FontProperties +import math, struct, sys from optparse import OptionParser -from scipy import fftpack from math import log10 +try: + import scipy + from scipy import fftpack +except ImportError: + print "Error: Program requires scipy (see: www.scipy.org)." + sys.exit(1) + +try: + from pylab import * + from matplotlib.font_manager import fontManager, FontProperties +except ImportError: + print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)." + sys.exit(1) + matplotlib.interactive(True) matplotlib.use('TkAgg') diff --git a/gnuradio-examples/python/pfb/channelize.py b/gnuradio-examples/python/pfb/channelize.py index f845c05c6..999e5d20e 100755 --- a/gnuradio-examples/python/pfb/channelize.py +++ b/gnuradio-examples/python/pfb/channelize.py @@ -21,10 +21,21 @@ # from gnuradio import gr, blks2 -import os, time -import scipy, pylab -from scipy import fftpack -from pylab import mlab +import sys, time + +try: + import scipy + from scipy import fftpack +except ImportError: + print "Error: Program requires scipy (see: www.scipy.org)." + sys.exit(1) + +try: + import pylab + from pylab import mlab +except ImportError: + print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)." + sys.exit(1) class pfb_top_block(gr.top_block): def __init__(self): diff --git a/gnuradio-examples/python/pfb/chirp_channelize.py b/gnuradio-examples/python/pfb/chirp_channelize.py index edebf5f59..951255d3b 100755 --- a/gnuradio-examples/python/pfb/chirp_channelize.py +++ b/gnuradio-examples/python/pfb/chirp_channelize.py @@ -21,10 +21,21 @@ # from gnuradio import gr, blks2 -import os, time -import scipy, pylab -from scipy import fftpack -from pylab import mlab +import sys, time + +try: + import scipy + from scipy import fftpack +except ImportError: + print "Error: Program requires scipy (see: www.scipy.org)." + sys.exit(1) + +try: + import pylab + from pylab import mlab +except ImportError: + print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)." + sys.exit(1) class pfb_top_block(gr.top_block): def __init__(self): diff --git a/gnuradio-examples/python/pfb/decimate.py b/gnuradio-examples/python/pfb/decimate.py index cb5d61b72..643a2c241 100755 --- a/gnuradio-examples/python/pfb/decimate.py +++ b/gnuradio-examples/python/pfb/decimate.py @@ -21,14 +21,21 @@ # from gnuradio import gr, blks2 -import os -import scipy, pylab -from scipy import fftpack -from pylab import mlab -import time - -#print os.getpid() -#raw_input() +import sys, time + +try: + import scipy + from scipy import fftpack +except ImportError: + print "Error: Program requires scipy (see: www.scipy.org)." + sys.exit(1) + +try: + import pylab + from pylab import mlab +except ImportError: + print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)." + sys.exit(1) class pfb_top_block(gr.top_block): def __init__(self): diff --git a/gnuradio-examples/python/pfb/fmtest.py b/gnuradio-examples/python/pfb/fmtest.py index 97df0e0f5..635ee4e9e 100755 --- a/gnuradio-examples/python/pfb/fmtest.py +++ b/gnuradio-examples/python/pfb/fmtest.py @@ -1,14 +1,42 @@ #!/usr/bin/env python # +# Copyright 2009 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +from gnuradio import gr, blks2 +import sys, math, time + +try: + import scipy + from scipy import fftpack +except ImportError: + print "Error: Program requires scipy (see: www.scipy.org)." + sys.exit(1) + +try: + import pylab +except ImportError: + print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)." + sys.exit(1) -from gnuradio import gr, eng_notation -from gnuradio import blks2 -from gnuradio.eng_option import eng_option -from optparse import OptionParser -import math, time, sys, scipy, pylab -from scipy import fftpack - class fmtx(gr.hier_block2): def __init__(self, lo_freq, audio_rate, if_rate): diff --git a/gnuradio-examples/python/pfb/interpolate.py b/gnuradio-examples/python/pfb/interpolate.py index a7a2522f8..370cf26a7 100755 --- a/gnuradio-examples/python/pfb/interpolate.py +++ b/gnuradio-examples/python/pfb/interpolate.py @@ -21,14 +21,21 @@ # from gnuradio import gr, blks2 -import os -import scipy, pylab -from scipy import fftpack -from pylab import mlab -import time - -#print os.getpid() -#raw_input() +import sys, time + +try: + import scipy + from scipy import fftpack +except ImportError: + print "Error: Program requires scipy (see: www.scipy.org)." + sys.exit(1) + +try: + import pylab + from pylab import mlab +except ImportError: + print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)." + sys.exit(1) class pfb_top_block(gr.top_block): def __init__(self): diff --git a/gnuradio-examples/python/pfb/resampler.py b/gnuradio-examples/python/pfb/resampler.py index 6be7cf14e..7b296ca71 100755 --- a/gnuradio-examples/python/pfb/resampler.py +++ b/gnuradio-examples/python/pfb/resampler.py @@ -1,7 +1,39 @@ #!/usr/bin/env python +# +# Copyright 2009 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# from gnuradio import gr, blks2 -import scipy, pylab +import sys + +try: + import scipy +except ImportError: + print "Error: Program requires scipy (see: www.scipy.org)." + sys.exit(1) + +try: + import pylab +except ImportError: + print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)." + sys.exit(1) class mytb(gr.top_block): def __init__(self, fs_in, fs_out, fc, N=10000): diff --git a/gnuradio-examples/python/pfb/synth_filter.py b/gnuradio-examples/python/pfb/synth_filter.py index a1562f9ea..074d9cb2c 100755 --- a/gnuradio-examples/python/pfb/synth_filter.py +++ b/gnuradio-examples/python/pfb/synth_filter.py @@ -21,7 +21,19 @@ # from gnuradio import gr, blks2 -import scipy, pylab +import sys + +try: + import scipy +except ImportError: + print "Error: Program requires scipy (see: www.scipy.org)." + sys.exit(1) + +try: + import pylab +except ImportError: + print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)." + sys.exit(1) def main(): N = 1000000 diff --git a/gnuradio-examples/python/pfb/synth_to_chan.py b/gnuradio-examples/python/pfb/synth_to_chan.py index 1beda1a54..7e454d903 100755 --- a/gnuradio-examples/python/pfb/synth_to_chan.py +++ b/gnuradio-examples/python/pfb/synth_to_chan.py @@ -21,7 +21,19 @@ # from gnuradio import gr, blks2 -import scipy, pylab +import sys + +try: + import scipy +except ImportError: + print "Error: Program requires scipy (see: www.scipy.org)." + sys.exit(1) + +try: + import pylab +except ImportError: + print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)." + sys.exit(1) def main(): N = 1000000 diff --git a/gnuradio-examples/python/tags/.gitignore b/gnuradio-examples/python/tags/.gitignore new file mode 100644 index 000000000..b336cc7ce --- /dev/null +++ b/gnuradio-examples/python/tags/.gitignore @@ -0,0 +1,2 @@ +/Makefile +/Makefile.in diff --git a/gnuradio-examples/python/tags/Makefile.am b/gnuradio-examples/python/tags/Makefile.am new file mode 100644 index 000000000..5d71bf9b0 --- /dev/null +++ b/gnuradio-examples/python/tags/Makefile.am @@ -0,0 +1,29 @@ +# +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +include $(top_srcdir)/Makefile.common + +ourdatadir = $(exampledir)/tags + +dist_ourdata_SCRIPTS = \ + test_file_tags.py \ + uhd_burst_detector.py + diff --git a/gnuradio-examples/python/tags/test_file_tags.py b/gnuradio-examples/python/tags/test_file_tags.py index 4ff4549ef..446986cd7 100755 --- a/gnuradio-examples/python/tags/test_file_tags.py +++ b/gnuradio-examples/python/tags/test_file_tags.py @@ -1,7 +1,33 @@ #!/usr/bin/env python +# +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# from gnuradio import gr -import scipy +import sys + +try: + import scipy +except ImportError: + print "Error: Program requires scipy (see: www.scipy.org)." + sys.exit(1) def main(): data = scipy.arange(0, 32000, 1).tolist() diff --git a/gnuradio-examples/python/tags/uhd_burst_detector.py b/gnuradio-examples/python/tags/uhd_burst_detector.py index f8ebbe66a..ffa419562 100755 --- a/gnuradio-examples/python/tags/uhd_burst_detector.py +++ b/gnuradio-examples/python/tags/uhd_burst_detector.py @@ -1,4 +1,24 @@ #!/usr/bin/env python +# +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# from gnuradio import eng_notation from gnuradio import gr @@ -9,16 +29,16 @@ from gnuradio.gr import firdes from optparse import OptionParser class uhd_burst_detector(gr.top_block): - def __init__(self, frequency, sample_rate, - uhd_address="192.168.10.2", trigger=False): + def __init__(self, uhd_address, options): gr.top_block.__init__(self) - self.freq = frequency - self.samp_rate = sample_rate self.uhd_addr = uhd_address - self.gain = 32 - self.trigger = trigger + self.freq = options.freq + self.samp_rate = options.samp_rate + self.gain = options.gain + self.threshold = options.threshold + self.trigger = options.trigger self.uhd_src = uhd.single_usrp_source( device_addr=self.uhd_addr, @@ -32,7 +52,6 @@ class uhd_burst_detector(gr.top_block): taps = firdes.low_pass_2(1, 1, 0.4, 0.1, 60) self.chanfilt = gr.fir_filter_ccc(10, taps) - self.ann0 = gr.annotator_alltoall(100000, gr.sizeof_gr_complex) self.tagger = gr.burst_tagger(gr.sizeof_gr_complex) # Dummy signaler to collect a burst on known periods @@ -40,11 +59,18 @@ class uhd_burst_detector(gr.top_block): self.signal = gr.vector_source_s(data, True) # Energy detector to get signal burst + ## use squelch to detect energy + self.det = gr.simple_squelch_cc(self.threshold, 0.01) + ## convert to mag squared (float) self.c2m = gr.complex_to_mag_squared() - self.iir = gr.single_pole_iir_filter_ff(0.0001) - self.sub = gr.sub_ff() - self.mult = gr.multiply_const_ff(32768) + ## average to debounce + self.avg = gr.single_pole_iir_filter_ff(0.01) + ## rescale signal for conversion to short + self.scale = gr.multiply_const_ff(2**16) + ## signal input uses shorts self.f2s = gr.float_to_short() + + # Use file sink burst tagger to capture bursts self.fsnk = gr.tagged_file_sink(gr.sizeof_gr_complex, self.samp_rate) @@ -60,17 +86,12 @@ class uhd_burst_detector(gr.top_block): else: # Connect an energy detector signaler to the burst tagger - self.connect((self.uhd_src, 0), (self.c2m, 0)) - self.connect((self.c2m, 0), (self.sub, 0)) - self.connect((self.c2m, 0), (self.iir, 0)) - self.connect((self.iir, 0), (self.sub, 1)) - self.connect((self.sub, 0), (self.mult,0)) - self.connect((self.mult, 0), (self.f2s, 0)) - self.connect((self.f2s, 0), (self.tagger, 1)) + self.connect(self.uhd_src, self.det) + self.connect(self.det, self.c2m, self.avg, self.scale, self.f2s) + self.connect(self.f2s, (self.tagger, 1)) def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate - self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate/10) self.uhd_src_0.set_samp_rate(self.samp_rate) if __name__ == '__main__': @@ -83,16 +104,15 @@ if __name__ == '__main__': help="set frequency to FREQ", metavar="FREQ") parser.add_option("-g", "--gain", type="eng_float", default=0, help="set gain in dB [default=%default]") - parser.add_option("-R", "--rate", type="eng_float", default=200000, + parser.add_option("-R", "--samp-rate", type="eng_float", default=200000, help="set USRP sample rate [default=%default]") + parser.add_option("-t", "--threshold", type="float", default=-60, + help="Set the detection power threshold (dBm) [default=%default") parser.add_option("-T", "--trigger", action="store_true", default=False, help="Use internal trigger instead of detector [default=%default]") (options, args) = parser.parse_args() - frequency = options.freq - samp_rate = samp_rate = options.rate uhd_addr = options.address - trigger = options.trigger - tb = uhd_burst_detector(frequency, samp_rate, uhd_addr, trigger) + tb = uhd_burst_detector(uhd_addr, options) tb.run() diff --git a/gr-atsc/src/lib/CMakeLists.txt b/gr-atsc/src/lib/CMakeLists.txt index 9b03d48dc..da104e465 100644 --- a/gr-atsc/src/lib/CMakeLists.txt +++ b/gr-atsc/src/lib/CMakeLists.txt @@ -31,8 +31,13 @@ LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) ######################################################################## # Generate viterbi mux source +# http://www.vtk.org/Wiki/CMake_Cross_Compiling#Using_executables_in_the_build_created_during_the_build ######################################################################## -ADD_EXECUTABLE(atsci_viterbi_gen atsci_viterbi_gen.cc) +IF(NOT CMAKE_CROSSCOMPILING) + ADD_EXECUTABLE(atsci_viterbi_gen atsci_viterbi_gen.cc) + EXPORT(TARGETS atsci_viterbi_gen APPEND FILE ${EXPORT_FILE}) +ENDIF() + SET(atsci_viterbi_mux_cc ${CMAKE_CURRENT_BINARY_DIR}/atsci_viterbi_mux.cc) diff --git a/gr-audio/lib/CMakeLists.txt b/gr-audio/lib/CMakeLists.txt index cc81ef123..f9f3ffec1 100644 --- a/gr-audio/lib/CMakeLists.txt +++ b/gr-audio/lib/CMakeLists.txt @@ -101,6 +101,7 @@ IF(AUDIO_UNIT_H AND AUDIO_TOOLBOX_H) "-framework AudioUnit" "-framework CoreAudio" "-framework AudioToolbox" + "-framework Carbon" ) LIST(APPEND gr_audio_sources ${CMAKE_CURRENT_SOURCE_DIR}/osx/audio_osx_source.cc diff --git a/gr-gsm-fr-vocoder/Makefile.am b/gr-gsm-fr-vocoder/Makefile.am new file mode 100644 index 000000000..968ce327c --- /dev/null +++ b/gr-gsm-fr-vocoder/Makefile.am @@ -0,0 +1,27 @@ +# +# Copyright 2004,2009 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +include $(top_srcdir)/Makefile.common + +SUBDIRS = src + +pkgconfigdir = $(libdir)/pkgconfig +dist_pkgconfig_DATA = gnuradio-gsm-fr-vocoder.pc diff --git a/gr-howto-write-a-block-cmake/cmake/Modules/FindGnuradioCore.cmake b/gr-howto-write-a-block-cmake/cmake/Modules/FindGnuradioCore.cmake index f76364acf..ffa6582a2 100644 --- a/gr-howto-write-a-block-cmake/cmake/Modules/FindGnuradioCore.cmake +++ b/gr-howto-write-a-block-cmake/cmake/Modules/FindGnuradioCore.cmake @@ -1,11 +1,11 @@ INCLUDE(FindPkgConfig) -PKG_CHECK_MODULES(GNURADIO_CORE gnuradio-core) -IF(NOT GNURADIO_CORE_FOUND) +PKG_CHECK_MODULES(PC_GNURADIO_CORE gnuradio-core QUIET) FIND_PATH( GNURADIO_CORE_INCLUDE_DIRS NAMES gr_random.h HINTS $ENV{GNURADIO_CORE_DIR}/include/gnuradio + ${PC_GNURADIO_CORE_INCLUDE_DIRS} PATHS /usr/local/include/gnuradio /usr/include/gnuradio ) @@ -14,6 +14,7 @@ FIND_LIBRARY( GNURADIO_CORE_LIBRARIES NAMES gnuradio-core HINTS $ENV{GNURADIO_CORE_DIR}/lib + ${PC_GNURADIO_CORE_LIBRARIES} PATHS /usr/local/lib /usr/local/lib64 /usr/lib @@ -22,5 +23,4 @@ FIND_LIBRARY( INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_CORE DEFAULT_MSG GNURADIO_CORE_LIBRARIES GNURADIO_CORE_INCLUDE_DIRS) - -ENDIF(NOT GNURADIO_CORE_FOUND) +MARK_AS_ADVANCED(GNURADIO_CORE_LIBRARIES GNURADIO_CORE_INCLUDE_DIRS) diff --git a/gr-howto-write-a-block-cmake/cmake/Modules/FindGruel.cmake b/gr-howto-write-a-block-cmake/cmake/Modules/FindGruel.cmake index c142c905e..3c21af91d 100644 --- a/gr-howto-write-a-block-cmake/cmake/Modules/FindGruel.cmake +++ b/gr-howto-write-a-block-cmake/cmake/Modules/FindGruel.cmake @@ -1,11 +1,11 @@ INCLUDE(FindPkgConfig) -PKG_CHECK_MODULES(GRUEL gnuradio-core) -IF(NOT GRUEL_FOUND) +PKG_CHECK_MODULES(PC_GRUEL gnuradio-core QUIET) FIND_PATH( GRUEL_INCLUDE_DIRS NAMES gruel/attributes.h HINTS $ENV{GRUEL_DIR}/include + ${PC_GRUEL_INCLUDE_DIRS} PATHS /usr/local/include /usr/include ) @@ -14,6 +14,7 @@ FIND_LIBRARY( GRUEL_LIBRARIES NAMES gruel HINTS $ENV{GRUEL_DIR}/lib + ${PC_GRUEL_LIBRARIES} PATHS /usr/local/lib /usr/local/lib64 /usr/lib @@ -22,5 +23,4 @@ FIND_LIBRARY( INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(GRUEL DEFAULT_MSG GRUEL_LIBRARIES GRUEL_INCLUDE_DIRS) - -ENDIF(NOT GRUEL_FOUND) +MARK_AS_ADVANCED(GRUEL_LIBRARIES GRUEL_INCLUDE_DIRS) diff --git a/gr-howto-write-a-block-cmake/lib/CMakeLists.txt b/gr-howto-write-a-block-cmake/lib/CMakeLists.txt index 798bc6ad6..a2b6da950 100644 --- a/gr-howto-write-a-block-cmake/lib/CMakeLists.txt +++ b/gr-howto-write-a-block-cmake/lib/CMakeLists.txt @@ -30,9 +30,9 @@ SET_TARGET_PROPERTIES(gnuradio-howto PROPERTIES DEFINE_SYMBOL "gnuradio_howto_EX # Install built library files ######################################################################## INSTALL(TARGETS gnuradio-howto - LIBRARY DESTINATION ${LIB_SUFFIX}/lib # .so/.dylib file - ARCHIVE DESTINATION ${LIB_SUFFIX}/lib # .lib file - RUNTIME DESTINATION bin # .dll file + LIBRARY DESTINATION lib${LIB_SUFFIX} # .so/.dylib file + ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib file + RUNTIME DESTINATION bin # .dll file ) ######################################################################## diff --git a/gr-howto-write-a-block-cmake/swig/CMakeLists.txt b/gr-howto-write-a-block-cmake/swig/CMakeLists.txt index 40f2b1051..fdf8d8c48 100644 --- a/gr-howto-write-a-block-cmake/swig/CMakeLists.txt +++ b/gr-howto-write-a-block-cmake/swig/CMakeLists.txt @@ -26,6 +26,7 @@ IF(NOT SWIG_FOUND OR NOT PYTHONLIBS_FOUND) RETURN() ENDIF() INCLUDE(GrSwig) +INCLUDE(GrPython) ######################################################################## # Setup swig generation diff --git a/gr-noaa/lib/noaa_hrpt_pll_cf.cc b/gr-noaa/lib/noaa_hrpt_pll_cf.cc index 08ab1d15f..ba2ce98d5 100644 --- a/gr-noaa/lib/noaa_hrpt_pll_cf.cc +++ b/gr-noaa/lib/noaa_hrpt_pll_cf.cc @@ -67,15 +67,16 @@ noaa_hrpt_pll_cf::work(int noutput_items, for (int i = 0; i < noutput_items; i++) { + // Generate and mix out carrier + float re, im; + gr_sincosf(d_phase, &im, &re); + out[i] = (in[i]*gr_complex(re, -im)).imag(); + // Adjust PLL phase/frequency float error = phase_wrap(gr_fast_atan2f(in[i].imag(), in[i].real()) - d_phase); d_freq = gr_branchless_clip(d_freq + error*d_beta, d_max_offset); d_phase = phase_wrap(d_phase + error*d_alpha + d_freq); - // Generate and mix out carrier - float re, im; - gr_sincosf(d_phase, &im, &re); - out[i] = (in[i]*gr_complex(re, -im)).imag(); } return noutput_items; diff --git a/gr-qtgui/Makefile.am b/gr-qtgui/Makefile.am index cc194e4c0..38033e1ac 100644 --- a/gr-qtgui/Makefile.am +++ b/gr-qtgui/Makefile.am @@ -24,7 +24,7 @@ include $(top_srcdir)/Makefile.common SUBDIRS = lib if PYTHON -SUBDIRS += swig python apps grc +SUBDIRS += swig python apps grc examples endif pkgconfigdir = $(libdir)/pkgconfig diff --git a/gr-qtgui/apps/Makefile.am b/gr-qtgui/apps/Makefile.am index 7b35d949e..4d0c550a1 100644 --- a/gr-qtgui/apps/Makefile.am +++ b/gr-qtgui/apps/Makefile.am @@ -28,13 +28,9 @@ nodist_bin_SCRIPTS = \ usrp_display_qtgui.ui noinst_PYTHON = \ - pyqt_example_f.py \ - pyqt_example_c.py \ - pyqt_time_c.py \ qt_digital.py \ qt_digital_window.py \ - usrp2_display.py \ - usrp_display.py \ + uhd_display.py \ qt_digital_window.py \ usrp_display_qtgui.py diff --git a/gr-qtgui/apps/qt_digital.py b/gr-qtgui/apps/qt_digital.py index 99c799f2a..2bc039a31 100755 --- a/gr-qtgui/apps/qt_digital.py +++ b/gr-qtgui/apps/qt_digital.py @@ -1,11 +1,42 @@ #!/usr/bin/env python +# +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# from gnuradio import gr, blks2 -from gnuradio import qtgui from gnuradio import eng_notation -from PyQt4 import QtGui, QtCore -import sys, sip -import scipy +import sys + +try: + from gnuradio import qtgui + from PyQt4 import QtGui, QtCore + import sip +except ImportError: + print "Error: Program requires PyQt4 and gr-qtgui." + sys.exit(1) + +try: + import scipy +except ImportError: + print "Error: Program requires scipy (see: www.scipy.org)." + sys.exit(1) try: from qt_digital_window import Ui_DigitalWindow diff --git a/gr-qtgui/apps/usrp2_display.py b/gr-qtgui/apps/uhd_display.py index ab1a6f742..806914797 100755 --- a/gr-qtgui/apps/usrp2_display.py +++ b/gr-qtgui/apps/uhd_display.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2009 Free Software Foundation, Inc. +# Copyright 2009,2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,7 +21,7 @@ # from gnuradio import gr -from gnuradio import usrp2 +from gnuradio import uhd from gnuradio import eng_notation from gnuradio.eng_option import eng_option from gnuradio.qtgui import qtgui @@ -33,7 +33,7 @@ try: from PyQt4 import QtGui, QtCore import sip except ImportError: - print "Please install gr-qtgui." + print "Error: Program requires PyQt4 and gr-qtgui." sys.exit(1) try: @@ -163,53 +163,40 @@ class main_window(QtGui.QMainWindow): class my_top_block(gr.top_block): - def __init__(self): + def __init__(self, options): gr.top_block.__init__(self) - parser = OptionParser(option_class=eng_option) - parser.add_option("-e", "--interface", type="string", default="eth0", - help="select Ethernet interface, default is eth0") - parser.add_option("-m", "--mac-addr", type="string", default="", - help="select USRP by MAC address, default is auto-select") - parser.add_option("-W", "--bw", type="eng_float", default=1e6, - help="set bandwidth of receiver [default=%default]") - parser.add_option("-f", "--freq", type="eng_float", default=2412e6, - help="set frequency to FREQ", metavar="FREQ") - parser.add_option("-g", "--gain", type="eng_float", default=None, - help="set gain in dB (default is midpoint)") - parser.add_option("--fft-size", type="int", default=2048, - help="Set number of FFT bins [default=%default]") - (options, args) = parser.parse_args() - - if len(args) != 0: - parser.print_help() - sys.exit(1) - self.options = options + self.options = options self.show_debug_info = True self.qapp = QtGui.QApplication(sys.argv) - self.u = usrp2.source_32fc(options.interface, options.mac_addr) - self._adc_rate = self.u.adc_rate() - self.set_bandwidth(options.bw) + self.u = uhd.usrp_source(device_addr=options.address, + io_type=uhd.io_type.COMPLEX_FLOAT32, + num_channels=1) + self.set_bandwidth(options.samp_rate) if options.gain is None: # if no gain was specified, use the mid-point in dB - g = self.u.gain_range() - options.gain = float(g[0]+g[1])/2 + g = self.u.get_gain_range() + options.gain = float(g.start()+g.stop())/2 self.set_gain(options.gain) if options.freq is None: - # if no frequency was specified, use the mid-point of the subdev - f = self.u.freq_range() - options.freq = float(f[0]+f[1])/2 + # if no freq was specified, use the mid-point + r = self.u.get_freq_range() + options.freq = float(r.start()+r.stop())/2 self.set_frequency(options.freq) + if(options.antenna): + self.u.set_antenna(options.antenna, 0) + self._fftsize = options.fft_size - self.snk = qtgui.sink_c(options.fft_size, gr.firdes.WIN_BLACKMAN_hARRIS, + self.snk = qtgui.sink_c(options.fft_size, + gr.firdes.WIN_BLACKMAN_hARRIS, self._freq, self._bandwidth, - "USRP2 Display", + "UHD Display", True, True, True, False) # Set up internal amplifier @@ -225,9 +212,9 @@ class my_top_block(gr.top_block): self.connect(self.u, self.amp, self.snk) if self.show_debug_info: - print "Decimation rate: ", self._decim - print "Bandwidth: ", self._bandwidth - print "D'board: ", self.u.daughterboard_id() + print "Bandwidth: ", self.u.get_samp_rate() + print "Center Freq: ", self.u.get_center_freq() + print "Freq Range: ", self.u.get_freq_range() # Get the reference pointer to the SpectrumDisplayForm QWidget # Wrap the pointer as a PyQt SIP object @@ -268,8 +255,7 @@ class my_top_block(gr.top_block): def set_bandwidth(self, bw): self._bandwidth = bw - self._decim = int(self._adc_rate / self._bandwidth) - self.u.set_decim(self._decim) + self.u.set_samp_rate(self._bandwidth) try: self.snk.set_frequency_range(self._freq, self._bandwidth) @@ -301,7 +287,26 @@ class my_top_block(gr.top_block): self.unlock() def main (): - tb = my_top_block() + parser = OptionParser(option_class=eng_option) + parser.add_option("-a", "--address", type="string", default="addr=192.168.10.2", + help="Address of UHD device, [default=%default]") + parser.add_option("-A", "--antenna", type="string", default=None, + help="select Rx Antenna where appropriate") + parser.add_option("-s", "--samp-rate", type="eng_float", default=1e6, + help="set sample rate (bandwidth) [default=%default]") + parser.add_option("-f", "--freq", type="eng_float", default=2412e6, + help="set frequency to FREQ", metavar="FREQ") + parser.add_option("-g", "--gain", type="eng_float", default=None, + help="set gain in dB (default is midpoint)") + parser.add_option("--fft-size", type="int", default=2048, + help="Set number of FFT bins [default=%default]") + (options, args) = parser.parse_args() + + if len(args) != 0: + parser.print_help() + sys.exit(1) + + tb = my_top_block(options) tb.start() tb.snk.exec_(); diff --git a/gr-qtgui/apps/usrp_display.py b/gr-qtgui/apps/usrp_display.py deleted file mode 100755 index 131bc4a7e..000000000 --- a/gr-qtgui/apps/usrp_display.py +++ /dev/null @@ -1,299 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2009 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr -from gnuradio import usrp -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from gnuradio.qtgui import qtgui -from optparse import OptionParser -import sys - -try: - from gnuradio.qtgui import qtgui - from PyQt4 import QtGui, QtCore - import sip -except ImportError: - print "Please install gr-qtgui." - sys.exit(1) - -try: - from usrp_display_qtgui import Ui_MainWindow -except ImportError: - print "Error: could not find usrp_display_qtgui.py:" - print "\t\"pyuic4 usrp_display_qtgui.ui -o usrp_display_qtgui.py\"" - sys.exit(1) - - - -# //////////////////////////////////////////////////////////////////// -# Define the QT Interface and Control Dialog -# //////////////////////////////////////////////////////////////////// - - -class main_window(QtGui.QMainWindow): - def __init__(self, snk, fg, parent=None): - - QtGui.QWidget.__init__(self, parent) - self.gui = Ui_MainWindow() - self.gui.setupUi(self) - - self.fg = fg - - # Add the qtsnk widgets to the layout box - self.gui.sinkLayout.addWidget(snk) - - # Connect up some signals - self.connect(self.gui.pauseButton, QtCore.SIGNAL("clicked()"), - self.pauseFg) - self.connect(self.gui.frequencyEdit, QtCore.SIGNAL("editingFinished()"), - self.frequencyEditText) - self.connect(self.gui.gainEdit, QtCore.SIGNAL("editingFinished()"), - self.gainEditText) - self.connect(self.gui.bandwidthEdit, QtCore.SIGNAL("editingFinished()"), - self.bandwidthEditText) - self.connect(self.gui.amplifierEdit, QtCore.SIGNAL("editingFinished()"), - self.amplifierEditText) - - self.connect(self.gui.actionSaveData, QtCore.SIGNAL("activated()"), - self.saveData) - self.gui.actionSaveData.setShortcut(QtGui.QKeySequence.Save) - - def pauseFg(self): - if(self.gui.pauseButton.text() == "Pause"): - self.fg.stop() - self.fg.wait() - self.gui.pauseButton.setText("Unpause") - else: - self.fg.start() - self.gui.pauseButton.setText("Pause") - - - # Functions to set the values in the GUI - def set_frequency(self, freq): - self.freq = freq - sfreq = eng_notation.num_to_str(self.freq) - self.gui.frequencyEdit.setText(QtCore.QString("%1").arg(sfreq)) - - def set_gain(self, gain): - self.gain = gain - self.gui.gainEdit.setText(QtCore.QString("%1").arg(self.gain)) - - def set_bandwidth(self, bw): - self.bw = bw - sbw = eng_notation.num_to_str(self.bw) - self.gui.bandwidthEdit.setText(QtCore.QString("%1").arg(sbw)) - - def set_amplifier(self, amp): - self.amp = amp - self.gui.amplifierEdit.setText(QtCore.QString("%1").arg(self.amp)) - - - # Functions called when signals are triggered in the GUI - def frequencyEditText(self): - try: - freq = eng_notation.str_to_num(self.gui.frequencyEdit.text().toAscii()) - self.fg.set_frequency(freq) - self.freq = freq - except RuntimeError: - pass - - def gainEditText(self): - try: - gain = float(self.gui.gainEdit.text()) - self.fg.set_gain(gain) - self.gain = gain - except ValueError: - pass - - def bandwidthEditText(self): - try: - bw = eng_notation.str_to_num(self.gui.bandwidthEdit.text().toAscii()) - self.fg.set_bandwidth(bw) - self.bw = bw - except ValueError: - pass - - def amplifierEditText(self): - try: - amp = float(self.gui.amplifierEdit.text()) - self.fg.set_amplifier_gain(amp) - self.amp = amp - except ValueError: - pass - - def saveData(self): - fileName = QtGui.QFileDialog.getSaveFileName(self, "Save data to file", "."); - if(len(fileName)): - self.fg.save_to_file(str(fileName)) - - -def pick_subdevice(u): - """ - The user didn't specify a subdevice on the command line. - If there's a daughterboard on A, select A. - If there's a daughterboard on B, select B. - Otherwise, select A. - """ - if u.db(0, 0).dbid() >= 0: # dbid is < 0 if there's no d'board or a problem - return (0, 0) - if u.db(0, 0).dbid() >= 0: - return (1, 0) - return (0, 0) - -class my_top_block(gr.top_block): - def __init__(self): - gr.top_block.__init__(self) - - parser = OptionParser(option_class=eng_option) - parser.add_option("-w", "--which", type="int", default=0, - help="select which USRP (0, 1, ...) default is %default", - metavar="NUM") - parser.add_option("-R", "--rx-subdev-spec", type="subdev", default=None, - help="select USRP Rx side A or B (default=first one with a daughterboard)") - parser.add_option("-A", "--antenna", default=None, - help="select Rx Antenna (only on RFX-series boards)") - parser.add_option("-W", "--bw", type="float", default=1e6, - help="set bandwidth of receiver [default=%default]") - parser.add_option("-f", "--freq", type="eng_float", default=None, - help="set frequency to FREQ", metavar="FREQ") - parser.add_option("-g", "--gain", type="eng_float", default=None, - help="set gain in dB [default is midpoint]") - parser.add_option("-8", "--width-8", action="store_true", default=False, - help="Enable 8-bit samples across USB") - parser.add_option( "--no-hb", action="store_true", default=False, - help="don't use halfband filter in usrp") - parser.add_option("-S", "--oscilloscope", action="store_true", default=False, - help="Enable oscilloscope display") - parser.add_option("", "--avg-alpha", type="eng_float", default=1e-1, - help="Set fftsink averaging factor, [default=%default]") - parser.add_option("", "--ref-scale", type="eng_float", default=13490.0, - help="Set dBFS=0dB input value, [default=%default]") - parser.add_option("", "--fft-size", type="int", default=2048, - help="Set FFT frame size, [default=%default]"); - - (options, args) = parser.parse_args() - if len(args) != 0: - parser.print_help() - sys.exit(1) - self.options = options - self.show_debug_info = True - - # Call this before creating the Qt sink - self.qapp = QtGui.QApplication(sys.argv) - - self._fftsize = options.fft_size - - self.u = usrp.source_c(which=options.which) - self._adc_rate = self.u.converter_rate() - self.set_bandwidth(options.bw) - - if options.rx_subdev_spec is None: - options.rx_subdev_spec = pick_subdevice(self.u) - self._rx_subdev_spec = options.rx_subdev_spec - self.u.set_mux(usrp.determine_rx_mux_value(self.u, self._rx_subdev_spec)) - self.subdev = usrp.selected_subdev(self.u, self._rx_subdev_spec) - - self._gain_range = self.subdev.gain_range() - if options.gain is None: - # if no gain was specified, use the mid-point in dB - g = self._gain_range - options.gain = float(g[0]+g[1])/2 - self.set_gain(options.gain) - - if options.freq is None: - # if no frequency was specified, use the mid-point of the subdev - f = self.subdev.freq_range() - options.freq = float(f[0]+f[1])/2 - self.set_frequency(options.freq) - - self.snk = qtgui.sink_c(self._fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, - self._freq, self._bandwidth, - "USRP Display", - True, True, True, False) - - # Set up internal amplifier - self.amp = gr.multiply_const_cc(0.0) - self.set_amplifier_gain(0.001) - - # Connect the flow graph - self.connect(self.u, self.amp, self.snk) - - - # Get the reference pointer to the SpectrumDisplayForm QWidget - # Wrap the pointer as a PyQt SIP object - # This can now be manipulated as a PyQt4.QtGui.QWidget - self.pysink = sip.wrapinstance(self.snk.pyqwidget(), QtGui.QWidget) - - self.main_win = main_window(self.pysink, self) - - self.main_win.set_frequency(self._freq) - self.main_win.set_gain(self._gain) - self.main_win.set_bandwidth(self._bandwidth) - self.main_win.set_amplifier(self._amp_value) - - self.main_win.show() - - def save_to_file(self, name): - # Pause the flow graph - self.stop() - self.wait() - - # Add file sink to save data - self.file_sink = gr.file_sink(gr.sizeof_gr_complex, name) - self.connect(self.amp, self.file_sink) - - # Restart flow graph - self.start() - - def set_gain(self, gain): - self._gain = gain - self.subdev.set_gain(self._gain) - - def set_frequency(self, freq): - self._freq = freq - self.u.tune(0, self.subdev, self._freq) - - try: - self.snk.set_frequency_range(self._freq, self._bandwidth) - except: - pass - - def set_bandwidth(self, bw): - self._bandwidth = bw - self._decim = int(self._adc_rate / self._bandwidth) - self.u.set_decim_rate(self._decim) - - try: - self.snk.set_frequency_range(self._freq, self._bandwidth) - except: - pass - - def set_amplifier_gain(self, amp): - self._amp_value = amp - self.amp.set_k(self._amp_value) - - -if __name__ == "__main__": - tb = my_top_block(); - tb.start() - tb.qapp.exec_() diff --git a/gr-qtgui/examples/.gitignore b/gr-qtgui/examples/.gitignore new file mode 100644 index 000000000..b336cc7ce --- /dev/null +++ b/gr-qtgui/examples/.gitignore @@ -0,0 +1,2 @@ +/Makefile +/Makefile.in diff --git a/gr-qtgui/examples/Makefile.am b/gr-qtgui/examples/Makefile.am new file mode 100644 index 000000000..a204d1fcc --- /dev/null +++ b/gr-qtgui/examples/Makefile.am @@ -0,0 +1,34 @@ +# +# Copyright 2008-2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +include $(top_srcdir)/Makefile.common + +if PYTHON +ourdatadir = $(exampledir)/qt-gui + +dist_ourdata_SCRIPTS = \ + pyqt_example_c.py \ + pyqt_example_f.py \ + pyqt_time_c.py \ + pyqt_time_f.py +endif + +EXTRA_DIST += diff --git a/gr-qtgui/apps/pyqt_example_c.py b/gr-qtgui/examples/pyqt_example_c.py index 607ab12ee..553d346c9 100755 --- a/gr-qtgui/apps/pyqt_example_c.py +++ b/gr-qtgui/examples/pyqt_example_c.py @@ -1,9 +1,35 @@ #!/usr/bin/env python +# +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# from gnuradio import gr -from gnuradio import qtgui -from PyQt4 import QtGui, QtCore -import sys, sip +import sys + +try: + from gnuradio import qtgui + from PyQt4 import QtGui, QtCore + import sip +except ImportError: + print "Error: Program requires PyQt4 and gr-qtgui." + sys.exit(1) class dialog_box(QtGui.QWidget): def __init__(self, display, control): diff --git a/gr-qtgui/apps/pyqt_example_f.py b/gr-qtgui/examples/pyqt_example_f.py index 2d957c85a..5e432fe78 100755 --- a/gr-qtgui/apps/pyqt_example_f.py +++ b/gr-qtgui/examples/pyqt_example_f.py @@ -1,9 +1,35 @@ #!/usr/bin/env python +# +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# from gnuradio import gr -from gnuradio import qtgui -from PyQt4 import QtGui, QtCore -import sys, sip +import sys + +try: + from gnuradio import qtgui + from PyQt4 import QtGui, QtCore + import sip +except ImportError: + print "Error: Program requires PyQt4 and gr-qtgui." + sys.exit(1) class dialog_box(QtGui.QWidget): def __init__(self, display, control): diff --git a/gr-qtgui/apps/pyqt_time_c.py b/gr-qtgui/examples/pyqt_time_c.py index fa7d60e81..a47302d19 100755 --- a/gr-qtgui/apps/pyqt_time_c.py +++ b/gr-qtgui/examples/pyqt_time_c.py @@ -1,9 +1,35 @@ #!/usr/bin/env python +# +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# from gnuradio import gr -from gnuradio import qtgui -from PyQt4 import QtGui, QtCore -import sys, sip +import sys + +try: + from gnuradio import qtgui + from PyQt4 import QtGui, QtCore + import sip +except ImportError: + print "Error: Program requires PyQt4 and gr-qtgui." + sys.exit(1) class dialog_box(QtGui.QWidget): def __init__(self, display, control): diff --git a/gr-qtgui/apps/pyqt_time_f.py b/gr-qtgui/examples/pyqt_time_f.py index 1b9efa10d..835b42a75 100755 --- a/gr-qtgui/apps/pyqt_time_f.py +++ b/gr-qtgui/examples/pyqt_time_f.py @@ -1,9 +1,35 @@ #!/usr/bin/env python +# +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# from gnuradio import gr -from gnuradio import qtgui -from PyQt4 import QtGui, QtCore -import sys, sip +import sys + +try: + from gnuradio import qtgui + from PyQt4 import QtGui, QtCore + import sip +except ImportError: + print "Error: Program requires PyQt4 and gr-qtgui." + sys.exit(1) class dialog_box(QtGui.QWidget): def __init__(self, display, control): diff --git a/gr-trellis/CMakeLists.txt b/gr-trellis/CMakeLists.txt index 11b547d70..a0ae29f8d 100644 --- a/gr-trellis/CMakeLists.txt +++ b/gr-trellis/CMakeLists.txt @@ -33,8 +33,8 @@ GR_REGISTER_COMPONENT("gr-trellis" ENABLE_GR_TRELLIS ) GR_SET_GLOBAL(GR_TRELLIS_INCLUDE_DIRS - ${CMAKE_CURRENT_SOURCE_DIR}/src/lib ${CMAKE_CURRENT_BINARY_DIR}/src/lib + ${CMAKE_CURRENT_SOURCE_DIR}/src/lib ) ######################################################################## @@ -95,6 +95,7 @@ CPACK_COMPONENT("trellis_swig" ADD_SUBDIRECTORY(src/lib) ADD_SUBDIRECTORY(doc) IF(ENABLE_PYTHON) + ADD_SUBDIRECTORY(grc) ADD_SUBDIRECTORY(src/python) ADD_SUBDIRECTORY(src/examples) ENDIF(ENABLE_PYTHON) diff --git a/gr-trellis/Makefile.am b/gr-trellis/Makefile.am index d68fb59c9..89d190ecf 100644 --- a/gr-trellis/Makefile.am +++ b/gr-trellis/Makefile.am @@ -21,7 +21,7 @@ include $(top_srcdir)/Makefile.common -SUBDIRS = src doc +SUBDIRS = src grc doc pkgconfigdir = $(libdir)/pkgconfig dist_pkgconfig_DATA = gnuradio-trellis.pc diff --git a/gr-trellis/grc/.gitignore b/gr-trellis/grc/.gitignore new file mode 100644 index 000000000..f3462d009 --- /dev/null +++ b/gr-trellis/grc/.gitignore @@ -0,0 +1,23 @@ +/Makefile +/Makefile.in +/aclocal.m4 +/configure +/config.h.in +/stamp-h.in +/libtool +/config.log +/config.h +/config.cache +/config.status +/missing +/stamp-h +/stamp-h1 +/.deps +/.libs +/*.la +/*.lo +/autom4te.cache +/*.cache +/missing +/make.log +/*.pc diff --git a/gr-trellis/grc/CMakeLists.txt b/gr-trellis/grc/CMakeLists.txt new file mode 100644 index 000000000..13188343d --- /dev/null +++ b/gr-trellis/grc/CMakeLists.txt @@ -0,0 +1,36 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +INSTALL(FILES + trellis_encoder_xx.xml + trellis_siso_combined_f.xml + trellis_viterbi_x.xml + trellis_metrics_x.xml + trellis_siso_f.xml + trellis_permutation.xml + trellis_viterbi_combined_xx.xml + trellis_sccc_encoder_xx.xml + trellis_sccc_decoder_x.xml + trellis_sccc_decoder_combined_xx.xml + trellis_pccc_encoder_xx.xml + trellis_pccc_decoder_x.xml + trellis_pccc_decoder_combined_xx.xml + DESTINATION ${GRC_BLOCKS_DIR} + COMPONENT "trellis_python" +) diff --git a/gr-trellis/grc/Makefile.am b/gr-trellis/grc/Makefile.am new file mode 100644 index 000000000..518c7f055 --- /dev/null +++ b/gr-trellis/grc/Makefile.am @@ -0,0 +1,39 @@ +# +# Copyright 2009 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +include $(top_srcdir)/Makefile.common + +grcblocksdir = $(grc_blocksdir) + +dist_grcblocks_DATA = \ + trellis_encoder_xx.xml \ + trellis_siso_combined_f.xml \ + trellis_viterbi_x.xml \ + trellis_metrics_x.xml \ + trellis_siso_f.xml \ + trellis_permutation.xml \ + trellis_viterbi_combined_xx.xml \ + trellis_sccc_encoder_xx.xml \ + trellis_sccc_decoder_x.xml \ + trellis_sccc_decoder_combined_xx.xml \ + trellis_pccc_encoder_xx.xml \ + trellis_pccc_decoder_x.xml \ + trellis_pccc_decoder_combined_xx.xml diff --git a/grc/blocks/trellis_encoder_xx.xml b/gr-trellis/grc/trellis_encoder_xx.xml index 74a8cc346..639e948ec 100644 --- a/grc/blocks/trellis_encoder_xx.xml +++ b/gr-trellis/grc/trellis_encoder_xx.xml @@ -4,9 +4,11 @@ ##Trellis Encoder ################################################### --> + <block> <name>Trellis Encoder</name> <key>trellis_encoder_xx</key> + <category>Error Correction/Trellis</category> <import>from gnuradio import trellis</import> <make>trellis.encoder_$(type)(trellis.fsm($fsm_args), $init_state)</make> <param> @@ -58,6 +60,7 @@ <param> <name>Initial State</name> <key>init_state</key> + <value>0</value> <type>int</type> </param> <sink> diff --git a/grc/blocks/trellis_metrics_x.xml b/gr-trellis/grc/trellis_metrics_x.xml index 2016a34c2..ccb59a36e 100644 --- a/grc/blocks/trellis_metrics_x.xml +++ b/gr-trellis/grc/trellis_metrics_x.xml @@ -4,9 +4,12 @@ ##Trellis Metrics ################################################### --> + + <block> <name>Trellis Metrics</name> <key>trellis_metrics_x</key> + <category>Error Correction/Trellis</category> <import>from gnuradio import trellis</import> <make>trellis.metrics_$(type)($card, $dim, $table, $metric_type)</make> <callback>set_TABLE($table)</callback> diff --git a/gr-trellis/grc/trellis_pccc_decoder_combined_xx.xml b/gr-trellis/grc/trellis_pccc_decoder_combined_xx.xml new file mode 100644 index 000000000..ec58132f8 --- /dev/null +++ b/gr-trellis/grc/trellis_pccc_decoder_combined_xx.xml @@ -0,0 +1,170 @@ +<?xml version="1.0"?> +<!-- +################################################### +## PCCC Decoder Combined +################################################### + --> + + +<block> + <name>PCCC Decoder Combo</name> + <key>trellis_pccc_decoder_combined_xx</key> + <category>Error Correction/Trellis</category> + <import>from gnuradio import trellis</import> + <make>trellis.pccc_decoder_combined_$(type)$(out_type)( + trellis.fsm($o_fsm_args), $o_init_state, $o_final_state, + trellis.fsm($i_fsm_args), $i_init_state, $i_final_state, + trellis.interleaver($interleaver), + $block_size, + $iterations, + $siso_type, + $dim, $table, $metric_type, + $scaling) + </make> + <callback>set_TABLE($table)</callback> + <param> + <name>Input Type</name> + <key>type</key> + <type>enum</type> + <option> + <name>Complex</name> + <key>c</key> + <opt>io:complex</opt> + <opt>table:complex_vector</opt> + </option> + <option> + <name>Float</name> + <key>f</key> + <opt>io:float</opt> + <opt>table:real_vector</opt> + </option> + </param> + <param> + <name>Output Type</name> + <key>out_type</key> + <type>enum</type> + <option> + <name>Int</name> + <key>i</key> + <opt>io:int</opt> + </option> + <option> + <name>Short</name> + <key>s</key> + <opt>io:short</opt> + </option> + <option> + <name>Byte</name> + <key>b</key> + <opt>io:byte</opt> + </option> + </param> + <param> + <name>FSM 1</name> + <key>o_fsm_args</key> + <type>raw</type> + </param> + <param> + <name>Initial State 1</name> + <key>o_init_state</key> + <value>0</value> + <type>int</type> + </param> + <param> + <name>Final State 1</name> + <key>o_final_state</key> + <value>-1</value> + <type>int</type> + </param> + <param> + <name>FSM 2</name> + <key>i_fsm_args</key> + <type>raw</type> + </param> + <param> + <name>Initial State 2</name> + <key>i_init_state</key> + <value>0</value> + <type>int</type> + </param> + <param> + <name>Final State 2</name> + <key>i_final_state</key> + <value>-1</value> + <type>int</type> + </param> + <param> + <name>Interleaver</name> + <key>interleaver</key> + <type>raw</type> + </param> + <param> + <name>Block Size</name> + <key>block_size</key> + <type>int</type> + </param> + <param> + <name>Iterations</name> + <key>iterations</key> + <value>10</value> + <type>int</type> + </param> + <param> + <name>Dimensionality</name> + <key>dim</key> + <type>int</type> + </param> + <param> + <name>Constellation</name> + <key>table</key> + <type>$type.table</type> + </param> + <param> + <name>Metric Type</name> + <key>metric_type</key> + <type>enum</type> + <option> + <name>Euclidean</name> + <key>trellis.TRELLIS_EUCLIDEAN</key> + </option> + <option> + <name>Hard Symbol</name> + <key>trellis.TRELLIS_HARD_SYMBOL</key> + </option> + <option> + <name>Hard Bit</name> + <key>trellis.TRELLIS_HARD_BIT</key> + </option> + </param> + <param> + <name>SISO Type</name> + <key>siso_type</key> + <type>enum</type> + <option> + <name>Min Sum</name> + <key>trellis.TRELLIS_MIN_SUM</key> + </option> + <option> + <name>Sum Product</name> + <key>trellis.TRELLIS_SUM_PRODUCT</key> + </option> + </param> + <param> + <name>Scaling</name> + <key>scaling</key> + <value>1.0</value> + <type>real</type> + </param> + <sink> + <name>in</name> + <type>$type.io</type> + </sink> + <source> + <name>out</name> + <type>$out_type.io</type> + </source> + <doc> +PCCC turbo Decoder combined with metric calculation. +The fsm arguments are passed directly to the trellis.fsm() constructor. + </doc> +</block> diff --git a/gr-trellis/grc/trellis_pccc_decoder_x.xml b/gr-trellis/grc/trellis_pccc_decoder_x.xml new file mode 100644 index 000000000..e6eb03f11 --- /dev/null +++ b/gr-trellis/grc/trellis_pccc_decoder_x.xml @@ -0,0 +1,117 @@ +<?xml version="1.0"?> +<!-- +################################################### +## PCCC Decoder +################################################### + --> + + +<block> + <name>PCCC Decoder</name> + <key>trellis_pccc_decoder_x</key> + <category>Error Correction/Trellis</category> + <import>from gnuradio import trellis</import> + <make>trellis.pccc_decoder_$(out_type)( + trellis.fsm($o_fsm_args), $o_init_state, $o_final_state, + trellis.fsm($i_fsm_args), $i_init_state, $i_final_state, + trellis.interleaver($interleaver), + $block_size, + $iterations, + $siso_type) + </make> + <param> + <name>Output Type</name> + <key>out_type</key> + <type>enum</type> + <option> + <name>Int</name> + <key>i</key> + <opt>io:int</opt> + </option> + <option> + <name>Short</name> + <key>s</key> + <opt>io:short</opt> + </option> + <option> + <name>Byte</name> + <key>b</key> + <opt>io:byte</opt> + </option> + </param> + <param> + <name>FSM 1</name> + <key>o_fsm_args</key> + <type>raw</type> + </param> + <param> + <name>Initial State 1</name> + <key>o_init_state</key> + <value>0</value> + <type>int</type> + </param> + <param> + <name>Final State 1</name> + <key>o_final_state</key> + <value>-1</value> + <type>int</type> + </param> + <param> + <name>FSM 2</name> + <key>i_fsm_args</key> + <type>raw</type> + </param> + <param> + <name>Initial State 2</name> + <key>i_init_state</key> + <value>0</value> + <type>int</type> + </param> + <param> + <name>Final State 2</name> + <key>i_final_state</key> + <value>-1</value> + <type>int</type> + </param> + <param> + <name>Interleaver</name> + <key>interleaver</key> + <type>raw</type> + </param> + <param> + <name>Block Size</name> + <key>block_size</key> + <type>int</type> + </param> + <param> + <name>Iterations</name> + <key>iterations</key> + <value>10</value> + <type>int</type> + </param> + <param> + <name>SISO Type</name> + <key>siso_type</key> + <type>enum</type> + <option> + <name>Min Sum</name> + <key>trellis.TRELLIS_MIN_SUM</key> + </option> + <option> + <name>Sum Product</name> + <key>trellis.TRELLIS_SUM_PRODUCT</key> + </option> + </param> + <sink> + <name>in</name> + <type>float</type> + </sink> + <source> + <name>out</name> + <type>$out_type.io</type> + </source> + <doc> +PCCC turbo Decoder. +The fsm and interleaver arguments are passed directly to the trellis.fsm() and trellis.interleaver() constructors. + </doc> +</block> diff --git a/gr-trellis/grc/trellis_pccc_encoder_xx.xml b/gr-trellis/grc/trellis_pccc_encoder_xx.xml new file mode 100644 index 000000000..6774f18d2 --- /dev/null +++ b/gr-trellis/grc/trellis_pccc_encoder_xx.xml @@ -0,0 +1,98 @@ +<?xml version="1.0"?> +<!-- +################################################### +## PCCC Encoder +################################################### + --> + +<block> + <name>PCCC Encoder</name> + <key>trellis_pccc_encoder_xx</key> + <category>Error Correction/Trellis</category> + <import>from gnuradio import trellis</import> + <make>trellis.pccc_encoder_$(type)(trellis.fsm($o_fsm_args), $o_init_state, trellis.fsm($i_fsm_args), $i_init_state, trellis.interleaver($interleaver_args), $bl)</make> + <param> + <name>Type</name> + <key>type</key> + <type>enum</type> + <option> + <name>Byte->Byte</name> + <key>bb</key> + <opt>input:byte</opt> + <opt>output:byte</opt> + </option> + <option> + <name>Byte->Short</name> + <key>bs</key> + <opt>input:byte</opt> + <opt>output:short</opt> + </option> + <option> + <name>Byte->Int</name> + <key>bi</key> + <opt>input:byte</opt> + <opt>output:int</opt> + </option> + <option> + <name>Short->Short</name> + <key>ss</key> + <opt>input:short</opt> + <opt>output:short</opt> + </option> + <option> + <name>Short->Int</name> + <key>si</key> + <opt>input:short</opt> + <opt>output:int</opt> + </option> + <option> + <name>Int->Int</name> + <key>ii</key> + <opt>input:int</opt> + <opt>output:int</opt> + </option> + </param> + <param> + <name>FSM 1</name> + <key>o_fsm_args</key> + <type>raw</type> + </param> + <param> + <name>Initial State 1</name> + <key>o_init_state</key> + <value>0</value> + <type>int</type> + </param> + <param> + <name>FSM 2</name> + <key>i_fsm_args</key> + <type>raw</type> + </param> + <param> + <name>Initial State 2</name> + <key>i_init_state</key> + <value>0</value> + <type>int</type> + </param> + <param> + <name>Interleaver</name> + <key>interleaver_args</key> + <type>raw</type> + </param> + <param> + <name>Blocklength</name> + <key>bl</key> + <type>int</type> + </param> + <sink> + <name>in</name> + <type>$type.input</type> + </sink> + <source> + <name>out</name> + <type>$type.output</type> + </source> + <doc> +The fsm and interleaver arguments are passed directly to the trellis.fsm() and trellis.interleaver() constructors. + </doc> +</block> diff --git a/grc/blocks/trellis_permutation.xml b/gr-trellis/grc/trellis_permutation.xml index 7721cc71d..125a78d4d 100644 --- a/grc/blocks/trellis_permutation.xml +++ b/gr-trellis/grc/trellis_permutation.xml @@ -4,11 +4,14 @@ ##Trellis Permutation ################################################### --> + + <block> <name>Trellis Permutation</name> <key>trellis_permutation</key> + <category>Error Correction/Trellis</category> <import>from gnuradio import trellis</import> - <make>trellis.permutation($block_size, $table, $syms_per_block, $type.size*$vlen)</make> + <make>trellis.permutation($interleaver_size, $table, $syms_per_block, $type.size*$vlen)</make> <param> <name>Type</name> <key>type</key> @@ -40,8 +43,8 @@ </option> </param> <param> - <name>Block Size</name> - <key>block_size</key> + <name>Interleaver Size</name> + <key>interleaver_size</key> <type>int</type> </param> <param> @@ -71,4 +74,8 @@ <type>$type</type> <vlen>$vlen</vlen> </source> + <doc> +Interleaver size is given in blocks. +One Symbol = (in/out type) * (vector length) + </doc> </block> diff --git a/gr-trellis/grc/trellis_sccc_decoder_combined_xx.xml b/gr-trellis/grc/trellis_sccc_decoder_combined_xx.xml new file mode 100644 index 000000000..81d800902 --- /dev/null +++ b/gr-trellis/grc/trellis_sccc_decoder_combined_xx.xml @@ -0,0 +1,170 @@ +<?xml version="1.0"?> +<!-- +################################################### +## SCCC Decoder Combined +################################################### + --> + + +<block> + <name>SCCC Decoder Combo</name> + <key>trellis_sccc_decoder_combined_xx</key> + <category>Error Correction/Trellis</category> + <import>from gnuradio import trellis</import> + <make>trellis.sccc_decoder_combined_$(type)$(out_type)( + trellis.fsm($o_fsm_args), $o_init_state, $o_final_state, + trellis.fsm($i_fsm_args), $i_init_state, $i_final_state, + trellis.interleaver($interleaver), + $block_size, + $iterations, + $siso_type, + $dim, $table, $metric_type, + $scaling) + </make> + <callback>set_TABLE($table)</callback> + <param> + <name>Input Type</name> + <key>type</key> + <type>enum</type> + <option> + <name>Complex</name> + <key>c</key> + <opt>io:complex</opt> + <opt>table:complex_vector</opt> + </option> + <option> + <name>Float</name> + <key>f</key> + <opt>io:float</opt> + <opt>table:real_vector</opt> + </option> + </param> + <param> + <name>Output Type</name> + <key>out_type</key> + <type>enum</type> + <option> + <name>Int</name> + <key>i</key> + <opt>io:int</opt> + </option> + <option> + <name>Short</name> + <key>s</key> + <opt>io:short</opt> + </option> + <option> + <name>Byte</name> + <key>b</key> + <opt>io:byte</opt> + </option> + </param> + <param> + <name>Outer FSM</name> + <key>o_fsm_args</key> + <type>raw</type> + </param> + <param> + <name>Outer Initial State</name> + <key>o_init_state</key> + <value>0</value> + <type>int</type> + </param> + <param> + <name>Outer Final State</name> + <key>o_final_state</key> + <value>-1</value> + <type>int</type> + </param> + <param> + <name>Inner FSM</name> + <key>i_fsm_args</key> + <type>raw</type> + </param> + <param> + <name>Inner Initial State</name> + <key>i_init_state</key> + <value>0</value> + <type>int</type> + </param> + <param> + <name>Inner Final State</name> + <key>i_final_state</key> + <value>-1</value> + <type>int</type> + </param> + <param> + <name>Interleaver</name> + <key>interleaver</key> + <type>raw</type> + </param> + <param> + <name>Block Size</name> + <key>block_size</key> + <type>int</type> + </param> + <param> + <name>Iterations</name> + <key>iterations</key> + <value>10</value> + <type>int</type> + </param> + <param> + <name>Dimensionality</name> + <key>dim</key> + <type>int</type> + </param> + <param> + <name>Constellation</name> + <key>table</key> + <type>$type.table</type> + </param> + <param> + <name>Metric Type</name> + <key>metric_type</key> + <type>enum</type> + <option> + <name>Euclidean</name> + <key>trellis.TRELLIS_EUCLIDEAN</key> + </option> + <option> + <name>Hard Symbol</name> + <key>trellis.TRELLIS_HARD_SYMBOL</key> + </option> + <option> + <name>Hard Bit</name> + <key>trellis.TRELLIS_HARD_BIT</key> + </option> + </param> + <param> + <name>SISO Type</name> + <key>siso_type</key> + <type>enum</type> + <option> + <name>Min Sum</name> + <key>trellis.TRELLIS_MIN_SUM</key> + </option> + <option> + <name>Sum Product</name> + <key>trellis.TRELLIS_SUM_PRODUCT</key> + </option> + </param> + <param> + <name>Scaling</name> + <key>scaling</key> + <value>1.0</value> + <type>real</type> + </param> + <sink> + <name>in</name> + <type>$type.io</type> + </sink> + <source> + <name>out</name> + <type>$out_type.io</type> + </source> + <doc> +SCCC turbo Decoder combined with metric calculation. +The fsm arguments are passed directly to the trellis.fsm() constructor. + </doc> +</block> diff --git a/gr-trellis/grc/trellis_sccc_decoder_x.xml b/gr-trellis/grc/trellis_sccc_decoder_x.xml new file mode 100644 index 000000000..9fc24927b --- /dev/null +++ b/gr-trellis/grc/trellis_sccc_decoder_x.xml @@ -0,0 +1,117 @@ +<?xml version="1.0"?> +<!-- +################################################### +## SCCC Decoder +################################################### + --> + + +<block> + <name>SCCC Decoder</name> + <key>trellis_sccc_decoder_x</key> + <category>Error Correction/Trellis</category> + <import>from gnuradio import trellis</import> + <make>trellis.sccc_decoder_$(out_type)( + trellis.fsm($o_fsm_args), $o_init_state, $o_final_state, + trellis.fsm($i_fsm_args), $i_init_state, $i_final_state, + trellis.interleaver($interleaver), + $block_size, + $iterations, + $siso_type) + </make> + <param> + <name>Output Type</name> + <key>out_type</key> + <type>enum</type> + <option> + <name>Int</name> + <key>i</key> + <opt>io:int</opt> + </option> + <option> + <name>Short</name> + <key>s</key> + <opt>io:short</opt> + </option> + <option> + <name>Byte</name> + <key>b</key> + <opt>io:byte</opt> + </option> + </param> + <param> + <name>Outer FSM</name> + <key>o_fsm_args</key> + <type>raw</type> + </param> + <param> + <name>Outer Initial State</name> + <key>o_init_state</key> + <value>0</value> + <type>int</type> + </param> + <param> + <name>Outer Final State</name> + <key>o_final_state</key> + <value>-1</value> + <type>int</type> + </param> + <param> + <name>Inner FSM</name> + <key>i_fsm_args</key> + <type>raw</type> + </param> + <param> + <name>Inner Initial State</name> + <key>i_init_state</key> + <value>0</value> + <type>int</type> + </param> + <param> + <name>Inner Final State</name> + <key>i_final_state</key> + <value>-1</value> + <type>int</type> + </param> + <param> + <name>Interleaver</name> + <key>interleaver</key> + <type>raw</type> + </param> + <param> + <name>Block Size</name> + <key>block_size</key> + <type>int</type> + </param> + <param> + <name>Iterations</name> + <key>iterations</key> + <value>10</value> + <type>int</type> + </param> + <param> + <name>SISO Type</name> + <key>siso_type</key> + <type>enum</type> + <option> + <name>Min Sum</name> + <key>trellis.TRELLIS_MIN_SUM</key> + </option> + <option> + <name>Sum Product</name> + <key>trellis.TRELLIS_SUM_PRODUCT</key> + </option> + </param> + <sink> + <name>in</name> + <type>float</type> + </sink> + <source> + <name>out</name> + <type>$out_type.io</type> + </source> + <doc> +SCCC turbo Decoder. +The fsm and interleaver arguments are passed directly to the trellis.fsm() and trellis.interleaver() constructors. + </doc> +</block> diff --git a/gr-trellis/grc/trellis_sccc_encoder_xx.xml b/gr-trellis/grc/trellis_sccc_encoder_xx.xml new file mode 100644 index 000000000..54d9c1e01 --- /dev/null +++ b/gr-trellis/grc/trellis_sccc_encoder_xx.xml @@ -0,0 +1,98 @@ +<?xml version="1.0"?> +<!-- +################################################### +##SCCC Encoder +################################################### + --> + +<block> + <name>SCCC Encoder</name> + <key>trellis_sccc_encoder_xx</key> + <category>Error Correction/Trellis</category> + <import>from gnuradio import trellis</import> + <make>trellis.sccc_encoder_$(type)(trellis.fsm($o_fsm_args), $o_init_state, trellis.fsm($i_fsm_args), $i_init_state, trellis.interleaver($interleaver_args), $bl)</make> + <param> + <name>Type</name> + <key>type</key> + <type>enum</type> + <option> + <name>Byte->Byte</name> + <key>bb</key> + <opt>input:byte</opt> + <opt>output:byte</opt> + </option> + <option> + <name>Byte->Short</name> + <key>bs</key> + <opt>input:byte</opt> + <opt>output:short</opt> + </option> + <option> + <name>Byte->Int</name> + <key>bi</key> + <opt>input:byte</opt> + <opt>output:int</opt> + </option> + <option> + <name>Short->Short</name> + <key>ss</key> + <opt>input:short</opt> + <opt>output:short</opt> + </option> + <option> + <name>Short->Int</name> + <key>si</key> + <opt>input:short</opt> + <opt>output:int</opt> + </option> + <option> + <name>Int->Int</name> + <key>ii</key> + <opt>input:int</opt> + <opt>output:int</opt> + </option> + </param> + <param> + <name>Outer FSM</name> + <key>o_fsm_args</key> + <type>raw</type> + </param> + <param> + <name>Outer Initial State</name> + <key>o_init_state</key> + <value>0</value> + <type>int</type> + </param> + <param> + <name>Inner FSM</name> + <key>i_fsm_args</key> + <type>raw</type> + </param> + <param> + <name>Inner Initial State</name> + <key>i_init_state</key> + <value>0</value> + <type>int</type> + </param> + <param> + <name>Interleaver</name> + <key>interleaver_args</key> + <type>raw</type> + </param> + <param> + <name>Blocklength</name> + <key>bl</key> + <type>int</type> + </param> + <sink> + <name>in</name> + <type>$type.input</type> + </sink> + <source> + <name>out</name> + <type>$type.output</type> + </source> + <doc> +The fsm and interleaver arguments are passed directly to the trellis.fsm() and trellis.interleaver() constructors. + </doc> +</block> diff --git a/grc/blocks/trellis_siso_combined_f.xml b/gr-trellis/grc/trellis_siso_combined_f.xml index 98874d7f4..a39986a86 100644 --- a/grc/blocks/trellis_siso_combined_f.xml +++ b/gr-trellis/grc/trellis_siso_combined_f.xml @@ -4,9 +4,12 @@ ##Trellis SISO Combined ################################################### --> + + <block> - <name>Trellis SISO Combo</name> + <name>SISO Combo</name> <key>trellis_siso_combined_f</key> + <category>Error Correction/Trellis</category> <import>from gnuradio import trellis</import> <make>trellis.siso_combined_f(trellis.fsm($fsm_args), $block_size, $init_state, $final_state, $a_post_in, $a_post_out, $siso_type, $dim, $table, $metric_type)</make> <param> @@ -22,7 +25,7 @@ <param> <name>Initial State</name> <key>init_state</key> - <value>-1</value> + <value>0</value> <type>int</type> </param> <param> diff --git a/grc/blocks/trellis_siso_f.xml b/gr-trellis/grc/trellis_siso_f.xml index 2b9cfe5f7..e3fb502b3 100644 --- a/grc/blocks/trellis_siso_f.xml +++ b/gr-trellis/grc/trellis_siso_f.xml @@ -4,9 +4,12 @@ ##Trellis SISO ################################################### --> + + <block> - <name>Trellis SISO</name> + <name>SISO</name> <key>trellis_siso_f</key> + <category>Error Correction/Trellis</category> <import>from gnuradio import trellis</import> <make>trellis.siso_f(trellis.fsm($fsm_args), $block_size, $init_state, $final_state, $a_post_in, $a_post_out, $siso_type)</make> <param> @@ -22,7 +25,7 @@ <param> <name>Initial State</name> <key>init_state</key> - <value>-1</value> + <value>0</value> <type>int</type> </param> <param> diff --git a/grc/blocks/trellis_viterbi_combined_xx.xml b/gr-trellis/grc/trellis_viterbi_combined_xx.xml index 33dcaaf73..200f07859 100644 --- a/grc/blocks/trellis_viterbi_combined_xx.xml +++ b/gr-trellis/grc/trellis_viterbi_combined_xx.xml @@ -4,9 +4,12 @@ ##Trellis Viterbi Combined ################################################### --> + + <block> - <name>Trellis Viterbi Combo</name> + <name>Viterbi Combo</name> <key>trellis_viterbi_combined_xx</key> + <category>Error Correction/Trellis</category> <import>from gnuradio import trellis</import> <make>trellis.viterbi_combined_$(type)$(out_type)(trellis.fsm($fsm_args), $block_size, $init_state, $final_state, $dim, $table, $metric_type)</make> <callback>set_TABLE($table)</callback> @@ -72,7 +75,7 @@ <param> <name>Initial State</name> <key>init_state</key> - <value>-1</value> + <value>0</value> <type>int</type> </param> <param> diff --git a/grc/blocks/trellis_viterbi_x.xml b/gr-trellis/grc/trellis_viterbi_x.xml index 84b39677c..d97e6707a 100644 --- a/grc/blocks/trellis_viterbi_x.xml +++ b/gr-trellis/grc/trellis_viterbi_x.xml @@ -4,9 +4,12 @@ ##Trellis Viterbi ################################################### --> + + <block> - <name>Trellis Viterbi</name> + <name>Viterbi</name> <key>trellis_viterbi_x</key> + <category>Error Correction/Trellis</category> <import>from gnuradio import trellis</import> <make>trellis.viterbi_$(type)(trellis.fsm($fsm_args), $block_size, $init_state, $final_state)</make> <param> @@ -42,7 +45,7 @@ <param> <name>Initial State</name> <key>init_state</key> - <value>-1</value> + <value>0</value> <type>int</type> </param> <param> diff --git a/gr-trellis/src/examples/fsm_utils.py b/gr-trellis/src/examples/fsm_utils.py index e3426637c..e9243f899 100755 --- a/gr-trellis/src/examples/fsm_utils.py +++ b/gr-trellis/src/examples/fsm_utils.py @@ -26,10 +26,15 @@ import math import sys import operator import numpy -import scipy.linalg from gnuradio import trellis +try: + import scipy.linalg +except ImportError: + print "Error: Program requires scipy (see: www.scipy.org)." + sys.exit(1) + ###################################################################### diff --git a/gr-trellis/src/examples/test_cpm.py b/gr-trellis/src/examples/test_cpm.py index ec432d4ff..b5bdaae44 100755 --- a/gr-trellis/src/examples/test_cpm.py +++ b/gr-trellis/src/examples/test_cpm.py @@ -13,10 +13,15 @@ from gnuradio.gr import firdes from grc_gnuradio import blks2 as grc_blks2 import math import numpy -import scipy.stats import fsm_utils from gnuradio import trellis +try: + import scipy.stats +except ImportError: + print "Error: Program requires scipy (see: www.scipy.org)." + sys.exit(1) + def run_test(seed,blocksize): tb = gr.top_block() @@ -83,7 +88,7 @@ def run_test(seed,blocksize): ################################################## # Blocks ################################################## - random_source_x_0 = gr.vector_source_b(data, False) + random_source_x_0 = gr.vector_source_b(data.tolist(), False) gr_chunks_to_symbols_xx_0 = gr.chunks_to_symbols_bf((-1, 1), 1) gr_interp_fir_filter_xxx_0 = gr.interp_fir_filter_fff(Q, p) gr_frequency_modulator_fc_0 = gr.frequency_modulator_fc(2*math.pi*h*(1.0/Q)) @@ -96,9 +101,9 @@ def run_test(seed,blocksize): # only works for N=2, do it manually for N>2... gr_fir_filter_xxx_0_0 = gr.fir_filter_ccc(Q, MF[0].conjugate()) gr_fir_filter_xxx_0_0_0 = gr.fir_filter_ccc(Q, MF[1].conjugate()) - gr_streams_to_stream_0 = gr.streams_to_stream(gr.sizeof_gr_complex*1, N) - gr_skiphead_0 = gr.skiphead(gr.sizeof_gr_complex*1, N*(1+0)) - viterbi = trellis.viterbi_combined_cb(f, head+blocksize+tail, 0, -1, N, constellation, trellis.TRELLIS_EUCLIDEAN) + gr_streams_to_stream_0 = gr.streams_to_stream(gr.sizeof_gr_complex*1, int(N)) + gr_skiphead_0 = gr.skiphead(gr.sizeof_gr_complex*1, int(N*(1+0))) + viterbi = trellis.viterbi_combined_cb(f, head+blocksize+tail, 0, -1, int(N), constellation, trellis.TRELLIS_EUCLIDEAN) gr_vector_sink_x_0 = gr.vector_sink_b() diff --git a/gr-trellis/src/lib/CMakeLists.txt b/gr-trellis/src/lib/CMakeLists.txt index 338baac9d..e9222b5fd 100644 --- a/gr-trellis/src/lib/CMakeLists.txt +++ b/gr-trellis/src/lib/CMakeLists.txt @@ -30,92 +30,96 @@ INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) ######################################################################## -# Generate the makefile.gen, then extract its sources: -# This is a round-about way to extract the sources, -# but it requires minimum changed to the python utils. -# -# The recommended way to do this: -# - Make a generation macro that registers the sources command. -# - List the generation macro with each templated source file. -# - Create a python script (very generic) to perform generation. -# - This way the targets would depend only on their sources. -######################################################################## -EXECUTE_PROCESS( - COMMAND ${PYTHON_EXECUTABLE} -c " -import os, sys +# generate the python helper script which calls into the build utils +######################################################################## +FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py " +#!${PYTHON_EXECUTABLE} + +import sys, os, re sys.path.append('${GR_CORE_PYTHONPATH}') sys.path.append('${CMAKE_CURRENT_SOURCE_DIR}') os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}' -os.environ['gendir'] = '${CMAKE_CURRENT_BINARY_DIR}' -os.environ['do_makefile'] = '1' -os.environ['do_sources'] = '0' -from generate_all import generate_all -generate_all() - " WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} -) +os.chdir('${CMAKE_CURRENT_BINARY_DIR}') -MACRO(GEGEN_GEN_EXTRACT outvar ext) - EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import os; print ';'.join( - map(lambda x: os.path.join('${CMAKE_CURRENT_BINARY_DIR}', x.replace('\\\\', '').strip()), - filter(lambda f: '${ext}' in f, open('${CMAKE_CURRENT_BINARY_DIR}/Makefile.gen').readlines() - )))" OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE ${outvar}) - FILE(TO_CMAKE_PATH "${${outvar}}" ${outvar}) -ENDMACRO(GEGEN_GEN_EXTRACT) - -GEGEN_GEN_EXTRACT(generated_trellis_sources ".cc") -GEGEN_GEN_EXTRACT(generated_trellis_includes ".h") -GEGEN_GEN_EXTRACT(generated_trellis_swigs ".i") - -#TODO simplify this list with a triple-threat for loop -SET(generated_trellis_deps - generate_all.py - generate_trellis.py - trellis_encoder_XX.cc.t - trellis_encoder_XX.h.t - trellis_encoder_XX.i.t - trellis_sccc_encoder_XX.cc.t - trellis_sccc_encoder_XX.h.t - trellis_sccc_encoder_XX.i.t - trellis_pccc_encoder_XX.cc.t - trellis_pccc_encoder_XX.h.t - trellis_pccc_encoder_XX.i.t - trellis_metrics_X.cc.t - trellis_metrics_X.h.t - trellis_metrics_X.i.t - trellis_viterbi_combined_XX.cc.t - trellis_viterbi_combined_XX.h.t - trellis_viterbi_combined_XX.i.t - trellis_sccc_decoder_combined_XX.cc.t - trellis_sccc_decoder_combined_XX.h.t - trellis_sccc_decoder_combined_XX.i.t - trellis_sccc_decoder_X.cc.t - trellis_sccc_decoder_X.h.t - trellis_sccc_decoder_X.i.t - trellis_pccc_decoder_X.cc.t - trellis_pccc_decoder_X.h.t - trellis_pccc_decoder_X.i.t - trellis_viterbi_X.cc.t - trellis_viterbi_X.h.t - trellis_viterbi_X.i.t -) +if __name__ == '__main__': + import build_utils, generate_trellis + root, inp = sys.argv[1:3] + for sig in sys.argv[3:]: + name = re.sub ('X+', sig, root) + d = generate_trellis.standard_dict(name, sig) + build_utils.expand_template(d, inp) -ADD_CUSTOM_COMMAND( - OUTPUT - ${generated_trellis_sources} - ${generated_trellis_includes} - ${generated_trellis_swigs} - DEPENDS ${generated_trellis_deps} - COMMAND ${PYTHON_EXECUTABLE} -B -c - \"import os, sys\;sys.path.append('${GR_CORE_PYTHONPATH}')\;sys.path.append('${CMAKE_CURRENT_SOURCE_DIR}')\;os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}'\;from generate_all import generate_all\;generate_all()\" - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMENT "generating trellis files" -) +") -ADD_CUSTOM_TARGET(trellis_generated DEPENDS - ${generated_trellis_sources} - ${generated_trellis_includes} - ${generated_trellis_swigs} -) +######################################################################## +# generation helper macro to generate various files from template +######################################################################## +MACRO(expand_h_cc_i root) + + FOREACH(ext h cc i) + #make a list of all the generated files + UNSET(expanded_files_${ext}) + FOREACH(sig ${ARGN}) + STRING(REGEX REPLACE "X+" ${sig} name ${root}) + LIST(APPEND expanded_files_${ext} ${CMAKE_CURRENT_BINARY_DIR}/${name}.${ext}) + ENDFOREACH(sig) + + #create a command to generate the files + ADD_CUSTOM_COMMAND( + OUTPUT ${expanded_files_${ext}} + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.${ext}.t + COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} + ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py + ${root} ${root}.${ext}.t ${ARGN} + ) + ENDFOREACH(ext) + + #make source files depends on headers to force generation + SET_SOURCE_FILES_PROPERTIES(${expanded_files_cc} + PROPERTIES OBJECT_DEPENDS "${expanded_files_h}" + ) + + #install rules for the generated cc, h, and i files + LIST(APPEND generated_trellis_sources ${expanded_files_cc}) + LIST(APPEND generated_trellis_includes ${expanded_files_h}) + LIST(APPEND generated_trellis_swigs ${expanded_files_i}) + +ENDMACRO(expand_h_cc_i) + +######################################################################## +# Invoke macro to generate various sources +######################################################################## +expand_h_cc_i(trellis_encoder_XX bb bs bi ss si ii) +expand_h_cc_i(trellis_sccc_encoder_XX bb bs bi ss si ii) +expand_h_cc_i(trellis_pccc_encoder_XX bb bs bi ss si ii) +expand_h_cc_i(trellis_metrics_X s i f c) +expand_h_cc_i(trellis_viterbi_X b s i) +expand_h_cc_i(trellis_viterbi_combined_XX sb ss si ib is ii fb fs fi cb cs ci) +expand_h_cc_i(trellis_sccc_decoder_X b s i) +expand_h_cc_i(trellis_sccc_decoder_combined_XX fb fs fi cb cs ci) +expand_h_cc_i(trellis_pccc_decoder_X b s i) +expand_h_cc_i(trellis_pccc_decoder_combined_XX fb fs fi cb cs ci) + +######################################################################## +# Create the master trellis swig include files +######################################################################## +FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/trellis_generated.i " +// +// This file is machine generated. All edits will be overwritten +// +") + +FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/trellis_generated.i "%{\n") +FOREACH(swig_file ${generated_trellis_swigs}) + GET_FILENAME_COMPONENT(name ${swig_file} NAME_WE) + FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/trellis_generated.i "#include<${name}.h>\n") +ENDFOREACH(swig_file) +FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/trellis_generated.i "%}\n") + +FOREACH(swig_file ${generated_trellis_swigs}) + GET_FILENAME_COMPONENT(name ${swig_file} NAME) + FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/trellis_generated.i "%include<${name}>\n") +ENDFOREACH(swig_file) ######################################################################## # Setup library @@ -198,9 +202,14 @@ SET(GR_SWIG_INCLUDE_DIRS ) SET(GR_SWIG_LIBRARIES gnuradio-trellis) - -SET(GR_SWIG_TARGET_DEPS trellis_generated) - +FILE(GLOB GR_SWIG_SOURCE_DEPS + "${CMAKE_CURRENT_SOURCE_DIR}/*.i" + "${CMAKE_CURRENT_SOURCE_DIR}/*.h" +) +LIST(APPEND GR_SWIG_SOURCE_DEPS + ${generated_trellis_swigs} + ${generated_trellis_includes} +) GR_SWIG_MAKE(trellis trellis.i) GR_SWIG_INSTALL( diff --git a/gr-trellis/src/lib/Makefile.am b/gr-trellis/src/lib/Makefile.am index 5f2fc1825..2c50dd635 100644 --- a/gr-trellis/src/lib/Makefile.am +++ b/gr-trellis/src/lib/Makefile.am @@ -41,12 +41,12 @@ core_generator = \ trellis_encoder_XX.cc.t \ trellis_encoder_XX.h.t \ trellis_encoder_XX.i.t \ - trellis_sccc_encoder_XX.cc.t \ - trellis_sccc_encoder_XX.h.t \ - trellis_sccc_encoder_XX.i.t \ - trellis_pccc_encoder_XX.cc.t \ - trellis_pccc_encoder_XX.h.t \ - trellis_pccc_encoder_XX.i.t \ + trellis_sccc_encoder_XX.cc.t \ + trellis_sccc_encoder_XX.h.t \ + trellis_sccc_encoder_XX.i.t \ + trellis_pccc_encoder_XX.cc.t \ + trellis_pccc_encoder_XX.h.t \ + trellis_pccc_encoder_XX.i.t \ trellis_metrics_X.cc.t \ trellis_metrics_X.h.t \ trellis_metrics_X.i.t \ @@ -54,14 +54,17 @@ core_generator = \ trellis_viterbi_combined_XX.h.t \ trellis_viterbi_combined_XX.i.t \ trellis_sccc_decoder_combined_XX.cc.t \ - trellis_sccc_decoder_combined_XX.h.t \ - trellis_sccc_decoder_combined_XX.i.t \ - trellis_sccc_decoder_X.cc.t \ + trellis_sccc_decoder_combined_XX.h.t \ + trellis_sccc_decoder_combined_XX.i.t \ + trellis_sccc_decoder_X.cc.t \ trellis_sccc_decoder_X.h.t \ trellis_sccc_decoder_X.i.t \ - trellis_pccc_decoder_X.cc.t \ + trellis_pccc_decoder_X.cc.t \ trellis_pccc_decoder_X.h.t \ trellis_pccc_decoder_X.i.t \ + trellis_pccc_decoder_combined_XX.cc.t \ + trellis_pccc_decoder_combined_XX.h.t \ + trellis_pccc_decoder_combined_XX.i.t \ trellis_viterbi_X.cc.t \ trellis_viterbi_X.h.t \ trellis_viterbi_X.i.t diff --git a/gr-trellis/src/lib/Makefile.gen b/gr-trellis/src/lib/Makefile.gen index 534a7466e..b9b9afb1f 100644 --- a/gr-trellis/src/lib/Makefile.gen +++ b/gr-trellis/src/lib/Makefile.gen @@ -13,6 +13,12 @@ GENERATED_H = \ trellis_metrics_i.h \ trellis_metrics_s.h \ trellis_pccc_decoder_b.h \ + trellis_pccc_decoder_combined_cb.h \ + trellis_pccc_decoder_combined_ci.h \ + trellis_pccc_decoder_combined_cs.h \ + trellis_pccc_decoder_combined_fb.h \ + trellis_pccc_decoder_combined_fi.h \ + trellis_pccc_decoder_combined_fs.h \ trellis_pccc_decoder_i.h \ trellis_pccc_decoder_s.h \ trellis_pccc_encoder_bb.h \ @@ -64,6 +70,12 @@ GENERATED_I = \ trellis_metrics_i.i \ trellis_metrics_s.i \ trellis_pccc_decoder_b.i \ + trellis_pccc_decoder_combined_cb.i \ + trellis_pccc_decoder_combined_ci.i \ + trellis_pccc_decoder_combined_cs.i \ + trellis_pccc_decoder_combined_fb.i \ + trellis_pccc_decoder_combined_fi.i \ + trellis_pccc_decoder_combined_fs.i \ trellis_pccc_decoder_i.i \ trellis_pccc_decoder_s.i \ trellis_pccc_encoder_bb.i \ @@ -115,6 +127,12 @@ GENERATED_CC = \ trellis_metrics_i.cc \ trellis_metrics_s.cc \ trellis_pccc_decoder_b.cc \ + trellis_pccc_decoder_combined_cb.cc \ + trellis_pccc_decoder_combined_ci.cc \ + trellis_pccc_decoder_combined_cs.cc \ + trellis_pccc_decoder_combined_fb.cc \ + trellis_pccc_decoder_combined_fi.cc \ + trellis_pccc_decoder_combined_fs.cc \ trellis_pccc_decoder_i.cc \ trellis_pccc_decoder_s.cc \ trellis_pccc_encoder_bb.cc \ diff --git a/gr-trellis/src/lib/core_algorithms.cc b/gr-trellis/src/lib/core_algorithms.cc index 91ac8fbdf..54193c818 100644 --- a/gr-trellis/src/lib/core_algorithms.cc +++ b/gr-trellis/src/lib/core_algorithms.cc @@ -784,7 +784,7 @@ template<class Ti, class To> void sccc_decoder_combined( const fsm &FSMo, int STo0, int SToK, const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, int blocklength, int repetitions, + const interleaver &INTERLEAVER, int blocklength, int iterations, float (*p2mymin)(float,float), int D, const std::vector<Ti> &TABLE, trellis_metric_type_t METRIC_TYPE, @@ -810,7 +810,7 @@ for(int k=0;k<blocklength;k++) { iprioro[k*FSMi.O()] *= scaling; } -for(int rep=0;rep<repetitions;rep++) { +for(int rep=0;rep<iterations;rep++) { // run inner SISO siso_algorithm(FSMi.I(),FSMi.S(),FSMi.O(), FSMi.NS(), FSMi.OS(), FSMi.PS(), FSMi.PI(), @@ -832,7 +832,7 @@ for(int rep=0;rep<repetitions;rep++) { // run outer SISO - if(rep<repetitions-1) { // do not produce posti + if(rep<iterations-1) { // do not produce posti siso_algorithm(FSMo.I(),FSMo.S(),FSMo.O(), FSMo.NS(), FSMo.OS(), FSMo.PS(), FSMo.PI(), blocklength, @@ -897,7 +897,7 @@ template void sccc_decoder_combined<float,unsigned char>( const fsm &FSMo, int STo0, int SToK, const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, int blocklength, int repetitions, + const interleaver &INTERLEAVER, int blocklength, int iterations, float (*p2mymin)(float,float), int D, const std::vector<float> &TABLE, trellis_metric_type_t METRIC_TYPE, @@ -909,7 +909,7 @@ template void sccc_decoder_combined<float,short>( const fsm &FSMo, int STo0, int SToK, const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, int blocklength, int repetitions, + const interleaver &INTERLEAVER, int blocklength, int iterations, float (*p2mymin)(float,float), int D, const std::vector<float> &TABLE, trellis_metric_type_t METRIC_TYPE, @@ -921,7 +921,7 @@ template void sccc_decoder_combined<float,int>( const fsm &FSMo, int STo0, int SToK, const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, int blocklength, int repetitions, + const interleaver &INTERLEAVER, int blocklength, int iterations, float (*p2mymin)(float,float), int D, const std::vector<float> &TABLE, trellis_metric_type_t METRIC_TYPE, @@ -933,7 +933,7 @@ template void sccc_decoder_combined<gr_complex,unsigned char>( const fsm &FSMo, int STo0, int SToK, const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, int blocklength, int repetitions, + const interleaver &INTERLEAVER, int blocklength, int iterations, float (*p2mymin)(float,float), int D, const std::vector<gr_complex> &TABLE, trellis_metric_type_t METRIC_TYPE, @@ -945,7 +945,7 @@ template void sccc_decoder_combined<gr_complex,short>( const fsm &FSMo, int STo0, int SToK, const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, int blocklength, int repetitions, + const interleaver &INTERLEAVER, int blocklength, int iterations, float (*p2mymin)(float,float), int D, const std::vector<gr_complex> &TABLE, trellis_metric_type_t METRIC_TYPE, @@ -957,7 +957,7 @@ template void sccc_decoder_combined<gr_complex,int>( const fsm &FSMo, int STo0, int SToK, const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, int blocklength, int repetitions, + const interleaver &INTERLEAVER, int blocklength, int iterations, float (*p2mymin)(float,float), int D, const std::vector<gr_complex> &TABLE, trellis_metric_type_t METRIC_TYPE, @@ -973,7 +973,7 @@ template<class T> void sccc_decoder( const fsm &FSMo, int STo0, int SToK, const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, int blocklength, int repetitions, + const interleaver &INTERLEAVER, int blocklength, int iterations, float (*p2mymin)(float,float), const float *iprioro, T *data ) @@ -988,7 +988,7 @@ void sccc_decoder( std::vector<float> oposti(blocklength*FSMo.I()); std::vector<float> oposto(blocklength*FSMo.O()); - for(int rep=0;rep<repetitions;rep++) { + for(int rep=0;rep<iterations;rep++) { // run inner SISO siso_algorithm(FSMi.I(),FSMi.S(),FSMi.O(), FSMi.NS(), FSMi.OS(), FSMi.PS(), FSMi.PI(), @@ -1010,7 +1010,7 @@ void sccc_decoder( // run outer SISO - if(rep<repetitions-1) { // do not produce posti + if(rep<iterations-1) { // do not produce posti siso_algorithm(FSMo.I(),FSMo.S(),FSMo.O(), FSMo.NS(), FSMo.OS(), FSMo.PS(), FSMo.PI(), blocklength, @@ -1050,7 +1050,7 @@ void sccc_decoder( */ } - } // end repetitions + } // end iterations // generate hard decisions for(int k=0;k<blocklength;k++) { @@ -1075,7 +1075,7 @@ template void sccc_decoder<unsigned char>( const fsm &FSMo, int STo0, int SToK, const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, int blocklength, int repetitions, + const interleaver &INTERLEAVER, int blocklength, int iterations, float (*p2mymin)(float,float), const float *iprioro, unsigned char *data ); @@ -1084,7 +1084,7 @@ template void sccc_decoder<short>( const fsm &FSMo, int STo0, int SToK, const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, int blocklength, int repetitions, + const interleaver &INTERLEAVER, int blocklength, int iterations, float (*p2mymin)(float,float), const float *iprioro, short *data ); @@ -1093,7 +1093,7 @@ template void sccc_decoder<int>( const fsm &FSMo, int STo0, int SToK, const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, int blocklength, int repetitions, + const interleaver &INTERLEAVER, int blocklength, int iterations, float (*p2mymin)(float,float), const float *iprioro, int *data ); @@ -1105,7 +1105,7 @@ template<class T> void pccc_decoder( const fsm &FSM1, int ST10, int ST1K, const fsm &FSM2, int ST20, int ST2K, - const interleaver &INTERLEAVER, int blocklength, int repetitions, + const interleaver &INTERLEAVER, int blocklength, int iterations, float (*p2mymin)(float,float), const float *cprioro, T *data ) @@ -1140,7 +1140,7 @@ void pccc_decoder( } } - for(int rep=0;rep<repetitions;rep++) { + for(int rep=0;rep<iterations;rep++) { // run SISO 1 siso_algorithm(FSM1.I(),FSM1.S(),FSM1.O(), FSM1.NS(), FSM1.OS(), FSM1.PS(), FSM1.PI(), @@ -1185,7 +1185,7 @@ void pccc_decoder( memcpy(&(priori1[ki*FSM1.I()]),&(posti2[k*FSM2.I()]),FSM1.I()*sizeof(float)); } - } // end repetitions + } // end iterations // generate hard decisions for(int k=0;k<blocklength;k++) { @@ -1204,8 +1204,6 @@ void pccc_decoder( } //std::cout << std::endl; - - } //---------------- @@ -1214,7 +1212,7 @@ template void pccc_decoder<unsigned char>( const fsm &FSM1, int ST10, int ST1K, const fsm &FSM2, int ST20, int ST2K, - const interleaver &INTERLEAVER, int blocklength, int repetitions, + const interleaver &INTERLEAVER, int blocklength, int iterations, float (*p2mymin)(float,float), const float *cprioro, unsigned char *data ); @@ -1223,7 +1221,7 @@ template void pccc_decoder<short>( const fsm &FSM1, int ST10, int ST1K, const fsm &FSM2, int ST20, int ST2K, - const interleaver &INTERLEAVER, int blocklength, int repetitions, + const interleaver &INTERLEAVER, int blocklength, int iterations, float (*p2mymin)(float,float), const float *cprioro, short *data ); @@ -1232,8 +1230,208 @@ template void pccc_decoder<int>( const fsm &FSM1, int ST10, int ST1K, const fsm &FSM2, int ST20, int ST2K, - const interleaver &INTERLEAVER, int blocklength, int repetitions, + const interleaver &INTERLEAVER, int blocklength, int iterations, float (*p2mymin)(float,float), const float *cprioro, int *data ); + + +//---------------- + + +template<class Ti, class To> +void pccc_decoder_combined( + const fsm &FSM1, int ST10, int ST1K, + const fsm &FSM2, int ST20, int ST2K, + const interleaver &INTERLEAVER, int blocklength, int iterations, + float (*p2mymin)(float,float), + int D, const std::vector<Ti> &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling, + const Ti *observations, To *data +) +{ + + //allocate space for cprioro + std::vector<float> cprioro(blocklength*FSM1.O()*FSM2.O(),0.0); + + //allocate space for priori, prioro and posti of FSM1 + std::vector<float> priori1(blocklength*FSM1.I(),0.0); + std::vector<float> prioro1(blocklength*FSM1.O()); + std::vector<float> posti1(blocklength*FSM1.I()); + + //allocate space for priori, prioro and posti of FSM2 + std::vector<float> priori2(blocklength*FSM2.I(),0.0); + std::vector<float> prioro2(blocklength*FSM2.O()); + std::vector<float> posti2(blocklength*FSM2.I()); + + // turn observations to neg-log-priors for cprioiro + int O=FSM1.O()*FSM2.O(); + for(int k=0;k<blocklength;k++) { + calc_metric(O, D, TABLE, &(observations[k*D]), &(cprioro[k*O]),METRIC_TYPE); + cprioro[k*O] *= scaling; + } + + //generate prioro1,2 (metrics are not updated per iteration: this is not the best you can do...) + for (int k=0;k<blocklength;k++) { + //std::cout << k << std::endl; + for(int i=0;i<FSM1.O();i++) { + float x=cprioro[k*FSM1.O()*FSM2.O()+i*FSM1.O()+0]; + for(int j=1;j<FSM2.O();j++) + x = (*p2mymin)(x,cprioro[k*FSM1.O()*FSM2.O()+i*FSM1.O()+j]); + prioro1[k*FSM1.O()+i]=x; + //std::cout << prioro1[k*FSM1.O()+i] << ", "; + } + //std::cout << std::endl; + for(int i=0;i<FSM2.O();i++) { + float x=cprioro[k*FSM1.O()*FSM2.O()+0*FSM1.O()+i]; + for(int j=1;j<FSM1.O();j++) + x = (*p2mymin)(x,cprioro[k*FSM1.O()*FSM2.O()+j*FSM1.O()+i]); + prioro2[k*FSM2.O()+i]=x; + } + } + + for(int rep=0;rep<iterations;rep++) { + // run SISO 1 + siso_algorithm(FSM1.I(),FSM1.S(),FSM1.O(), + FSM1.NS(), FSM1.OS(), FSM1.PS(), FSM1.PI(), + blocklength, + ST10,ST1K, + true, false, + p2mymin, + &(priori1[0]), &(prioro1[0]), &(posti1[0]) + ); + + //for(int k=0;k<blocklength;k++){ + //for(int i=0;i<FSM1.I();i++) + //std::cout << posti1[k*FSM1.I()+i] << ", "; + //std::cout << std::endl; + //} + + //interleave soft info 1 -> 2 + for(int k=0;k<blocklength;k++) { + int ki = INTERLEAVER.INTER()[k]; + //for(int i=0;i<FSMi.I();i++) { + //oprioro[k*FSMi.I()+i]=iposti[ki*FSMi.I()+i]; + //} + memcpy(&(priori2[k*FSM2.I()]),&(posti1[ki*FSM1.I()]),FSM1.I()*sizeof(float)); + } + + // run SISO 2 + siso_algorithm(FSM2.I(),FSM2.S(),FSM2.O(), + FSM2.NS(), FSM2.OS(), FSM2.PS(), FSM2.PI(), + blocklength, + ST20,ST2K, + true, false, + p2mymin, + &(priori2[0]), &(prioro2[0]), &(posti2[0]) + ); + + //interleave soft info 2 --> 1 + for(int k=0;k<blocklength;k++) { + int ki = INTERLEAVER.INTER()[k]; + //for(int i=0;i<FSMi.I();i++) { + //ipriori[ki*FSMi.I()+i]=oposto[k*FSMi.I()+i]; + //} + memcpy(&(priori1[ki*FSM1.I()]),&(posti2[k*FSM2.I()]),FSM1.I()*sizeof(float)); + } + + } // end iterations + + // generate hard decisions + for(int k=0;k<blocklength;k++) { + for(int i=0;i<FSM1.I();i++) + posti1[k*FSM1.I()+i] = (*p2mymin)(priori1[k*FSM1.I()+i],posti1[k*FSM1.I()+i]); + float min=INF; + int mini=0; + for(int i=0;i<FSM1.I();i++) { + if(posti1[k*FSM1.I()+i]<min) { + min=posti1[k*FSM1.I()+i]; + mini=i; + } + } + data[k]=(To)mini; + //std::cout << data[k] << ", "<< std::endl; + } + //std::cout << std::endl; + +} + + +template +void pccc_decoder_combined( + const fsm &FSM1, int ST10, int ST1K, + const fsm &FSM2, int ST20, int ST2K, + const interleaver &INTERLEAVER, int blocklength, int iterations, + float (*p2mymin)(float,float), + int D, const std::vector<float> &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling, + const float *observations, unsigned char *data +); + + +template +void pccc_decoder_combined( + const fsm &FSM1, int ST10, int ST1K, + const fsm &FSM2, int ST20, int ST2K, + const interleaver &INTERLEAVER, int blocklength, int iterations, + float (*p2mymin)(float,float), + int D, const std::vector<float> &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling, + const float *observations, short *data +); + + +template +void pccc_decoder_combined( + const fsm &FSM1, int ST10, int ST1K, + const fsm &FSM2, int ST20, int ST2K, + const interleaver &INTERLEAVER, int blocklength, int iterations, + float (*p2mymin)(float,float), + int D, const std::vector<float> &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling, + const float *observations, int *data +); + + +template +void pccc_decoder_combined( + const fsm &FSM1, int ST10, int ST1K, + const fsm &FSM2, int ST20, int ST2K, + const interleaver &INTERLEAVER, int blocklength, int iterations, + float (*p2mymin)(float,float), + int D, const std::vector<gr_complex> &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling, + const gr_complex *observations, unsigned char *data +); + + +template +void pccc_decoder_combined( + const fsm &FSM1, int ST10, int ST1K, + const fsm &FSM2, int ST20, int ST2K, + const interleaver &INTERLEAVER, int blocklength, int iterations, + float (*p2mymin)(float,float), + int D, const std::vector<gr_complex> &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling, + const gr_complex *observations, short *data +); + + +template +void pccc_decoder_combined( + const fsm &FSM1, int ST10, int ST1K, + const fsm &FSM2, int ST20, int ST2K, + const interleaver &INTERLEAVER, int blocklength, int iterations, + float (*p2mymin)(float,float), + int D, const std::vector<gr_complex> &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling, + const gr_complex *observations, int *data +); diff --git a/gr-trellis/src/lib/core_algorithms.h b/gr-trellis/src/lib/core_algorithms.h index fd45844c0..cab7086ba 100644 --- a/gr-trellis/src/lib/core_algorithms.h +++ b/gr-trellis/src/lib/core_algorithms.h @@ -91,11 +91,21 @@ void siso_algorithm_combined(int I, int S, int O, ); +template<class T> +void sccc_decoder( + const fsm &FSMo, int STo0, int SToK, + const fsm &FSMi, int STi0, int STiK, + const interleaver &INTERLEAVER, int blocklength, int iterations, + float (*p2mymin)(float,float), + const float *iprioro, T *data +); + + template<class Ti, class To> void sccc_decoder_combined( const fsm &FSMo, int STo0, int SToK, const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, int blocklength, int repetitions, + const interleaver &INTERLEAVER, int blocklength, int iterations, float (*p2mymin)(float,float), int D, const std::vector<Ti> &TABLE, trellis_metric_type_t METRIC_TYPE, @@ -103,26 +113,28 @@ void sccc_decoder_combined( const Ti *observations, To *data ); - template<class T> -void sccc_decoder( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, int blocklength, int repetitions, +void pccc_decoder( + const fsm &FSM1, int ST10, int ST1K, + const fsm &FSM2, int ST20, int ST2K, + const interleaver &INTERLEAVER, int blocklength, int iterations, float (*p2mymin)(float,float), - const float *iprioro, T *data + const float *cprioro, T *data ); - -template<class T> -void pccc_decoder( +template<class Ti, class To> +void pccc_decoder_combined( const fsm &FSM1, int ST10, int ST1K, const fsm &FSM2, int ST20, int ST2K, - const interleaver &INTERLEAVER, int blocklength, int repetitions, + const interleaver &INTERLEAVER, int blocklength, int iterations, float (*p2mymin)(float,float), - const float *cprioro, T *data + int D, const std::vector<Ti> &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling, + const Ti *observations, To *data ); + #endif diff --git a/gr-trellis/src/lib/generate_trellis.py b/gr-trellis/src/lib/generate_trellis.py index 9f845f74a..31bc44aac 100644 --- a/gr-trellis/src/lib/generate_trellis.py +++ b/gr-trellis/src/lib/generate_trellis.py @@ -33,9 +33,10 @@ other_roots = [ 'trellis_metrics_X', 'trellis_viterbi_X', 'trellis_viterbi_combined_XX', - 'trellis_sccc_decoder_combined_XX', 'trellis_sccc_decoder_X', + 'trellis_sccc_decoder_combined_XX', 'trellis_pccc_decoder_X', + 'trellis_pccc_decoder_combined_XX', ] other_signatures = ( @@ -45,9 +46,10 @@ other_signatures = ( ['s','i','f','c'], ['b','s','i'], ['sb','ss','si','ib','is','ii','fb','fs','fi','cb','cs','ci'], - ['fb','fs','fi','cb','cs','ci'], ['b','s','i'], + ['fb','fs','fi','cb','cs','ci'], ['b','s','i'], + ['fb','fs','fi','cb','cs','ci'], ) diff --git a/gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.cc.t b/gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.cc.t new file mode 100644 index 000000000..48f68f1fe --- /dev/null +++ b/gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.cc.t @@ -0,0 +1,147 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2010 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// @WARNING@ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <@NAME@.h> +#include <gr_io_signature.h> +#include <assert.h> +#include <iostream> +#include "core_algorithms.h" + + +static const float INF = 1.0e9; + +@SPTR_NAME@ +trellis_make_@BASE_NAME@ ( + const fsm &FSMo, int STo0, int SToK, + const fsm &FSMi, int STi0, int STiK, + const interleaver &INTERLEAVER, + int blocklength, + int repetitions, + trellis_siso_type_t SISO_TYPE, + int D, + const std::vector<@I_TYPE@> &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling +) +{ + return gnuradio::get_initial_sptr (new @NAME@ ( + FSMo, STo0, SToK, + FSMi, STi0, STiK, + INTERLEAVER, + blocklength, + repetitions, + SISO_TYPE, + D, + TABLE,METRIC_TYPE, + scaling + )); +} + +@NAME@::@NAME@ ( + const fsm &FSMo, int STo0, int SToK, + const fsm &FSMi, int STi0, int STiK, + const interleaver &INTERLEAVER, + int blocklength, + int repetitions, + trellis_siso_type_t SISO_TYPE, + int D, + const std::vector<@I_TYPE@> &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling +) + : gr_block ("@BASE_NAME@", + gr_make_io_signature (1, 1, sizeof (@I_TYPE@)), + gr_make_io_signature (1, 1, sizeof (@O_TYPE@))), + d_FSMo (FSMo), d_STo0 (STo0), d_SToK (SToK), + d_FSMi (FSMi), d_STi0 (STi0), d_STiK (STiK), + d_INTERLEAVER (INTERLEAVER), + d_blocklength (blocklength), + d_repetitions (repetitions), + d_SISO_TYPE (SISO_TYPE), + d_D (D), + d_TABLE (TABLE), + d_METRIC_TYPE (METRIC_TYPE), + d_scaling (scaling) +{ + assert(d_FSMo.I() == d_FSMi.I()); + set_relative_rate (1.0 / ((double) d_D)); + set_output_multiple (d_blocklength); +} + +void @NAME@::set_scaling(float scaling) +{ + d_scaling = scaling; +} + + +void +@NAME@::forecast (int noutput_items, gr_vector_int &ninput_items_required) +{ + assert (noutput_items % d_blocklength == 0); + int input_required = d_D * noutput_items ; + ninput_items_required[0] = input_required; +} + + + +//=========================================================== + +int +@NAME@::general_work (int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + assert (noutput_items % d_blocklength == 0); + int nblocks = noutput_items / d_blocklength; + + float (*p2min)(float, float) = NULL; + if(d_SISO_TYPE == TRELLIS_MIN_SUM) + p2min = &min; + else if(d_SISO_TYPE == TRELLIS_SUM_PRODUCT) + p2min = &min_star; + + + const @I_TYPE@ *in = (const @I_TYPE@ *) input_items[0]; + @O_TYPE@ *out = (@O_TYPE@ *) output_items[0]; + for (int n=0;n<nblocks;n++) { + pccc_decoder_combined( + d_FSMo, d_STo0, d_SToK, + d_FSMi, d_STi0, d_STiK, + d_INTERLEAVER, d_blocklength, d_repetitions, + p2min, + d_D,d_TABLE, + d_METRIC_TYPE, + d_scaling, + &(in[n*d_blocklength*d_D]),&(out[n*d_blocklength]) + ); + } + + consume_each (d_D * noutput_items ); + return noutput_items; +} diff --git a/gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.h.t b/gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.h.t new file mode 100644 index 000000000..6d177cca2 --- /dev/null +++ b/gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.h.t @@ -0,0 +1,125 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// @WARNING@ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <trellis_api.h> +#include "fsm.h" +#include "interleaver.h" +#include <gr_block.h> +#include <vector> +#include "calc_metric.h" +#include "siso_type.h" + +class @NAME@; +typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; + +TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( + const fsm &FSMo, int STo0, int SToK, + const fsm &FSMi, int STi0, int STiK, + const interleaver &INTERLEAVER, + int blocklength, + int repetitions, + trellis_siso_type_t SISO_TYPE, // perform "min-sum" or "sum-product" combining + int D, + const std::vector<@I_TYPE@> &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling +); + + +/*! + * \ingroup coding_blk + */ +class TRELLIS_API @NAME@ : public gr_block +{ + fsm d_FSMo; + fsm d_FSMi; + int d_STo0; + int d_SToK; + int d_STi0; + int d_STiK; + interleaver d_INTERLEAVER; + int d_blocklength; + int d_repetitions; + trellis_siso_type_t d_SISO_TYPE; + int d_D; + std::vector<@I_TYPE@> d_TABLE; + trellis_metric_type_t d_METRIC_TYPE; + float d_scaling; + std::vector<float> d_buffer; + + friend TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( + const fsm &FSMo, int STo0, int SToK, + const fsm &FSMi, int STi0, int STiK, + const interleaver &INTERLEAVER, + int blocklength, + int repetitions, + trellis_siso_type_t SISO_TYPE, + int D, + const std::vector<@I_TYPE@> &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling + ); + + @NAME@ ( + const fsm &FSMo, int STo0, int SToK, + const fsm &FSMi, int STi0, int STiK, + const interleaver &INTERLEAVER, + int blocklength, + int repetitions, + trellis_siso_type_t SISO_TYPE, + int D, + const std::vector<@I_TYPE@> &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling + ); + +public: + fsm FSM1 () const { return d_FSMo; } + fsm FSM2 () const { return d_FSMi; } + int ST10 () const { return d_STo0; } + int ST1K () const { return d_SToK; } + int ST20 () const { return d_STi0; } + int ST2K () const { return d_STiK; } + interleaver INTERLEAVER () const { return d_INTERLEAVER; } + int blocklength () const { return d_blocklength; } + int repetitions () const { return d_repetitions; } + int D () const { return d_D; } + std::vector<@I_TYPE@> TABLE () const { return d_TABLE; } + trellis_metric_type_t METRIC_TYPE () const { return d_METRIC_TYPE; } + trellis_siso_type_t SISO_TYPE () const { return d_SISO_TYPE; } + float scaling () const { return d_scaling; } + void set_scaling (float scaling); + + void forecast (int noutput_items, + gr_vector_int &ninput_items_required); + int general_work (int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); +}; + +#endif diff --git a/gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.i.t b/gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.i.t new file mode 100644 index 000000000..d841f67b4 --- /dev/null +++ b/gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.i.t @@ -0,0 +1,73 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// @WARNING@ + +GR_SWIG_BLOCK_MAGIC(trellis,@BASE_NAME@); + +@SPTR_NAME@ trellis_make_@BASE_NAME@ ( + const fsm &FSMo, int STo0, int SToK, + const fsm &FSMi, int STi0, int STiK, + const interleaver &INTERLEAVER, + int blocklength, + int repetitions, + trellis_siso_type_t SISO_TYPE, + int D, + const std::vector<@I_TYPE@> &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling +); + + +class @NAME@ : public gr_block +{ +private: + @NAME@ ( + const fsm &FSMo, int STo0, int SToK, + const fsm &FSMi, int STi0, int STiK, + const interleaver &INTERLEAVER, + int blocklength, + int repetitions, + trellis_siso_type_t SISO_TYPE, + int D, + const std::vector<@I_TYPE@> &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling + ); + +public: + fsm FSM1 () const { return d_FSMo; } + fsm FSM2 () const { return d_FSMi; } + int ST10 () const { return d_STo0; } + int ST1K () const { return d_SToK; } + int ST20 () const { return d_STi0; } + int ST2K () const { return d_STiK; } + interleaver INTERLEAVER () const { return d_INTERLEAVER; } + int blocklength () const { return d_blocklength; } + int repetitions () const { return d_repetitions; } + int D () const { return d_D; } + std::vector<@I_TYPE@> TABLE () const { return d_TABLE; } + trellis_metric_type_t METRIC_TYPE () const { return d_METRIC_TYPE; } + trellis_siso_type_t SISO_TYPE () const { return d_SISO_TYPE; } + float scaling() const { return d_scaling; } + void set_scaling (float scaling); +}; diff --git a/gr-trellis/src/lib/trellis_permutation.cc b/gr-trellis/src/lib/trellis_permutation.cc index a32390742..416fc58ec 100644 --- a/gr-trellis/src/lib/trellis_permutation.cc +++ b/gr-trellis/src/lib/trellis_permutation.cc @@ -30,19 +30,19 @@ #include <string.h> trellis_permutation_sptr -trellis_make_permutation (int K, const std::vector<int> &TABLE, int SYMS_PER_BLOCK, size_t NBYTES_INOUT) +trellis_make_permutation (int K, const std::vector<int> &TABLE, int SYMS_PER_BLOCK, size_t BYTES_PER_SYMBOL) { - return gnuradio::get_initial_sptr(new trellis_permutation (K,TABLE,SYMS_PER_BLOCK,NBYTES_INOUT)); + return gnuradio::get_initial_sptr(new trellis_permutation (K,TABLE,SYMS_PER_BLOCK,BYTES_PER_SYMBOL)); } -trellis_permutation::trellis_permutation (int K, const std::vector<int> &TABLE, int SYMS_PER_BLOCK, size_t NBYTES_INOUT) +trellis_permutation::trellis_permutation (int K, const std::vector<int> &TABLE, int SYMS_PER_BLOCK, size_t BYTES_PER_SYMBOL) : gr_sync_block ("permutation", - gr_make_io_signature (1, -1, NBYTES_INOUT), - gr_make_io_signature (1, -1, NBYTES_INOUT)), + gr_make_io_signature (1, -1, BYTES_PER_SYMBOL), + gr_make_io_signature (1, -1, BYTES_PER_SYMBOL)), d_K (K), d_TABLE (TABLE), d_SYMS_PER_BLOCK (SYMS_PER_BLOCK), - d_NBYTES_INOUT (NBYTES_INOUT) + d_BYTES_PER_SYMBOL (BYTES_PER_SYMBOL) { set_output_multiple (d_K*SYMS_PER_BLOCK); //std::cout << d_K << "\n"; @@ -72,9 +72,9 @@ trellis_permutation::work (int noutput_items, int j0 = i%d_K; // new position of block within packet (in blocks) int k0 = d_TABLE[j0]; - memcpy(&(out[i*d_SYMS_PER_BLOCK*d_NBYTES_INOUT]), - &(in[(i0+k0)*d_SYMS_PER_BLOCK*d_NBYTES_INOUT]), - d_NBYTES_INOUT*d_SYMS_PER_BLOCK); + memcpy(&(out[i*d_SYMS_PER_BLOCK*d_BYTES_PER_SYMBOL]), + &(in[(i0+k0)*d_SYMS_PER_BLOCK*d_BYTES_PER_SYMBOL]), + d_BYTES_PER_SYMBOL*d_SYMS_PER_BLOCK); } // end per stream processing } diff --git a/gr-trellis/src/lib/trellis_permutation.h b/gr-trellis/src/lib/trellis_permutation.h index 7fec9682f..2786de29a 100644 --- a/gr-trellis/src/lib/trellis_permutation.h +++ b/gr-trellis/src/lib/trellis_permutation.h @@ -31,7 +31,7 @@ class trellis_permutation; typedef boost::shared_ptr<trellis_permutation> trellis_permutation_sptr; -TRELLIS_API trellis_permutation_sptr trellis_make_permutation (int K, const std::vector<int> &TABLE, int SYMS_PER_BLOCK, size_t NBYTES_INOUT); +TRELLIS_API trellis_permutation_sptr trellis_make_permutation (int K, const std::vector<int> &TABLE, int SYMS_PER_BLOCK, size_t BYTES_PER_SYMBOL); /*! * \brief Permutation. @@ -40,18 +40,18 @@ TRELLIS_API trellis_permutation_sptr trellis_make_permutation (int K, const std: class TRELLIS_API trellis_permutation : public gr_sync_block { private: - friend TRELLIS_API trellis_permutation_sptr trellis_make_permutation (int K, const std::vector<int> &TABLE, int SYMS_PER_BLOCK, size_t NBYTES_INOUT); + friend TRELLIS_API trellis_permutation_sptr trellis_make_permutation (int K, const std::vector<int> &TABLE, int SYMS_PER_BLOCK, size_t BYTES_PER_SYMBOL); int d_K; std::vector<int> d_TABLE; int d_SYMS_PER_BLOCK; - size_t d_NBYTES_INOUT; + size_t d_BYTES_PER_SYMBOL; trellis_permutation (int K, const std::vector<int> &TABLE, int SYMS_PER_BLOCK, size_t NBYTES); public: int K () const { return d_K; } const std::vector<int> & TABLE () const { return d_TABLE; } int SYMS_PER_BLOCK () const { return d_SYMS_PER_BLOCK; } - size_t NBYTES_INOUT () const { return d_NBYTES_INOUT; } + size_t BYTES_PER_SYMBOL () const { return d_BYTES_PER_SYMBOL; } int work (int noutput_items, gr_vector_const_void_star &input_items, diff --git a/gr-trellis/src/lib/trellis_permutation.i b/gr-trellis/src/lib/trellis_permutation.i index 834a36986..1433a6584 100644 --- a/gr-trellis/src/lib/trellis_permutation.i +++ b/gr-trellis/src/lib/trellis_permutation.i @@ -22,7 +22,7 @@ GR_SWIG_BLOCK_MAGIC(trellis,permutation); -trellis_permutation_sptr trellis_make_permutation (int K, const std::vector<int> &TABLE, int SYMS_PER_BLOCK, size_t NBYTES_INOUT); +trellis_permutation_sptr trellis_make_permutation (int K, const std::vector<int> &TABLE, int SYMS_PER_BLOCK, size_t BYTES_PER_SYMBOL); class trellis_permutation : public gr_sync_block { @@ -30,12 +30,12 @@ private: int d_K; std::vector<int> d_TABLE; int d_SYMS_PER_BLOCK; - size_t d_NBYTES_INOUT; - trellis_permutation (int K, const std::vector<int> &TABLE, int SYMS_PER_BLOCK, size_t NBYTES_INOUT); + size_t d_BYTES_PER_SYMBOL; + trellis_permutation (int K, const std::vector<int> &TABLE, int SYMS_PER_BLOCK, size_t BYTES_PER_SYMBOL); public: int K () const { return d_K; } const std::vector<int> & TABLE () const { return d_TABLE; } int SYMS_PER_BLOCK () const { return d_SYMS_PER_BLOCK; } - size_t NBYTES_INOUT () const { return d_NBYTES_INOUT; } + size_t BYTES_PER_SYMBOL () const { return d_BYTES_PER_SYMBOL; } }; diff --git a/gr-uhd/CMakeLists.txt b/gr-uhd/CMakeLists.txt index 2e7e26ab0..102320884 100644 --- a/gr-uhd/CMakeLists.txt +++ b/gr-uhd/CMakeLists.txt @@ -83,6 +83,7 @@ CPACK_COMPONENT("uhd_swig" ######################################################################## ADD_SUBDIRECTORY(include) ADD_SUBDIRECTORY(lib) +ADD_SUBDIRECTORY(examples) IF(ENABLE_PYTHON) ADD_SUBDIRECTORY(swig) ADD_SUBDIRECTORY(grc) diff --git a/gr-uhd/examples/CMakeLists.txt b/gr-uhd/examples/CMakeLists.txt new file mode 100644 index 000000000..3e1c80362 --- /dev/null +++ b/gr-uhd/examples/CMakeLists.txt @@ -0,0 +1,39 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup the include and linker paths +######################################################################## +INCLUDE_DIRECTORIES( + ${GNURADIO_CORE_INCLUDE_DIRS} + ${GR_UHD_INCLUDE_DIRS} + ${CMAKE_CURRENT_SOURCE_DIR} +) + +INCLUDE_DIRECTORIES(${UHD_INCLUDE_DIRS}) +LINK_DIRECTORIES(${UHD_LIBRARY_DIRS}) + +INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) +LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) + +######################################################################## +# Build executable +######################################################################## +ADD_EXECUTABLE(tags_demo tags_demo.cc) +TARGET_LINK_LIBRARIES(tags_demo gnuradio-uhd) diff --git a/gr-uhd/examples/tag_sink_demo.h b/gr-uhd/examples/tag_sink_demo.h new file mode 100644 index 000000000..84baf0a9c --- /dev/null +++ b/gr-uhd/examples/tag_sink_demo.h @@ -0,0 +1,66 @@ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#include <gr_sync_block.h> +#include <gr_io_signature.h> +#include <gr_tag_info.h> +#include <boost/foreach.hpp> +#include <boost/format.hpp> +#include <iostream> +#include <complex> + +class tag_sink_demo : public gr_sync_block{ +public: + + tag_sink_demo(void): + gr_sync_block( + "uhd tag sink demo", + gr_make_io_signature(1, 1, sizeof(std::complex<float>)), + gr_make_io_signature(0, 0, 0) + ) + { + //NOP + } + + int work( + int ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items + ){ + //grab all "rx time" tags in this work call + const uint64_t samp0_count = this->nitems_read(0); + std::vector<pmt::pmt_t> rx_time_tags; + get_tags_in_range(rx_time_tags, 0, samp0_count, samp0_count + ninput_items, pmt::pmt_string_to_symbol("rx_time")); + + //print all tags + BOOST_FOREACH(const pmt::pmt_t &rx_time_tag, rx_time_tags){ + const uint64_t count = gr_tags::get_nitems(rx_time_tag); + const pmt::pmt_t &value = gr_tags::get_value(rx_time_tag); + + std::cout << boost::format("Full seconds %u, Frac seconds %f") + % pmt::pmt_to_uint64(pmt_tuple_ref(value, 0)) + % pmt::pmt_to_double(pmt_tuple_ref(value, 1)) + << std::endl; + } + + return ninput_items; + } +}; diff --git a/gr-uhd/examples/tag_source_demo.h b/gr-uhd/examples/tag_source_demo.h new file mode 100644 index 000000000..c7c0884d3 --- /dev/null +++ b/gr-uhd/examples/tag_source_demo.h @@ -0,0 +1,129 @@ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#include <gr_sync_block.h> +#include <gr_io_signature.h> +#include <gr_tag_info.h> +#include <boost/foreach.hpp> +#include <boost/format.hpp> +#include <iostream> +#include <complex> + +class tag_source_demo : public gr_sync_block{ +public: + + tag_source_demo( + const uint64_t start_secs, + const double start_fracs, + const double samp_rate, + const double idle_duration, + const double burst_duration + ): + gr_sync_block( + "uhd tag source demo", + gr_make_io_signature(0, 0, 0), + gr_make_io_signature(1, 1, sizeof(std::complex<float>)) + ), + _time_secs(start_secs), + _time_fracs(start_fracs), + _samp_rate(samp_rate), + _samps_per_burst(samp_rate*burst_duration), + _cycle_duration(idle_duration + burst_duration), + _samps_left_in_burst(1), //immediate EOB + _do_new_burst(false) + { + //NOP + } + + void make_time_tag(const uint64_t tag_count){; + const pmt::pmt_t key = pmt::pmt_string_to_symbol("tx_time"); + const pmt::pmt_t value = pmt::pmt_make_tuple( + pmt::pmt_from_uint64(_time_secs), + pmt::pmt_from_double(_time_fracs) + ); + const pmt::pmt_t srcid = pmt::pmt_string_to_symbol(this->name()); + this->add_item_tag(0/*chan0*/, tag_count, key, value, srcid); + } + + void make_sob_tag(const uint64_t tag_count){ + const pmt::pmt_t key = pmt::pmt_string_to_symbol("tx_sob"); + const pmt::pmt_t value = pmt::PMT_T; + const pmt::pmt_t srcid = pmt::pmt_string_to_symbol(this->name()); + this->add_item_tag(0/*chan0*/, tag_count, key, value, srcid); + } + + void make_eob_tag(const uint64_t tag_count){; + const pmt::pmt_t key = pmt::pmt_string_to_symbol("tx_eob"); + const pmt::pmt_t value = pmt::PMT_T; + const pmt::pmt_t srcid = pmt::pmt_string_to_symbol(this->name()); + this->add_item_tag(0/*chan0*/, tag_count, key, value, srcid); + } + + int work( + int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items + ){ + //load the output with a constant + std::complex<float> *output = reinterpret_cast<std::complex<float> *>(output_items[0]); + for (size_t i = 0; i < size_t(noutput_items); i++){ + output[i] = std::complex<float>(0.7, 0.7); + } + + //Handle the start of burst condition. + //Tag a start of burst and timestamp. + //Increment the time for the next burst. + if (_do_new_burst){ + _do_new_burst = false; + _samps_left_in_burst = _samps_per_burst; + + this->make_sob_tag(this->nitems_written(0)); + this->make_time_tag(this->nitems_written(0)); + + _time_fracs += _cycle_duration; + double intpart; //normalize + _time_fracs = std::modf(_time_fracs, &intpart); + _time_secs += uint64_t(intpart); + } + + //Handle the end of burst condition. + //Tag an end of burst and return early. + //the next work call will be a start of burst. + if (_samps_left_in_burst < size_t(noutput_items)){ + this->make_eob_tag(this->nitems_written(0) + _samps_left_in_burst - 1); + _do_new_burst = true; + noutput_items = _samps_left_in_burst; + } + + _samps_left_in_burst -= noutput_items; + return noutput_items; + } + +private: + uint64_t _time_secs; + double _time_fracs; + const double _samp_rate; + const uint64_t _samps_per_burst; + const double _cycle_duration; + bool _do_new_burst; + uint64_t _samps_left_in_burst; + +}; diff --git a/gr-uhd/examples/tags_demo.cc b/gr-uhd/examples/tags_demo.cc new file mode 100644 index 000000000..b40518f34 --- /dev/null +++ b/gr-uhd/examples/tags_demo.cc @@ -0,0 +1,139 @@ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#include <gr_top_block.h> +#include <gr_uhd_usrp_source.h> +#include <gr_uhd_usrp_sink.h> +#include <tag_source_demo.h> +#include <tag_sink_demo.h> +#include <boost/make_shared.hpp> +#include <boost/thread/thread.hpp> //sleep +#include <boost/program_options.hpp> +#include <csignal> +#include <iostream> + +namespace po = boost::program_options; + +/*********************************************************************** + * Signal handlers + **********************************************************************/ +static bool stop_signal_called = false; +void sig_int_handler(int){stop_signal_called = true;} + +/*********************************************************************** + * Main w/ program options + **********************************************************************/ +int main(int argc, char *argv[]){ + + std::string device_addr; + double center_freq, samp_rate, burst_dur, idle_dur; + + //setup the program options + po::options_description desc("Allowed options"); + desc.add_options() + ("help", "help message") + ("addr", po::value<std::string>(&device_addr)->default_value(""), "the device address in string format") + ("rate", po::value<double>(&samp_rate)->default_value(1e6), "the sample rate in samples per second") + ("freq", po::value<double>(¢er_freq)->default_value(10e6), "the center frequency in Hz") + ("burst", po::value<double>(&burst_dur)->default_value(0.1), "the duration of each burst in seconds") + ("idle", po::value<double>(&idle_dur)->default_value(0.05), "idle time between bursts in seconds") + ; + po::variables_map vm; + po::store(po::parse_command_line(argc, argv, desc), vm); + po::notify(vm); + + //print the help message + if (vm.count("help")){ + std::cout + << boost::format("UHD Tags Demo %s") % desc << std::endl + << "The tags sink demo block will print USRP source time stamps." << std::endl + << "The tags source demo block will send bursts to the USRP sink." << std::endl + << "Look at the USRP output on a scope to see the timed bursts." << std::endl + << std::endl; + return ~0; + } + + //------------------------------------------------------------------ + //-- make a top block + //------------------------------------------------------------------ + gr_top_block_sptr tb = gr_make_top_block("tags_demo"); + + //------------------------------------------------------------------ + //-- make the usrp source test blocks + //------------------------------------------------------------------ + boost::shared_ptr<uhd_usrp_source> usrp_source = uhd_make_usrp_source( + device_addr, uhd::io_type_t::COMPLEX_FLOAT32, 1 + ); + usrp_source->set_samp_rate(samp_rate); + usrp_source->set_center_freq(center_freq); + + boost::shared_ptr<tag_sink_demo> tag_sink = boost::make_shared<tag_sink_demo>(); + + //------------------------------------------------------------------ + //-- connect the usrp source test blocks + //------------------------------------------------------------------ + tb->connect(usrp_source, 0, tag_sink, 0); + + //------------------------------------------------------------------ + //-- make the usrp sink test blocks + //------------------------------------------------------------------ + boost::shared_ptr<uhd_usrp_sink> usrp_sink = uhd_make_usrp_sink( + device_addr, uhd::io_type_t::COMPLEX_FLOAT32, 1 + ); + usrp_sink->set_samp_rate(samp_rate); + usrp_sink->set_center_freq(center_freq); + const uhd::time_spec_t time_now = usrp_sink->get_time_now(); + + boost::shared_ptr<tag_source_demo> tag_source = boost::make_shared<tag_source_demo>( + time_now.get_full_secs() + 1, time_now.get_frac_secs(), //time now + 1 second + samp_rate, idle_dur, burst_dur + ); + + //------------------------------------------------------------------ + //-- connect the usrp sink test blocks + //------------------------------------------------------------------ + tb->connect(tag_source, 0, usrp_sink, 0); + + //------------------------------------------------------------------ + //-- start flow graph execution + //------------------------------------------------------------------ + std::cout << "starting flow graph" << std::endl; + tb->start(); + + //------------------------------------------------------------------ + //-- poll the exit signal while running + //------------------------------------------------------------------ + std::signal(SIGINT, &sig_int_handler); + std::cout << "press ctrl + c to exit" << std::endl; + while (not stop_signal_called){ + boost::this_thread::sleep(boost::posix_time::milliseconds(100)); + } + + //------------------------------------------------------------------ + //-- stop flow graph execution + //------------------------------------------------------------------ + std::cout << "stopping flow graph" << std::endl; + tb->stop(); + tb->wait(); + + std::cout << "done!" << std::endl; + return 0; +} diff --git a/gr-uhd/grc/CMakeLists.txt b/gr-uhd/grc/CMakeLists.txt index 9e1cdb015..d89b8d77e 100644 --- a/gr-uhd/grc/CMakeLists.txt +++ b/gr-uhd/grc/CMakeLists.txt @@ -39,6 +39,7 @@ ADD_CUSTOM_TARGET(uhd_grc_xml_blocks ALL DEPENDS ${xml_blocks}) INSTALL(FILES ${xml_blocks} + uhd_amsg_source.xml uhd_block_tree.xml DESTINATION ${GRC_BLOCKS_DIR} COMPONENT "uhd_python" diff --git a/gr-uhd/grc/Makefile.am b/gr-uhd/grc/Makefile.am index 7e73a5b39..42a35b1c1 100644 --- a/gr-uhd/grc/Makefile.am +++ b/gr-uhd/grc/Makefile.am @@ -31,6 +31,7 @@ BUILT_SOURCES += $(generated_uhd_usrp_blocks) dist_grcblocks_DATA = \ uhd_block_tree.xml \ + uhd_amsg_source.xml \ $(BUILT_SOURCES) ######################################################################## diff --git a/gr-uhd/grc/gen_uhd_usrp_blocks.py b/gr-uhd/grc/gen_uhd_usrp_blocks.py index c77df6c97..b6bc5fb79 100644 --- a/gr-uhd/grc/gen_uhd_usrp_blocks.py +++ b/gr-uhd/grc/gen_uhd_usrp_blocks.py @@ -256,6 +256,8 @@ The center frequency is the overall frequency of the RF chain. \\ For greater control of how the UHD tunes elements in the RF chain, \\ pass a tune_request object rather than a simple target frequency. Tuning with an LO offset example: uhd.tune_request(freq, lo_off) +Tuning without DSP: uhd.tune_request(target_freq, dsp_freq=0, \\ +dsp_freq_policy=uhd.tune_request.POLICY_MANUAL) Antenna: For subdevices with only one antenna, this may be left blank. \\ @@ -266,6 +268,9 @@ Bandwidth: To use the default bandwidth filter setting, this should be zero. \\ Only certain subdevices have configurable bandwidth filters. \\ See the daughterboard application notes for possible configurations. + +See the UHD manual for more detailed documentation: +http://code.ettus.com/redmine/ettus/projects/uhd/wiki </doc> </block> """ diff --git a/gr-uhd/grc/uhd_amsg_source.xml b/gr-uhd/grc/uhd_amsg_source.xml new file mode 100644 index 000000000..78c9d7b58 --- /dev/null +++ b/gr-uhd/grc/uhd_amsg_source.xml @@ -0,0 +1,24 @@ +<?xml version="1.0"?> +<block> + <name>UHD: USRP Async Msg Source</name> + <key>uhd_amsg_source</key> + <import>from gnuradio import uhd</import> + <make>uhd.amsg_source(device_addr=$dev_addr, msgq=$(id)_msgq_out)</make> + <param> + <name>Device Addr</name> + <key>dev_addr</key> + <value></value> + <type>string</type> + <hide> + #if $dev_addr() + none + #else + part + #end if + </hide> + </param> + <source> + <name>out</name> + <type>msg</type> + </source> +</block> diff --git a/gr-uhd/grc/uhd_block_tree.xml b/gr-uhd/grc/uhd_block_tree.xml index 8a9f62f7c..5d3b49393 100644 --- a/gr-uhd/grc/uhd_block_tree.xml +++ b/gr-uhd/grc/uhd_block_tree.xml @@ -10,5 +10,6 @@ <name>UHD</name> <block>uhd_usrp_source</block> <block>uhd_usrp_sink</block> + <block>uhd_amsg_source</block> </cat> </cat> diff --git a/gr-uhd/include/CMakeLists.txt b/gr-uhd/include/CMakeLists.txt index d13f85c0f..20d152859 100644 --- a/gr-uhd/include/CMakeLists.txt +++ b/gr-uhd/include/CMakeLists.txt @@ -24,6 +24,7 @@ INSTALL(FILES gr_uhd_api.h gr_uhd_usrp_source.h gr_uhd_usrp_sink.h + gr_uhd_amsg_source.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio COMPONENT "uhd_devel" ) diff --git a/gr-uhd/include/Makefile.am b/gr-uhd/include/Makefile.am index 4a04c98c1..70b80681b 100644 --- a/gr-uhd/include/Makefile.am +++ b/gr-uhd/include/Makefile.am @@ -24,4 +24,5 @@ include $(top_srcdir)/Makefile.common grinclude_HEADERS = \ gr_uhd_api.h \ gr_uhd_usrp_source.h \ - gr_uhd_usrp_sink.h + gr_uhd_usrp_sink.h \ + gr_uhd_amsg_source.h diff --git a/gr-uhd/include/gr_uhd_amsg_source.h b/gr-uhd/include/gr_uhd_amsg_source.h new file mode 100644 index 000000000..bc0feb438 --- /dev/null +++ b/gr-uhd/include/gr_uhd_amsg_source.h @@ -0,0 +1,39 @@ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_UHD_AMSG_SOURCE_H +#define INCLUDED_GR_UHD_AMSG_SOURCE_H + +#include <gr_uhd_api.h> +#include <uhd/usrp/multi_usrp.hpp> +#include <gr_msg_queue.h> + +class uhd_amsg_source; + +GR_UHD_API boost::shared_ptr<uhd_amsg_source> uhd_make_amsg_source( + const uhd::device_addr_t &device_addr, + gr_msg_queue_sptr msgq +); + +class GR_UHD_API uhd_amsg_source{ +}; + +#endif /* INCLUDED_GR_UHD_AMSG_SOURCE_H */ diff --git a/gr-uhd/include/gr_uhd_usrp_sink.h b/gr-uhd/include/gr_uhd_usrp_sink.h index 2adc5f1bf..c1fc3b09e 100644 --- a/gr-uhd/include/gr_uhd_usrp_sink.h +++ b/gr-uhd/include/gr_uhd_usrp_sink.h @@ -28,6 +28,33 @@ class uhd_usrp_sink; +/*! + * \brief Make a new USRP sink block. + * + * The USRP sink block reads a stream and transmits the samples. + * The sink block also provides API calls for transmitter settings. + * + * TX Stream tagging: + * + * The following tag keys will be consumed by the work function: + * - pmt::pmt_string_to_symbol("tx_sob") + * - pmt::pmt_string_to_symbol("tx_eob") + * - pmt::pmt_string_to_symbol("tx_time") + * + * The sob and eob (start and end of burst) tag values are pmt booleans. + * When present, burst tags should be set to true (pmt::PMT_T). + * + * The timstamp tag value is a pmt tuple of the following: + * (uint64 seconds, and double fractional seconds). + * + * See the UHD manual for more detailed documentation: + * http://code.ettus.com/redmine/ettus/projects/uhd/wiki + * + * \param device_addr the address to identify the hardware + * \param io_type the desired input data type + * \param num_channels number of stream from the device + * \return a new USRP sink block object + */ GR_UHD_API boost::shared_ptr<uhd_usrp_sink> uhd_make_usrp_sink( const uhd::device_addr_t &device_addr, const uhd::io_type_t &io_type, diff --git a/gr-uhd/include/gr_uhd_usrp_source.h b/gr-uhd/include/gr_uhd_usrp_source.h index 6e51a1423..f8ac9361e 100644 --- a/gr-uhd/include/gr_uhd_usrp_source.h +++ b/gr-uhd/include/gr_uhd_usrp_source.h @@ -28,6 +28,29 @@ class uhd_usrp_source; +/*! + * \brief Make a new USRP source block. + * + * The USRP source block receives samples and writes to a stream. + * The source block also provides API calls for receiver settings. + * + * RX Stream tagging: + * + * The following tag keys will be produced by the work function: + * - pmt::pmt_string_to_symbol("rx_time") + * + * The timstamp tag value is a pmt tuple of the following: + * (uint64 seconds, and double fractional seconds). + * A timestamp tag is produced at start() and after overflows. + * + * See the UHD manual for more detailed documentation: + * http://code.ettus.com/redmine/ettus/projects/uhd/wiki + * + * \param device_addr the address to identify the hardware + * \param io_type the desired output data type + * \param num_channels number of stream from the device + * \return a new USRP source block object + */ GR_UHD_API boost::shared_ptr<uhd_usrp_source> uhd_make_usrp_source( const uhd::device_addr_t &device_addr, const uhd::io_type_t &io_type, diff --git a/gr-uhd/lib/CMakeLists.txt b/gr-uhd/lib/CMakeLists.txt index 086126eb5..8afb48942 100644 --- a/gr-uhd/lib/CMakeLists.txt +++ b/gr-uhd/lib/CMakeLists.txt @@ -37,6 +37,7 @@ LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) LIST(APPEND gr_uhd_sources gr_uhd_usrp_source.cc gr_uhd_usrp_sink.cc + gr_uhd_amsg_source.cc ) LIST(APPEND uhd_libs diff --git a/gr-uhd/lib/Makefile.am b/gr-uhd/lib/Makefile.am index c27682f7f..c322c6124 100644 --- a/gr-uhd/lib/Makefile.am +++ b/gr-uhd/lib/Makefile.am @@ -31,7 +31,8 @@ lib_LTLIBRARIES = libgnuradio-uhd.la libgnuradio_uhd_la_SOURCES = \ gr_uhd_usrp_source.cc \ - gr_uhd_usrp_sink.cc + gr_uhd_usrp_sink.cc \ + gr_uhd_amsg_source.cc libgnuradio_uhd_la_LIBADD = \ $(GNURADIO_CORE_LA) \ diff --git a/gr-uhd/lib/gr_uhd_amsg_source.cc b/gr-uhd/lib/gr_uhd_amsg_source.cc new file mode 100644 index 000000000..f2958f115 --- /dev/null +++ b/gr-uhd/lib/gr_uhd_amsg_source.cc @@ -0,0 +1,88 @@ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#include <gr_uhd_amsg_source.h> +#include <boost/bind.hpp> +#include <gruel/thread.h> + +/*********************************************************************** + * UHD Asynchronous Message Source Impl + **********************************************************************/ +class uhd_amsg_source_impl : public uhd_amsg_source{ +public: + uhd_amsg_source_impl( + const uhd::device_addr_t &device_addr, + gr_msg_queue_sptr msgq + ): + _msgq(msgq), _running(true) + { + _dev = uhd::usrp::multi_usrp::make(device_addr); + _amsg_thread = + gruel::thread(boost::bind(&uhd_amsg_source_impl::recv_loop, this)); + } + + ~uhd_amsg_source_impl() + { + _running = false; + _amsg_thread.join(); + } + + void recv_loop() + { + gr_message_sptr msg; + uhd::async_metadata_t *md; + + while (_running) { + msg = gr_make_message(0, 0.0, 0.0, sizeof(uhd::async_metadata_t)); + md = (uhd::async_metadata_t *) msg->msg(); + + while (!_dev->get_device()->recv_async_msg(*md, 0.1)) { + if (!_running) + return; + } + + post(msg); + } + } + + void post(gr_message_sptr msg) + { + _msgq->insert_tail(msg); + } + +protected: + uhd::usrp::multi_usrp::sptr _dev; + gruel::thread _amsg_thread; + gr_msg_queue_sptr _msgq; + bool _running; +}; + +/*********************************************************************** + * Make UHD Asynchronous Message Source + **********************************************************************/ +boost::shared_ptr<uhd_amsg_source> uhd_make_amsg_source( + const uhd::device_addr_t &device_addr, + gr_msg_queue_sptr msgq +){ + return boost::shared_ptr<uhd_amsg_source>( + new uhd_amsg_source_impl(device_addr, msgq) + ); +} diff --git a/gr-uhd/lib/gr_uhd_usrp_sink.cc b/gr-uhd/lib/gr_uhd_usrp_sink.cc index ce9d89d8d..a780f0551 100644 --- a/gr-uhd/lib/gr_uhd_usrp_sink.cc +++ b/gr-uhd/lib/gr_uhd_usrp_sink.cc @@ -21,8 +21,13 @@ #include <gr_uhd_usrp_sink.h> #include <gr_io_signature.h> +#include <gr_tag_info.h> #include <stdexcept> +static const pmt::pmt_t SOB_KEY = pmt::pmt_string_to_symbol("tx_sob"); +static const pmt::pmt_t EOB_KEY = pmt::pmt_string_to_symbol("tx_eob"); +static const pmt::pmt_t TIME_KEY = pmt::pmt_string_to_symbol("tx_time"); + /*********************************************************************** * UHD Multi USRP Sink Impl **********************************************************************/ @@ -39,8 +44,7 @@ public: gr_make_io_signature(0, 0, 0) ), _type(io_type), - _nchan(num_channels), - _has_time_spec(_nchan > 1) + _nchan(num_channels) { _dev = uhd::usrp::multi_usrp::make(device_addr); } @@ -180,13 +184,20 @@ public: gr_vector_const_void_star &input_items, gr_vector_void_star &output_items ){ + int ninput_items = noutput_items; //cuz its a sync block + //send a mid-burst packet with time spec _metadata.start_of_burst = false; _metadata.end_of_burst = false; - _metadata.has_time_spec = _has_time_spec; - size_t num_sent = _dev->get_device()->send( - input_items, noutput_items, _metadata, + //collect tags in this work() + const uint64_t samp0_count = nitems_read(0); + get_tags_in_range(_tags, 0, samp0_count, samp0_count + ninput_items); + if (not _tags.empty()) this->tag_work(ninput_items); + + //send all ninput_items with metadata + const size_t num_sent = _dev->get_device()->send( + input_items, ninput_items, _metadata, _type, uhd::device::SEND_MODE_FULL_BUFF, 1.0 ); @@ -195,12 +206,70 @@ public: return num_sent; } +/*********************************************************************** + * Tag Work + **********************************************************************/ + inline void tag_work(int &ninput_items){ + //the for loop below assumes tags sorted by count low -> high + std::sort(_tags.begin(), _tags.end(), gr_tags::nitems_compare); + + //extract absolute sample counts + const pmt::pmt_t &tag0 = _tags.front(); + const uint64_t tag0_count = gr_tags::get_nitems(tag0); + const uint64_t samp0_count = this->nitems_read(0); + + //only transmit nsamples from 0 to the first tag + //this ensures that the next work starts on a tag + if (samp0_count != tag0_count){ + ninput_items = tag0_count - samp0_count; + return; + } + + //time will not be set unless a time tag is found + _metadata.has_time_spec = false; + + //process all of the tags found with the same count as tag0 + BOOST_FOREACH(const pmt::pmt_t &my_tag, _tags){ + const uint64_t my_tag_count = gr_tags::get_nitems(my_tag); + const pmt::pmt_t &key = gr_tags::get_key(my_tag); + const pmt::pmt_t &value = gr_tags::get_value(my_tag); + + //determine how many samples to send... + //from zero until the next tag or end of work + if (my_tag_count != tag0_count){ + ninput_items = my_tag_count - samp0_count; + break; + } + + //handle end of burst with a mini end of burst packet + else if (pmt::pmt_equal(key, EOB_KEY)){ + _metadata.end_of_burst = pmt::pmt_to_bool(value); + ninput_items = 1; + return; + } + + //set the start of burst flag in the metadata + else if (pmt::pmt_equal(key, SOB_KEY)){ + _metadata.start_of_burst = pmt::pmt_to_bool(value); + } + + //set the time specification in the metadata + else if (pmt::pmt_equal(key, TIME_KEY)){ + _metadata.has_time_spec = true; + _metadata.time_spec = uhd::time_spec_t( + pmt::pmt_to_uint64(pmt_tuple_ref(value, 0)), + pmt::pmt_to_double(pmt_tuple_ref(value, 1)) + ); + } + } + } + //Send an empty start-of-burst packet to begin streaming. //Set at a time in the near future to avoid late packets. bool start(void){ _metadata.start_of_burst = true; _metadata.end_of_burst = false; - _metadata.has_time_spec = _has_time_spec; + _metadata.has_time_spec = _nchan > 1; _metadata.time_spec = get_time_now() + uhd::time_spec_t(0.01); _dev->get_device()->send( @@ -224,13 +293,15 @@ public: return true; } -protected: +private: uhd::usrp::multi_usrp::sptr _dev; const uhd::io_type_t _type; size_t _nchan; - bool _has_time_spec; uhd::tx_metadata_t _metadata; double _sample_rate; + + //stream tags related stuff + std::vector<pmt::pmt_t> _tags; }; /*********************************************************************** diff --git a/gr-uhd/lib/gr_uhd_usrp_source.cc b/gr-uhd/lib/gr_uhd_usrp_source.cc index 669f890ea..62da83d96 100644 --- a/gr-uhd/lib/gr_uhd_usrp_source.cc +++ b/gr-uhd/lib/gr_uhd_usrp_source.cc @@ -25,6 +25,8 @@ #include <iostream> #include <boost/format.hpp> +static const pmt::pmt_t TIME_KEY = pmt::pmt_string_to_symbol("rx_time"); + /*********************************************************************** * UHD Multi USRP Source Impl **********************************************************************/ @@ -43,8 +45,11 @@ public: _type(io_type), _nchan(num_channels), _stream_now(_nchan == 1), - _tmp_buffs(_nchan) + _tag_now(false) { + std::stringstream str; + str << name() << unique_id(); + _id = pmt::pmt_string_to_symbol(str.str()); _dev = uhd::usrp::multi_usrp::make(device_addr); } @@ -202,7 +207,18 @@ public: //handle possible errors conditions switch(_metadata.error_code){ case uhd::rx_metadata_t::ERROR_CODE_NONE: - //TODO insert tag for time stamp + if (_tag_now){ + _tag_now = false; + //create a timestamp pmt for the first sample + const pmt::pmt_t val = pmt::pmt_make_tuple( + pmt::pmt_from_uint64(_metadata.time_spec.get_full_secs()), + pmt::pmt_from_double(_metadata.time_spec.get_frac_secs()) + ); + //create a timestamp tag for each channel + for (size_t i = 0; i < _nchan; i++){ + this->add_item_tag(i, nitems_written(0), TIME_KEY, val, _id); + } + } break; case uhd::rx_metadata_t::ERROR_CODE_TIMEOUT: @@ -211,8 +227,8 @@ public: return WORK_DONE; case uhd::rx_metadata_t::ERROR_CODE_OVERFLOW: + _tag_now = true; //ignore overflows and try work again - //TODO insert tag for overflow return work(noutput_items, input_items, output_items); default: @@ -232,6 +248,7 @@ public: stream_cmd.stream_now = _stream_now; stream_cmd.time_spec = get_time_now() + uhd::time_spec_t(reasonable_delay); _dev->issue_stream_cmd(stream_cmd); + _tag_now = true; return true; } @@ -244,9 +261,9 @@ private: uhd::usrp::multi_usrp::sptr _dev; const uhd::io_type_t _type; size_t _nchan; - bool _stream_now; - gr_vector_void_star _tmp_buffs; + bool _stream_now, _tag_now; uhd::rx_metadata_t _metadata; + pmt::pmt_t _id; }; diff --git a/gr-uhd/swig/__init__.py b/gr-uhd/swig/__init__.py index 7ed689ec0..1f82b4a26 100644 --- a/gr-uhd/swig/__init__.py +++ b/gr-uhd/swig/__init__.py @@ -32,9 +32,13 @@ def _prepare_uhd_swig(): #Make the python tune request object inherit from float #so that it can be passed in GRC as a frequency parameter. #The type checking in GRC will accept the tune request. + #Also use kwargs to construct individual struct elements. class tune_request_t(uhd_swig.tune_request_t, float): - def __new__(self, *args): return float.__new__(self) + def __new__(self, *args, **kwargs): return float.__new__(self) def __float__(self): return self.target_freq + def __init__(self, *args, **kwargs): + super(tune_request_t, self).__init__(*args) + for key, val in kwargs.iteritems(): setattr(self, key, val) setattr(uhd_swig, 'tune_request_t', tune_request_t) #Make the python tune request object inherit from string @@ -60,7 +64,7 @@ def _prepare_uhd_swig(): if attr.endswith('_t'): setattr(uhd_swig, attr[:-2], myobj) #Cast constructor args (FIXME swig handle overloads?) - for attr in ('usrp_source', 'usrp_sink'): + for attr in ('usrp_source', 'usrp_sink', 'amsg_source'): def constructor_factory(old_constructor): def constructor_interceptor(*args, **kwargs): args = list(args) diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i index 9bdb962c9..b58fe9e18 100644 --- a/gr-uhd/swig/uhd_swig.i +++ b/gr-uhd/swig/uhd_swig.i @@ -55,6 +55,7 @@ %{ #include <gr_uhd_usrp_source.h> #include <gr_uhd_usrp_sink.h> +#include <gr_uhd_amsg_source.h> %} //////////////////////////////////////////////////////////////////////// @@ -114,6 +115,9 @@ GR_SWIG_BLOCK_MAGIC(uhd,usrp_source) GR_SWIG_BLOCK_MAGIC(uhd,usrp_sink) %include <gr_uhd_usrp_sink.h> +GR_SWIG_BLOCK_MAGIC(uhd,amsg_source) +%include <gr_uhd_amsg_source.h> + //////////////////////////////////////////////////////////////////////// // helpful constants //////////////////////////////////////////////////////////////////////// diff --git a/gr-vocoder/lib/codec2/CMakeLists.txt b/gr-vocoder/lib/codec2/CMakeLists.txt index 2b8273d16..3a666fb59 100644 --- a/gr-vocoder/lib/codec2/CMakeLists.txt +++ b/gr-vocoder/lib/codec2/CMakeLists.txt @@ -19,10 +19,14 @@ ######################################################################## # Create executable to generate other sources +# http://www.vtk.org/Wiki/CMake_Cross_Compiling#Using_executables_in_the_build_created_during_the_build ######################################################################## -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) -ADD_EXECUTABLE(generate_codebook ${CMAKE_CURRENT_SOURCE_DIR}/generate_codebook.c) -TARGET_LINK_LIBRARIES(generate_codebook -lm) +IF(NOT CMAKE_CROSSCOMPILING) + INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) + ADD_EXECUTABLE(generate_codebook ${CMAKE_CURRENT_SOURCE_DIR}/generate_codebook.c) + TARGET_LINK_LIBRARIES(generate_codebook -lm) + EXPORT(TARGETS generate_codebook APPEND FILE ${EXPORT_FILE}) +ENDIF() ######################################################################## # Create codebook diff --git a/grc/CMakeLists.txt b/grc/CMakeLists.txt index ee422a4da..eec35d27c 100644 --- a/grc/CMakeLists.txt +++ b/grc/CMakeLists.txt @@ -32,14 +32,20 @@ GR_PYTHON_CHECK_MODULE("numpy" numpy True # Register component ######################################################################## INCLUDE(GrComponent) +IF(NOT CMAKE_CROSSCOMPILING) + SET(grc_python_deps + CHEETAH_FOUND + LXML_FOUND + PYGTK_FOUND + NUMPY_FOUND + ) +ENDIF(NOT CMAKE_CROSSCOMPILING) + GR_REGISTER_COMPONENT("gnuradio-companion" ENABLE_GRC ENABLE_GR_CORE_ ENABLE_PYTHON_ PYTHON_MIN_VER_FOUND - CHEETAH_FOUND - LXML_FOUND - PYGTK_FOUND - NUMPY_FOUND + ${grc_python_deps} ) ######################################################################## diff --git a/grc/blocks/Makefile.am b/grc/blocks/Makefile.am index bed84adc8..9813154bd 100644 --- a/grc/blocks/Makefile.am +++ b/grc/blocks/Makefile.am @@ -80,6 +80,7 @@ dist_ourdata_DATA = \ gr_conjugate_cc.xml \ gr_copy.xml \ gr_cpfsk_bc.xml \ + gr_ctcss_squelch_ff.xml \ gr_dc_blocker.xml \ gr_cpmmod_bc.xml \ gr_decode_ccsds_27_fb.xml \ @@ -195,13 +196,6 @@ dist_ourdata_DATA = \ parameter.xml \ random_source_x.xml \ root_raised_cosine_filter.xml \ - trellis_encoder_xx.xml \ - trellis_metrics_x.xml \ - trellis_permutation.xml \ - trellis_siso_combined_f.xml \ - trellis_siso_f.xml \ - trellis_viterbi_combined_xx.xml \ - trellis_viterbi_x.xml \ variable.xml \ variable_config.xml \ variable_function_probe.xml \ diff --git a/grc/blocks/block_tree.xml b/grc/blocks/block_tree.xml index c729d4903..ea7d744d4 100644 --- a/grc/blocks/block_tree.xml +++ b/grc/blocks/block_tree.xml @@ -145,6 +145,7 @@ <block>gr_simple_squelch_cc</block> <block>blks2_standard_squelch</block> <block>gr_pwr_squelch_xx</block> + <block>gr_ctcss_squelch_ff</block> <block>gr_threshold_ff</block> </cat> <cat> @@ -222,13 +223,6 @@ <name>Error Correction</name> <cat> <name>Trellis</name> - <block>trellis_encoder_xx</block> - <block>trellis_metrics_x</block> - <block>trellis_permutation</block> - <block>trellis_siso_combined_f</block> - <block>trellis_siso_f</block> - <block>trellis_viterbi_combined_xx</block> - <block>trellis_viterbi_x</block> </cat> <block>gr_encode_ccsds_27_bb</block> diff --git a/grc/blocks/gr_ctcss_squelch_ff.xml b/grc/blocks/gr_ctcss_squelch_ff.xml new file mode 100644 index 000000000..a34c75374 --- /dev/null +++ b/grc/blocks/gr_ctcss_squelch_ff.xml @@ -0,0 +1,79 @@ +<?xml version="1.0"?> +<!-- +# +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +--> + +<!-- +################################################### +##CTCSS Squelch +################################################### + --> +<block> + <name>CTCSS Squelch</name> + <key>gr_ctcss_squelch_ff</key> + <import>from gnuradio import gr</import> + <make>gr.ctcss_squelch_ff($rate, $freq, $level, $len, $ramp, $gate)</make> + <callback>set_level($level)</callback> + <param> + <name>Sampling Rate (Hz)</name> + <key>rate</key> + <value>samp_rate</value> + <type>real</type> + </param> + <param> + <name>Tone Frequency</name> + <key>freq</key> + <value>100.0</value> + <type>real</type> + </param> + <param> + <name>Level</name> + <key>level</key> + <value>0.01</value> + <type>real</type> + </param> + <param> + <name>Length</name> + <key>len</key> + <value>0</value> + <type>int</type> + </param> + <param> + <name>Ramp</name> + <key>ramp</key> + <value>0</value> + <type>int</type> + </param> + <param> + <name>Gate</name> + <key>gate</key> + <value>False</value> + <type>bool</type> + </param> + <sink> + <name>in</name> + <type>float</type> + </sink> + <source> + <name>out</name> + <type>float</type> + </source> +</block> diff --git a/grc/python/Block.py b/grc/python/Block.py index 14a5859e4..424706d68 100644 --- a/grc/python/Block.py +++ b/grc/python/Block.py @@ -108,7 +108,7 @@ class Block(_Block, _GUIBlock): if nports == num_ports: continue #remove excess ports and connections if nports < num_ports: - for key in map(str, range(index_first+nports, index_first+num_ports)): + for key in reversed(map(str, range(index_first+nports, index_first+num_ports))): remove_port(get_ports, get_port, key) continue #add more ports diff --git a/gruel/src/swig/CMakeLists.txt b/gruel/src/swig/CMakeLists.txt index 05f875451..5b256a793 100644 --- a/gruel/src/swig/CMakeLists.txt +++ b/gruel/src/swig/CMakeLists.txt @@ -35,7 +35,7 @@ GR_SWIG_INSTALL( ) INSTALL( - FILES gr_intrusive_ptr.i + FILES gr_intrusive_ptr.i pmt_swig.i DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig COMPONENT "gruel_swig" ) diff --git a/usrp/firmware/include/usrp_ids.h b/usrp/firmware/include/usrp_ids.h index 46a069434..159151ea9 100644 --- a/usrp/firmware/include/usrp_ids.h +++ b/usrp/firmware/include/usrp_ids.h @@ -44,21 +44,31 @@ #define USB_PID_FSF_HPSDR_HA 0x0007 // High Performance Software Defined Radio (Host Assisted Boot) #define USB_PID_FSF_QS1R 0x0008 // QS1R HF receiver #define USB_PID_FSF_EZDOP 0x0009 // ezdop <jcorgan@aeinet.com> -#define USB_PID_FSF_BDALE_0 0x000a // Bdale Garbee <bdale@gag.com> -#define USB_PID_FSF_BDALE_1 0x000b // Bdale Garbee <bdale@gag.com> -#define USB_PID_FSF_BDALE_2 0x000c // Bdale Garbee <bdale@gag.com> -#define USB_PID_FSF_BDALE_3 0x000d // Bdale Garbee <bdale@gag.com> -#define USB_PID_FSF_BDALE_4 0x000e // Bdale Garbee <bdale@gag.com> -#define USB_PID_FSF_BDALE_5 0x000f // Bdale Garbee <bdale@gag.com> -#define USB_PID_FSF_BDALE_6 0x0010 // Bdale Garbee <bdale@gag.com> -#define USB_PID_FSF_BDALE_7 0x0011 // Bdale Garbee <bdale@gag.com> -#define USB_PID_FSF_BDALE_8 0x0012 // Bdale Garbee <bdale@gag.com> +#define USB_PID_FSF_BDALE_Development 0x000a // Bdale Garbee <bdale@gag.com> +#define USB_PID_FSF_BDALE_TeleMetrum 0x000b // Bdale Garbee <bdale@gag.com> +#define USB_PID_FSF_BDALE_TeleDongle 0x000c // Bdale Garbee <bdale@gag.com> +#define USB_PID_FSF_BDALE_TeleTerra 0x000d // Bdale Garbee <bdale@gag.com> +#define USB_PID_FSF_BDALE_TeleBT 0x000e // Bdale Garbee <bdale@gag.com> +#define USB_PID_FSF_BDALE_TeleLaunch 0x000f // Bdale Garbee <bdale@gag.com> +#define USB_PID_FSF_BDALE_TeleLCO 0x0010 // Bdale Garbee <bdale@gag.com> +#define USB_PID_FSF_BDALE_TeleScience 0x0011 // Bdale Garbee <bdale@gag.com> +#define USB_PID_FSF_BDALE_TelePyro 0x0012 // Bdale Garbee <bdale@gag.com> #define USB_PID_FSF_BDALE_9 0x0013 // Bdale Garbee <bdale@gag.com> #define USB_PID_FSF_HPSDR_HERMES 0x0014 // HPSDR Hermes #define USB_PID_FSF_THINKRF 0x0015 // Catalin Patulea <catalin.patulea@thinkrf.com> #define USB_PID_FSF_MSA 0x0016 // Hans de Bok <hdbok@dionaea.demon.nl> Scotty's Modular Spectrum Analyzer #define USB_PID_FSF_LBNL_UXO 0x0018 // http://recycle.lbl.gov/~ldoolitt/uxo/ +#define USB_PID_FSF_BDALE_10 0x0019 // Bdale Garbee <bdale@gag.com> +#define USB_PID_FSF_BDALE_11 0x001a // Bdale Garbee <bdale@gag.com> +#define USB_PID_FSF_BDALE_12 0x001b // Bdale Garbee <bdale@gag.com> +#define USB_PID_FSF_BDALE_13 0x001c // Bdale Garbee <bdale@gag.com> +#define USB_PID_FSF_BDALE_14 0x001d // Bdale Garbee <bdale@gag.com> +#define USB_PID_FSF_BDALE_15 0x001e // Bdale Garbee <bdale@gag.com> +#define USB_PID_FSF_BDALE_16 0x001f // Bdale Garbee <bdale@gag.com> +#define USB_PID_FSF_BDALE_17 0x0020 // Bdale Garbee <bdale@gag.com> +#define USB_PID_FSF_BDALE_18 0x0021 // Bdale Garbee <bdale@gag.com> +#define USB_PID_FSF_BDALE_19 0x0022 // Bdale Garbee <bdale@gag.com> #define USB_DID_USRP_0 0x0000 // unconfigured rev 0 USRP diff --git a/volk/bootstrap b/volk/bootstrap index a7fb78ac5..838f03aa2 100755 --- a/volk/bootstrap +++ b/volk/bootstrap @@ -20,7 +20,11 @@ # Boston, MA 02110-1301, USA. rm -fr config.cache autom4te*.cache -python -B gen/volk_register.py +#alternative to -B that wont break on python 2.5 +PYTHONDONTWRITEBYTECODE=1 +export PYTHONDONTWRITEBYTECODE +python gen/volk_register.py + mv gen/lib/Makefile.am lib/ aclocal -I config -I gen/config diff --git a/volk/gen/volk_register.py b/volk/gen/volk_register.py index f5854bbce..cd874e470 100644 --- a/volk/gen/volk_register.py +++ b/volk/gen/volk_register.py @@ -3,6 +3,7 @@ import sys import os import re +import glob import string from xml.dom import minidom from volk_regexp import * @@ -48,18 +49,13 @@ outfile_environment_h = open(os.path.join(gendir, "lib/volk_environment_init.h") outfile_makefile_am = open(os.path.join(gendir, "lib/Makefile.am"), "w") outfile_machines_h = open(os.path.join(gendir, "lib/volk_machines.h"), "w") outfile_machines_c = open(os.path.join(gendir, "lib/volk_machines.c"), "w") -infile = open(os.path.join(srcdir, "include/volk/Makefile.am"), "r") - - -mfile = infile.readlines(); +hdr_files = glob.glob(os.path.join(srcdir, "include/volk/*.h")) datatypes = []; functions = []; - - -for line in mfile: - subline = re.search(".*_(a|u)\.h.*", line); +for line in hdr_files: + subline = re.search(".*_(a|u)\.h.*", os.path.basename(line)) if subline: subsubline = re.search("(?<=volk_).*", subline.group(0)); if subsubline: @@ -71,7 +67,7 @@ for line in mfile: datatypes = set(datatypes); -for line in mfile: +for line in hdr_files: for dt in datatypes: if dt in line: subline = re.search("(volk_" + dt +"_.*(a|u).*\.h)", line); diff --git a/volk/lib/CMakeLists.txt b/volk/lib/CMakeLists.txt index c8b9449a6..645a0dc17 100644 --- a/volk/lib/CMakeLists.txt +++ b/volk/lib/CMakeLists.txt @@ -168,10 +168,20 @@ FILE(GLOB xml_files ${CMAKE_SOURCE_DIR}/gen/*.xml) FILE(GLOB py_files ${CMAKE_SOURCE_DIR}/gen/*.py) FILE(GLOB h_files ${CMAKE_SOURCE_DIR}/include/volk/*.h) +#make sure we can use -B with python (introduced in 2.6) +EXECUTE_PROCESS( + COMMAND ${PYTHON_EXECUTABLE} -B -c "" + OUTPUT_QUIET ERROR_QUIET + RESULT_VARIABLE PYTHON_HAS_DASH_B_RESULT +) +IF(PYTHON_HAS_DASH_B_RESULT EQUAL 0) + SET(PYTHON_DASH_B "-B") +ENDIF() + ADD_CUSTOM_COMMAND( OUTPUT ${volk_gen_sources} DEPENDS ${xml_files} ${py_files} ${h_files} - COMMAND ${PYTHON_EXECUTABLE} -B + COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${CMAKE_SOURCE_DIR}/gen/volk_register.py ${CMAKE_BINARY_DIR} ) @@ -215,7 +225,8 @@ ENDIF() ######################################################################## # Setup the volk sources list and library ######################################################################## -IF(NOT WIN32) +IF(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32) + #http://gcc.gnu.org/wiki/Visibility ADD_DEFINITIONS(-fvisibility=hidden) ENDIF() |