Skip to content

Commit

Permalink
scripts/hw_rowhammer.py: Fix incorrect number of ACT
Browse files Browse the repository at this point in the history
gateware/payload_executor.py: Fix rank selection
scripts/rowhammer.py: Fix bankbits count for DDR5

This commit fixes an incorrect amount of ACT commands, when the payload executor is selected.
By default read_count should define how many read accesses/activations are performed.
They should be split evenly over selected rows.
On the other hand, payload generation was creating `read_count` ACTs to each selected row.
This caused `nrows *  read_Count` ACT to be sent.
From now on payload will have `floor(read_count / nrows) * nrows` ACT commands.

Signed-off-by: Maciej Dudek <[email protected]>
  • Loading branch information
mtdudek committed Oct 2, 2023
1 parent 7da87a8 commit 41018dd
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion rowhammer_tester/gateware/payload_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def __init__(self, instruction, *, rankbits, bankbits, rowbits, colbits):

if rankbits:
self.dfi_rank = Signal(rankbits)
self.comb += self.dfi_bank.eq(self.address[:rankbits]),
self.comb += self.dfi_rank.eq(self.address[:rankbits]),

class Encoder:
"""Helper for writing payloads"""
Expand Down
2 changes: 1 addition & 1 deletion rowhammer_tester/scripts/hw_rowhammer.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ 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, row_tuple=row_tuple)
self.payload_executor_attack(read_count=read_count//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
4 changes: 2 additions & 2 deletions rowhammer_tester/scripts/rowhammer.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,8 @@ 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,
bank=self.bank,
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,
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 41018dd

Please sign in to comment.