def testUpdateNoEvent(self): """ update without value change should not return event waiters """ s1 = Signal(1) s1.next = 4 s1._update() s1.next = 4 s1._eventWaiters = self.eventWaiters[:] s1._posedgeWaiters = self.posedgeWaiters[:] s1._negedgeWaiters = self.negedgeWaiters[:] waiters = s1._update() self.assertEqual(waiters, []) self.assertEqual(s1._eventWaiters, self.eventWaiters) self.assertEqual(s1._posedgeWaiters, self.posedgeWaiters) self.assertEqual(s1._negedgeWaiters, self.negedgeWaiters)
def testUpdateEvent(self): """ update on non-edge event should return event waiters """ s1 = Signal(1) s1.next = 4 s1._update() s1.next = 5 s1._eventWaiters = self.eventWaiters[:] s1._posedgeWaiters = self.posedgeWaiters[:] s1._negedgeWaiters = self.negedgeWaiters[:] waiters = s1._update() expected = self.eventWaiters assert set(waiters) == set(expected) assert s1._eventWaiters == [] assert s1._posedgeWaiters == self.posedgeWaiters assert s1._negedgeWaiters == self.negedgeWaiters
def testUpdateNegedge(self): """ update on negedge should return event and negedge waiters """ s1 = Signal(1) s1.next = 1 s1._update() s1.next = 0 s1._eventWaiters = self.eventWaiters[:] s1._posedgeWaiters = self.posedgeWaiters[:] s1._negedgeWaiters = self.negedgeWaiters[:] waiters = s1._update() expected = self.eventWaiters + self.negedgeWaiters assert set(waiters) == set(expected) assert s1._eventWaiters == [] assert s1._posedgeWaiters == self.posedgeWaiters assert s1._negedgeWaiters == []
def testUpdateEvent(self): """ update on non-edge event should return event waiters """ s1 = Signal(1) s1.next = 4 s1._update() s1.next = 5 s1._eventWaiters = self.eventWaiters[:] s1._posedgeWaiters = self.posedgeWaiters[:] s1._negedgeWaiters = self.negedgeWaiters[:] waiters = s1._update() expected = self.eventWaiters self.assertEqual(set(waiters), set(expected)) self.assertEqual(s1._eventWaiters, []) self.assertEqual(s1._posedgeWaiters, self.posedgeWaiters) self.assertEqual(s1._negedgeWaiters, self.negedgeWaiters)
def testUpdateNegedge(self): """ update on negedge should return event and negedge waiters """ s1 = Signal(1) s1.next = 1 s1._update() s1.next = 0 s1._eventWaiters = self.eventWaiters[:] s1._posedgeWaiters = self.posedgeWaiters[:] s1._negedgeWaiters = self.negedgeWaiters[:] waiters = s1._update() expected = self.eventWaiters + self.negedgeWaiters self.assertEqual(set(waiters), set(expected)) self.assertEqual(s1._eventWaiters, []) self.assertEqual(s1._posedgeWaiters, self.posedgeWaiters) self.assertEqual(s1._negedgeWaiters, [])
def testUpdatePosedge(self): """ update on posedge should return event and posedge waiters """ s1 = Signal(1) s1.next = 0 s1._update() s1.next = 1 s1._eventWaiters = self.eventWaiters[:] s1._posedgeWaiters = self.posedgeWaiters[:] s1._negedgeWaiters = self.negedgeWaiters[:] waiters = s1._update() expected = self.eventWaiters + self.posedgeWaiters assert set(waiters) == set(expected) assert s1._eventWaiters == [] assert s1._posedgeWaiters == [] assert s1._negedgeWaiters == self.negedgeWaiters
def testUpdatePosedge(self): """ update on posedge should return event and posedge waiters """ s1 = Signal(1) s1.next = 0 s1._update() s1.next = 1 s1._eventWaiters = self.eventWaiters[:] s1._posedgeWaiters = self.posedgeWaiters[:] s1._negedgeWaiters = self.negedgeWaiters[:] waiters = s1._update() expected = self.eventWaiters + self.posedgeWaiters self.assertEqual(set(waiters), set(expected)) self.assertEqual(s1._eventWaiters, []) self.assertEqual(s1._posedgeWaiters, []) self.assertEqual(s1._negedgeWaiters, self.negedgeWaiters)
def testUpdateEvent(self): """ update on non-edge event should return event waiters """ s1 = Signal(1) s1.next = 4 s1._update() s1.next = 5 s1._eventWaiters = self.eventWaiters[:] s1._posedgeWaiters = self.posedgeWaiters[:] s1._negedgeWaiters = self.negedgeWaiters[:] waiters = s1._update() expected = self.eventWaiters waiters.sort() expected.sort() self.assertEqual(waiters, expected) self.assertEqual(s1._eventWaiters, []) self.assertEqual(s1._posedgeWaiters, self.posedgeWaiters) self.assertEqual(s1._negedgeWaiters, self.negedgeWaiters)