SEED = $$RANDOM
INC = +incdir+../rtl +incdir+../tb +incdir+../test
comp = ncverilog +access+rwc -uvm -coverage all -seed $(SEED) $(INC) ../tb/top.sv
logs=mkdir logs;mv test_case* ./logs
test1:
$(comp) +UVM_VERBOSITY=UVM_MEDIUM +UVM_TESTNAME=test_case_1;
mkdir test_case_1_$(SEED);
mv cov_work ./test_case_1_$(SEED);
mv ncverilog.log NCVERILOG_$(SEED).log
mv *.log ./test_case_1_$(SEED)
$(logs)
Here “SEED” means a random number:
make test1 SEED=23679
I will run the target test1 in terminal likewise. But the problem is here I want to run that target 10 times by using any conditional loops. If i want to run the test1 2nd time again I need to give like this:
make test1 SEED=40244
3rd time:
make test1 SEED=87797
4th time:
make test1 SEED=5489
Likewise, each and every time I need to give the seed value in the terminal. I don’t want it to be like that, if any conditional loops are there to run test1 for 10 times with 10 different seeds that’s reduce a lot of time for me.
Advertisement
Answer
seeds.txt:
23679 40244 87797 5489
Execute make test1 with SEED taken from seeds.txt only once:
cat seeds.txt | while read in; do make test1 SEED=$in; done
Execute make test1 with SEED taken from seeds.txt 10 times:
cat seeds.txt | while read in; do seq 10 | xargs -I -- make test1 SEED=$in; done
You’re welcome.