Internals: Use D for double; fix t_dist_uint

This commit is contained in:
Wilson Snyder 2010-01-16 20:30:29 -05:00
parent d46074e0ad
commit ba07dc1804
4 changed files with 14 additions and 9 deletions

View File

@ -42,14 +42,15 @@ using namespace std;
//=========================================================================
// Basic types
// P // Packed data of bit type (C/S/I/Q/W)
typedef vluint8_t CData; ///< Verilated pack data, 1-8 bits
typedef vluint16_t SData; ///< Verilated pack data, 9-16 bits
typedef vluint32_t IData; ///< Verilated pack data, 17-32 bits
typedef vluint64_t QData; ///< Verilated pack data, 33-64 bits
typedef vluint32_t WData; ///< Verilated pack data, >64 bits, as an array
// float F // No typedef needed; Verilator uses float
// double G // No typedef needed; Verilator uses double
// string N // No typedef needed; Verilator uses double
// double D // No typedef needed; Verilator uses double
// string N // No typedef needed; Verilator uses string
typedef const WData* WDataInP; ///< Array input to a function
typedef WData* WDataOutP; ///< Array output from a function

View File

@ -74,7 +74,7 @@ public:
void emitVarCtors();
bool emitSimpleOk(AstNodeMath* nodep);
void emitIQW(AstNode* nodep) {
// Other abbrevs: "C"har, "S"hort, "F"loat, "G"double, stri"N"g
// Other abbrevs: "C"har, "S"hort, "F"loat, "D"ouble, stri"N"g
puts (nodep->isWide()?"W":(nodep->isQuad()?"Q":"I"));
}
void emitScIQW(AstVar* nodep) {

View File

@ -18,17 +18,21 @@ if (!-r "$root/.git") {
### Must trim output before and after our file list
#my $files = "*/*.c* */*.h test_regress/t/*.c* test_regress/t/*.h";
# src isn't clean, and probably doesn't need to be (yet?)
my $files = "include/*.c* include/*.h test_c/*.c* test_c/*.h test_regress/t/*.c* test_regress/t/*.h";
my $files = "include/*.c* include/*.h test_c/*.c* test_regress/t/*.c* test_regress/t/*.h";
my $cmd = "cd $root && fgrep -n int $files | sort";
print "C $cmd\n";
my $grep = `$cmd`;
my %names;
foreach my $line (split /\n/, $grep) {
next if $line !~ /uint\d+_t/;
$line =~ s!//.*$!!;
next if $line !~ /uint\d+_t\b/;
next if $line =~ /vl[su]int\d+_t/;
next if $line =~ /typedef/;
next if $line =~ m!include/svdpi.h!; # Not ours
$names{$1} = 1 if $line =~ /^([^:]+)/;
if ($line =~ /^([^:]+)/) {
$names{$1} = 1;
print $line;
}
}
if (keys %names) {
$Self->error("Files with uint32*_t instead of vluint32s: ",join(' ',sort keys %names));

View File

@ -88,7 +88,7 @@ module t ();
chandle i_c, o_c;
`ifndef VERILATOR
string i_n, o_n;
real i_g, o_g;
real i_d, o_d;
`endif
`ifndef NO_SHORTREAL
shortreal i_f, o_f;
@ -136,7 +136,7 @@ module t ();
if (dpii_f_chandle (i_c) !== i_c) $stop;
`ifndef VERILATOR
if (dpii_f_string (i_n) != i_n) $stop;
if (dpii_f_real (i_g) != i_g+1.5) $stop;
if (dpii_f_real (i_d) != i_d+1.5) $stop;
`endif
`ifndef NO_SHORTREAL
if (dpii_f_shortreal(i_f) != i_f+1.5) $stop;
@ -152,7 +152,7 @@ module t ();
`ifndef VCS // Strange link error
dpii_v_string (i_n,o_n); if (o_n != i_n) $stop;
`endif
dpii_v_real (i_g,o_g); if (o_g != i_g+1.5) $stop;
dpii_v_real (i_d,o_d); if (o_d != i_d+1.5) $stop;
`endif
`ifndef NO_SHORTREAL
dpii_v_shortreal(i_f,o_f); if (o_f != i_f+1.5) $stop;