Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

flow/actor/PipelinedActor: clean up

  • Loading branch information...
commit c2d6f14087d7ce29353bcc7f7ad63c7c3f9adff9 1 parent 6aa1e0c
Sébastien Bourdeauducq authored July 12, 2013

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

  1. 20  migen/flow/actor.py
20  migen/flow/actor.py
@@ -90,15 +90,17 @@ def __init__(self, latency):
90 90
 		BinaryActor.__init__(self, latency)
91 91
 
92 92
 	def build_binary_control(self, stb_i, ack_o, stb_o, ack_i, latency):
93  
-		valid = Signal(latency)
94  
-		if latency > 1:
95  
-			self.sync += If(self.pipe_ce, valid.eq(Cat(stb_i, valid[:latency-1])))
96  
-		else:
97  
-			self.sync += If(self.pipe_ce, valid.eq(stb_i))
98  
-		last_valid = valid[latency-1]
  93
+		busy = 0
  94
+		valid = stb_i
  95
+		for i in range(latency):
  96
+			valid_n = Signal()
  97
+			self.sync += If(self.pipe_ce, valid_n.eq(valid))
  98
+			valid = valid_n
  99
+			busy = busy | valid
  100
+
99 101
 		self.comb += [
100  
-			self.pipe_ce.eq(ack_i | ~last_valid),
  102
+			self.pipe_ce.eq(ack_i | ~valid),
101 103
 			ack_o.eq(self.pipe_ce),
102  
-			stb_o.eq(last_valid),
103  
-			self.busy.eq(optree("|", [valid[i] for i in range(latency)]))
  104
+			stb_o.eq(valid),
  105
+			self.busy.eq(busy)
104 106
 		]

0 notes on commit c2d6f14

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