Skip to content

Commit d06114d

Browse files
committed
[sca] Slice timeout with sleeps for busy clear
1 parent 3ef3c0e commit d06114d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Sca.cxx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,13 @@ void Sca::execute()
208208

209209
void Sca::waitOnBusyClear()
210210
{
211-
auto endTime = std::chrono::steady_clock::now() + BUSY_TIMEOUT;
212-
while (std::chrono::steady_clock::now() < endTime) {
211+
int count = 10;
212+
auto sleepSlice = BUSY_TIMEOUT / count;
213+
while (count--) {
213214
if ((((barRead(sc_regs::SCA_RD_CTRL.index)) >> 31) & 0x1) == 0) {
214215
return;
215216
}
217+
std::this_thread::sleep_for(sleepSlice);
216218
}
217219

218220
BOOST_THROW_EXCEPTION(ScaException()

0 commit comments

Comments
 (0)