Spectre HDL $fread() question

R

rubin

Guest
Greeting to all,

I'm using $fread() function in spectreHDL. The code is as the
following:

finput = $fopen("dataFileName","r");
while(! $fread(finput,"%e %e\n",V1[size],I1[size]));

//"V1,I1" are real type array, "finput" is the input file handle

to read in the following data file in:

0.0e-1 3.0e-1
1.0e-1 2.969e-1
2.0e-1 2.875e-1
3.0e-1 2.711e-1
4.0e-1 2.462e-1
5.0e-1 2.100e-1
6.0e-1 1.545e-1
7.0e-1 0.000e-1

This data file is exactly of the format "%e %e\n" (At least, I think
it is). But when I simulate it in Cadence, it keeps on complaining as
the following:

******************************************************************
Fatal error found by spectre during DC analysis `dc'.
"/usr/local/cadence/db/rect/ahdl/ahdl.def" 19: format string in
$fread() does not match input file.

Analysis `dc' terminated prematurely due to error.
******************************************************************

Line 19 is the the $fread() code line described at the beginning.

Anybody has similar experience? Does this mean something is wrong with
our cadence enviorment? We use ic446. Any advice will be appriciated.

Thanks,

Tian
 
You should post the complete model; it's very difficult to help out with just
the error and a snippet of the code.

Andrew.

On 13 Jan 2004 09:58:17 -0800, rubinzhao@yahoo.com (rubin) wrote:

Greeting to all,

I'm using $fread() function in spectreHDL. The code is as the
following:

finput = $fopen("dataFileName","r");
while(! $fread(finput,"%e %e\n",V1[size],I1[size]));

//"V1,I1" are real type array, "finput" is the input file handle

to read in the following data file in:

0.0e-1 3.0e-1
1.0e-1 2.969e-1
2.0e-1 2.875e-1
3.0e-1 2.711e-1
4.0e-1 2.462e-1
5.0e-1 2.100e-1
6.0e-1 1.545e-1
7.0e-1 0.000e-1

This data file is exactly of the format "%e %e\n" (At least, I think
it is). But when I simulate it in Cadence, it keeps on complaining as
the following:

******************************************************************
Fatal error found by spectre during DC analysis `dc'.
"/usr/local/cadence/db/rect/ahdl/ahdl.def" 19: format string in
$fread() does not match input file.

Analysis `dc' terminated prematurely due to error.
******************************************************************

Line 19 is the the $fread() code line described at the beginning.

Anybody has similar experience? Does this mean something is wrong with
our cadence enviorment? We use ic446. Any advice will be appriciated.

Thanks,

Tian
--
Andrew Beckett
Senior Technical Leader
Custom IC Solutions
Cadence Design Systems Ltd
 
All right, here it is:

// Spectre AHDL for mitllmp6, rectenna_emp, ahdl

#define Nmax 200

module rectenna_emp (p,n) (order)
node [V,I] p,n; //2 nodes module
parameter integer order = 1 from [1:3]; //Interpolation order

{
table VIdata; //Interpolation table
real V1[Nmax], I1[Nmax]; //real type array defination
real vd; //temp variable to hold voltage as interpolation input.
integer size = 0;
stream finput; //file handle
initial
{
finput = $fopen("/home/ecestud/zhaot/proj_mit/v_i.data","r");
while(! $fread(finput,"%e %e\n",V1[size],I1[size]));
{
size++;
}
$fclose(finput);

VIdata=$build_table(order,I1,V1,size);
}
analog
{
vd = V(p,n);
I(n,p)<- $interpolate(VIdata,vd);
}
}

That's all for the module. This is not much different from the
magnetic core B-H characteristic modeling example, which is given by
the spectreHDL manual. But, for some reason, it just complains and
displays the message as I mentioned in the first email. The data file
it reads in is as shown in the first email.

Thanks,

Tian

Andrew Beckett <andrewb@DELETETHISBITcadence.com> wrote in message news:<a6n800puttpvbjsnu67b2v4p0n3pv4fmc4@4ax.com>...
You should post the complete model; it's very difficult to help out with just
the error and a snippet of the code.

Andrew.

On 13 Jan 2004 09:58:17 -0800, rubinzhao@yahoo.com (rubin) wrote:

Greeting to all,

I'm using $fread() function in spectreHDL. The code is as the
following:

finput = $fopen("dataFileName","r");
while(! $fread(finput,"%e %e\n",V1[size],I1[size]));

//"V1,I1" are real type array, "finput" is the input file handle

to read in the following data file in:

0.0e-1 3.0e-1
1.0e-1 2.969e-1
2.0e-1 2.875e-1
3.0e-1 2.711e-1
4.0e-1 2.462e-1
5.0e-1 2.100e-1
6.0e-1 1.545e-1
7.0e-1 0.000e-1

This data file is exactly of the format "%e %e\n" (At least, I think
it is). But when I simulate it in Cadence, it keeps on complaining as
the following:

