diff --git a/samples/mem_tg/mem_tg.h b/samples/mem_tg/mem_tg.h index 138dda9fd022..2e38c4dbe671 100644 --- a/samples/mem_tg/mem_tg.h +++ b/samples/mem_tg/mem_tg.h @@ -211,6 +211,13 @@ class mem_tg : public test_afu { return res; } + // Combines major and minor version into single code for comparison. + static uint32_t version_code(uint32_t major, uint32_t minor) + { + // Major and minor version are encoded with 4 bits each. + return major * 16 + minor; + } + public: uint32_t count_; std::vector mem_ch_; @@ -225,6 +232,7 @@ class mem_tg : public test_afu { uint32_t mem_speed_; uint32_t status_; uint64_t tg_offset_; + uint32_t version_; std::map limits_; @@ -265,6 +273,7 @@ class mem_tg : public test_afu { duplicate_obj->timeout_msec_ = this->timeout_msec_; duplicate_obj->handle_ = this->handle_; duplicate_obj->logger_ = this->logger_; + duplicate_obj->version_ = this->version_; } }; diff --git a/samples/mem_tg/tg_test.h b/samples/mem_tg/tg_test.h index a9be33c71dce..f843f3e0c534 100644 --- a/samples/mem_tg/tg_test.h +++ b/samples/mem_tg/tg_test.h @@ -230,6 +230,11 @@ class tg_test : public test_command token_ = d_afu->get_token(); // Read HW details + const uint64_t tg_version = tg_exe_->read64(TG_VERSION); + const uint32_t major_ver = (tg_version >> 12) & 0xf; // [51:48] + const uint32_t minor_ver = (tg_version >> 48) & 0xf; // [15:12] + tg_exe_->version_ = tg_exe_->version_code(major_ver, minor_ver); + tg_exe_->logger_->debug("version: {}.{}", major_ver, minor_ver); if (0 == tg_exe_->mem_speed_) { tg_exe_->mem_speed_ = 300;