#VPATH=src/:build/ CONFIG_DIR = configurations_3tr SRC_DIR = src SRC_COMMON_DIR=$(SRC_DIR)/common BUILD_DIR ?= build TMP = tmp TCS2ASM_CONST=$(SRC_COMMON_DIR)/run_parameters TCS2ASM_PRE_CONST=$(SRC_COMMON_DIR)/run_pre_const TCS2ASM_POST_CONST=$(SRC_COMMON_DIR)/run_post_const INS_ERR=insert_error # Programs used TCC = trapcc program=lb2tp program_rx_reset=lb2tp -s0 --reset_rx --status --SFPinfo program_rx_status=lb2tp -s0 --status --SFPinfo program_rx_get=lb2tp -s0 --opt_out program_pre=pretrigger program_scsn_peek=scsn_peek program_ori_clr=ori_pre --clrcnt program_ori_cnt=ori_pre --getcnt config_of_rob3a=./cnf_rob simulation_of_rob3a=./sim_rob # 3 << 16 are the HCM and BM, bits 0..15 are the normal MCMs. # for only one column the mask is 0x3000F, for full ROB is 0x3FFFF MCM_PRESENT_MSK=0x3FFFF #MCM_PRESENT_MSK=0x3000F data_va=./data # -Ve : overflow as error not as warning # -g : ignore all ORG directives (set the start address at some defined point in program) # ignoring the ORGs leads to better usage of the IMEM, but for simulation it is good to have some well recognized start addresses of the different program parts. ASM_OPTIONS=-Ve ASM_MAIN=fitred # default: rob_sim default: help help: ## Print this help text @perl -nle 'printf(" %-20s %s\n",$$1,$$2) if /^(\S+):.*##\s*(.*)/' Makefile # Venelin - test, can be deleted later # filter all scsn and extended commands to get only the configuration for one ROB3A $(CONFIG_DIR)/test.dat: $(TMP)/$(ASM_MAIN).dat $(SRC_COMMON_DIR)/reset.tcs $(SRC_DIR)/trg/ptrg.tcs $(SRC_COMMON_DIR)/main.tcs $(SRC_COMMON_DIR)/scsn_ids.tcs $(TCS2ASM_PRE_CONST).tcs $(TCS2ASM_CONST).tcs $(TCS2ASM_POST_CONST).tcs $(TCC) $(SRC_COMMON_DIR)/reset.tcs > $@ cat $(TMP)/$(ASM_MAIN).dat >> $@ $(TCC) $(SRC_DIR)/trg/ptrg.tcs >> $@ $(TMP)/$(ASM_MAIN).dat: $(TMP)/$(ASM_MAIN).cpu0.code $(TMP)/$(ASM_MAIN).cpu1.code $(TMP)/$(ASM_MAIN).cpu2.code $(TMP)/$(ASM_MAIN).cpu3.code codem -i0 $(TMP)/$(ASM_MAIN).cpu0.code \ -i1 $(TMP)/$(ASM_MAIN).cpu1.code \ -i2 $(TMP)/$(ASM_MAIN).cpu2.code \ -i3 $(TMP)/$(ASM_MAIN).cpu3.code \ -o $@ -3 -s127 -v $(TCS2ASM_CONST).asm: $(SRC_COMMON_DIR)/scsn_ids.tcs $(TCS2ASM_PRE_CONST).tcs $(TCS2ASM_CONST).tcs $(TCS2ASM_POST_CONST).tcs $(TCC) -s $(TCS2ASM_CONST).asm $(SRC_COMMON_DIR)/scsn_ids.tcs $(TCS2ASM_PRE_CONST).tcs $(TCS2ASM_CONST).tcs $(TCS2ASM_POST_CONST).tcs $(TMP)/$(ASM_MAIN).cpu0.code $(SRC_COMMON_DIR)/$(ASM_MAIN).cpu0.labe0s.tcs: $(TCS2ASM_CONST).asm $(SRC_COMMON_DIR)/*.asm asm_mimd -i $(SRC_COMMON_DIR)/$(ASM_MAIN).asm -od $(TMP)/$(ASM_MAIN).cpu0.code -ol \ $(TMP)/$(ASM_MAIN).cpu0.log -oc $(TMP)/$(ASM_MAIN).cpu0c.log -dcpu0 \ -oa $(SRC_COMMON_DIR)/$(ASM_MAIN).cpu0.labels.tcs -oh \ $(TMP)/$(ASM_MAIN).imem0.hex $(ASM_OPTIONS) @grep -i 'warning\|error' $(TMP)/$(ASM_MAIN).cpu0.log $(TMP)/$(ASM_MAIN).cpu1.code $(SRC_COMMON_DIR)/$(ASM_MAIN).cpu1.labels.tcs: $(TCS2ASM_CONST).asm $(SRC_COMMON_DIR)/*.asm asm_mimd -i $(SRC_COMMON_DIR)/$(ASM_MAIN).asm -od $(TMP)/$(ASM_MAIN).cpu1.code -ol \ $(TMP)/$(ASM_MAIN).cpu1.log -oc $(TMP)/$(ASM_MAIN).cpu1c.log -dcpu1 \ -oa $(SRC_COMMON_DIR)/$(ASM_MAIN).cpu1.labels.tcs -oh \ $(TMP)/$(ASM_MAIN).imem1.hex $(ASM_OPTIONS) @grep -i 'warning\|error' $(TMP)/$(ASM_MAIN).cpu1.log $(TMP)/$(ASM_MAIN).cpu2.code $(SRC_COMMON_DIR)/$(ASM_MAIN).cpu2.labels.tcs: $(TCS2ASM_CONST).asm $(SRC_COMMON_DIR)/*.asm asm_mimd -i $(SRC_COMMON_DIR)/$(ASM_MAIN).asm -od $(TMP)/$(ASM_MAIN).cpu2.code -ol \ $(TMP)/$(ASM_MAIN).cpu2.log -oc $(TMP)/$(ASM_MAIN).cpu2c.log -dcpu2 \ -oa $(SRC_COMMON_DIR)/$(ASM_MAIN).cpu2.labels.tcs -oh \ $(TMP)/$(ASM_MAIN).imem2.hex $(ASM_OPTIONS) @grep -i 'warning\|error' $(TMP)/$(ASM_MAIN).cpu2.log $(TMP)/$(ASM_MAIN).cpu3.code $(SRC_COMMON_DIR)/$(ASM_MAIN).cpu3.labels.tcs: $(TCS2ASM_CONST).asm $(SRC_COMMON_DIR)/*.asm asm_mimd -i $(SRC_COMMON_DIR)/$(ASM_MAIN).asm -od $(TMP)/$(ASM_MAIN).cpu3.code -ol \ $(TMP)/$(ASM_MAIN).cpu3.log -oc $(TMP)/$(ASM_MAIN).cpu3c.log -dcpu3 \ -oa $(SRC_COMMON_DIR)/$(ASM_MAIN).cpu3.labels.tcs -oh \ $(TMP)/$(ASM_MAIN).imem3.hex $(ASM_OPTIONS) @grep -i 'warning\|error' $(TMP)/$(ASM_MAIN).cpu3.log rob_config: $(CONFIG_DIR)/test.dat topti_cnf -i $^ -o $(config_of_rob3a)/sc_send_rob.dat --rob_pos 4 -d $(config_of_rob3a)/config_dump.txt scp $(config_of_rob3a)/sc_send_rob.dat angelov@va-tosh:TRD.svn/TRAPconfig.svn/cnf_rob rob_sim: $(CONFIG_DIR)/test.dat #./src/common/patch_single_rob3a_sim.tcs # $(TCC) ./src/common/patch_single_rob3a_sim.tcs > ./src/common/patch_single_rob3a_sim.dat topti_cnf -i $< -o $(simulation_of_rob3a)/sc_send.dat --rob_pos 4 \ --pmask $(MCM_PRESENT_MSK) --no_imem -d $(simulation_of_rob3a)/config_dump.txt cp $(TMP)/fitred.imem0.hex $(simulation_of_rob3a)/imem0.hex cp $(TMP)/fitred.imem1.hex $(simulation_of_rob3a)/imem1.hex cp $(TMP)/fitred.imem2.hex $(simulation_of_rob3a)/imem2.hex cp $(TMP)/fitred.imem3.hex $(simulation_of_rob3a)/imem3.hex @grep -i 'warning\|error' $(TMP)/fitred.cpu?.log #-p ./src/common/patch_single_rob3a_sim.dat init: ## init the ROB @echo "*** Send the scsn commands to the ROB3A via scsn" $(program) --rob_reset -i $(config_of_rob3a)/sc_send_rob.dat -o $(config_of_rob3a)/out @echo "*** Send one pretrigger 5 - go to acq mode" $(program_pre) 5 # switch to acq mode @echo "*** Clear the ORI receiver" $(program_rx_reset) -rm $(data_va)/* @echo "*** Send one pretrigger 1 - first event is configuration send!" $(program_pre) 1 1 1000 1 48 # first event with configuration $(program_rx_get) $(data_va)/evn00000001.txt read_raw -d 1 -i1 $(data_va)/evn00000001.txt tdump_packed $(data_va)/evn00000001.txt > $(config_of_rob3a)/unpacked_cnf # unpack the configuration @echo "*** Dump only two registers from the unpacked received configuration" grep "SMMODE" $(config_of_rob3a)/unpacked_cnf grep "ADCMSK" $(config_of_rob3a)/unpacked_cnf @sleep 1 @echo "*** Dump the state of the TRAPs" @$(program_scsn_peek) smcmd @$(program_scsn_peek) all > rconf_ini.txt rob_reset: $(program) --rob_reset cmp_cnf: @$(program_scsn_peek) all > rconf_end.txt diff -y rconf_ini.txt rconf_end.txt |less ins_err: $(SRC_COMMON_DIR)/$(INS_ERR).tcs $(TCC) $(SRC_COMMON_DIR)/$(INS_ERR).tcs > $(config_of_rob3a)/$(INS_ERR).dat $(program) -i $(config_of_rob3a)/$(INS_ERR).dat pre1000: $(program_ori_clr) $(program_rx_reset) $(program_pre) 1 1000 300 sleep 1 @echo "\n*** Read the ORI counter..." @$(program_ori_cnt) @$(program_rx_status) pre: @$(program_ori_clr) $(program_rx_reset) -rm $(data_va)/* $(program_pre) 1 1 1000 1 48 $(program_rx_get) $(data_va)/evn00000001.txt read_raw -d 1 -i1 $(data_va)/evn00000001.txt -o1 data/ read_raw -d 2 -i1 $(data_va)/evn00000001.txt |less read_raw -d 1 -i1 $(data_va)/evn00000001.txt @echo "*** Read the ORI counter..." @$(program_ori_cnt) @echo "*** RX status" @$(program_rx_status) pre3: @$(program_ori_clr) $(program_rx_reset) -rm $(data_va)/* $(program_pre) 1 1 1000 1 47 3 75 # event with additional pretr. cmd 3 $(program_rx_get) $(data_va)/evn00000001.txt read_raw -d 1 -i1 $(data_va)/evn00000001.txt -o1 data/ read_raw -d 2 -i1 $(data_va)/evn00000001.txt |less read_raw -d 1 -i1 $(data_va)/evn00000001.txt @echo "*** Read the ORI counter..." @$(program_ori_cnt) @echo "*** RX status" @$(program_rx_status) pre1001r: pre1000 pre pow_cyc: pow_off pow_on pow_off: @echo "*** Turn ROB power off" $(program) --rob_off sleep 2 pow_on: @echo "*** Turn ROB power on" $(program) --rob_on sleep 1 rob_all: rob_config pow_cyc init clean: rm -f $(TCS2ASM_CONST).asm find $(SRC_COMMON_DIR)/ -name '*.cpu?.labels.tcs' -exec rm -f '{}' ';' find $(TMP)/ -name '*.cpu?.code' -exec rm -f '{}' ';' find $(TMP)/ -name '*.cpu?.log' -exec rm -f '{}' ';' find $(TMP)/ -name '*.cpu?c.log' -exec rm -f '{}' ';' find $(TMP)/ -name '*.imem?.hex' -exec rm -f '{}' ';' find $(TMP)/ -name '*.dat' -exec rm -f '{}' ';' rm -rf build/ rm -f src/common/runpar_*.asm