Exemple #1
0
def set_trigmode_reg(skiroc,mode):
    "set the trigger mode of a skiroc"
    if mode!="undef":
        if mode=="ext":
            return common_roc.apply_mask(skiroc,9,common_roc.split_bin(1,1))
        if mode=="int":
            return common_roc.apply_mask(skiroc,9,common_roc.split_bin(0,1))
    return 0,"Unknown mode %s. Supported mode are int or ext"%(mode)
Exemple #2
0
def set_start_ro_reg(skiroc,start_ro):
    "start the readout set"
    if int(start_ro)==1:
        return common_roc.apply_mask(skiroc,5,common_roc.split_bin(1,1))
    elif int(start_ro)==2:
        return common_roc.apply_mask(skiroc,5,common_roc.split_bin(0,1))
    elif start_ro=="undef":
        return 1,"ok"
    return 0,"invalid value: %s"%(start_ro)
Exemple #3
0
def set_end_ro_reg(skiroc,end_ro):
    "end the readout set"
    if int(end_ro)==1:
        return common_roc.apply_mask(skiroc,6,common_roc.split_bin(1,1))
    elif int(end_ro)==2:
        return common_roc.apply_mask(skiroc,6,common_roc.split_bin(0,1))
    elif end_ro=="undef":
        return 1,"ok"
    return 0,"invalid value: %s"%(end_ro)
Exemple #4
0
def set_lg_tau(easiroc_id, lg_tau):
    lg_tau = int(lg_tau)
    if (lg_tau % 25) == 0 and lg_tau >= 0 and lg_tau <= 175:
        lg_tau = lg_tau / 25
        return common_roc.apply_to_roc(
            easiroc_pool, easiroc_id, common_roc.apply_inv_mask, "set lg tau", 76, common_roc.split_bin(lg_tau, 3)
        )
    return 0, "low-gain time constant must be a multiple of 25ns between 0 and 175ns"
Exemple #5
0
def set_hg_tau(easiroc_id, hg_tau):
    hg_tau = int(hg_tau)
    if (hg_tau % 25) == 0 and hg_tau >= 0 and hg_tau <= 175:
        hg_tau = hg_tau / 25
        return common_roc.apply_to_roc(
            easiroc_pool, easiroc_id, common_roc.apply_inv_mask, "set hg tau", 71, common_roc.split_bin(hg_tau, 3)
        )
    return 0, "high-gain time constant must be a multiple of 25ns between 0 and 175ns"
Exemple #6
0
def set_lg_fb_capa(easiroc_id, lg_fb_capa):
    lg_fb_capa = float(lg_fb_capa)
    if (lg_fb_capa % 0.1) == 0 and lg_fb_capa >= 0.1 and lg_fb_capa <= 1.5:
        lg_fb_capa = int(15 - 10 * lg_fb_capa)
        return common_roc.apply_to_roc(
            easiroc_pool, easiroc_id, common_roc.apply_inv_mask, 149, common_roc.split_bin(lg_fb_capa, 4)
        )
    return 0, "low-gain preamp feedback capacitance must be a multiple of 0.1pF between 0.1pF and 1.5pF"
Exemple #7
0
def set_cpcap_reg(skiroc,cpcap):
    "set the compensation capacitance of a skiroc"
    if cpcap!="undef":
        for i in range(len(cpcap_strings)):
            if cpcap_strings[i]==cpcap:
                return common_roc.apply_inv_mask(skiroc,611,common_roc.split_bin(i,3))
    else:
        return 1,"ok"
    return 0,"unknown value %s. accepted values are 0pF,1pF,2pF,3pF,4pF,5pF,6pF,7pF"%(cpcap)
Exemple #8
0
def set_fbcap_reg(skiroc,fbcap):
    "set the feedback capacitance of a skiroc"
    if fbcap!="undef":
        for i in range(len(fbcap_strings)):
            if fbcap_strings[i]==fbcap:
                return common_roc.apply_inv_mask(skiroc,607,common_roc.split_bin(i,4))
    else:
        return 1,"ok"
    return 0,"unknown value %s. accepted values are 0pF,0.4pF,0.8pF,1.2pF,1.6pF,2pF,2.4pF,2.8pF,3.2pF,3.6pF,4pF,4.4pF,4.8pF,5.2pF,5.6pF,6pF"%(fbcap)
Exemple #9
0
def set_chipid(skiroc_id,skiroc):
    "set the chipid of a skiroc chip on its bitstream"
    idbin=common_roc.split_bin(common_roc.bin2gray(int(skiroc["chipid"])),8)
    retcode,res=common_roc.apply_to_roc(skiroc_pool,skiroc_id,common_roc.apply_mask,"set chipid",10,idbin)
    if retcode==0:
        return 0,res
    retcode,res=submod.execcmd("set_param_cmod",skiroc_id,"skiroc_chipid",skiroc["chipid"])
    if retcode==0:
        return 0,res
    return 1,"ok"
Exemple #10
0
def set_lg_comp_capa(easiroc_id, lg_comp_capa):
    lg_comp_capa = float(lg_comp_capa)
    if (lg_comp_capa % 0.5) == 0 and lg_comp_capa >= 0 and lg_comp_capa <= 7:
        lg_comp_capa = int(2 * lg_comp_capa)
        return common_roc.apply_to_roc(
            easiroc_pool,
            easiroc_id,
            common_roc.apply_inv_mask,
            145,
            "set lg comp capa",
            common_roc.split_bin(lg_comp_capa, 4),
        )
    return 0, "low-gain preamp compensation capacitance must be a multiple of 0.5pF between 0pF and 7pF"
Exemple #11
0
def set_hg_comp_capa(easiroc_id, hg_comp_capa):
    hg_comp_capa = float(hg_comp_capa)
    if (hg_comp_capa % 0.5) == 0 and hg_comp_capa >= 0 and hg_comp_capa <= 7:
        hg_comp_capa = int(2 * hg_comp_capa)
        return common_roc.apply_to_roc(
            easiroc_pool,
            easiroc_id,
            common_roc.apply_mask,
            157,
            "set hg comp capa",
            common_roc.split_bin(hg_comp_capa, 4),
        )
    return 0, "high-gain preamp compensation capacitance must be a multiple of 0.5pF between 0 and 7"
Exemple #12
0
def set_hg_fb_capa(easiroc_id, hg_fb_capa):
    hg_fb_capa = float(hg_fb_capa)
    if (hg_fb_capa % 0.1) == 0 and hg_fb_capa >= 0.1 and hg_fb_capa <= 1.5:
        hg_fb_capa = int(15 - 10 * hg_fb_capa)
        return common_roc.apply_to_roc(
            easiroc_pool,
            easiroc_id,
            common_roc.apply_mask,
            153,
            "set hg feedback capa",
            common_roc.split_bin(hg_fb_capa, 4),
        )
    return 0, "high-gain preamp feedback capacitance must be a multiple of 0.1pF between 0.1pF and 1.5pF"
Exemple #13
0
def set_dac1(maroc3_id,value):
    if value!="undef":
        return common_roc.apply_to_roc(maroc3_pool,maroc3_id,common_roc.apply_mask,"set DAC1 value",3,common_roc.split_bin(int(value),10))
    return 1,"ok"
Exemple #14
0
def set_preamp_gain(maroc3,chan,value):
    return common_roc.apply_mask(maroc3,190+(63-chan)*9,common_roc.split_bin(value,8))
Exemple #15
0
def set_dac_data(easiroc, chan, value):
    common_roc.apply_mask(easiroc, 166 + 288 - 9 * (int(chan) + 1) + 1, common_roc.split_bin(dac_data_value, 8))
    return 1, "ok"
Exemple #16
0
def set_delay_reg(skiroc,delay):
    "set the hold delay of a skiroc"
    if delay!="undef":
        return common_roc.apply_inv_mask(skiroc,63,common_roc.split_bin(int(delay),8))
    return 1,"ok"
Exemple #17
0
def set_gtrigger_reg(skiroc,gtrigger):
    "set the trigger threshold of a skiroc"
    if gtrigger!="undef":
        return common_roc.apply_inv_mask(skiroc,41,common_roc.split_bin(int(gtrigger),10))
    return 1,"ok"
Exemple #18
0
def set_dacadj(skiroc,chan,dacadj):
    "set the dac adjustment of a channel"
    if dacadj!="undef":
        return common_roc.apply_mask(skiroc,137+int(chan),common_roc.split_bin(int(dacadj),4))
    return 1,"ok"
Exemple #19
0
def disallow_trig(skiroc,chan):
    "disallow a channel to trig"
    return common_roc.apply_mask(skiroc,73+int(chan),common_roc.split_bin(1,1))
Exemple #20
0
def unselect_leak_chan(skiroc, chan):
    "unselect the high leakage for a channel"
    return common_roc.apply_mask(skiroc,415+(63-int(chan))*3,common_roc.split_bin(0,1))
Exemple #21
0
def disable_calib_chan(skiroc, chan):
    "disable the calibration for a channel"
    return common_roc.apply_mask(skiroc, 416+(63-int(chan))*3,common_roc.split_bin(0,1))
Exemple #22
0
def disable_preamp_chan(skiroc,chan):
    "disable the preamplifier of a channel"
    return common_roc.apply_mask(skiroc,417+(63-int(chan))*3,common_roc.split_bin(1,1))
Exemple #23
0
def set_dac_code(easiroc_id, dac_code):
    if dac_code != "undef":
        return common_roc.apply_to_roc(
            easiroc_pool, easiroc_id, common_roc.apply_mask, "set DAC code", 20, common_roc.split_bin(int(dac_code), 10)
        )
    return 1, "ok"
Exemple #24
0
def set_gtrigger(spiroc_id,gtrigger):
    "set the trigger threshold of a spiroc"
    if gtrigger!="undef":
        return common_roc.apply_to_roc(spiroc_pool,spiroc_id,common_roc.apply_inv_mask,"set trigger threshold",239,common_roc.split_bin(int(gtrigger),10))
    return 1,"ok"
Exemple #25
0
def allow_trig(spiroc,chan):
    "allow a channel to trig"
    common_roc.apply_mask(spiroc,73+int(chan),common_roc.split_bin(0,1))
    return 1,"ok"