Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

actorlib/structuring/Cast: support inversion

  • Loading branch information...
commit 77a0f0a3bb4b971bb30643935c295940680b72c1 1 parent c4c4765
Sébastien Bourdeauducq authored March 25, 2013

Showing 1 changed file with 7 additions and 1 deletion. Show diff stats Hide diff stats

  1. 8  migen/actorlib/structuring.py
8  migen/actorlib/structuring.py
@@ -8,14 +8,20 @@ def _rawbits_layout(l):
8 8
 		return l
9 9
 
10 10
 class Cast(CombinatorialActor):
11  
-	def __init__(self, layout_from, layout_to):
  11
+	def __init__(self, layout_from, layout_to, reverse_from=False, reverse_to=False):
  12
+		self.reverse_from = reverse_from
  13
+		self.reverse_to = reverse_to
12 14
 		CombinatorialActor.__init__(self,
13 15
 			("sink", Sink, _rawbits_layout(layout_from)),
14 16
 			("source", Source, _rawbits_layout(layout_to)))
15 17
 	
16 18
 	def get_process_fragment(self):
17 19
 		sigs_from = self.token("sink").flatten()
  20
+		if self.reverse_from:
  21
+			sigs_from = list(reversed(sigs_from))
18 22
 		sigs_to = self.token("source").flatten()
  23
+		if self.reverse_to:
  24
+			sigs_to = list(reversed(sigs_to))
19 25
 		if sum(len(s) for s in sigs_from) != sum(len(s) for s in sigs_to):
20 26
 			raise TypeError
21 27
 		return Fragment([

0 notes on commit 77a0f0a

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