2015-09-22 12:36:47 -04:00
|
|
|
from migen 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
|
2015-03-02 02:24:51 -05:00
|
|
|
from migen.actorlib import structuring, misc
|
2012-06-17 11:22:02 -04:00
|
|
|
|
2015-09-22 12:35:02 -04:00
|
|
|
from misoc.mem.sdram.frontend import dma_lasmi
|
|
|
|
from misoc.video.framebuffer.format import bpp, pixel_layout, FrameInitiator, VTG
|
|
|
|
from misoc.video.framebuffer.phy import Driver
|
2012-07-03 13:04:44 -04:00
|
|
|
|
2015-04-13 10:47:22 -04:00
|
|
|
|
2013-09-17 12:15:22 -04:00
|
|
|
class Framebuffer(Module, AutoCSR):
|
2015-04-13 10:19:55 -04:00
|
|
|
def __init__(self, pads_vga, pads_dvi, lasmim):
|
|
|
|
pack_factor = lasmim.dw//bpp
|
2014-10-17 05:14:35 -04:00
|
|
|
|
2015-04-13 10:19:55 -04:00
|
|
|
g = DataFlowGraph()
|
2013-11-20 18:33:22 -05:00
|
|
|
|
2015-04-13 10:19:55 -04:00
|
|
|
self.fi = FrameInitiator(lasmim.aw, pack_factor)
|
2013-11-20 18:33:22 -05:00
|
|
|
|
2015-04-13 10:19:55 -04:00
|
|
|
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
|
|
|
|
2015-04-13 10:19:55 -04:00
|
|
|
cast = structuring.Cast(lasmim.dw, pixel_layout(pack_factor), reverse_to=True)
|
|
|
|
vtg = VTG(pack_factor)
|
|
|
|
self.driver = Driver(pack_factor, pads_vga, pads_dvi)
|
2014-10-17 05:14:35 -04:00
|
|
|
|
2015-04-13 10:19:55 -04:00
|
|
|
g.add_connection(self.fi, vtg, source_subr=self.fi.timing_subr, sink_ep="timing")
|
|
|
|
g.add_connection(dma_out, cast)
|
|
|
|
g.add_connection(cast, vtg, sink_ep="pixels")
|
|
|
|
g.add_connection(vtg, self.driver)
|
|
|
|
self.submodules += CompositeActor(g)
|