Last active
January 28, 2020 07:44
-
-
Save awygle/00cca56b2d58185f3ab7112739588882 to your computer and use it in GitHub Desktop.
This file contains 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 * | |
import nmigen.back | |
from nmigen.cli import main | |
class MVCE(Elaboratable): | |
def __init__(self): | |
self.write_en = Signal() | |
def elaborate(self, platform): | |
m = Module() | |
with m.FSM() as fsm: | |
with m.State("A"): | |
with m.If(~self.write_en): | |
m.next = "B" | |
m.next = "C" # doesn't exist | |
with m.State("B"): | |
with m.If(self.write_en): | |
m.next = "A" | |
return m | |
if __name__ == "__main__": | |
m = MVCE() | |
main(m, ports=(m.write_en)) | |
print(nmigen.back.verilog.convert(m, ports=[m.write_en])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment