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

Negative values support in Switch-Case #559

Closed
weshu opened this issue Dec 10, 2020 · 1 comment
Closed

Negative values support in Switch-Case #559

weshu opened this issue Dec 10, 2020 · 1 comment

Comments

@weshu
Copy link

weshu commented Dec 10, 2020

I opened an issue at m-labs/nmigen, but seems no response at there ...
so I moved to here!

A typical usage:
If I defined a signed signal:
self.slice_begin_idx = Signal(signed(5))
And try to match to a negative value

with m.Switch(self.slice_begin_idx):
    for ii in range(-3, 0):
        with m.Case(ii):
            m.d.sync += ...

Then I get:

            5'b0?11:
                ...
            5'b0?10:
                ...
            5'b00?1:
                ...

Not sure if we can add support to negative value in Switch-Case?
or any better ideas?

@whitequark whitequark added this to the 0.3 milestone Dec 10, 2020
@whitequark
Copy link
Member

This has always been intended to work, but does not because of a bug. Thanks for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants