Skip to content

Commit

Permalink
added descriptions to --help (#3031)
Browse files Browse the repository at this point in the history
### Description
Fixed timeout issue in mem_tg and elaborated on --help in mem_tg to describe limits for -r -w and -bls to prevent overflow behavior.

### Collateral (docs, reports, design examples, case IDs):

- [ ] Document Update Required? (Specify FIM/AFU/Scripts)

### Tests added:

### Tests run:
mem_tg test
  • Loading branch information
robert-purcaru committed Nov 6, 2023
1 parent cba8608 commit 58d443b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
3 changes: 2 additions & 1 deletion samples/mem_tg/mem_tg.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ enum {
TG_STATUS_ACTIVE = 0x1,
TG_STATUS_TIMEOUT = 0x2,
TG_STATUS_ERROR = 0x4,
TG_STATUS_PASS = 0x8
TG_STATUS_PASS = 0x8,
TG_STATUS_RESPONSE_TIMEOUT = 0x10
};

enum {
Expand Down
17 changes: 14 additions & 3 deletions samples/mem_tg/tg_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ class tg_test : public test_command

if (tg_exe_->status_ == TG_STATUS_TIMEOUT) {
std::cout << "TG TIMEOUT" << std::endl;
} else if (tg_exe_->status_ == (uint32_t)(-1)) {
std::cout << "Error: Timed out in TG_STATUS_ACTIVE state. Consider increasing MEM_TG_TEST_TIMEOUT." << std::endl;
} else if (tg_exe_->status_ == TG_STATUS_ERROR) {
uint32_t tg_fail_exp;
uint32_t tg_fail_act;
Expand All @@ -104,6 +106,12 @@ class tg_test : public test_command
uint32_t mem_ch_offset = (std::stoi(tg_exe_->mem_ch_[0])) << 0x3;
uint64_t num_ticks = tg_exe_->read64(MEM_TG_CLOCKS + mem_ch_offset);
std::cout << "Mem Clock Cycles: " << std::dec << num_ticks << std::endl;

std::cout << "DEBUG: wcnt_ " << std::dec << tg_exe_->wcnt_ << std::endl;
std::cout << "DEBUG: rcnt_ " << std::dec << tg_exe_->rcnt_ << std::endl;
std::cout << "DEBUG: bcnt_ " << std::dec << tg_exe_->bcnt_ << std::endl;
std::cout << "DEBUG: loop_ " << std::dec << tg_exe_->loop_ << std::endl;
std::cout << "DEBUG: num_ticks " << std::dec << num_ticks << std::endl;

uint64_t write_bytes = 64 * (tg_exe_->loop_*tg_exe_->wcnt_*tg_exe_->bcnt_);
uint64_t read_bytes = 64 * (tg_exe_->loop_*tg_exe_->rcnt_*tg_exe_->bcnt_);
Expand All @@ -116,25 +124,28 @@ class tg_test : public test_command
bool tg_wait_test_completion (mem_tg *tg_exe_)
{
/* Wait for test completion */
uint32_t timeout = MEM_TG_TEST_TIMEOUT;
uint32_t timeout = MEM_TG_TEST_TIMEOUT * tg_exe_->loop_ * tg_exe_->bcnt_;
// poll while active bit is set (channel status = {pass,fail,timeout,active})
uint32_t tg_status = 0x1;
tg_status = 0xF & (tg_exe_->read64(MEM_TG_STAT) >> (0x4*(std::stoi(tg_exe_->mem_ch_[0]))));
while (tg_status == TG_STATUS_ACTIVE) {
tg_status = 0xF & (tg_exe_->read64(MEM_TG_STAT) >> (0x4*(std::stoi(tg_exe_->mem_ch_[0]))));
std::this_thread::yield();
if (--timeout == 0) {
tg_exe_->status_ = tg_status;
return false;
tg_exe_->status_ = -1;
std::cout << "DEBUG: timeout error" << std::endl;
return false;
}
}
if (tg_status == TG_STATUS_TIMEOUT) {
tg_exe_->status_ = tg_status;
std::cout << "DEBUG: status timeout" << std::endl;
return false;
}

if (tg_status == TG_STATUS_ERROR) {
tg_exe_->status_ = tg_status;
std::cout << "DEBUG: status error" << std::endl;
return false;
}
tg_exe_->status_ = tg_status;
Expand Down

0 comments on commit 58d443b

Please sign in to comment.