fix masks on EdgeDetector
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Sun, 12 Aug 2012 17:39:26 +0000 (19:39 +0200)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Sun, 12 Aug 2012 17:39:26 +0000 (19:39 +0200)
migScope/__init__.py
top.py

index d8ee29bad5d896092ae222a04b850e4922345b67..7b7f42799f7ee22e8f0e639ba91b4e5c8e178324 100644 (file)
@@ -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 e2b3eb971206ad96d1d00b3b51eeb92d6074d972..246259aeb55d6bd91af527a14ab31511007ca611 100644 (file)
--- 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)
+