ic makefile record

该makefile 能够实现根据不同的case选择不同的仿真目录。
目录结构: testbench 存放design 的top.
testcase 存放每种测试场景的case(必须存在默认子目录example,每种case创建相应的子目录)

testbench= ./testbench
testcase=./testcase
test=example  #default dir
case=$(wildcard $(testcase)/* )                                 #  $(wildcard pattern)   获取某个pattern目录下的文件列表 
test_case_lis=$(notdir $(foreach n, $(case), $(n)))    #  $(notdir  ) 是为了剥离文件的绝对路径,只保留文件名。

define log 
	@echo -e "\033[42m $1 \033\0m"
endef
help:
	$(info)
	$(info -----------------------------------------)
	$(info -----VERDI------ make verdi test=TEST_NAME)
	$(info ---SIMULATION--- make sim   test=TEST_NAME)
	$(info )
	$(info ----------------TEST_NAME list -----------)
	$(info)
	$(foreach n, $(test_case_list), $(info|---${n} $(newline)))
	$(info)
	


verdi:
	verdi +incdir+"./testcast/$(test)"\
		     +incdir+"other_dir"\
		     -f ${testbench}/tb.lst\
		     -sv -top pcs_pma_top \
		     -nologo&
sim:
	vcs 	+incidr+"./testcast/$(test)"\
			+incdir+"other_dir"\
			+lint=TFIPC-L\
			-f ${testbench}/tblst\
			-sverilog -top pcs_pma_top\
			-cm line+cond+fsm+tgl+branch\
			-cm_dir cov/${test}.vdb\
			-R -l ${test}_sim.log -debug_access & 

clean:
	rm -rf csrc novas.conf novas_dump.log simv simv.adidir verdiLog ucli.key novas.rc 

你可能感兴趣的:(verilog,makefile)