Skip to content

Instantly share code, notes, and snippets.

@awygle

awygle/const.py Secret

Last active February 1, 2020 04:24
Show Gist options
  • Save awygle/821434bc1b2846453bcba3c46e032973 to your computer and use it in GitHub Desktop.
Save awygle/821434bc1b2846453bcba3c46e032973 to your computer and use it in GitHub Desktop.
from nmigen import *
from nmigen.lib.io import *
from nmigen.back.pysim import *
from nmigen.cli import main
from nmigen.asserts import Rose, Fell
from cic_bus import CICBus
import random
region_id = Const(0b0001) # NTSC, make configurable later
# CIC control module
class CICTop(Elaboratable):
def __init__(self):
pass
def ports(self):
pass
def elaborate(self, platform):
m = Module()
bus_input = Signal()
counter = Signal(range(region_id.width))
# state machine
with m.FSM() as fsm:
"""
REGION ID STATE:
write the 4 bits of the Region ID
"""
with m.State("REGION_ID"):
m.d.sync += bus_input.eq(region_id[counter])
m.d.sync += counter.eq(counter + 1 )
return m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment