From 051e8ac5702df95b4c1276c9f5c33f09d0c01328 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Sun, 12 Aug 2012 19:42:25 +0200 Subject: [PATCH] simplify EdgeDetector --- migScope/__init__.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/migScope/__init__.py b/migScope/__init__.py index 7b7f4279..ea2fe628 100644 --- a/migScope/__init__.py +++ b/migScope/__init__.py @@ -65,26 +65,29 @@ class EdgeDetector: sync += [self.i_d.eq(self.i)] # Rising Edge if "R" in self.mode: + r_eq = [self.ro.eq(self.r_mask & self.i & (~self.i_d))] if self.pipe: - sync += [self.ro.eq(self.r_mask & self.i & (~self.i_d))] + sync += r_eq else: - comb += [self.ro.eq(self.r_mask & self.i & (~ self.i_d))] + comb += r_eq else: comb += [self.ro.eq(0)] # Falling Edge if "F" in self.mode: + f_eq = [self.fo.eq(self.f_mask & (~ self.i) & self.i_d)] if self.pipe: - sync += [self.fo.eq(self.f_mask & (~ self.i) & self.i_d)] + sync += f_eq else: - comb += [self.fo.eq(self.f_mask & (~ self.i) & self.i_d)] + comb += f_eq else: comb += [self.fo.eq(0)] # Both if "B" in self.mode: + b_eq = [self.bo.eq(self.b_mask & self.i != self.i_d)] if self.pipe: - sync += [self.bo.eq(self.b_mask & self.i != self.i_d)] + sync += b_eq else: - comb += [self.bo.eq(self.b_mask & self.i != self.i_d)] + comb += b_eq else: comb += [self.bo.eq(0)] #Output -- 2.30.2