Bit Concatenation
(Ask a Question)#include "hls/ap_int.hpp" #include <iostream> #include <stdio.h> using namespace hls;
//... ap_uint<4> AA(0xA); std::cout << "AA = " << AA << std::endl; ap_uint<8> BB(0xCB); std::cout << "BB = " << BB << std::endl; ap_uint<8> AB((AA, BB(3, 0))); // AB initialized as 0xAB std::cout << "AB = " << AB << std::endl; ap_uint<12> ABC( (AA, ap_uint<4>(0xB), BB(7, 4))); // ABC initialized as 0xABC std::cout << "ABC = " << ABC << std::endl;
Putting any C++ arbitrary precision types in a comma separated list will generate a concatenation. The concatenation can currently be used to create arbitrary precision types (zero extending or truncating to match widths), but can not be assigned to.