On 4/3/2022 4:37 PM, jamesbondtia--- via gem5-users wrote:
Hi,

I am trying to pass a boolean as one of the params to the BaseCPU class from 
the Options.py file. I have declared my boolean in the Options.py file as
parser.add_argument('--defense', action="store_true", default=False, help="Enable 
defense") so that I could enable or disable from the cmd line.

In the BaseCPU.py file, I have added the boolean to pass to the BaseCPU class
defense = Param.Bool(False, "Whether to use Defense")

Finally, in the base.cc file in the constructor for BaseCPU, I used 
params().defense and p.defense, but the value never changes to True. It's 
always False.

Command to run Gem5 with my passed argument
run configs/example/se.py --cmd tests/test-progs/hello/bin/arm/linux/hello 
--mem-size=4GB --cpu-type=DerivO3CPU --cpu-clock 2GHz --sys-clock 2GHz 
--l1d_size 32kB --l1d_assoc 8 --l1i_size 32kB --l1i_assoc 8 --l2_size 2MB 
--l2_assoc 16 --l2cache --caches --defense

I am not sure what I am doing wrong.

I wonder if the actual name of the parameter is something like 
system.cpu[0].defense.
You can check the config file that a run dumps out to see.  (The [0] is 
something I
discovered on my own to be necessary, even in a system with only one cpu; it's
because there is an underlying vector.)  You could try:

--param "system.cpu[0].defense=True"

Or something like it.  There's probably a way to get a top-level new parameter
like --defense to work, but at some point, some piece of code has to pass it
on to the actual component.  A given component will ignore parameters that
do not match its name ...

Regards - Eliot Moss
_______________________________________________
gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to