******************************************************************
Fatal error found by spectre during DC analysis `dc'.
"/usr/local/cadence/db/rect/ahdl/ahdl.def" 19: format string in
$fread() does not match input file.

Analysis `dc' terminated prematurely due to error.
******************************************************************

Line 19 is the the $fread() code line described at the beginning.

Anybody has similar experience? Does this mean something is wrong with
our cadence enviorment? We use ic446. Any advice will be appriciated.

Thanks,

Tian
 
Hi Tian,

I think it's a bug, which you should report to Cadence via your normal support
channel.

I did some experiments, and found that if I omitted the \n from the format
string, it can read the first line in the file, but fails on subsequent lines.
It seems to be something to do with the carriage returns, which is odd, because
I'd expect those to be interpreted as whitespace (this is what C's fscanf
does, as does SKILL's fscanf).

I came up with a workaround, which is to use the %[] syntax to read the
separators as a dummy string. This seems to work fine (see below).
Note, you had an error in your code; there was a semicolon at the
end of the while statement which would have meant (if it had worked)
that it would read all the lines from the file, but not store them in the
array).

Regards,

Andrew.

// Spectre AHDL for mitllmp6, rectenna_emp, ahdl

#define Nmax 200

module rectenna_emp (p,n) (order)
node [V,I] p,n; //2 nodes module
parameter integer order = 1 from [1:3]; //Interpolation order

{
table VIdata; //Interpolation table
real V1[Nmax], I1[Nmax]; //real type array defination
real vd; //temp variable to hold voltage as interpolation input.
string dummy;
integer size = 0;
stream finput; //file handle
initial
{
finput = $fopen("rubin.data","r");
//while(! $fread(finput,"%e %e\n",V1[size],I1[size]));
while(!
$fread(finput,"%e%[^0-9.]%e%[^0-9]",V1[size],dummy,I1[size],dummy))
{
$debug("debug %e %e\n",V1[size],I1[size]);
size=size+1;
}
$debug("Size is %d\n",size);
$fclose(finput);

VIdata=$build_table(order,I1,V1,size);
}
analog
{
vd = V(p,n);
I(n,p)<- $interpolate(VIdata,vd);
}
}


On 13 Jan 2004 19:09:42 -0800, rubinzhao@yahoo.com (rubin) wrote:

All right, here it is:

// Spectre AHDL for mitllmp6, rectenna_emp, ahdl

#define Nmax 200

module rectenna_emp (p,n) (order)
node [V,I] p,n; //2 nodes module
parameter integer order = 1 from [1:3]; //Interpolation order

{
table VIdata; //Interpolation table
real V1[Nmax], I1[Nmax]; //real type array defination
real vd; //temp variable to hold voltage as interpolation input.
integer size = 0;
stream finput; //file handle
initial
{
finput = $fopen("/home/ecestud/zhaot/proj_mit/v_i.data","r");
while(! $fread(finput,"%e %e\n",V1[size],I1[size]));
{
size++;
}
$fclose(finput);

VIdata=$build_table(order,I1,V1,size);
}
analog
{
vd = V(p,n);
I(n,p)<- $interpolate(VIdata,vd);
}
}

That's all for the module. This is not much different from the
magnetic core B-H characteristic modeling example, which is given by
the spectreHDL manual. But, for some reason, it just complains and
displays the message as I mentioned in the first email. The data file
it reads in is as shown in the first email.

Thanks,

Tian
--
Andrew Beckett
Senior Technical Leader
Custom IC Solutions
Cadence Design Systems Ltd
 
Hi Andrew,

I tried the alternative way, it works perfect. I will report the bug to Cadence.

Thanks so much for the help.

best,

Tian

Andrew Beckett <andrewb@DELETETHISBITcadence.com> wrote in message news:<8lea009tvevor235ihfvl239p27tqhni2t@4ax.com>...
Hi Tian,

I think it's a bug, which you should report to Cadence via your normal support
channel.

I did some experiments, and found that if I omitted the \n from the format
string, it can read the first line in the file, but fails on subsequent lines.
It seems to be something to do with the carriage returns, which is odd, because
I'd expect those to be interpreted as whitespace (this is what C's fscanf
does, as does SKILL's fscanf).

I came up with a workaround, which is to use the %[] syntax to read the
separators as a dummy string. This seems to work fine (see below).
Note, you had an error in your code; there was a semicolon at the
end of the while statement which would have meant (if it had worked)
that it would read all the lines from the file, but not store them in the
array).

Regards,

Andrew.
 
Hi Tian,

To avoid re-work for my colleagues when you report this, please can you
point them to this discussion? (on google say) so that they can see the
workaround too.

Thanks,

Andrew.

On 14 Jan 2004 21:14:33 -0800, rubinzhao@yahoo.com (rubin) wrote:

Hi Andrew,

I tried the alternative way, it works perfect. I will report the bug to Cadence.

Thanks so much for the help.

best,

Tian

