mirror of
https://github.com/verilator/verilator.git
synced 2025-01-01 04:07:34 +00:00
Fix $system
with string argument (#5042).
This commit is contained in:
parent
a8b5738b44
commit
1012c054e6
1
Changes
1
Changes
@ -13,6 +13,7 @@ Verilator 5.025 devel
|
||||
|
||||
**Minor:**
|
||||
|
||||
* Fix `$system` with string argument (#5042).
|
||||
|
||||
|
||||
Verilator 5.024 2024-04-05
|
||||
|
@ -1749,7 +1749,10 @@ IData VL_SYSTEM_IQ(QData lhs) VL_MT_SAFE {
|
||||
IData VL_SYSTEM_IW(int lhswords, const WDataInP lhsp) VL_MT_SAFE {
|
||||
char filenamez[VL_VALUE_STRING_MAX_CHARS + 1];
|
||||
_vl_vint_to_string(lhswords * VL_EDATASIZE, filenamez, lhsp);
|
||||
const int code = std::system(filenamez); // Yes, std::system() is threadsafe
|
||||
return VL_SYSTEM_IN(filenamez);
|
||||
}
|
||||
IData VL_SYSTEM_IN(const std::string& lhs) VL_MT_SAFE {
|
||||
const int code = std::system(lhs.c_str()); // Yes, std::system() is threadsafe
|
||||
return code >> 8; // Want exit status
|
||||
}
|
||||
|
||||
|
@ -152,6 +152,7 @@ extern std::string VL_STACKTRACE_N() VL_MT_SAFE;
|
||||
extern IData VL_SYSTEM_IW(int lhswords, WDataInP const lhsp) VL_MT_SAFE;
|
||||
extern IData VL_SYSTEM_IQ(QData lhs) VL_MT_SAFE;
|
||||
inline IData VL_SYSTEM_II(IData lhs) VL_MT_SAFE { return VL_SYSTEM_IQ(lhs); }
|
||||
extern IData VL_SYSTEM_IN(const std::string& lhs) VL_MT_SAFE;
|
||||
|
||||
extern IData VL_TESTPLUSARGS_I(const std::string& format) VL_MT_SAFE;
|
||||
extern const char* vl_mc_scan_plusargs(const char* prefixp) VL_MT_SAFE; // PLIish
|
||||
|
@ -7,6 +7,7 @@
|
||||
module t;
|
||||
|
||||
integer i;
|
||||
string s;
|
||||
|
||||
initial begin
|
||||
`ifndef VERILATOR
|
||||
@ -26,6 +27,9 @@ module t;
|
||||
if (i!==10) $stop;
|
||||
i = $system("exit 20"); // Wide
|
||||
if (i!==20) $stop;
|
||||
s = "exit 10";
|
||||
i = $system(s); // String
|
||||
if (i!==10) $stop;
|
||||
`endif
|
||||
|
||||
$write("*-* All Finished *-*\n");
|
||||
|
Loading…
Reference in New Issue
Block a user