From: Sebastien Bourdeauducq Date: Sat, 16 Jun 2012 20:38:16 +0000 (+0200) Subject: flow/actor: add single_sink/single_source retrieval methods X-Git-Tag: 24jan2021_ls180~2099^2~914 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9228e8a96debfbb92530bc354d28334ecaf801cc;p=litex.git flow/actor: add single_sink/single_source retrieval methods --- 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")