From 98d9f1ffc035479fef7510706e5136baa20c391b Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Fri, 10 Feb 2017 13:18:04 +0100 Subject: [PATCH] test/test_bitslip: simplify BitSlipModel --- test/test_bitslip.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/test_bitslip.py b/test/test_bitslip.py index 1f827d7..909caa1 100644 --- a/test/test_bitslip.py +++ b/test/test_bitslip.py @@ -19,8 +19,9 @@ class BitSlipModel: # simulate bitslip r = [] for i in range(len(s)-1): - v = (s[i+1] & (2**bitslip-1)) << (self.data_width-bitslip) - v |= (s[i] >> bitslip) & (2**(self.data_width-bitslip)-1) + v = (s[i+1] << self.data_width) | s[i] + v = v >> bitslip + v &= 2**self.data_width-1 r.append(v) return r @@ -60,7 +61,7 @@ class TestBitSlip(unittest.TestCase): self.bitslip_test(16) def test_bitslip_32b(self): - self.bitslip_test(32) + self.bitslip_test(32) def test_bitslip_64b(self): self.bitslip_test(64)