Ejemplo n.º 1
0
    while fixed_point(KBBPD, INT_BITS, FRAC_BITS) == 0.0:
        print(
            "KBBPD is quantized to zero with current data word resolution, incrementing fractional bits by 1."
        )
        FRAC_BITS += 1
    KBBPD = fixed_point(KBBPD, INT_BITS, FRAC_BITS)
    print("* Quantized Kbb = ", KBBPD)
# M_BBPD = 1/(FCLK*(BBPD_TH+BBPD_TSU))
# else: KBBPD = 0
#TDC_STEPS = int(TDC_STEPS/float(KBBPD))

print(
    "\n* Final resolution of data words: %d frac bits, %d int bits, 1 sign bit"
    % (FRAC_BITS, _int_bits))
print("\n* Digitized ilter coeffients in TDC mode")
binary_lf_coefs(lf_params, _int_bits, FRAC_BITS)
if USE_BBPD:
    print("\n* Digitized filter coeffients in BBPD mode")
    binary_lf_coefs(lf_params_bbpd, _int_bits, FRAC_BITS)

if USE_BBPD: EST_TOTAL_LOCK_TIME = TSETTLE_EST + TSETTLE_EST_BBPD
else: EST_TOTAL_LOCK_TIME = TSETTLE_EST
print(
    "\n* Final estimated settling time of PLL (TDC and or BBPD mode) = %E s" %
    EST_TOTAL_LOCK_TIME)

###############################################################################
# Main phase noise simulation
###############################################################################

print("\n***********************************************")
Ejemplo n.º 2
0
    print("Test optimization, BBPD:")
    print("\tN int bits  = %d" % bbpd_int_bits)
    print("\tN frac bits = %d" % bbpd_frac_bits)
    if not FORCE_INT_BITS:
        INT_BITS = max((sc_int_bits, bbpd_int_bits))
    if not FORCE_FRAC_BITS:
        FRAC_BITS = max((sc_frac_bits, bbpd_frac_bits))
    print("\nFinal Dataword size:")
    print("\tN int bits  = %d" % INT_BITS)
    print("\tN frac bits = %d" % FRAC_BITS)

    print(
        "\n* Final resolution of data words: %d frac bits, %d int bits, 1 sign bit"
        % (FRAC_BITS, INT_BITS))
    print("\n* Digitized ilter coeffients in SCPD mode")
    binary_lf_coefs(lfs["sc"], INT_BITS, FRAC_BITS)
    print("\n* Digitized filter coeffients in BBPD mode")
    binary_lf_coefs(lfs["bbpd"], INT_BITS, FRAC_BITS)

    #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    # Estimate lock times
    sc_tsettle = tsettle_lf(lfs["sc"], ftol=SETTLE_DF_SCPD, df0=INIT_F_ERR)
    bbpd_tsettle = tsettle_lf(lfs["bbpd"],
                              ftol=SETTLE_DF_BBPD,
                              df0=SETTLE_DF_SCPD)
    EST_TOTAL_LOCK_TIME = sc_tsettle + bbpd_tsettle
    print(
        "\n* Final estimated settling time of PLL (SC and or BBPD mode) = %E s"
        % EST_TOTAL_LOCK_TIME)
    print("\n* Estimated settling time of PLL (SC) = %E s" % sc_tsettle)
Ejemplo n.º 3
0
from libpll.tools import binary_lf_coefs, fixed_point

int_bits = 5
frac_bits = 8
# lf_params = dict(b0=3.1975968494E+01, b1=-2.8851627388E+01)
lf_params = dict(b0=24.746023869534508, b1=-22.328113694243058)

binary_lf_coefs(lf_params, int_bits, frac_bits)

print("\nQuantized Equivalent")
for k, v in lf_params.items():
    x = fixed_point(v, int_bits, frac_bits)
    print("%s\t->\t%.10E\tError = %.10E" % (k, x, x - v))