From 09bcfb0fa54d3020283015df1d10174b81787d33 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Sun, 12 Aug 2012 19:39:26 +0200 Subject: [PATCH] fix masks on EdgeDetector --- migScope/__init__.py | 14 +++++++------- top.py | 11 +++++++---- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/migScope/__init__.py b/migScope/__init__.py index d8ee29bad..7b7f42799 100644 --- a/migScope/__init__.py +++ b/migScope/__init__.py @@ -66,25 +66,25 @@ class EdgeDetector: # Rising Edge if "R" in self.mode: if self.pipe: - sync += [self.ro.eq(self.i & (~self.i_d))] + sync += [self.ro.eq(self.r_mask & self.i & (~self.i_d))] else: - comb += [self.ro.eq(self.i & (~ self.i_d))] + comb += [self.ro.eq(self.r_mask & self.i & (~ self.i_d))] else: comb += [self.ro.eq(0)] # Falling Edge if "F" in self.mode: if self.pipe: - sync += [self.fo.eq((~ self.i) & self.i_d)] + sync += [self.fo.eq(self.f_mask & (~ self.i) & self.i_d)] else: - comb += [self.fo.eq((~ self.i) & self.i_d)] + comb += [self.fo.eq(self.f_mask & (~ self.i) & self.i_d)] else: comb += [self.fo.eq(0)] # Both if "B" in self.mode: if self.pipe: - sync += [self.bo.eq(self.i != self.i_d)] + sync += [self.bo.eq(self.b_mask & self.i != self.i_d)] else: - comb += [self.bo.eq(self.i != self.i_d)] + comb += [self.bo.eq(self.b_mask & self.i != self.i_d)] else: comb += [self.bo.eq(0)] #Output @@ -256,7 +256,7 @@ class Trigger: comb+= [self.dat.eq(self.in_dat)] - return frag + _sum.get_fragment() + Fragment(comb=comb, sync=sync) + return frag + Fragment(comb=comb, sync=sync) class Storage: diff --git a/top.py b/top.py index e2b3eb971..246259aeb 100644 --- a/top.py +++ b/top.py @@ -8,7 +8,7 @@ from migen.bus import csr import migScope # -#Test RangeDetector +#Test Term # #term = migScope.Term(32,True) #v = verilog.convert(term.get_fragment()) @@ -70,12 +70,15 @@ import migScope #v = verilog.convert(recorder.get_fragment()) #print(v) - +# +#Test Trigger +# term0 = migScope.Term(32) -term1 = migScope.Term(32) -term2 = migScope.Term(32) +term1 = migScope.RangeDetector(32) +term2 = migScope.EdgeDetector(32) term3 = migScope.Term(32) trigger0 = migScope.Trigger(0,32,64,[term0, term1, term2, term3]) v = verilog.convert(trigger0.get_fragment()) print(v) +