From 19f19c77a91dcba6c1bf0f99e73ae9ffca1d75a4 Mon Sep 17 00:00:00 2001 From: Aaron Rossetto Date: Thu, 4 Jun 2020 16:24:01 -0500 Subject: python: Add FFT RFNoC block controller bindings --- host/lib/rfnoc/fft_block_control_python.hpp | 46 +++++++++++++++++++++++++++++ host/python/pyuhd.cpp | 2 ++ host/python/uhd/rfnoc.py | 1 + 3 files changed, 49 insertions(+) create mode 100644 host/lib/rfnoc/fft_block_control_python.hpp diff --git a/host/lib/rfnoc/fft_block_control_python.hpp b/host/lib/rfnoc/fft_block_control_python.hpp new file mode 100644 index 000000000..1c97105ce --- /dev/null +++ b/host/lib/rfnoc/fft_block_control_python.hpp @@ -0,0 +1,46 @@ +// +// Copyright 2020 Ettus Research, a National Instruments Brand +// +// SPDX-License-Identifier: GPL-3.0-or-later +// + +#pragma once + +#include "block_controller_factory_python.hpp" +#include + +using namespace uhd::rfnoc; + +void export_fft_block_control(py::module& m) +{ + py::enum_(m, "fft_shift") + .value("NORMAL", fft_shift::NORMAL) + .value("REVERSE", fft_shift::REVERSE) + .value("NATURAL", fft_shift::NATURAL) + .export_values(); + + py::enum_(m, "fft_direction") + .value("REVERSE", fft_direction::REVERSE) + .value("FORWARD", fft_direction::FORWARD) + .export_values(); + + py::enum_(m, "fft_magnitude") + .value("COMPLEX", fft_magnitude::COMPLEX) + .value("MAGNITUDE", fft_magnitude::MAGNITUDE) + .value("MAGNITUDE_SQUARED", fft_magnitude::MAGNITUDE_SQUARED) + .export_values(); + + py::class_( + m, "fft_block_control") + .def(py::init(&block_controller_factory::make_from)) + .def("set_direction", &fft_block_control::set_direction) + .def("get_direction", &fft_block_control::get_direction) + .def("set_magnitude", &fft_block_control::set_magnitude) + .def("get_magnitude", &fft_block_control::get_magnitude) + .def("set_shift_config", &fft_block_control::set_shift_config) + .def("get_shift_config", &fft_block_control::get_shift_config) + .def("set_scaling", &fft_block_control::set_scaling) + .def("get_scaling", &fft_block_control::get_scaling) + .def("set_length", &fft_block_control::set_length) + .def("get_length", &fft_block_control::get_length); +} diff --git a/host/python/pyuhd.cpp b/host/python/pyuhd.cpp index eed30ff32..b0fce9b55 100644 --- a/host/python/pyuhd.cpp +++ b/host/python/pyuhd.cpp @@ -16,6 +16,7 @@ namespace py = pybind11; #include "cal/cal_python.hpp" #include "rfnoc/ddc_block_control_python.hpp" #include "rfnoc/duc_block_control_python.hpp" +#include "rfnoc/fft_block_control_python.hpp" #include "rfnoc/fir_filter_block_control_python.hpp" #include "rfnoc/fosphor_block_control_python.hpp" #include "rfnoc/null_block_control_python.hpp" @@ -83,6 +84,7 @@ PYBIND11_MODULE(libpyuhd, m) export_rfnoc(rfnoc_module); export_ddc_block_control(rfnoc_module); export_duc_block_control(rfnoc_module); + export_fft_block_control(rfnoc_module); export_fosphor_block_control(rfnoc_module); export_fir_filter_block_control(rfnoc_module); export_null_block_control(rfnoc_module); diff --git a/host/python/uhd/rfnoc.py b/host/python/uhd/rfnoc.py index bc8217d68..0f25b8a6a 100644 --- a/host/python/uhd/rfnoc.py +++ b/host/python/uhd/rfnoc.py @@ -20,6 +20,7 @@ Timekeeper = lib.rfnoc.timekeeper NocBlock = lib.rfnoc.noc_block_base DdcBlockControl = lib.rfnoc.ddc_block_control DucBlockControl = lib.rfnoc.duc_block_control +FftBlockControl = lib.rfnoc.fft_block_control FosphorBlockControl = lib.rfnoc.fosphor_block_control FirFilterBlockControl = lib.rfnoc.fir_filter_block_control NullBlockControl = lib.rfnoc.null_block_control -- cgit v1.2.3