[vcs] seed 產生

testbench一切随机变量都是和vcs的 +ntb_random_seed 变量相关。这个option的值相当于所有random var的种子,有几种比较差的做法:
1. 从一个固定数开始递增或递增, 这样,seed之间相差不大,testbench中的随机数其实变化不是特别大,所以达不到很随机去验证的目的。如果有10个rand int var, seed =1 和seed = 2两次仿真的结束可能只有一个 var不一样,而且还是相差不大
2.使用年月日时分秒,和1有同样的问题。



比较好的做法

  • 每一个seed都是随机产生的,来保证每一次测试都足够random,如在makefile中产生强随机数
SEED=$(shell head -4 /dev/urandom | od -N 4 -D -A n |awk '{gsub(/ /,"")}1')

+ntb_random_seed=${SEED}
  • vcs提供 +ntb_random_seed_automatic

+ntb_random_seed_automatic


Picks a unique value to supply as the first seed used by a testbench. The value is determined by combining the time of day, host name and process id. This ensures that no two simulations have the same starting seed.
The +ntb_random_seed_automatic seed appears in both the simulation log and the coverage report.

When you enter both +ntb_random_seed_automatic and +ntb_random_seed,  VCS MX displays a warning message and uses the +ntb_random_seed value.
 

猜你喜欢

转载自blog.csdn.net/lbt_dvshare/article/details/85773676
VCS