.. _program_listing_file__tmp_ws_src_vitis_common_include_common_xf_axi_io.hpp: Program Listing for File xf_axi_io.hpp ====================================== |exhale_lsh| :ref:`Return to documentation for file ` (``/tmp/ws/src/vitis_common/include/common/xf_axi_io.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp /* * Copyright 2019 Xilinx, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ___XF__AXI_IO__ #define ___XF__AXI_IO__ #include "utils/x_hls_utils.h" #include namespace xf { namespace cv { template void AXIGetBitFields(ap_uint pix, int start, int w, T& val) { // clang-format off #pragma HLS inline // clang-format on assert(start >= 0 && start + w <= W); val = (T)pix(start + w - 1, start); } template void AXIGetBitFields(ap_uint pix, int start, int w, float& val) { // clang-format off #pragma HLS inline // clang-format on assert(w == 32 && start >= 0 && start + w <= W); fp_struct temp((ap_uint<32>)pix(start + w - 1, start)); val = temp.to_float(); } template void AXIGetBitFields(ap_uint pix, int start, int w, double& val) { // clang-format off #pragma HLS inline // clang-format on assert(w == 64 && start >= 0 && start + w <= W); fp_struct temp((ap_uint<64>)pix(start + w - 1, start)); val = temp.to_double(); } template void AXIGetBitFields(ap_axiu axi, int start, int w, T& val) { // clang-format off #pragma HLS inline // clang-format on AXIGetBitFields(axi.data, start, w, val); } template void AXISetBitFields(ap_uint& pix, int start, int w, T val) { // clang-format off #pragma HLS inline // clang-format on assert(start >= 0 && start + w <= W); pix(start + w - 1, start) = val; } template void AXISetBitFields(ap_uint& pix, int start, int w, float val) { // clang-format off #pragma HLS inline // clang-format on assert(w == 32 && start >= 0 && start + w <= W); fp_struct temp(val); pix(start + w - 1, start) = temp.data(); } template void AXISetBitFields(ap_uint& pix, int start, int w, double val) { // clang-format off #pragma HLS inline // clang-format on assert(w == 64 && start >= 0 && start + w <= W); fp_struct temp(val); pix(start + w - 1, start) = temp.data(); } template void AXISetBitFields(ap_axiu& axi, int start, int w, T val) { // clang-format off #pragma HLS inline // clang-format on AXISetBitFields(axi.data, start, w, val); } } // namespace cv }; // namespace xf #endif