The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Jul 17th, 2024, 12:20am
Pages: 1
Send Topic Print
Macros inside Macros in Verilog-A for Cadence (Read 4093 times)
designerjoe
New Member
*
Offline



Posts: 6
England
Macros inside Macros in Verilog-A for Cadence
Apr 25th, 2008, 9:12am
 
I am creating Verilog-A models for simulation in Cadence and Spectre and would like to create macros that incorporate other macros and/or contants.

It should be possible to define one macro as result of another one and one or several operations such as:

`define WORD 2
`define LONGWORD (4*WORD)

This seems all well and good until one actually tries to use the macro `LONGWORD in the code.
The parser then gives an error message suggesting that LONGWORD uses an undeclared identifier: WORD.

The end of the error message reads like this:
Encountered undeclared identifier: WORD. Declare the
       identifier before using it.

This isn't actually the macro I am going for but unless I can get something as simple as the example above working there is no chance to get anything really productive in place.

Could someone please tell me if this is an intended limitation of the compiler directives for Cadence or if I'm missing a vital point in the syntax rules?

Back to top
 
 
View Profile   IP Logged
patrick
Junior Member
**
Offline



Posts: 30
Santa Rosa, CA.
Re: Macros inside Macros in Verilog-A for Cadence
Reply #1 - Apr 25th, 2008, 9:21am
 
You need:

`define WORD 2
`define LONGWORD (4*`WORD)

Patrick
Back to top
 
 
View Profile   IP Logged
designerjoe
New Member
*
Offline



Posts: 6
England
Re: Macros inside Macros in Verilog-A for Cadence
Reply #2 - Apr 25th, 2008, 9:48am
 
Cheers Patrick!

That works.
I was mislead by the section "`if `MACRO is Not Allowed" in the Cadence Verilog-AMS Language Reference.

Best regards
Joe
Back to top
 
 
View Profile   IP Logged
Pages: 1
Send Topic Print
Copyright 2002-2024 Designer’s Guide Consulting, Inc. Designer’s Guide® is a registered trademark of Designer’s Guide Consulting, Inc. All rights reserved. Send comments or questions to editor@designers-guide.org. Consider submitting a paper or model.