Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RANDOM_SEED variable to set random init for VCS and Verilator simulations #629

Merged
merged 1 commit into from
Aug 3, 2020

Conversation

jerryz123
Copy link
Contributor

@jerryz123 jerryz123 commented Jul 17, 2020

Setting RANDOM_SEED now lets you control the random seed for VCS and Verilator. Leaving RANDOM_SEED unset results in randomly generated seed.

Related issue:

Type of change: new feature

Impact: software change

Release Notes

@@ -47,13 +47,11 @@ VCS_OPTS = -notice -line $(VCS_CC_OPTS) $(VCS_NONCC_OPTS) $(VCS_DEFINE_OPTS) $(E
# vcs simulator rules
#########################################################################################
$(sim): $(sim_vsrcs) $(sim_common_files) $(dramsim_lib) $(EXTRA_SIM_REQS)
rm -rf csrc && $(VCS) $(VCS_OPTS) -o $@ \
-debug_pp
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-debug_pp is already defined in VCS_OPTS

@@ -29,6 +29,7 @@ sim = $(sim_dir)/$(sim_prefix)-$(MODEL_PACKAGE)-$(CONFIG)
sim_debug = $(sim_dir)/$(sim_prefix)-$(MODEL_PACKAGE)-$(CONFIG)-debug

WAVEFORM_FLAG=-v$(sim_out_name).vcd
SEED_FLAG=+verilator+seed+I$(RANDOM_SEED)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good thing we added support for these flags 😝

variables.mk Outdated Show resolved Hide resolved
@davidbiancolin
Copy link
Contributor

davidbiancolin commented Jul 19, 2020 via email

@jerryz123
Copy link
Contributor Author

The seed is already printed in the TestDriver.v, and can be seen in the .out/.log file.
The new default behavior is random init in both verilator and VCS, with the option to set a seed with the RANDOM_SEED variable.

Copy link
Contributor

@colinschmidt colinschmidt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jerryz123 jerryz123 merged commit c7586be into dev Aug 3, 2020
@jerryz123 jerryz123 deleted the random-seed branch August 24, 2020 17:55
@alonamid alonamid mentioned this pull request Nov 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants