Merge pull request #432 from esden/csr-doc-fix-int

Don't let python convert lane number to float.
This commit is contained in:
Sean Cross 2020-03-20 09:20:02 +08:00 committed by GitHub
commit fbadfa1764
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -257,8 +257,8 @@ class DocumentedCSRRegion:
print(" {\"name\": \"" + field_name + "\", " + type_str + attr_str + "\"bits\": " + str(field.size) + "}" + term, file=stream) print(" {\"name\": \"" + field_name + "\", " + type_str + attr_str + "\"bits\": " + str(field.size) + "}" + term, file=stream)
bit_offset = field.offset + field.size bit_offset = field.offset + field.size
min_field_size = min(min_field_size, field.size) min_field_size = min(min_field_size, field.size)
if min_field_size < 8: if min_field_size < 8:
multilane = True multilane = True
if bit_offset != self.busword: if bit_offset != self.busword:
print(" {\"bits\": " + str(self.busword - bit_offset) + "}", file=stream) print(" {\"bits\": " + str(self.busword - bit_offset) + "}", file=stream)
else: else:
@ -270,10 +270,11 @@ class DocumentedCSRRegion:
attr_str = "\"attr\": 'reset: " + str(reg.reset_value) + "', " attr_str = "\"attr\": 'reset: " + str(reg.reset_value) + "', "
print(" {\"name\": \"" + reg.short_name.lower() + self.bit_range(reg.offset, reg.offset + reg.size, empty_if_zero=True) + "\", " + attr_str + "\"bits\": " + str(reg.size) + "}" + term, file=stream) print(" {\"name\": \"" + reg.short_name.lower() + self.bit_range(reg.offset, reg.offset + reg.size, empty_if_zero=True) + "\", " + attr_str + "\"bits\": " + str(reg.size) + "}" + term, file=stream)
if reg.size != self.csr_data_width: if reg.size != self.csr_data_width:
multilane = True
print(" {\"bits\": " + str(self.csr_data_width - reg.size) + "},", file=stream) print(" {\"bits\": " + str(self.csr_data_width - reg.size) + "},", file=stream)
if reg.size < 8:
multilane = True
if multilane: if multilane:
lanes = self.busword / 8 lanes = self.busword // 8
else: else:
lanes = 1 lanes = 1
print(" ], \"config\": {\"hspace\": 400, \"bits\": " + str(self.busword) + ", \"lanes\": " + str(lanes) + " }, \"options\": {\"hspace\": 400, \"bits\": " + str(self.busword) + ", \"lanes\": " + str(lanes) + "}", file=stream) print(" ], \"config\": {\"hspace\": 400, \"bits\": " + str(self.busword) + ", \"lanes\": " + str(lanes) + " }, \"options\": {\"hspace\": 400, \"bits\": " + str(self.busword) + ", \"lanes\": " + str(lanes) + "}", file=stream)