Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

framebuffer: chop memory words

  • Loading branch information...
commit ccbd5e8baf58d457583858a3115b340b7ede0a39 1 parent 0f9e16a
Sébastien Bourdeauducq authored June 29, 2012

Showing 1 changed file with 16 additions and 2 deletions. Show diff stats Hide diff stats

  1. 18  milkymist/framebuffer/__init__.py
18  milkymist/framebuffer/__init__.py
@@ -2,7 +2,7 @@
2 2
 from migen.flow.actor import *
3 3
 from migen.flow.network import *
4 4
 from migen.flow import plumbing
5  
-from migen.actorlib import ala, misc, dma_asmi
  5
+from migen.actorlib import ala, misc, dma_asmi, structuring
6 6
 from migen.bank.description import *
7 7
 from migen.bank import csrgen
8 8
 
@@ -66,18 +66,30 @@ def get_fragment(self):
66 66
 		]
67 67
 		return Fragment(comb)
68 68
 
  69
+_bpp = 32
  70
+_bpc = 10
  71
+_pixel_layout = [
  72
+	("b", BV(_bpc)),
  73
+	("g", BV(_bpc)),
  74
+	("r", BV(_bpc)),
  75
+	("pad", BV(_bpp-3*_bpc))
  76
+]
  77
+
69 78
 class Framebuffer:
70 79
 	def __init__(self, address, asmiport):
71 80
 		asmi_bits = asmiport.hub.aw
72 81
 		alignment_bits = asmiport.hub.dw//8
73 82
 		length_bits = _hbits + _vbits + 2 - alignment_bits
  83
+		pack_factor = asmiport.hub.dw//_bpp
  84
+		packed_pixels = structuring.pack_layout(_pixel_layout, pack_factor)
74 85
 		
75 86
 		fi = ActorNode(_FrameInitiator(asmi_bits, length_bits, alignment_bits))
76 87
 		adrloop = ActorNode(misc.IntSequence(length_bits))
77 88
 		adrbase = ActorNode(ala.Add(BV(asmi_bits)))
78 89
 		adrbuffer = ActorNode(plumbing.Buffer)
79 90
 		dma = ActorNode(dma_asmi.SequentialReader(asmiport))
80  
-		# TODO: chop
  91
+		cast = ActorNode(structuring.Cast(asmiport.hub.dw, packed_pixels))
  92
+		unpack = ActorNode(structuring.Unpack(pack_factor, _pixel_layout))
81 93
 		# TODO: VTG
82 94
 		
83 95
 		g = DataFlowGraph()
@@ -86,6 +98,8 @@ def __init__(self, address, asmiport):
86 98
 		g.add_connection(fi, adrbase, source_subr=["base"], sink_subr=["b"])
87 99
 		g.add_connection(adrbase, adrbuffer)
88 100
 		g.add_connection(adrbuffer, dma)
  101
+		g.add_connection(dma, cast)
  102
+		g.add_connection(cast, unpack)
89 103
 		self._comp_actor = CompositeActor(g)
90 104
 		
91 105
 		self.bank = csrgen.Bank(fi.actor.get_registers(), address=address)

0 notes on commit ccbd5e8

Please sign in to comment.
Something went wrong with that request. Please try again.