Created
November 17, 2019 14:14
-
-
Save kbob/9f94547498ec091d9f8412aaa156792d to your computer and use it in GitHub Desktop.
nMigen sign extension issue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from nmigen import * | |
from nmigen_boards.icebreaker import ICEBreakerPlatform | |
from nmigen.cli import main | |
class Foo(Elaboratable): | |
def __init__(self): | |
self.bar = Signal(signed(24)) | |
def elaborate(self, platform): | |
led0 = platform.request('user_led', 0) | |
led1 = platform.request('user_led', 1) | |
m = Module() | |
m.d.sync += self.bar.eq(self.bar - 1) | |
m.d.comb += led0.eq(self.bar[-1]) | |
m.d.comb += led1.eq(self.bar[-2]) | |
return m | |
if __name__ == '__main__': | |
platform = ICEBreakerPlatform() | |
design = Foo() | |
platform.build(design, do_program=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The LEDs show that the counter is incrementing, not decrementing.
Created nMigen issue #271.