Andrew Beckett <andrewb@DELETETHISBITcadence.com> wrote in message news:<8lea009tvevor235ihfvl239p27tqhni2t@4ax.com>...
Hi Tian,

I think it's a bug, which you should report to Cadence via your normal support
channel.

I did some experiments, and found that if I omitted the \n from the format
string, it can read the first line in the file, but fails on subsequent lines.
It seems to be something to do with the carriage returns, which is odd, because
I'd expect those to be interpreted as whitespace (this is what C's fscanf
does, as does SKILL's fscanf).

I came up with a workaround, which is to use the %[] syntax to read the
separators as a dummy string. This seems to work fine (see below).
Note, you had an error in your code; there was a semicolon at the
end of the while statement which would have meant (if it had worked)
that it would read all the lines from the file, but not store them in the
array).

Regards,

Andrew.
--
Andrew Beckett
Senior Technical Leader
Custom IC Solutions
Cadence Design Systems Ltd
 
Andrew Beckett wrote:
Hi Tian,

To avoid re-work for my colleagues when you report this, please can you
point them to this discussion? (on google say) so that they can see the
workaround too.

Thanks,

Andrew.

On 14 Jan 2004 21:14:33 -0800, rubinzhao@yahoo.com (rubin) wrote:


Hi Andrew,

I tried the alternative way, it works perfect. I will report the bug to Cadence.

Thanks so much for the help.

best,

Tian

Andrew Beckett <andrewb@DELETETHISBITcadence.com> wrote in message news:<8lea009tvevor235ihfvl239p27tqhni2t@4ax.com>...

Hi Tian,

I think it's a bug, which you should report to Cadence via your normal support
channel.

I did some experiments, and found that if I omitted the \n from the format
string, it can read the first line in the file, but fails on subsequent lines.
It seems to be something to do with the carriage returns, which is odd, because
I'd expect those to be interpreted as whitespace (this is what C's fscanf
does, as does SKILL's fscanf).

I came up with a workaround, which is to use the %[] syntax to read the
separators as a dummy string. This seems to work fine (see below).
Note, you had an error in your code; there was a semicolon at the
end of the while statement which would have meant (if it had worked)
that it would read all the lines from the file, but not store them in the
array).

Regards,

Andrew.
Tian & Andrew ,

isn t this just the usual infamous DOS versus unix versus Mac line-end
problem in ASCII files ?
I believe that dos files have <cr><lf> whereas unix expects only <cr>
and Macs expect only <lf>

This is the cause of the most unusual/cryptic messages also with skill
files. It happens when your files where generated by windows/dirty-OS
tools, or transfered through some "intelligent" ftp or SMB client/server
setup.

Under linux, the "file" command tells you wether your ascii file is
with dos or unix line-ends (I assume solaris does the same).
 
Possibly, but that was the first thing I checked when I tried it out...
My files were completely with UNIX end-of-line characters.

Andrew.

On Mon, 19 Jan 2004 15:15:59 +0100, fogh
<cad_support@skipthisandunderscores.catena.nl> wrote:

Andrew Beckett wrote:
Hi Tian,

To avoid re-work for my colleagues when you report this, please can you
point them to this discussion? (on google say) so that they can see the
workaround too.

Thanks,

Andrew.

On 14 Jan 2004 21:14:33 -0800, rubinzhao@yahoo.com (rubin) wrote:


Hi Andrew,

I tried the alternative way, it works perfect. I will report the bug to Cadence.

Thanks so much for the help.

best,

Tian

Andrew Beckett <andrewb@DELETETHISBITcadence.com> wrote in message news:<8lea009tvevor235ihfvl239p27tqhni2t@4ax.com>...

Hi Tian,

I think it's a bug, which you should report to Cadence via your normal support
channel.

I did some experiments, and found that if I omitted the \n from the format
string, it can read the first line in the file, but fails on subsequent lines.
It seems to be something to do with the carriage returns, which is odd, because
I'd expect those to be interpreted as whitespace (this is what C's fscanf
does, as does SKILL's fscanf).

I came up with a workaround, which is to use the %[] syntax to read the
separators as a dummy string. This seems to work fine (see below).
Note, you had an error in your code; there was a semicolon at the
end of the while statement which would have meant (if it had worked)
that it would read all the lines from the file, but not store them in the
array).

Regards,

Andrew.

Tian & Andrew ,

isn t this just the usual infamous DOS versus unix versus Mac line-end
problem in ASCII files ?
I believe that dos files have <cr><lf> whereas unix expects only <cr
and Macs expect only <lf

This is the cause of the most unusual/cryptic messages also with skill
files. It happens when your files where generated by windows/dirty-OS
tools, or transfered through some "intelligent" ftp or SMB client/server
setup.

Under linux, the "file" command tells you wether your ascii file is
with dos or unix line-ends (I assume solaris does the same).
--
Andrew Beckett
Senior Technical Leader
Custom IC Solutions
Cadence Design Systems Ltd
 

Welcome to EDABoard.com

Sponsor

Back
Top