mirror of
https://github.com/Silicon1602/srdl2sv.git
synced 2024-12-22 15:08:39 +00:00
Add genvar declaration to addrmap
This commit is contained in:
parent
f4432f5b49
commit
21abdefac0
@ -147,6 +147,14 @@ class AddrMap(Component):
|
|||||||
inputs = '\n'.join(input_ports_rtl),
|
inputs = '\n'.join(input_ports_rtl),
|
||||||
outputs = '\n'.join(output_ports_rtl)))
|
outputs = '\n'.join(output_ports_rtl)))
|
||||||
|
|
||||||
|
# Append genvars
|
||||||
|
genvars = ''.join([
|
||||||
|
'\ngenvar ',
|
||||||
|
','.join([chr(97+i) for i in range(self.get_max_dim_depth())]),
|
||||||
|
';\n'
|
||||||
|
])
|
||||||
|
|
||||||
|
self.rtl_header.append(genvars)
|
||||||
|
|
||||||
# Add endmodule keyword
|
# Add endmodule keyword
|
||||||
self.rtl_footer.append('endmodule')
|
self.rtl_footer.append('endmodule')
|
||||||
|
@ -65,6 +65,21 @@ class Component():
|
|||||||
|
|
||||||
return self.ports[port_type]
|
return self.ports[port_type]
|
||||||
|
|
||||||
|
def get_max_dim_depth(self) -> int:
|
||||||
|
try:
|
||||||
|
total_dimensions = self.total_dimensions
|
||||||
|
total_array_dimensions = self.total_array_dimensions
|
||||||
|
except AttributeError:
|
||||||
|
total_dimensions = 0
|
||||||
|
total_array_dimensions = []
|
||||||
|
|
||||||
|
self.logger.debug("Return depth '{}' for dimensions (including "\
|
||||||
|
"parents) '{}'".format(total_dimensions, total_array_dimensions))
|
||||||
|
return max([
|
||||||
|
total_dimensions,
|
||||||
|
*[x.get_max_dim_depth() for x in self.children]
|
||||||
|
])
|
||||||
|
|
||||||
def get_signals(self):
|
def get_signals(self):
|
||||||
self.logger.debug("Return signal list")
|
self.logger.debug("Return signal list")
|
||||||
|
|
||||||
|
@ -145,6 +145,7 @@ class Field(Component):
|
|||||||
# Save dimensions of unpacked dimension
|
# Save dimensions of unpacked dimension
|
||||||
self.array_dimensions = array_dimensions
|
self.array_dimensions = array_dimensions
|
||||||
self.total_array_dimensions = array_dimensions
|
self.total_array_dimensions = array_dimensions
|
||||||
|
self.total_dimensions = len(self.total_array_dimensions)
|
||||||
|
|
||||||
# Calculate how many genvars shall be added
|
# Calculate how many genvars shall be added
|
||||||
genvars = ['[{}]'.format(chr(97+i)) for i in range(len(array_dimensions))]
|
genvars = ['[{}]'.format(chr(97+i)) for i in range(len(array_dimensions))]
|
||||||
|
Loading…
Reference in New Issue
Block a user