Ejemplo n.º 1
0
 def update(self, clk, xin):
     """ Inputs in phase (radians)
     """
     if is_edge_phase(clk, self.clk_last) or self.ignore_clk:
         new_count = np.floor(xin / (2 * np.pi))
         self.out = -new_count + self.count + self.modulus
         self.count = new_count
     self.clk_last = clk
     return self.out
Ejemplo n.º 2
0
 def update(self, clk, xin):
     """ Inputs in phase (radians)
     """
     if is_edge_phase(clk, self.clk_last):
         self.out = round(self.tdc_steps * (clk - xin) / (2 * np.pi))
         self.out = (self.out + self.tdc_steps /
                     2) % self.tdc_steps - self.tdc_steps / 2
     self.clk_last = clk
     return self.out
Ejemplo n.º 3
0
 def update(self, clk, xin):
     """ Inputs in phase (radians)
     """
     if is_edge_phase(clk, self.clk_last):  # or self.ignore_clk:
         xin /= 2 * np.pi
         xin -= np.floor(xin)
         # error = (clk-xin)
         if xin > self.cyc_jit and xin <= 0.5: self.out = -1.0
         elif xin < 1 - self.cyc_jit and xin > 0.5: self.out = +1.0
         else: self.out = np.random.choice((-1.0, 1.0))
     self.clk_last = clk
     return self.out
Ejemplo n.º 4
0
    def update(self, xin, clk):
        """ args:
                xin - filter input
                clk - clk of filter
            returns:
                filtered version of input
        """
        if is_edge_phase(clk, self.clk_last) or self.ignore_clk:
            ynew = self.b0 * xin + self.b1 * self.x1 + self.y1
            if self.quantize:
                ynew = fixed_point(ynew, self.out_bits, self.frac_bits)
            self.x1 = xin
            self.y1 = ynew
        self.clk_last = clk

        if self.y1 < 0: return 0
        elif self.y1 > self.max_int: return self.max_int
        else: return np.floor(self.y1)