try to fix issue with unnamed sources

This commit is contained in:
bunnie 2020-11-15 22:03:23 +08:00
parent ea80e9ef32
commit 5d6c851f32
1 changed files with 7 additions and 3 deletions

View File

@ -219,10 +219,14 @@ class EventManager(Module, AutoCSR):
self.enable = CSRStorage(n, description=desc, fields=fields)
for i, source in enumerate(sources):
if source.name == None:
src_name = "event{}".format(i)
else:
src_name = source.name
self.comb += [
getattr(self.status.fields, source.name).eq(source.status),
getattr(self.pending.fields, source.name).eq(source.pending),
If(self.pending.re & getattr(self.pending.fields, source.name), source.clear.eq(1)),
getattr(self.status.fields, src_name).eq(source.status),
getattr(self.pending.fields, src_name).eq(source.pending),
If(self.pending.re & getattr(self.pending.fields, src_name), source.clear.eq(1)),
]
irqs = [self.pending.status[i] & self.enable.storage[i] for i in range(n)]