Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 3 commits
  • 1 file changed
  • 0 comments
  • 1 contributor

Showing 1 changed file with 30 additions and 11 deletions. Show diff stats Hide diff stats

  1. 41  milkymist/framebuffer/__init__.py
41  milkymist/framebuffer/__init__.py
@@ -110,23 +110,23 @@ def get_fragment(self):
110 110
 		hcounter = Signal(BV(_hbits))
111 111
 		vcounter = Signal(BV(_vbits))
112 112
 		
  113
+		skip = _bpc - _bpc_dac
113 114
 		comb = [
114 115
 			active.eq(hactive & vactive),
115 116
 			If(active,
116  
-				self.token("dac").r.eq(self.token("pixels").r[:_bpc_dac]),
117  
-				self.token("dac").g.eq(self.token("pixels").g[:_bpc_dac]),
118  
-				self.token("dac").b.eq(self.token("pixels").b[:_bpc_dac])
  117
+				self.token("dac").r.eq(self.token("pixels").r[skip:]),
  118
+				self.token("dac").g.eq(self.token("pixels").g[skip:]),
  119
+				self.token("dac").b.eq(self.token("pixels").b[skip:])
119 120
 			),
120 121
 			
121  
-			generate_en.eq(self.endpoints["timing"].stb & self.endpoints["dac"].ack \
122  
-				& (~active | self.endpoints["pixels"].stb)),
  122
+			generate_en.eq(self.endpoints["timing"].stb & (~active | self.endpoints["pixels"].stb)),
123 123
 			self.endpoints["pixels"].ack.eq(self.endpoints["dac"].ack & active),
124 124
 			self.endpoints["dac"].stb.eq(generate_en)
125 125
 		]
126 126
 		tp = self.token("timing")
127 127
 		sync = [
128 128
 			self.endpoints["timing"].ack.eq(0),
129  
-			If(generate_en,
  129
+			If(generate_en & self.endpoints["dac"].ack,
130 130
 				hcounter.eq(hcounter + 1),
131 131
 			
132 132
 				If(hcounter == 0, hactive.eq(1)),
@@ -137,6 +137,8 @@ def get_fragment(self):
137 137
 					hcounter.eq(0),
138 138
 					If(vcounter == tp.vscan,
139 139
 						vcounter.eq(0)
  140
+						# FIXME: work around Flow bug
  141
+						#self.endpoints["timing"].ack.eq(1)
140 142
 					).Else(
141 143
 						vcounter.eq(vcounter + 1)
142 144
 					)
@@ -145,10 +147,7 @@ def get_fragment(self):
145 147
 				If(vcounter == 0, vactive.eq(1)),
146 148
 				If(vcounter == tp.vres, vactive.eq(0)),
147 149
 				If(vcounter == tp.vsync_start, self.token("dac").vsync.eq(1)),
148  
-				If(vcounter == tp.vsync_end,
149  
-					self.token("dac").vsync.eq(0),
150  
-					self.endpoints["timing"].ack.eq(1)
151  
-				)
  150
+				If(vcounter == tp.vsync_end, self.token("dac").vsync.eq(0))
152 151
 			)
153 152
 		]
154 153
 		
@@ -202,6 +201,25 @@ def get_fragment(self):
202 201
 		],
203 202
 		instances=[asfifo])
204 203
 
  204
+class FakeDMA(Actor):
  205
+	def __init__(self, port):
  206
+		self.port = port
  207
+		super().__init__(
  208
+				("address", Sink, [("a", BV(self.port.hub.aw))]),
  209
+				("data", Source, [("d", BV(self.port.hub.dw))]))
  210
+	
  211
+	def get_fragment(self):
  212
+		pixel = Signal(BV(32))
  213
+		comb = [
  214
+			self.endpoints["address"].ack.eq(1),
  215
+			self.endpoints["data"].stb.eq(1),
  216
+			self.token("data").d.eq(Replicate(pixel, 4))
  217
+		]
  218
+		sync = [
  219
+			If(self.endpoints["data"].ack, pixel.eq(pixel + 1))
  220
+		]
  221
+		return Fragment(comb, sync)
  222
+
205 223
 class Framebuffer:
206 224
 	def __init__(self, address, asmiport):
207 225
 		asmi_bits = asmiport.hub.aw
@@ -214,7 +232,8 @@ def __init__(self, address, asmiport):
214 232
 		adrloop = ActorNode(misc.IntSequence(length_bits))
215 233
 		adrbase = ActorNode(ala.Add(BV(asmi_bits)))
216 234
 		adrbuffer = ActorNode(plumbing.Buffer)
217  
-		dma = ActorNode(dma_asmi.SequentialReader(asmiport))
  235
+		#dma = ActorNode(dma_asmi.SequentialReader(asmiport))
  236
+		dma = ActorNode(FakeDMA(asmiport))
218 237
 		cast = ActorNode(structuring.Cast(asmiport.hub.dw, packed_pixels))
219 238
 		unpack = ActorNode(structuring.Unpack(pack_factor, _pixel_layout))
220 239
 		vtg = ActorNode(VTG())

No commit comments for this range

Something went wrong with that request. Please try again.