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
|
2013-03-17 09:43:10 -04:00
|
|
|
from milkymist.dvisampler.clocking import Clocking
|
|
|
|
from milkymist.dvisampler.datacapture import DataCapture
|
2013-03-13 14:56:26 -04:00
|
|
|
|
|
|
|
class DVISampler(Module, AutoReg):
|
2013-03-20 19:46:29 -04:00
|
|
|
def __init__(self, inversions=""):
|
2013-03-17 09:43:10 -04:00
|
|
|
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)
|
2013-03-21 14:06:15 -04:00
|
|
|
invert = datan in inversions
|
|
|
|
cap = DataCapture(8, invert)
|
2013-03-17 09:43:10 -04:00
|
|
|
setattr(self.submodules, name + "_cap", cap)
|
2013-03-21 14:06:15 -04:00
|
|
|
if invert:
|
2013-03-13 14:56:26 -04:00
|
|
|
name += "_n"
|
2013-03-17 09:43:10 -04:00
|
|
|
s = Signal(name=name)
|
|
|
|
setattr(self, name, s)
|
|
|
|
self.comb += [
|
|
|
|
cap.pad.eq(s),
|
2013-03-18 14:03:17 -04:00
|
|
|
cap.serdesstrobe.eq(self.clocking.serdesstrobe)
|
2013-03-17 09:43:10 -04:00
|
|
|
]
|