From 9228e8a96debfbb92530bc354d28334ecaf801cc Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sat, 16 Jun 2012 22:38:16 +0200 Subject: [PATCH] flow/actor: add single_sink/single_source retrieval methods --- migen/flow/actor.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/migen/flow/actor.py b/migen/flow/actor.py index 71dc1dff..90049701 100644 --- a/migen/flow/actor.py +++ b/migen/flow/actor.py @@ -60,6 +60,16 @@ class Actor: def sources(self): return self.filter_endpoints(Source) + + def single_sink(self): + eps = self.sinks() + assert(len(eps) == 1) + return eps[0] + + def single_source(self): + eps = self.sources() + assert(len(eps) == 1) + return eps[0] def get_control_fragment(self): raise NotImplementedError("Actor classes must overload get_control_fragment or get_fragment") -- 2.30.2