Fix with SV string, bug947.

This commit is contained in:
Wilson Snyder 2015-07-21 18:36:27 -04:00
parent 1891cfd79a
commit 445c83a60d
5 changed files with 17 additions and 0 deletions

View File

@ -15,6 +15,8 @@ indicates the contributor was also the author of the fix; Thanks!
**** Fix rounding in trace $timescale, bug946. [Frederic Requin]
**** Fix $fopen with SV string, bug947. [Sven Stucki]
* Verilator 3.874 2015-06-06

View File

@ -750,6 +750,11 @@ IData VL_FGETS_IXI(int obits, void* destp, IData fpi) {
return got;
}
IData VL_FOPEN_NI(const string& filename, IData mode) {
char modez[5];
_VL_VINT_TO_STRING(VL_WORDSIZE, modez, &mode);
return VL_FOPEN_S(filename.c_str(), modez);
}
IData VL_FOPEN_QI(QData filename, IData mode) {
IData fnw[2]; VL_SET_WQ(fnw, filename);
return VL_FOPEN_WI(2, fnw, mode);

View File

@ -357,6 +357,7 @@ extern IData VL_FOPEN_WI(int fnwords, WDataInP ofilename, IData mode);
extern IData VL_FOPEN_QI(QData ofilename, IData mode);
inline IData VL_FOPEN_II(IData ofilename, IData mode) { return VL_FOPEN_QI(ofilename,mode); }
extern void VL_FCLOSE_I(IData fdi);
extern void VL_READMEM_W(bool hex, int width, int depth, int array_lsb, int fnwords,

View File

@ -60,6 +60,7 @@ inline string VL_REPLICATEN_NNI(int obits,int lbits,int rbits, const string& lhs
return VL_REPLICATEN_NNQ(obits,lbits,rbits,lhs,rep);
}
extern IData VL_FOPEN_NI(const string& filename, IData mode);
extern IData VL_SSCANF_INX(int lbits, const string& ld, const char* formatp, ...);
extern void VL_SFORMAT_X(int obits_ignored, string &output, const char* formatp, ...);
extern string VL_SFORMATF_NX(const char* formatp, ...);

View File

@ -66,6 +66,14 @@ module t;
$fclose(file);
end
begin
// Check read functions w/string
s = "t/t_sys_file_basic_input.dat";
file = $fopen(s,"r");
if ($feof(file)) $stop;
$fclose(file);
end
begin
// Check read functions
file = $fopen("t/t_sys_file_basic_input.dat","r");