Пример #1
0
def execute(wb):
    depth = wb.mems.payload.size // 4  # bytes to 32-bit instructions

    program = [w for w in PAYLOAD]
    program += [0] * (wb.mems.payload.size // 4 - len(program)
                      )  # fill with NOOPs

    # Write some data to the column we are reading to check that scratchpad gets filled
    converter = DRAMAddressConverter.load()
    data = list(itertools.islice(word_gen(3), 128))
    memwrite(wb, data, base=converter.encode_bus(bank=0, row=100, col=200))

    print('\nTransferring the payload ...')
    memwrite(wb, program, base=wb.mems.payload.base)

    def ready():
        status = wb.regs.payload_executor_status.read()
        return (status & 1) != 0

    print('\nExecuting ...')
    assert ready()
    wb.regs.payload_executor_start.write(1)
    while not ready():
        time.sleep(0.001)

    print('Finished')

    print('\nScratchpad contents:')
    scratchpad = memread(wb, n=512 // 4, base=wb.mems.scratchpad.base)
    memdump(scratchpad, base=0)
Пример #2
0
 def runner():
     if profile:
         cProfile.runctx(command, {}, ctx, fname)
     else:
         if is_write:
             memwrite(wb, datas, burst=burst)
         else:
             x = len(memread(wb, n, burst=burst))
 def runner():
     if profile:
         cProfile.runctx(command, {}, ctx, fname)
     else:
         if rw == 'memread':
             x = len(memread(wb, n, burst=burst))
             print(x)
         else:
             memwrite(wb, datas, burst=burst)
Пример #4
0
#!/usr/bin/env python3

from rowhammer_tester.scripts.utils import RemoteClient, memread

if __name__ == "__main__":
    wb = RemoteClient()
    wb.open()

    # Maximal identification info size is 256
    buildinfo = memread(wb, 256, wb.bases.identifier_mem)

    # Info is stored as a \0 terminated string
    # truncate it
    string_term_idx = buildinfo.index(0)
    buildinfo = buildinfo[:string_term_idx]

    # Map int values to ASCII characters
    print(''.join(map(chr, buildinfo)))

    wb.close()