Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ILA frontend print_samples() doesn't work when captured signals are Slices #107

Open
H-S-S-11 opened this issue Apr 24, 2021 · 0 comments
Open
Labels

Comments

@H-S-S-11
Copy link
Contributor

H-S-S-11 commented Apr 24, 2021

For example: capturing the lower 8 bits of a counter:

        counter = Signal(20)
        trigger = Signal()
        m.d.sync += [
            counter.eq(counter+1),
            trigger.eq(0),
        ]
        with m.If(counter==0):
            m.d.sync += [
                trigger.eq(~trigger),
            ]     
        m.submodules.serial_ila = self.serial_ila = serial_ila = AsyncSerialILA(
            signals=counter[0:8], sample_depth=100, divisor=10000, domain="sync")

When trying to print samples with AsyncSerialILAFrontend, the following error is seen:

>>> ila.print_samples()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Harry\.pyenv\pyenv-win\versions\3.9.0\lib\site-packages\luna\gateware\debug\ila.py", line 831, in print_samples
    for timestamp, sample in self.enumerate_samples():
  File "C:\Users\Harry\.pyenv\pyenv-win\versions\3.9.0\lib\site-packages\luna\gateware\debug\ila.py", line 816, in enumerate_samples
    self.refresh()
  File "C:\Users\Harry\.pyenv\pyenv-win\versions\3.9.0\lib\site-packages\luna\gateware\debug\ila.py", line 808, in refresh
    self.samples = self._parse_samples(self._read_samples())
  File "C:\Users\Harry\.pyenv\pyenv-win\versions\3.9.0\lib\site-packages\luna\gateware\debug\ila.py", line 803, in _parse_samples
    return [self._parse_sample(sample) for sample in raw_samples]
  File "C:\Users\Harry\.pyenv\pyenv-win\versions\3.9.0\lib\site-packages\luna\gateware\debug\ila.py", line 803, in <listcomp>
    return [self._parse_sample(sample) for sample in raw_samples]
  File "C:\Users\Harry\.pyenv\pyenv-win\versions\3.9.0\lib\site-packages\luna\gateware\debug\ila.py", line 796, in _parse_sample
    sample[signal.name] = signal_bits
AttributeError: 'Slice' object has no attribute 'name'

This can be fixed by doing

count_low = Signal(8)
m.d.comb += count_low.eq(Cat(counter[0:8]))
m.submodules.serial_ila = self.serial_ila = serial_ila = AsyncSerialILA(
            signals=[count_low], sample_depth=100, divisor=10000, domain="sync")

I'm content if the answer is "user should Cat()" but this seems like a slightly non-obvious behaviour, and potentially the AsyncSerialILA could Cat() the signals itself. (Notably, just assigning the slice to it's signal and passing that as the signal to sample doesn't fix this: it has to be concatenated to be a Signal not a Slice)

@ktemkin ktemkin added the bug label Apr 26, 2021
@ktemkin ktemkin self-assigned this Apr 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants