Beispiel #1
0
 def setup_vamos_ram_trace(self):
     mem = self.machine.get_mem()
     self.mem_tracer = TraceMemory(mem, self)
     if not log_mem_int.isEnabledFor(logging.INFO):
         log_mem_int.setLevel(logging.INFO)
     # replace machine mem with trace memory
     self.machine.set_mem(self.mem_tracer)
Beispiel #2
0
def trace_mem_rws_test(caplog):
    caplog.set_level(logging.INFO)
    log_mem_int.setLevel(logging.INFO)
    tmem = setup_tmem()
    tmem.w8s(0, -42)
    assert tmem.r8s(0) == -42
    tmem.w16s(2, -4711)
    assert tmem.r16s(2) == -4711
    tmem.w32s(4, -0x1eadbeef)
    assert tmem.r32s(4) == -0x1eadbeef
    tmem.writes(2, 8, -0x2afebabe)
    assert tmem.reads(2, 8) == -0x2afebabe
    lvl = logging.INFO
    assert caplog.record_tuples == [
        ('mem_int', lvl, 'W(1): 000000: -2a                [??] '),
        ('mem_int', lvl, 'R(1): 000000: -2a                [??] '),
        ('mem_int', lvl, 'W(2): 000002: -1267              [??] '),
        ('mem_int', lvl, 'R(2): 000002: -1267              [??] '),
        ('mem_int', lvl, 'W(4): 000004: -1eadbeef          [??] '),
        ('mem_int', lvl, 'R(4): 000004: -1eadbeef          [??] '),
        ('mem_int', lvl, 'W(4): 000008: -2afebabe          [??] '),
        ('mem_int', lvl, 'R(4): 000008: -2afebabe          [??] ')
    ]
Beispiel #3
0
def trace_mem_rw_test(caplog):
    caplog.set_level(logging.INFO)
    log_mem_int.setLevel(logging.INFO)
    tmem = setup_tmem()
    tmem.w8(0, 42)
    assert tmem.r8(0) == 42
    tmem.w16(2, 4711)
    assert tmem.r16(2) == 4711
    tmem.w32(4, 0xdeadbeef)
    assert tmem.r32(4) == 0xdeadbeef
    tmem.write(2, 8, 0xcafebabe)
    assert tmem.read(2, 8) == 0xcafebabe
    lvl = logging.INFO
    assert caplog.record_tuples == [
        ('mem_int', lvl, 'W(1): 000000: 2a                [??] '),
        ('mem_int', lvl, 'R(1): 000000: 2a                [??] '),
        ('mem_int', lvl, 'W(2): 000002: 1267              [??] '),
        ('mem_int', lvl, 'R(2): 000002: 1267              [??] '),
        ('mem_int', lvl, 'W(4): 000004: deadbeef          [??] '),
        ('mem_int', lvl, 'R(4): 000004: deadbeef          [??] '),
        ('mem_int', lvl, 'W(4): 000008: cafebabe          [??] '),
        ('mem_int', lvl, 'R(4): 000008: cafebabe          [??] ')
    ]
Beispiel #4
0
def trace_mem_rws_test(caplog):
    caplog.set_level(logging.INFO)
    log_mem_int.setLevel(logging.INFO)
    tmem = setup_tmem()
    tmem.w8s(0, -42)
    assert tmem.r8s(0) == -42
    tmem.w16s(2, -4711)
    assert tmem.r16s(2) == -4711
    tmem.w32s(4, -0x1EADBEEF)
    assert tmem.r32s(4) == -0x1EADBEEF
    tmem.writes(2, 8, -0x2AFEBABE)
    assert tmem.reads(2, 8) == -0x2AFEBABE
    lvl = logging.INFO
    assert caplog.record_tuples == [
        ("mem_int", lvl, "W(1): 000000: -2a                [??] "),
        ("mem_int", lvl, "R(1): 000000: -2a                [??] "),
        ("mem_int", lvl, "W(2): 000002: -1267              [??] "),
        ("mem_int", lvl, "R(2): 000002: -1267              [??] "),
        ("mem_int", lvl, "W(4): 000004: -1eadbeef          [??] "),
        ("mem_int", lvl, "R(4): 000004: -1eadbeef          [??] "),
        ("mem_int", lvl, "W(4): 000008: -2afebabe          [??] "),
        ("mem_int", lvl, "R(4): 000008: -2afebabe          [??] "),
    ]
