mirror of
https://github.com/verilator/verilator.git
synced 2025-01-31 18:54:03 +00:00
Fix underscores in real literals, bug863.
This commit is contained in:
parent
2b5017e610
commit
5c3eee34a1
2
Changes
2
Changes
@ -23,6 +23,8 @@ indicates the contributor was also the author of the fix; Thanks!
|
|||||||
|
|
||||||
**** Fix bare generates in interfaces, bug789. [Bob Newgard]
|
**** Fix bare generates in interfaces, bug789. [Bob Newgard]
|
||||||
|
|
||||||
|
**** Fix underscores in real literals, bug863. [Jonathon Donaldson]
|
||||||
|
|
||||||
|
|
||||||
* Verilator 3.866 2014-11-15
|
* Verilator 3.866 2014-11-15
|
||||||
|
|
||||||
|
@ -972,15 +972,14 @@ int V3ParseImp::stateVerilogRecent() { return STATE_VERILOG_RECENT; }
|
|||||||
double V3ParseImp::parseDouble(const char* textp, size_t length) {
|
double V3ParseImp::parseDouble(const char* textp, size_t length) {
|
||||||
char* strgp = new char[length+1];
|
char* strgp = new char[length+1];
|
||||||
char* dp=strgp;
|
char* dp=strgp;
|
||||||
for (const char* sp=textp; sp<(textp+length);) {
|
for (const char* sp=textp; sp<(textp+length); ++sp) {
|
||||||
if (*sp != '_') *dp++ = *sp++;
|
if (*sp != '_') *dp++ = *sp;
|
||||||
else sp++;
|
|
||||||
}
|
}
|
||||||
*dp++ = '\0';
|
*dp++ = '\0';
|
||||||
char* endp = strgp;
|
char* endp = strgp;
|
||||||
double d = strtod(strgp, &endp);
|
double d = strtod(strgp, &endp);
|
||||||
size_t parsed_len = endp-strgp;
|
size_t parsed_len = endp-strgp;
|
||||||
if (parsed_len != length) { yyerrorf("Syntax error parsing real: %s",strgp); }
|
if (parsed_len != strlen(strgp)) { yyerrorf("Syntax error parsing real: %s",strgp); }
|
||||||
delete strgp;
|
delete strgp;
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ module t (/*AUTOARG*/
|
|||||||
sub_cast_bug374 sub (.cyc5(cyc[4:0]), .*);
|
sub_cast_bug374 sub (.cyc5(cyc[4:0]), .*);
|
||||||
|
|
||||||
initial begin
|
initial begin
|
||||||
|
if (1_00_0.0_1 != 1000.01) $stop;
|
||||||
// rtoi truncates
|
// rtoi truncates
|
||||||
if ($rtoi(36.7) != 36) $stop;
|
if ($rtoi(36.7) != 36) $stop;
|
||||||
if ($rtoi(36.5) != 36) $stop;
|
if ($rtoi(36.5) != 36) $stop;
|
||||||
|
Loading…
Reference in New Issue
Block a user