litex/milkymist/dvisampler/__init__.py

37 lines
1.0 KiB
Python
Raw Normal View History

2013-03-13 14:56:26 -04:00
from migen.fhdl.structure import *
from migen.fhdl.module import Module
from migen.bank.description import *
from milkymist.dvisampler.edid import EDID
from milkymist.dvisampler.clocking import Clocking
from milkymist.dvisampler.datacapture import DataCapture
2013-03-21 17:56:13 -04:00
from milkymist.dvisampler.charsync import CharSync
2013-03-13 14:56:26 -04:00
class DVISampler(Module, AutoReg):
def __init__(self, inversions=""):
self.submodules.edid = EDID()
self.sda = self.edid.sda
self.scl = self.edid.scl
self.submodules.clocking = Clocking()
self.clk = self.clocking.clkin
2013-03-13 14:56:26 -04:00
for datan in "012":
name = "data" + str(datan)
invert = datan in inversions
2013-03-21 17:56:13 -04:00
signame = name + "_n" if invert else name
s = Signal(name=signame)
setattr(self, signame, s)
cap = DataCapture(8, invert)
setattr(self.submodules, name + "_cap", cap)
self.comb += [
cap.pad.eq(s),
2013-03-18 14:03:17 -04:00
cap.serdesstrobe.eq(self.clocking.serdesstrobe)
]
2013-03-21 17:56:13 -04:00
charsync = CharSync()
setattr(self.submodules, name + "_charsync", charsync)
self.comb += charsync.raw_data.eq(cap.d)