LiteXXX cores: use format in prints

This commit is contained in:
Florent Kermarrec 2015-03-03 10:29:28 +01:00
parent f27e7a4b22
commit 1d4dc45436
3 changed files with 9 additions and 9 deletions

View File

@ -2,9 +2,9 @@ def main(wb):
wb.open() wb.open()
regs = wb.regs regs = wb.regs
### ###
print("sysid : 0x%04x" %regs.identifier_sysid.read()) print("sysid : 0x{:04x}".format(regs.identifier_sysid.read()))
print("revision : 0x%04x" %regs.identifier_revision.read()) print("revision : 0x{:04x}".format(regs.identifier_revision.read()))
print("frequency : %d MHz" %(regs.identifier_frequency.read()/1000000)) print("frequency : 0x{:04x}MHz".format(regs.identifier_frequency.read()/1000000))
SRAM_BASE = 0x02000000 SRAM_BASE = 0x02000000
wb.write(SRAM_BASE, [i for i in range(64)]) wb.write(SRAM_BASE, [i for i in range(64)])
print(wb.read(SRAM_BASE, 64)) print(wb.read(SRAM_BASE, 64))

View File

@ -2,8 +2,8 @@ def main(wb):
wb.open() wb.open()
regs = wb.regs regs = wb.regs
### ###
print("sysid : 0x%04x" %regs.identifier_sysid.read()) print("sysid : 0x{:04x}".format(regs.identifier_sysid.read()))
print("revision : 0x%04x" %regs.identifier_revision.read()) print("revision : 0x{:04x}".format(regs.identifier_revision.read()))
print("frequency : %d MHz" %(regs.identifier_frequency.read()/1000000)) print("frequency : 0x{:04x}MHz".format(regs.identifier_frequency.read()/1000000))
### ###
wb.close() wb.close()

View File

@ -2,8 +2,8 @@ def main(wb):
wb.open() wb.open()
regs = wb.regs regs = wb.regs
### ###
print("sysid : 0x%04x" %regs.identifier_sysid.read()) print("sysid : 0x{:04x}".format(regs.identifier_sysid.read()))
print("revision : 0x%04x" %regs.identifier_revision.read()) print("revision : 0x{:04x}".format(regs.identifier_revision.read()))
print("frequency : %d MHz" %(regs.identifier_frequency.read()/1000000)) print("frequency : 0x{:04x}MHz".format(regs.identifier_frequency.read()/1000000))
### ###
wb.close() wb.close()