hdd: improve debug print
This commit is contained in:
parent
707b43178b
commit
d193bd3321
|
@ -471,14 +471,22 @@ class HDD(Module):
|
||||||
def write(self, sector, data):
|
def write(self, sector, data):
|
||||||
n = math.ceil(self.dwords2sectors(len(data)))
|
n = math.ceil(self.dwords2sectors(len(data)))
|
||||||
if self.debug:
|
if self.debug:
|
||||||
print_hdd("Writing sector {s} to {e}".format(s=sector, e=sector+n-1))
|
if n == 1:
|
||||||
|
s = "{}".format(sector)
|
||||||
|
else:
|
||||||
|
s = "{s} to {e}".format(s=sector, e=sector+n-1)
|
||||||
|
print_hdd("Writing sector " + s)
|
||||||
for i in range(len(data)):
|
for i in range(len(data)):
|
||||||
offset = self.sectors2dwords(sector)
|
offset = self.sectors2dwords(sector)
|
||||||
self.mem.data[offset+i] = data[i]
|
self.mem.data[offset+i] = data[i]
|
||||||
|
|
||||||
def read(self, sector, count):
|
def read(self, sector, count):
|
||||||
if self.debug:
|
if self.debug:
|
||||||
print_hdd("Reading sector {s} to {e}".format(s=sector, e=sector+count-1))
|
if count == 1:
|
||||||
|
s = "{}".format(sector)
|
||||||
|
else:
|
||||||
|
s = "{s} to {e}".format(s=sector, e=sector+count-1)
|
||||||
|
print_hdd("Reading sector " + s)
|
||||||
data = []
|
data = []
|
||||||
for i in range(self.sectors2dwords(count)):
|
for i in range(self.sectors2dwords(count)):
|
||||||
data.append(self.mem.data[self.sectors2dwords(sector)+i])
|
data.append(self.mem.data[self.sectors2dwords(sector)+i])
|
||||||
|
|
Loading…
Reference in New Issue