- clk, data = self.wait([{0: 'r'}, {'skip': round(snum_per_ms)}])
-
- # Timeout after inactivity.
- if timeout_ms > 0:
- if self.samplenum > self.es + timeout_snum:
- if self.number_bits or self.flags_bits:
- count = len(self.number_bits) + len(self.flags_bits)
- self.putg(self.ss, self.samplenum, 1, [
- 'timeout with %s bits in buffer' % (count),
- 'timeout',
- ])
- self.reset()
-
- # Do nothing if there was timeout without rising clock edge.
- if self.matched == (False, True):
+ # Sample data at the rising clock edge. Optionally timeout
+ # after inactivity for a user specified period. Present the
+ # number of unprocessed bits to the user for diagnostics.
+ clk, data = self.wait(wait_cond)
+ if timeout_ms and not self.matched[0]:
+ if self.number_bits or self.flags_bits:
+ count = len(self.number_bits) + len(self.flags_bits)
+ self.putg(self.ss, self.samplenum, 1, [
+ 'timeout with {} bits in buffer'.format(count),
+ 'timeout ({} bits)'.format(count),
+ 'timeout',
+ ])
+ self.reset()