2013-05-22 11:10:13 -04:00
|
|
|
from migen.fhdl.std import *
|
2012-06-17 11:22:02 -04:00
|
|
|
from migen.flow.network import *
|
2013-11-20 18:33:22 -05:00
|
|
|
from migen.flow import plumbing
|
2014-08-03 00:30:15 -04:00
|
|
|
from migen.bank.description import AutoCSR
|
|
|
|
from migen.actorlib import dma_lasmi, structuring, misc
|
2012-06-17 11:22:02 -04:00
|
|
|
|
2013-11-09 09:27:32 -05:00
|
|
|
from misoclib.framebuffer.format import bpp, pixel_layout, FrameInitiator, VTG
|
|
|
|
from misoclib.framebuffer.phy import Driver
|
2012-07-03 13:04:44 -04:00
|
|
|
|
2013-09-17 12:15:22 -04:00
|
|
|
class Framebuffer(Module, AutoCSR):
|
2014-08-03 00:30:15 -04:00
|
|
|
def __init__(self, pads_vga, pads_dvi, lasmim):
|
2013-11-17 17:41:18 -05:00
|
|
|
pack_factor = lasmim.dw//bpp
|
2012-06-17 12:36:23 -04:00
|
|
|
|
2013-11-20 18:33:22 -05:00
|
|
|
g = DataFlowGraph()
|
|
|
|
|
|
|
|
self.fi = FrameInitiator(lasmim.aw, pack_factor)
|
|
|
|
|
|
|
|
intseq = misc.IntSequence(lasmim.aw, lasmim.aw)
|
|
|
|
dma_out = AbstractActor(plumbing.Buffer)
|
|
|
|
g.add_connection(self.fi, intseq, source_subr=self.fi.dma_subr())
|
|
|
|
g.add_pipeline(intseq, AbstractActor(plumbing.Buffer), dma_lasmi.Reader(lasmim), dma_out)
|
2013-09-17 12:15:22 -04:00
|
|
|
|
2013-11-17 17:41:18 -05:00
|
|
|
cast = structuring.Cast(lasmim.dw, pixel_layout(pack_factor), reverse_to=True)
|
|
|
|
vtg = VTG(pack_factor)
|
2013-11-20 18:33:22 -05:00
|
|
|
self.driver = Driver(pack_factor, pads_vga, pads_dvi)
|
2012-06-17 11:22:02 -04:00
|
|
|
|
2013-11-20 18:33:22 -05:00
|
|
|
g.add_connection(self.fi, vtg, source_subr=self.fi.timing_subr, sink_ep="timing")
|
|
|
|
g.add_connection(dma_out, cast)
|
2013-11-17 17:41:18 -05:00
|
|
|
g.add_connection(cast, vtg, sink_ep="pixels")
|
2013-09-17 12:15:22 -04:00
|
|
|
g.add_connection(vtg, self.driver)
|
2013-04-30 12:55:35 -04:00
|
|
|
self.submodules += CompositeActor(g)
|