diff options
Diffstat (limited to 'bindings')
-rw-r--r-- | bindings/galearn_pdm.cpp | 9 | ||||
-rw-r--r-- | bindings/setup.py | 11 |
2 files changed, 19 insertions, 1 deletions
diff --git a/bindings/galearn_pdm.cpp b/bindings/galearn_pdm.cpp index 9274a01..5b7e4f5 100644 --- a/bindings/galearn_pdm.cpp +++ b/bindings/galearn_pdm.cpp @@ -1,6 +1,8 @@ #include <pybind11/pybind11.h> #include <pybind11/numpy.h> +int sim(void); + namespace py = pybind11; void process(py::array_t<uint8_t> arr1, py::array_t<int16_t> arr2) { @@ -16,12 +18,19 @@ void process(py::array_t<uint8_t> arr1, py::array_t<int16_t> arr2) { throw std::runtime_error("Input 1 must be same or larger than input 2"); } +#if 0 // Example: access data uint8_t* in = static_cast<uint8_t*>(buf1.ptr); int16_t* out = static_cast<int16_t*>(buf2.ptr); for (int i=0; i<buf2.size; i++) { out[i] = in[i] + 1; } +#else + + sim(); + +#endif + } PYBIND11_MODULE(galearn_pdm, m) { diff --git a/bindings/setup.py b/bindings/setup.py index 487949a..c2f93f7 100644 --- a/bindings/setup.py +++ b/bindings/setup.py @@ -1,14 +1,23 @@ from setuptools import setup, Extension import pybind11 import numpy +import os.path + +verilated_build_dir = '../verilator_lib/obj_dir/' ext_modules = [ Extension( 'galearn_pdm', - ['galearn_pdm.cpp'], + sources=[ + 'galearn_pdm.cpp', + ], include_dirs=[ pybind11.get_include(), numpy.get_include(), + verilated_build_dir, + ], + extra_objects=[ + os.path.join(verilated_build_dir, 'libsim.so') ], language='c++', ), |