From 38198c21423cbc07ea0297605e6e5da9ff6074ec Mon Sep 17 00:00:00 2001 From: Maciej Dudek Date: Thu, 28 Nov 2024 14:16:49 +0100 Subject: [PATCH] Update 'test_payload_loop' unittests After adding checks to the timeslice field, 'test_payload_loop' unittests started failing as they used 40 or 50, but max supported is 31. This commit changes offending timeslices to 30, as these unittests check executed commands and not evaluation time. This commit also updates assertion message to print correct max values. Signed-off-by: Maciej Dudek --- rowhammer_tester/gateware/payload_executor.py | 4 ++-- tests/test_payload_executor.py | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/rowhammer_tester/gateware/payload_executor.py b/rowhammer_tester/gateware/payload_executor.py index 48ef61bb1..e19ac79cf 100644 --- a/rowhammer_tester/gateware/payload_executor.py +++ b/rowhammer_tester/gateware/payload_executor.py @@ -140,7 +140,7 @@ def __init__(self, op_code, **kwargs): if op_code == OpCode.LOOP: count = kwargs["count"] assert count < 2**Decoder.LOOP_COUNT, \ - f'LOOP count value:{count} exceeded max value:{2**Decoder.LOOP_COUNT}' + f'LOOP count value:{count} exceeded max value:{2**Decoder.LOOP_COUNT - 1}' self._parts = [ (Decoder.OP_CODE, op_code), (Decoder.LOOP_COUNT, count), @@ -155,7 +155,7 @@ def __init__(self, op_code, **kwargs): timeslice = kwargs['timeslice'] assert timeslice != 0, 'Timeslice for instructions other than NOOP should be > 0' assert timeslice < 2**Decoder.TIMESLICE, \ - f'Timeslice value:{timeslice} exceeded max value:{2**Decoder.TIMESLICE}' + f'Timeslice value:{timeslice} exceeded max value:{2**Decoder.TIMESLICE - 1}' no_address = [OpCode.REF] # PRE requires bank address assert 'address' in kwargs or op_code in no_address, \ '{} instruction requires `address`'.format(op_code.name) diff --git a/tests/test_payload_executor.py b/tests/test_payload_executor.py index 588100f5b..6933b2aeb 100644 --- a/tests/test_payload_executor.py +++ b/tests/test_payload_executor.py @@ -552,9 +552,9 @@ def test_payload_loop(self): encoder(OpCode.ACT, timeslice=10, address=encoder.address(bank=0, row=100)), encoder(OpCode.READ, timeslice=30, address=encoder.address(bank=0, col=200)), encoder(OpCode.LOOP, count=8 - 1, jump=1), # to READ col=200 - encoder(OpCode.PRE, timeslice=40, address=encoder.address(bank=0)), - encoder(OpCode.REF, timeslice=50), - encoder(OpCode.REF, timeslice=50), + encoder(OpCode.PRE, timeslice=30, address=encoder.address(bank=0)), + encoder(OpCode.REF, timeslice=30), + encoder(OpCode.REF, timeslice=30), encoder(OpCode.LOOP, count=5 - 1, jump=2), # to first REF ] @@ -795,9 +795,9 @@ def test_payload_loop(self): encoder(OpCode.ACT, timeslice=10, address=encoder.address(bank=0, row=100)), encoder(OpCode.READ, timeslice=30, address=encoder.address(bank=0, col=200)), encoder(OpCode.LOOP, count=8 - 1, jump=1), # to READ col=200 - encoder(OpCode.PRE, timeslice=40, address=encoder.address(bank=0)), - encoder(OpCode.REF, timeslice=50), - encoder(OpCode.REF, timeslice=50), + encoder(OpCode.PRE, timeslice=30, address=encoder.address(bank=0)), + encoder(OpCode.REF, timeslice=30), + encoder(OpCode.REF, timeslice=30), encoder(OpCode.LOOP, count=5 - 1, jump=2), # to first REF ]