def run(self): axi.c_axi_test_base.run_start(self) d = dump.c_dump() f = open(self.dump_filename) d.load(f, base_address=0, address_mask=0x7fffffff) f.close() self.bfm_wait(100) (resp, timer) = self.simple_read(address=0) print "Response to write", self.simple_write(address=16, data=timer + 30) print "Response to read", self.simple_read(address=16) print "Response to read", self.simple_read(address=16) print "Response to read", self.simple_read(address=16) for (base, data) in d.package_data(): print "Write RISC-V SRAM address to %08x" % base, self.simple_write( address=0x40000, data=base) n = 0 for d in data: print "Write RISC-V SRAM code at %08x to %08x" % ( (base + n), d) self.simple_write(address=0x4000c, data=d) n += 1 pass pass print "Response to read", self.simple_read(address=0x40010) print "Response to read", self.simple_read(address=0x40010) print "Response to read", self.simple_read(address=0x40010) print "Response to read", self.simple_read(address=0x40010) print "Start RISC-V", self.simple_write(address=0x40008, data=1) self.finishtest(0, "") pass
def __init__(self, test): self.memory = dump.c_dump() self.mif = get_mif_of_file(self.memory, test.mif_filename) self.th_forces = self.th_forces.copy() self.th_forces["dut.riscv.mem.filename"] = self.mif.name self.th_forces["dut.subsys.apb_rom.filename"] = self.apb_rom_mif self.th_forces["dut.subsys.apb_rom.verbose"] = -1 vcu108_generic_hw.__init__(self, test) class named: def __init__(self, name): self._name = name pass def __repr__(self): return self._name pass self.wave_hierarchies = [ named("dut.dut.apb_dprintf_uart"), named("dut.dut.rv_apb"), #named("dut.dut.apb_dprintf"), named("dut.dut.apb_axi4s"), named("dut.dut.sgmii_txd_trace_reduce"), named("dut.dut.apb_analyzer"), named("dut.dut.gbe"), named("dut.dut.sgg"), named("dut.dut.gpio"), #named("dut.dut.riscv"), ] pass
def get_image(self): self.mif = None self.test_image = dump.c_dump() if self.mif_filename is not None: f = open(self.mif_filename) self.test_image.load_mif(f, self.base_address, address_mask=0x7fffffff) f.close() return self.mif_filename elf = None if self.dump_filename[-5:] == '.dump': try: elf = open(self.dump_filename[:-5]) pass except: pass pass if elf: print "Using ELF file instead of %s" % (self.dump_filename) self.test_image.load_elf(elf, self.base_address, address_mask=0x7fffffff) pass else: f = open(self.dump_filename) self.test_image.load(f, self.base_address, address_mask=0x7fffffff) f.close() pass self.mif = tempfile.NamedTemporaryFile(mode='w') self.test_image.write_mif(self.mif) self.mif.flush() return self.mif.name
def do_rv_load(self, arg): "Load a RISC-V image in to the HPS" test_image = dump.c_dump() try: f = open(arg) test_image.load(f, base_address=0, address_mask=0x7fffffff) f.close() self.skt.send_dump(test_image) except Exception as e: print "Failed: %s" % (e) pass pass
def get_image(self): self.mif = None self.test_image = dump.c_dump() if self.mif_filename is not None: f = open(self.mif_filename) self.test_image.load_mif(f, self.base_address) f.close() return self.mif_filename f = open(self.dump_filename) self.test_image.load(f, self.base_address) f.close() self.mif = tempfile.NamedTemporaryFile(mode='w') self.test_image.write_mif(self.mif) self.mif.flush() return self.mif.name
#!/usr/bin/env python import sys import dump dump_filename = sys.argv[1] base_address = int(sys.argv[2], 0) if (len(sys.argv) > 3): format = sys.argv[3] pass d = dump.c_dump() f = open(dump_filename) d.load(f, base_address) f.close() if format == "C": d.write_c_data(sys.stdout) else: d.write_mif(sys.stdout)