Record.connect(sink, source),
If(sink.stb,
If(~change,
- counter.ce.eq(sink.ack & (counter.value !=2)),
+ counter.ce.eq(sink.ack & (counter.value != 2)),
# insert CONT
If(counter.value == 1,
source.charisk.eq(0b0001),
self.frequency = regs.identifier_frequency.read()
self.time = 0
for s in ["start", "sector", "count", "loops", "random", "done", "aborted", "errors", "cycles"]:
- setattr(self, s, getattr(regs, name + "_"+ s))
+ setattr(self, s, getattr(regs, name + "_" + s))
def run(self, sector, count, loops, random, blocking=True, hw_timer=True):
self.sector.write(sector)
self.regs = regs
self.name = name
for s in ["start", "done", "source_stb", "source_ack", "source_data"]:
- setattr(self, s, getattr(regs, name + "_identify_"+ s))
+ setattr(self, s, getattr(regs, name + "_identify_" + s))
self.data = []
def read_fifo(self):
info = "Serial Number: " + self.serial_number + "\n"
info += "Firmware Revision: " + self.firmware_revision + "\n"
info += "Model Number: " + self.model_number + "\n"
- info += "Capacity: %3.2f GB\n" %((self.total_sectors*logical_sector_size)/GB)
+ info += "Capacity: {:3.2f} GB\n".format((self.total_sectors*logical_sector_size)/GB)
for k, v in self.capabilities.items():
info += k + ": " + str(v) + "\n"
print(info, end="")
if not read_done:
retry += 1
- print("sector=%d(%dMB) wr_speed=%4.2fMB/s rd_speed=%4.2fMB/s errors=%d retry=%d" %(
+ print("sector={:d}({:d}MB) wr_speed={:4.2f}MB/s rd_speed={:4.2f}MB/s errors={:d} retry={:d}".format(
sector,
- run_sectors*logical_sector_size/MB,
+ run_sectors*logical_sector_size/MB,
write_speed/MB,
read_speed/MB,
write_errors + read_errors,
rx_data = var.values
for i in range(len(tx_data)):
- tx = "%08x " %tx_data[i]
+ tx = "{:08x} ".format(tx_data[i])
tx += decode_primitive(tx_data[i])
tx += " "*(16-len(tx))
- rx = "%08x " %rx_data[i]
+ rx = "{:08x} ".format(rx_data[i])
rx += decode_primitive(rx_data[i])
rx += " "*(16-len(rx))
# check results
s, l, e = check(write_data, read_data)
- print("shift "+ str(s) + " / length " + str(l) + " / errors " + str(e))
+ print("shift " + str(s) + " / length " + str(l) + " / errors " + str(e))
if __name__ == "__main__":
run_simulation(TB(), ncycles=2048, vcd_name="my.vcd", keep_files=True)
else:
ref, res = p2, p1
shift = 0
- while((ref[0] != res[0]) and (len(res)>1)):
+ while((ref[0] != res[0]) and (len(res) > 1)):
res.pop(0)
shift += 1
length = min(len(ref), len(res))
# check results
s, l, e = check(streamer_packet, self.logger.packet)
- print("shift "+ str(s) + " / length " + str(l) + " / errors " + str(e))
+ print("shift " + str(s) + " / length " + str(l) + " / errors " + str(e))
if __name__ == "__main__":
def get_c_crc(self, datas):
stdin = ""
for data in datas:
- stdin += "0x%08x " %data
+ stdin += "0x{:08x} ".format(data)
stdin += "exit"
with subprocess.Popen("./crc", stdin=subprocess.PIPE, stdout=subprocess.PIPE) as process:
process.stdin.write(stdin.encode("ASCII"))
# check results
s, l, e = check(c_crc, sim_crc)
- print("shift "+ str(s) + " / length " + str(l) + " / errors " + str(e))
+ print("shift " + str(s) + " / length " + str(l) + " / errors " + str(e))
if __name__ == "__main__":
from migen.sim.generic import run_simulation
yield from self.rx.receive()
def __repr__(self):
- receiving = "%08x " %self.rx.dword.dat
+ receiving = "{:08x} ".format(self.rx.dword.dat)
receiving += decode_primitive(self.rx.dword.dat)
receiving += " "*(16-len(receiving))
- sending = "%08x " %self.tx.dword.dat
+ sending = "{:08x} ".format(self.tx.dword.dat)
sending += decode_primitive(self.tx.dword.dat)
sending += " "*(16-len(sending))
def check_crc(self):
stdin = ""
for v in self[:-1]:
- stdin += "0x%08x " %v
+ stdin += "0x{:08x} ".format(v)
stdin += "exit"
with subprocess.Popen("./crc", stdin=subprocess.PIPE, stdout=subprocess.PIPE) as process:
process.stdin.write(stdin.encode("ASCII"))
def insert_crc(self):
stdin = ""
for v in self:
- stdin += "0x%08x " %v
+ stdin += "0x{:08x} ".foramt(v)
stdin += "exit"
with subprocess.Popen("./crc", stdin=subprocess.PIPE, stdout=subprocess.PIPE) as process:
process.stdin.write(stdin.encode("ASCII"))
else:
r = "<<<<<<<<\n"
for k in sorted(self.description.keys()):
- r += k + " : 0x%x" %getattr(self, k) + "\n"
+ r += k + " : 0x{:x}".format(getattr(self, k)) + "\n"
return r
r = "FIS_DATA\n"
r += FIS.__repr__(self)
for data in self.packet[1:]:
- r += "%08x\n" %data
+ r += "{:08x}\n".format(data)
return r
else:
r += "<<<<<<<<\n"
for dword in self.packet:
- r += "%08x\n" %dword
+ r += "{:08x}\n".format(dword)
return r
# check results
s, l, e = check(streamer_packet, self.logger.packet)
- print("shift "+ str(s) + " / length " + str(l) + " / errors " + str(e))
+ print("shift " + str(s) + " / length " + str(l) + " / errors " + str(e))
if __name__ == "__main__":
yield from self.streamer.send(streamer_packet)
yield from self.logger.receive(512)
for d in self.logger.packet:
- r = "%08x " %d
- r +=decode_primitive(d)
+ r = "{:08x} ".format(d)
+ r += decode_primitive(d)
print(r)
# check results
#s, l, e = check(streamer_packet, self.logger.packet)
- #print("shift "+ str(s) + " / length " + str(l) + " / errors " + str(e))
+ #print("shift " + str(s) + " / length " + str(l) + " / errors " + str(e))
if __name__ == "__main__":
self.length = length
def get_c_values(self, length):
- stdin = "0x%08x" %length
+ stdin = "0x{:08x}".format(length)
with subprocess.Popen("./scrambler", stdin=subprocess.PIPE, stdout=subprocess.PIPE) as process:
process.stdin.write(stdin.encode("ASCII"))
out, err = process.communicate()
# check results
s, l, e = check(c_values, sim_values)
- print("shift "+ str(s) + " / length " + str(l) + " / errors " + str(e))
+ print("shift " + str(s) + " / length " + str(l) + " / errors " + str(e))
if __name__ == "__main__":
from migen.sim.generic import run_simulation