Closed seldridge closed 6 years ago
@ccelio: This should do what you want.
Some options that elucidate the change are below. Now, when a short option known to VCS, but unknown to htif shows up (e.g., -q
) this only results in stderr output when not parsing permissively.
No unknown short options inside +permissive
/+permissive-off
> ./simv-freechips.rocketchip.system-DefaultConfig +permissive +ntb_random_seed_automatic +permissive-off +permissive +max-cycles=100000000 +permissive-off $RISCV/riscv64-unknown-elf/share/riscv-tests/isa/rv64si-p-wfi 3>&1 1>&2 2>&3
Chronologic VCS simulator copyright 1991-2013
Contains Synopsys proprietary information.
Compiler version H-2013.06-SP1_Full64; Runtime version H-2013.06-SP1_Full64; Mar 6 14:30 2018
NOTE: automatic random seed used: 1127523411
$finish called from file "/home/schuyler/repos/github.com/freechipsproject/rocket-chip/vsrc/TestDriver.v", line 130.
$finish at simulation time 3802050
V C S S i m u l a t i o n R e p o r t
Time: 38020500 ps
CPU Time: 15.000 seconds; Data structure size: 513.8Mb
Tue Mar 6 14:30:28 2018
bash: __git_ps1: command not found
schuyler@silserv1:~/repos/github.com/freechipsproject/rocket-chip/vsim$
One unknown short option (-q
) inside +permissive
/+permissive-off
. There is no stderr getopt complaint from inside htif.cc.
> ./simv-freechips.rocketchip.system-DefaultConfig +permissive -q +ntb_random_seed_automatic +permissive-off +permissive +max-cycles=100000000 +permissive-off $RISCV/riscv64-unknown-elf/share/riscv-tests/isa/rv64si-p-wfi 3>&1 1>&2 2>&3
NOTE: automatic random seed used: 3613937659
$finish called from file "/home/schuyler/repos/github.com/freechipsproject/rocket-chip/vsrc/TestDriver.v", line 130.
$finish at simulation time 3778050
bash: __git_ps1: command not found
schuyler@silserv1:~/repos/github.com/freechipsproject/rocket-chip/vsim$
One unknown short option (-q
) outside of +permissve
guards. This generates getopt stderr and an exception
> ./simv-freechips.rocketchip.system-DefaultConfig -q +permissive +ntb_random_seed_automatic +permissive-off +permissive +max-cycles=100000000 +permissive-off $RISCV/riscv64-unknown-elf/share/riscv-tests/isa/rv64si-p-wfi 3>&1 1>&2 2>&3
NOTE: automatic random seed used: 3743293718
./simv-freechips.rocketchip.system-DefaultConfig: invalid option -- 'q'
terminate called after throwing an instance of 'std::invalid_argument'
what(): Unknown argument (did you mean to enable +permissive parsing?)
bash: __git_ps1: command not found
schuyler@silserv1:~/repos/github.com/freechipsproject/rocket-chip/vsim$
Attempt to nest +permissive
throws an exception
> ./simv-freechips.rocketchip.system-DefaultConfig +permissive +permissive +ntb_random_seed_automatic +permissive-off +permissive +max-cycles=100000000 +permissive-off $RISCV/riscv64-unknown-elf/share/riscv-tests/isa/rv64si-p-wfi 3>&1 1>&2 2>&3
Chronologic VCS simulator copyright 1991-2013
Contains Synopsys proprietary information.
Compiler version H-2013.06-SP1_Full64; Runtime version H-2013.06-SP1_Full64; Mar 6 14:31 2018
NOTE: automatic random seed used: 541785289
terminate called after throwing an instance of 'std::invalid_argument'
what(): Found +permissive when already parsing permissively
bash: __git_ps1: command not found
schuyler@silserv1:~/repos/github.com/freechipsproject/rocket-chip/vsim$
Attempt to use +permissive-off
when not permissively parsing throws an exception
> ./simv-freechips.rocketchip.system-DefaultConfig +permissive +ntb_random_seed_automatic +permissive-off +permissive-off +permissive +max-cycles=100000000 +permissive-off $RISCV/riscv64-unknown-elf/share/riscv-tests/isa/rv64si-p-wfi 3>&1 1>&2 2>&3
Chronologic VCS simulator copyright 1991-2013
Contains Synopsys proprietary information.
Compiler version H-2013.06-SP1_Full64; Runtime version H-2013.06-SP1_Full64; Mar 6 14:31 2018
NOTE: automatic random seed used: 3254520216
terminate called after throwing an instance of 'std::invalid_argument'
what(): Found +permissive-off when not parsing permissively
bash: __git_ps1: command not found
This removes
bool permissive
from htif.cc, which was originally used to control whether or not htif was parsing arguments permissively. This instead uses getopt's builtinint opterr
to hold this state. getopt then uses this to print/not print to stderr on unknown options.Resultingly, unknown VCS options will not produce any stderr output.
From discussion in https://github.com/freechipsproject/rocket-chip/pull/1266#issuecomment-370890731.