Fix real constant parameter functions, bug475.
This commit is contained in:
parent
f32a422330
commit
d45d58b6bf
2
Changes
2
Changes
|
|
@ -14,6 +14,8 @@ indicates the contributor was also the author of the fix; Thanks!
|
||||||
|
|
||||||
**** Fix genvar and begin under generate, bug461. [Alex Solomatnikov]
|
**** Fix genvar and begin under generate, bug461. [Alex Solomatnikov]
|
||||||
|
|
||||||
|
**** Fix real constant parameter functions, bug475. [Alex Solomatnikov]
|
||||||
|
|
||||||
**** Fix and document --gdb option, bug454. [Jeremy Bennett]
|
**** Fix and document --gdb option, bug454. [Jeremy Bennett]
|
||||||
|
|
||||||
**** Fix OpenSolaris compile error. [Sanjay Singh]
|
**** Fix OpenSolaris compile error. [Sanjay Singh]
|
||||||
|
|
|
||||||
|
|
@ -339,7 +339,8 @@ string V3Number::ascii(bool prefixed, bool cleanVerilog) const {
|
||||||
|
|
||||||
if (isDouble()) {
|
if (isDouble()) {
|
||||||
out.precision(17);
|
out.precision(17);
|
||||||
out<<toDouble();
|
if (width()!=64) out<<"%E-bad-width-double";
|
||||||
|
else out<<toDouble();
|
||||||
return out.str();
|
return out.str();
|
||||||
}
|
}
|
||||||
if (prefixed) {
|
if (prefixed) {
|
||||||
|
|
|
||||||
|
|
@ -156,6 +156,7 @@ public:
|
||||||
bool isFromString() const { return m_fromString; }
|
bool isFromString() const { return m_fromString; }
|
||||||
bool isSigned() const { return m_signed; } // Only correct for parsing of numbers from strings, otherwise not used (use AstConst::isSigned())
|
bool isSigned() const { return m_signed; } // Only correct for parsing of numbers from strings, otherwise not used (use AstConst::isSigned())
|
||||||
bool isDouble() const { return m_double; } // Only correct for parsing of numbers from strings, otherwise not used (use AstConst::isSigned())
|
bool isDouble() const { return m_double; } // Only correct for parsing of numbers from strings, otherwise not used (use AstConst::isSigned())
|
||||||
|
void isDouble(bool flag) { m_double=flag; } // Only if have 64 bit value loaded, and want to indicate it's real
|
||||||
bool isNegative() const { return bitIs1(width()-1); }
|
bool isNegative() const { return bitIs1(width()-1); }
|
||||||
bool isFourState() const { for (int i=0;i<words();i++) {if (m_valueX[i]) return true;} return false; }
|
bool isFourState() const { for (int i=0;i<words();i++) {if (m_valueX[i]) return true;} return false; }
|
||||||
bool hasZ() const { for(int i=0;i<words();i++) {if((~m_value[i]) & m_valueX[i]) return true;} return false;}
|
bool hasZ() const { for(int i=0;i<words();i++) {if((~m_value[i]) & m_valueX[i]) return true;} return false;}
|
||||||
|
|
|
||||||
|
|
@ -144,6 +144,7 @@ private:
|
||||||
nump = new V3Number (nodep->fileline(), nodep->width(), value);
|
nump = new V3Number (nodep->fileline(), nodep->width(), value);
|
||||||
m_numAllps.push_back(nump);
|
m_numAllps.push_back(nump);
|
||||||
}
|
}
|
||||||
|
nump->isDouble(nodep->isDouble());
|
||||||
return nump;
|
return nump;
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
#!/usr/bin/perl
|
||||||
|
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
|
||||||
|
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||||
|
#
|
||||||
|
# Copyright 2003 by Wilson Snyder. This program is free software; you can
|
||||||
|
# redistribute it and/or modify it under the terms of either the GNU
|
||||||
|
# Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
|
# Version 2.0.
|
||||||
|
|
||||||
|
compile (
|
||||||
|
);
|
||||||
|
|
||||||
|
execute (
|
||||||
|
check_finished=>1,
|
||||||
|
);
|
||||||
|
|
||||||
|
ok(1);
|
||||||
|
1;
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
// DESCRIPTION: Verilator: Verilog Test module
|
||||||
|
//
|
||||||
|
// This file ONLY is placed into the Public Domain, for any use,
|
||||||
|
// without warranty, 2012 by Wilson Snyder.
|
||||||
|
|
||||||
|
// bug475
|
||||||
|
|
||||||
|
module t();
|
||||||
|
|
||||||
|
function real get_real_one;
|
||||||
|
input ignored;
|
||||||
|
get_real_one = 1.1;
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
localparam R_PARAM = get_real_one(1'b0);
|
||||||
|
localparam R_PARAM_2 = (R_PARAM > 0);
|
||||||
|
|
||||||
|
generate
|
||||||
|
initial begin
|
||||||
|
if (R_PARAM != 1.1) $stop;
|
||||||
|
if (R_PARAM_2 != 1'b1) $stop;
|
||||||
|
$write("*-* All Finished *-*\n");
|
||||||
|
$finish;
|
||||||
|
end
|
||||||
|
endgenerate
|
||||||
|
|
||||||
|
endmodule
|
||||||
Loading…
Reference in New Issue