Skip to content

Commit

Permalink
rowhammer-tester/scripts: Fix formatting
Browse files Browse the repository at this point in the history
rowhammer-tester/scripts: Add comments
rowhammer-tester/scripts: Improve multirank handling

Signed-off-by: Maciej Dudek <[email protected]>
  • Loading branch information
mtdudek committed Oct 3, 2023
1 parent 745df46 commit 596b2fa
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
7 changes: 6 additions & 1 deletion rowhammer_tester/scripts/hw_rowhammer.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,12 @@ def run(self, row_pairs, pattern_generator, read_count, row_progress=16, verify_
for i, row_tuple in enumerate(row_pairs, start=1):
s = 'Iter {:{n}} / {:{n}}'.format(i, len(row_pairs), n=len(str(len(row_pairs))))
if self.payload_executor:
self.payload_executor_attack(read_count=read_count//len(row_tuple), row_tuple=row_tuple)
# 1 read count maps to 1 ACT sent to all selected rows
# To keep read_count consistent with BIST behaviour read_count
# must be divided by number of rows, and rounded up
self.payload_executor_attack(
read_count=(read_count + len(row_tuple) - 1) // len(row_tuple),
row_tuple=row_tuple)
else:
if len(row_tuple) & (len(row_tuple) - 1) != 0:
print("ERROR: BIST only supports power of 2 rows\n")
Expand Down
12 changes: 8 additions & 4 deletions rowhammer_tester/scripts/playbook/lib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


# returns the number of refreshes issued
def encode_one_loop(*, unrolled, rolled, row_sequence, timings, encoder, bank, refresh_op, payload):
def encode_one_loop(*, unrolled, rolled, row_sequence, timings, encoder, bank, rank, refresh_op, payload):
tras = timings.tRAS
trp = timings.tRP
trefi = timings.tREFI
Expand All @@ -26,9 +26,9 @@ def encode_one_loop(*, unrolled, rolled, row_sequence, timings, encoder, bank, r
payload.extend(
[
encoder.I(
OpCode.ACT, timeslice=tras, address=encoder.address(bank=bank, row=row)),
OpCode.ACT, timeslice=tras, address=encoder.address(bank=bank, row=row, rank=rank)),
encoder.I(OpCode.PRE, timeslice=trp,
address=encoder.address(col=1 << 10)), # all
address=encoder.address(col=1 << 10, rank=rank)), # all
])
jump_target = 2 * unrolled * len(row_sequence) + local_refreshes
assert jump_target < 2**Decoder.LOOP_JUMP
Expand Down Expand Up @@ -74,11 +74,13 @@ def generate_payload_from_row_list(
timings,
bankbits,
bank,
nranks,
rank,
payload_mem_size,
refresh=False,
verbose=False,
sys_clk_freq=None):
encoder = Encoder(bankbits=bankbits)
encoder = Encoder(bankbits=bankbits, nranks=nranks)

tras = timings.tRAS
trp = timings.tRP
Expand Down Expand Up @@ -113,6 +115,7 @@ def generate_payload_from_row_list(
timings=timings,
encoder=encoder,
bank=bank,
rank=rank,
refresh_op=refresh_op,
payload=payload)
refreshes += encode_long_loop(
Expand All @@ -122,6 +125,7 @@ def generate_payload_from_row_list(
timings=timings,
encoder=encoder,
bank=bank,
rank=rank,
refresh_op=refresh_op,
payload=payload)

Expand Down
6 changes: 4 additions & 2 deletions rowhammer_tester/scripts/rowhammer.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,10 @@ def payload_executor_attack(self, read_count, row_tuple):
read_count=read_count,
row_sequence=row_tuple,
timings=self.settings.timing,
bankbits=self.settings.geom.bankbits if self.settings.phy.memtype != "DDR5" else self.settings.geom.bankbits + 1,
bank=self.bank if self.settings.phy.memtype != "DDR5" else self.bank*2,
bankbits=self.settings.geom.bankbits,
bank=self.bank,
nranks=self.settings.phy.nranks,
rank=0,
payload_mem_size=self.wb.mems.payload.size,
refresh=not self.no_refresh,
sys_clk_freq=sys_clk_freq,
Expand Down

0 comments on commit 596b2fa

Please sign in to comment.