diff options
author | Andrew Lynch <andrew.lynch@ni.com> | 2020-06-10 17:15:46 -0500 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2020-06-26 14:34:13 -0500 |
commit | 5c1771cc68edca442d870611ef8d9662b5d00d8b (patch) | |
tree | 33c4c2dbf82259a4bc6ce4bd11f40e2384260d32 /host/lib/include | |
parent | 9318323b769200ee328456b0ef92ea19c1b96b6e (diff) | |
download | uhd-5c1771cc68edca442d870611ef8d9662b5d00d8b.tar.gz uhd-5c1771cc68edca442d870611ef8d9662b5d00d8b.tar.bz2 uhd-5c1771cc68edca442d870611ef8d9662b5d00d8b.zip |
CHDR: support multiple CHDR widths
Support management payloads on busses over 64 bits
Automatically set CHDR width for mpmd_link_if_ctrl_udp
Diffstat (limited to 'host/lib/include')
-rw-r--r-- | host/lib/include/uhdlib/rfnoc/chdr_types.hpp | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/host/lib/include/uhdlib/rfnoc/chdr_types.hpp b/host/lib/include/uhdlib/rfnoc/chdr_types.hpp index 6e650507f..3eea40850 100644 --- a/host/lib/include/uhdlib/rfnoc/chdr_types.hpp +++ b/host/lib/include/uhdlib/rfnoc/chdr_types.hpp @@ -678,6 +678,12 @@ public: return _op_payload; } + //! Comparison operator (==) + inline bool operator==(const mgmt_op_t& rhs) const + { + return (_op_code == rhs._op_code) && (_op_payload == rhs._op_payload); + } + private: const op_code_t _op_code; const payload_t _op_payload; @@ -712,12 +718,24 @@ public: } //! Serialize the payload to a uint64_t buffer + // The RFNoC Specification section 2.2.6 specifies that for chdr widths + // greater than 64, all MSBs are 0, so we pad out the hop based on the width size_t serialize(std::vector<uint64_t>& target, - const std::function<uint64_t(uint64_t)>& conv_byte_order) const; + const std::function<uint64_t(uint64_t)>& conv_byte_order, + const size_t padding_size) const; //! Deserialize the payload from a uint64_t buffer + // The RFNoC Specification section 2.2.6 specifies that for chdr widths + // greater than 64, all MSBs are 0, so we remove padding based on the width void deserialize(std::list<uint64_t>& src, - const std::function<uint64_t(uint64_t)>& conv_byte_order); + const std::function<uint64_t(uint64_t)>& conv_byte_order, + const size_t padding_size); + + //! Comparison operator (==) + inline bool operator==(const mgmt_hop_t& rhs) const + { + return _ops == rhs._ops; + } private: std::vector<mgmt_op_t> _ops; @@ -737,9 +755,10 @@ public: inline void set_header(sep_id_t src_epid, uint16_t protover, chdr_w_t chdr_w) { - _src_epid = src_epid; - _chdr_w = chdr_w; - _protover = protover; + _src_epid = src_epid; + _chdr_w = chdr_w; + _protover = protover; + _padding_size = (chdr_w_to_bits(_chdr_w) / 64) - 1; } //! Add a management hop to this transaction @@ -814,11 +833,15 @@ public: return _src_epid; } + //! Comparison operator (==) + bool operator==(const mgmt_payload& rhs) const; + private: sep_id_t _src_epid = 0; uint16_t _protover = 0; chdr_w_t _chdr_w = CHDR_W_64; std::vector<mgmt_hop_t> _hops; + size_t _padding_size = 0; }; }}} // namespace uhd::rfnoc::chdr |