The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl
Simulators >> Circuit Simulators >> Feature like IFDEF for Spectre?
https://designers-guide.org/forum/YaBB.pl?num=1170774276

Message started by Daniel_Platte on Feb 6th, 2007, 7:04am

Title: Feature like IFDEF for Spectre?
Post by Daniel_Platte on Feb 6th, 2007, 7:04am

Hi,

I would like to change Spectre netlists controlled by an environment variable within a script-automated simulation. Is there a feature like IFDEF for the Spectre netlist parser? How can I access environment variables within the netlist?

Example:
-> if $DEBUG is set, add additional netlist entries to the simulation

Thanks
Daniel

Title: Re: Feature like IFDEF for Spectre?
Post by bernd on Feb 6th, 2007, 8:14am

In my opinion this is not directly possible within the
Analog Environment. I would use a programming language
either SKILL or PERL to parse the netlist after it's creation and
make the modification.

Bernd

Title: Re: Feature like IFDEF for Spectre?
Post by Andrew Beckett on Feb 6th, 2007, 4:17pm

If using spectre from the command line, you can use the -E option to spectre to tell it to use the C preprocessor before spectre parses it.

For example:


Code:
#ifdef MYDEF
// something you want to include
#endif


You can then use spectre -E -DMYDEF mynetlist.scs to pass in particular definitions from the outside.

Regards,

Andrew.

Title: Re: Feature like IFDEF for Spectre?
Post by Daniel_Platte on Feb 7th, 2007, 12:48am

Thanks for the advice!

Unfortunately, the C-preprocessor does not evaluate Spectre's include statement. As I would need the #ifdef in an options file (that is typically included with Spectre include), the C-preprocessor does not evaluate the #ifdef. Replacing all includes by #include does not solve the problem (and would be very tedious). Shouldn't the C-preprocessor evaluate the #include statements?

Is it possible to combine Spectre's include and the #ifdef directive?


Title: Re: Feature like IFDEF for Spectre?
Post by Andrew Beckett on Feb 7th, 2007, 3:38am

The C preprocessor does process the #include statements. But it won't process any files which are included with spectre's include statements - because these are processed after cpp has done its job.

I can only assume you didn't replace all the includes with #includes?

Regards,

Andrew.

The Designer's Guide Community Forum » Powered by YaBB 2.2.2!
YaBB © 2000-2008. All Rights Reserved.