dat_vcd = []
recorder0.size(1024)
-def capture():
+def capture(size):
global trigger0
global recorder0
global dat_vcd
print("-Receiving Data...", end = ' ')
sys.stdout.flush()
- dat_vcd += migLa0.rec.read(1024)
+ dat_vcd += migLa0.rec.read(size)
print("[Done]")
print("Capturing Ramp..")
print("----------------------")
-term0.write(0x0000)
+term0.write(0x0000,0xFFFF)
csr.write(0x0000, 0)
-capture()
+capture(1024)
print("Capturing Square..")
print("----------------------")
-term0.write(0x0000)
+term0.write(0x0000,0xFFFF)
csr.write(0x0000, 1)
-capture()
+capture(1024)
print("Capturing Sinus..")
print("----------------------")
-term0.write(0x0080)
+term0.write(0x0080,0xFFFF)
csr.write(0x0000, 2)
-capture()
+capture(1024)
myvcd = Vcd()
myvcd.add(Var("wire", 16, "trig_dat", dat_vcd))
dat_vcd = []
recorder0.size(1024)
-def capture():
+def capture(size):
global trigger0
global recorder0
global dat_vcd
print("-Receiving Data...", end = ' ')
sys.stdout.flush()
- dat_vcd += migLa0.rec.read(1024)
+ dat_vcd += migLa0.rec.read(size)
print("[Done]")
print("Capturing Ramp..")
print("----------------------")
-term0.write(0x0000)
+term0.write(0x0000,0xFFFF)
csr.write(0x0000, 0)
-capture()
+capture(1024)
print("Capturing Square..")
print("----------------------")
-term0.write(0x0000)
+term0.write(0x0000,0xFFFF)
csr.write(0x0000, 1)
-capture()
+capture(1024)
print("Capturing Sinus..")
print("----------------------")
-term0.write(0x0080)
+term0.write(0x0080,0xFFFF)
csr.write(0x0000, 2)
-capture()
+capture(1024)
myvcd = Vcd()
myvcd.add(Var("wire", 16, "trig_dat", dat_vcd))
self.reg_name = "term_reg"
self.reg_base = 0
- self.reg_size = 1*width
+ self.reg_size = 2*width
self.words = int(2**bits_for(width-1)/8)
self.i = Signal(BV(self.width))
self.t = Signal(BV(self.width))
+ self.m = Signal(BV(self.width))
self.o = Signal()
def get_fragment(self):
frag = [
- self.o.eq(self.i==self.t)
+ self.o.eq((self.m & self.i) == self.t)
]
if self.pipe:
return Fragment(sync=frag)
def connect_to_reg(self, reg):
comb = []
comb += [self.t.eq(reg.field.r[0*self.width:1*self.width])]
+ comb += [self.m.eq(reg.field.r[1*self.width:2*self.width])]
return comb
#
#Driver
#
- def write(self, dat):
- self.interface.write_n(self.reg_base, dat ,self.width)
-
+ def write(self, dat, mask = None):
+ if mask == None:
+ mask = (2**self.width)-1
+ self.interface.write_n(self.reg_base + self.words, dat ,self.width)
+ self.interface.write_n(self.reg_base, mask ,self.width)
+
class RangeDetector:
#
# Definition
#
#Driver
#
+
+ def get_offset(self, type):
+ if type == "R":
+ r = 0
+ r = r+self.words if "F" in self.mode else r
+ r = r+self.words if "B" in self.mode else r
+ return r
+ elif type == "F":
+ r = 0
+ r = r+self.words if "B" in self.mode else r
+ return r
+ elif type == "B":
+ r = 0
+ return r
+ return 0
+
def write_r(self, dat):
- self.interface.write_n(self.reg_base, dat ,self.width)
+ self.interface.write_n(self.reg_base + self.get_offset("R"), dat ,self.width)
def write_f(self, dat):
- offset = 0
- if "R" in self.mode:
- offset += self.words
- self.interface.write_n(self.reg_base + offset, dat ,self.width)
+ self.interface.write_n(self.reg_base + self.get_offset("F"), dat ,self.width)
def write_b(self, dat):
- if "R" in self.mode:
- offset += self.words
- if "F" in self.mode:
- offset += self.words
- self.interface.write_n(self.reg_base + offset, dat ,self.width)
+ self.interface.write_n(self.reg_base + self.get_offset("B"), dat ,self.width)
class Timer:
#