fix masks on EdgeDetector
This commit is contained in:
parent
68c451148a
commit
09bcfb0fa5
|
@ -66,25 +66,25 @@ class EdgeDetector:
|
||||||
# Rising Edge
|
# Rising Edge
|
||||||
if "R" in self.mode:
|
if "R" in self.mode:
|
||||||
if self.pipe:
|
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:
|
else:
|
||||||
comb += [self.ro.eq(self.i & (~ self.i_d))]
|
comb += [self.ro.eq(self.r_mask & self.i & (~ self.i_d))]
|
||||||
else:
|
else:
|
||||||
comb += [self.ro.eq(0)]
|
comb += [self.ro.eq(0)]
|
||||||
# Falling Edge
|
# Falling Edge
|
||||||
if "F" in self.mode:
|
if "F" in self.mode:
|
||||||
if self.pipe:
|
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:
|
else:
|
||||||
comb += [self.fo.eq((~ self.i) & self.i_d)]
|
comb += [self.fo.eq(self.f_mask & (~ self.i) & self.i_d)]
|
||||||
else:
|
else:
|
||||||
comb += [self.fo.eq(0)]
|
comb += [self.fo.eq(0)]
|
||||||
# Both
|
# Both
|
||||||
if "B" in self.mode:
|
if "B" in self.mode:
|
||||||
if self.pipe:
|
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:
|
else:
|
||||||
comb += [self.bo.eq(self.i != self.i_d)]
|
comb += [self.bo.eq(self.b_mask & self.i != self.i_d)]
|
||||||
else:
|
else:
|
||||||
comb += [self.bo.eq(0)]
|
comb += [self.bo.eq(0)]
|
||||||
#Output
|
#Output
|
||||||
|
@ -256,7 +256,7 @@ class Trigger:
|
||||||
|
|
||||||
comb+= [self.dat.eq(self.in_dat)]
|
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:
|
class Storage:
|
||||||
|
|
11
top.py
11
top.py
|
@ -8,7 +8,7 @@ from migen.bus import csr
|
||||||
import migScope
|
import migScope
|
||||||
|
|
||||||
#
|
#
|
||||||
#Test RangeDetector
|
#Test Term
|
||||||
#
|
#
|
||||||
#term = migScope.Term(32,True)
|
#term = migScope.Term(32,True)
|
||||||
#v = verilog.convert(term.get_fragment())
|
#v = verilog.convert(term.get_fragment())
|
||||||
|
@ -70,12 +70,15 @@ import migScope
|
||||||
#v = verilog.convert(recorder.get_fragment())
|
#v = verilog.convert(recorder.get_fragment())
|
||||||
#print(v)
|
#print(v)
|
||||||
|
|
||||||
|
#
|
||||||
|
#Test Trigger
|
||||||
|
#
|
||||||
term0 = migScope.Term(32)
|
term0 = migScope.Term(32)
|
||||||
term1 = migScope.Term(32)
|
term1 = migScope.RangeDetector(32)
|
||||||
term2 = migScope.Term(32)
|
term2 = migScope.EdgeDetector(32)
|
||||||
term3 = migScope.Term(32)
|
term3 = migScope.Term(32)
|
||||||
|
|
||||||
trigger0 = migScope.Trigger(0,32,64,[term0, term1, term2, term3])
|
trigger0 = migScope.Trigger(0,32,64,[term0, term1, term2, term3])
|
||||||
v = verilog.convert(trigger0.get_fragment())
|
v = verilog.convert(trigger0.get_fragment())
|
||||||
print(v)
|
print(v)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue