#pragma once #include "pybind11_tests.h" /// Simple class used to test py::local: template class LocalBase { public: LocalBase(int i) : i(i) { } int i = -1; }; /// Registered with py::module_local in both main and secondary modules: using LocalType = LocalBase<0>; /// Registered without py::module_local in both modules: using NonLocalType = LocalBase<1>; /// A second non-local type (for stl_bind tests): using NonLocal2 = LocalBase<2>; /// Tests within-module, different-compilation-unit local definition conflict: using LocalExternal = LocalBase<3>; /// Mixed: registered local first, then global using MixedLocalGlobal = LocalBase<4>; /// Mixed: global first, then local using MixedGlobalLocal = LocalBase<5>; /// Registered with py::module_local only in the secondary module: using ExternalType1 = LocalBase<6>; using ExternalType2 = LocalBase<7>; using LocalVec = std::vector; using LocalVec2 = std::vector; using LocalMap = std::unordered_map; using NonLocalVec = std::vector; using NonLocalVec2 = std::vector; using NonLocalMap = std::unordered_map; using NonLocalMap2 = std::unordered_map; PYBIND11_MAKE_OPAQUE(LocalVec); PYBIND11_MAKE_OPAQUE(LocalVec2); PYBIND11_MAKE_OPAQUE(LocalMap); PYBIND11_MAKE_OPAQUE(NonLocalVec); //PYBIND11_MAKE_OPAQUE(NonLocalVec2); // same type as LocalVec2 PYBIND11_MAKE_OPAQUE(NonLocalMap); PYBIND11_MAKE_OPAQUE(NonLocalMap2); // Simple bindings (used with the above): template py::class_ bind_local(Args && ...args) { return py::class_(std::forward(args)...) .def(py::init()) .def("get", [](T &i) { return i.i + Adjust; }); }; // Simulate a foreign library base class (to match the example in the docs): namespace pets { class Pet { public: Pet(std::string name) : name_(name) {} std::string name_; const std::string &name() { return name_; } }; } // namespace pets struct MixGL { int i; MixGL(int i) : i{i} {} }; struct MixGL2 { int i; MixGL2(int i) : i{i} {} }; value='d44f618de52af4122a4d927863516d91a2145314'/>
blob: a14a78e72670a8d3ce34991d7ee385a6f5c6596c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash
set -ex
if [ -z $ISE_DIR ]; then
	ISE_DIR=/opt/Xilinx/ISE/14.7
fi
sed 's/DSP48A1/MARKER1/; s/DSP48A/DSP48A_UUT/; s/MARKER1/DSP48A1_UUT/; /module DSP48A_UUT/,/endmodule/ p; /module DSP48A1_UUT/,/endmodule/ p; d;' < ../cells_sim.v > test_dsp48a1_model_uut.v
if [ ! -f "test_dsp48a1_model_ref.v" ]; then
	cp $ISE_DIR/ISE_DS/ISE/verilog/src/unisims/DSP48A1.v test_dsp48a1_model_ref.v
fi
if [ ! -f "test_dsp48a_model_ref.v" ]; then
	cp $ISE_DIR/ISE_DS/ISE/verilog/src/unisims/DSP48A.v test_dsp48a_model_ref.v
fi
for tb in mult_allreg mult_noreg mult_inreg
do
	iverilog -s $tb -s glbl -o test_dsp48a1_model test_dsp48a1_model.v test_dsp48a1_model_uut.v test_dsp48a1_model_ref.v test_dsp48a_model_ref.v $ISE_DIR/ISE_DS/ISE/verilog/src/glbl.v
	vvp -N ./test_dsp48a1_model
done