I uploaded version 13 to the mantis database.
Francoise
'
________________________________
From: Steven Sharp
Sent: Monday, June 13, 2011 12:37 PM
To: Francoise Martinolle; Little Scott-B11206; sv-dc@eda.org
Subject: RE: mantis 3398 updated
That looks good.
From: Francoise Martinolle
Sent: Monday, June 13, 2011 12:35 PM
To: Steven Sharp; Little Scott-B11206; sv-dc@eda.org
Subject: RE: mantis 3398 updated
Steven,
I changed the example to this:
class Base #(parameter p = 1);
typedef struct {
real r;
bit[p-1:0] other_data;
} T;
static function T Tsum(input T driver[]);
Tsum.r= 0.0;
Tsum.data = 0;
foreach (driver[i])
Tsum.rdata += driver[i]. rdata;
Tsum.r = $itor(Tsum.data);
endfunction
endclass
typedef Base#(32) MyBaseT;
nettype MyBaseT::T narrowTsum with MyBaseT::Tsum;
typedef Base#(3264) MyBaseType;
nettype MyBaseType::T wideTsum with MyBaseType::Tsum;
narrowTsum net1; // other_data is 32 bits wide
wideTsum net2; // other_data is 3264 bits wide
________________________________
From: Steven Sharp
Sent: Monday, June 13, 2011 12:27 PM
To: Francoise Martinolle; Little Scott-B11206; sv-dc@eda.org
Subject: RE: mantis 3398 updated
I expect that you meant to use $itor, not $bitstoreal. The $itor system function converts an integer to a real with truncation (or you could simply assign the value without a system function to get rounding). The $bitstoreal function treats the integer as the bits of the representation of a floating point number, so it makes no sense unless the bit vector is exactly 64 bits. The exact representation is not specified (e.g. even if it is assumed to use IEEE floating point format, ordering of the bits could vary with implementation) so it isn't guaranteed to make sense for any value not produced by $realtobits.
The revised example does make use of the parameterized data field, and it shows an example of a driven field (data) being used to compute a dependent value (r). However, it seems like a less realistic example than the previous one, and the name Tsum no longer seems appropriate. I would suggest that it go back to adding up the data values, rather than ORing them together. Then it would make more sense if the parameter value were larger than 2 in the first specialization.
From: owner-sv-dc@eda.org [mailto:owner-sv-dc@eda.org] On Behalf Of Francoise Martinolle
Sent: Monday, June 13, 2011 12:06 PM
To: Little Scott-B11206; sv-dc@eda.org
Subject: [sv-dc] RE: mantis 3398 updated
I changed the whole example.
How does this look like?
class Base #(parameter p = 1);
typedef struct {
real r;
bit[p-1:0] other_data;
} T;
static function T Tsum(input T driver[]);
Tsum.r= 0.0;
Tsum.data = 0;
foreach (driver[i])
Tsum.rdata +|= driver[i]. rdata;
Tsum.r = $bitstoreal(Tsum.data);
endfunction
endclass
typedef Base#(2) MyBaseT;
nettype MyBaseT::T narrowTsum with MyBaseT::Tsum;
typedef Base#(32) MyBaseType;
nettype MyBaseType::T wideTsum with MyBaseType::Tsum;
narrowTsum net1; // other_data is 2 bits wide
wideTsum net2; // other_data is 32 bits wide
-- This message has been scanned for viruses and dangerous content by MailScanner<http://www.mailscanner.info/>, and is believed to be clean. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Mon Jun 13 09:39:46 2011
This archive was generated by hypermail 2.1.8 : Mon Jun 13 2011 - 09:39:47 PDT