Beispiel #5
0
def trace_mem_rw_test(caplog):
    caplog.set_level(logging.INFO)
    log_mem_int.setLevel(logging.INFO)
    tmem = setup_tmem()
    tmem.w8(0, 42)
    assert tmem.r8(0) == 42
    tmem.w16(2, 4711)
    assert tmem.r16(2) == 4711
    tmem.w32(4, 0xDEADBEEF)
    assert tmem.r32(4) == 0xDEADBEEF
    tmem.write(2, 8, 0xCAFEBABE)
    assert tmem.read(2, 8) == 0xCAFEBABE
    lvl = logging.INFO
    assert caplog.record_tuples == [
        ("mem_int", lvl, "W(1): 000000: 2a                [??] "),
        ("mem_int", lvl, "R(1): 000000: 2a                [??] "),
        ("mem_int", lvl, "W(2): 000002: 1267              [??] "),
        ("mem_int", lvl, "R(2): 000002: 1267              [??] "),
        ("mem_int", lvl, "W(4): 000004: deadbeef          [??] "),
        ("mem_int", lvl, "R(4): 000004: deadbeef          [??] "),
        ("mem_int", lvl, "W(4): 000008: cafebabe          [??] "),
        ("mem_int", lvl, "R(4): 000008: cafebabe          [??] "),
    ]
Beispiel #6
0
def trace_mem_rws_test(caplog):
  caplog.set_level(logging.INFO)
  log_mem_int.setLevel(logging.INFO)
  tmem = setup_tmem()
  tmem.w8s(0, -42)
  assert tmem.r8s(0) == -42
  tmem.w16s(2, -4711)
  assert tmem.r16s(2) == -4711
  tmem.w32s(4, -0x1eadbeef)
  assert tmem.r32s(4) == -0x1eadbeef
  tmem.writes(2, 8, -0x2afebabe)
  assert tmem.reads(2, 8) == -0x2afebabe
  lvl = logging.INFO
  assert caplog.record_tuples == [
      ('mem_int', lvl, 'W(1): 000000: -2a                [??] '),
      ('mem_int', lvl, 'R(1): 000000: -2a                [??] '),
      ('mem_int', lvl, 'W(2): 000002: -1267              [??] '),
      ('mem_int', lvl, 'R(2): 000002: -1267              [??] '),
      ('mem_int', lvl, 'W(4): 000004: -1eadbeef          [??] '),
      ('mem_int', lvl, 'R(4): 000004: -1eadbeef          [??] '),
      ('mem_int', lvl, 'W(4): 000008: -2afebabe          [??] '),
      ('mem_int', lvl, 'R(4): 000008: -2afebabe          [??] ')
  ]
Beispiel #7
0
def trace_mem_rw_test(caplog):
  caplog.set_level(logging.INFO)
  log_mem_int.setLevel(logging.INFO)
  tmem = setup_tmem()
  tmem.w8(0, 42)
  assert tmem.r8(0) == 42
  tmem.w16(2, 4711)
  assert tmem.r16(2) == 4711
  tmem.w32(4, 0xdeadbeef)
  assert tmem.r32(4) == 0xdeadbeef
  tmem.write(2, 8, 0xcafebabe)
  assert tmem.read(2, 8) == 0xcafebabe
  lvl = logging.INFO
  assert caplog.record_tuples == [
      ('mem_int', lvl, 'W(1): 000000: 2a                [??] '),
      ('mem_int', lvl, 'R(1): 000000: 2a                [??] '),
      ('mem_int', lvl, 'W(2): 000002: 1267              [??] '),
      ('mem_int', lvl, 'R(2): 000002: 1267              [??] '),
      ('mem_int', lvl, 'W(4): 000004: deadbeef          [??] '),
      ('mem_int', lvl, 'R(4): 000004: deadbeef          [??] '),
      ('mem_int', lvl, 'W(4): 000008: cafebabe          [??] '),
      ('mem_int', lvl, 'R(4): 000008: cafebabe          [??] ')
  ]
Beispiel #8
0
 def setup_vamos_ram_trace(self):
   mem = self.machine.get_mem()
   self.mem_tracer = TraceMemory(mem, self)
   if not log_mem_int.isEnabledFor(logging.INFO):
     log_mem_int.setLevel(logging.INFO)
Beispiel #9
0
 def setup_cpu_mem_trace(self):
   self.machine.set_cpu_mem_trace_hook(self.trace_cpu_mem)
   if not log_mem_int.isEnabledFor(logging.INFO):
     log_mem_int.setLevel(logging.INFO)