diff --git a/openfpga/src/fpga_bitstream/fabric_bitstream.cpp b/openfpga/src/fpga_bitstream/fabric_bitstream.cpp index 34c352161..f622f3fbc 100644 --- a/openfpga/src/fpga_bitstream/fabric_bitstream.cpp +++ b/openfpga/src/fpga_bitstream/fabric_bitstream.cpp @@ -75,9 +75,9 @@ std::vector FabricBitstream::bit_address(const FabricBitId& bit_id) const std::vector addr_bits; addr_bits.reserve(address_length_); for (size_t curr_idx = 0; curr_idx < bit_address_1bits_[bit_id].size(); curr_idx++) { - size_t curr_addr_len = std::min(64, address_length_ - curr_idx * 64); + size_t curr_addr_len = std::min(size_t(64), address_length_ - curr_idx * 64); std::vector curr_addr_vec = decode_address_bits(bit_address_1bits_[bit_id][curr_idx], bit_address_xbits_[bit_id][curr_idx], curr_addr_len); - addr_bits.insert(addr_bits.end(), curr_addr_len.begin(), curr_addr_len.end()); + addr_bits.insert(addr_bits.end(), curr_addr_vec.begin(), curr_addr_vec.end()); } return addr_bits; } @@ -96,9 +96,9 @@ std::vector FabricBitstream::bit_wl_address(const FabricBitId& bit_id) con std::vector addr_bits; addr_bits.reserve(wl_address_length_); for (size_t curr_idx = 0; curr_idx < bit_wl_address_1bits_[bit_id].size(); curr_idx++) { - size_t curr_addr_len = std::min(64, wl_address_length_ - curr_idx * 64); + size_t curr_addr_len = std::min(size_t(64), wl_address_length_ - curr_idx * 64); std::vector curr_addr_vec = decode_address_bits(bit_wl_address_1bits_[bit_id][curr_idx], bit_wl_address_xbits_[bit_id][curr_idx], curr_addr_len); - addr_bits.insert(addr_bits.end(), curr_addr_len.begin(), curr_addr_len.end()); + addr_bits.insert(addr_bits.end(), curr_addr_vec.begin(), curr_addr_vec.end()); } return addr_bits; } @@ -199,8 +199,8 @@ void FabricBitstream::set_bit_wl_address(const FabricBitId& bit_id, size_t curr_end_idx = std::min(address.size(), start_idx + 64); std::vector curr_addr_vec64(address.begin() + start_idx, address.begin() + curr_end_idx); /* Encode bit '1' and bit 'x' into two numbers */ - bit_wl_address_1bits_[bit_id] = encode_address_1bits(curr_addr_vec64); - bit_wl_address_xbits_[bit_id] = encode_address_xbits(curr_addr_vec64); + bit_wl_address_1bits_[bit_id].push_back(encode_address_1bits(curr_addr_vec64)); + bit_wl_address_xbits_[bit_id].push_back(encode_address_xbits(curr_addr_vec64)); } } @@ -294,7 +294,7 @@ bool FabricBitstream::valid_region_id(const FabricBitRegionId& region_id) const return (size_t(region_id) < num_regions_); } -size_t FabricBitstream::encode_address_1bits(const std::vector& address) const { +uint64_t FabricBitstream::encode_address_1bits(const std::vector& address) const { /* Convert all the 'x' bit into 0 */ std::vector binary_address = address; for (char& bit : binary_address) { @@ -306,7 +306,7 @@ size_t FabricBitstream::encode_address_1bits(const std::vector& address) c return (uint64_t)bintoi_charvec(binary_address); } -size_t FabricBitstream::encode_address_xbits(const std::vector& address) const { +uint64_t FabricBitstream::encode_address_xbits(const std::vector& address) const { /* Convert all the '1' bit into 0 and Convert all the 'x' bit into 1 */ std::vector binary_address = address; for (char& bit : binary_address) { diff --git a/openfpga/src/fpga_bitstream/fabric_bitstream.h b/openfpga/src/fpga_bitstream/fabric_bitstream.h index b00732e7e..12f2f9e03 100644 --- a/openfpga/src/fpga_bitstream/fabric_bitstream.h +++ b/openfpga/src/fpga_bitstream/fabric_bitstream.h @@ -188,10 +188,9 @@ class FabricBitstream { bool valid_region_id(const FabricBitRegionId& bit_id) const; private: /* Private APIs */ - size_t encode_address_1bits(const std::vector& address) const; - size_t encode_address_xbits(const std::vector& address) const; - std::vector decode_address_bits(const size_t& bit1, const size_t& bitx) const; - std::vector decode_wl_address_bits(const size_t& bit1, const size_t& bitx) const; + uint64_t encode_address_1bits(const std::vector& address) const; + uint64_t encode_address_xbits(const std::vector& address) const; + std::vector decode_address_bits(const size_t& bit1, const size_t& bitx, const size_t& addr_len) const; private: /* Internal data */ /* Unique id of a region in the Bitstream */