The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl
Design Languages >> Verilog-AMS >> Need to use a pin named "I"
https://designers-guide.org/forum/YaBB.pl?num=1191354695

Message started by IVerify on Oct 2nd, 2007, 12:51pm

Title: Need to use a pin named "I"
Post by IVerify on Oct 2nd, 2007, 12:51pm

I'm writing a model of a block designed by someone else.  They have named one of the pins "I".   I tried using "\I ", and this does not work.  In the example below, I was able to successfully escape the "for" reserved word, but not "I".


Code:
// Verilog-AMS
`include "constants.vams"
`include "disciplines.vams"                        
module block (\I , \for , x);                                                                      
 inout \I ; electrical \I ;
 inout \for ; electrical \for ;
 inout x; electrical x;                                                                
 analog begin
   I(\I ) <+ 1u;
   I(\for ) <+ 1u;
   I(x) <+ 1u;
 end                              
endmodule


ncvlog -ams I-fails.vams
ncvlog: 05.83-p003: (c) Copyright 1995-2006 Cadence Design Systems, Inc.
   I(\I ) <+ 1u;
   |
ncvlog: *E,ILLPRI (I-fails.vams,12|4): illegal expression primary [5.2(AMSLRM)].
   I(\for ) <+ 1u;
   |
ncvlog: *E,ILLPRI (I-fails.vams,13|4): illegal expression primary [5.2(AMSLRM)].
   I(x) <+ 1u;
   |
ncvlog: *E,ILLPRI (I-fails.vams,14|4): illegal expression primary [5.2(AMSLRM)].

The following does work, but then I need to ask the designer to change the pin name and would prefer not to.  Note that in this case, the "\for " is fine.

Code:
`include "constants.vams"
`include "disciplines.vams"
module block (Ix , \for , x);
 inout Ix ; electrical Ix ;
 inout \for ; electrical \for ;
 inout x; electrical x;
 analog begin
   I(Ix ) <+ 1u;
   I(\for ) <+ 1u;
   I(x) <+ 1u;
 end
endmodule


Does anyone have any suggestions?

Title: Re: Need to use a pin named "I"
Post by Geoffrey_Coram on Oct 3rd, 2007, 6:39am

Do you need the discipline to be electrical?  The LRM has some wording to the effect that, if you don't use the discipline in your module, then the access functions (I and V) are not imported into the namespace, so they wouldn't interfere with using I for a pin name.

However, you may not be able to use this suggestion, based on discipline resolution rules.  Try not including disciplines.vams and writing your own electrical discipline:

// Current in amperes
nature Current
       units      = "A";
       access     = Ix; // NOTE CHANGE FROM ORIGINAL DEFINITION
       idt_nature = Charge;
`ifdef CURRENT_ABSTOL
       abstol     = `CURRENT_ABSTOL;
`else
       abstol     = 1e-12;
`endif
endnature

// Charge in coulombs
nature Charge
       units      = "coul";
       access     = Q;
       ddt_nature = Current;
`ifdef CHARGE_ABSTOL
       abstol     = `CHARGE_ABSTOL;
`else
       abstol     = 1e-14;
`endif
endnature

// Potential in volts
nature Voltage
       units      = "V";
       access     = V;
       idt_nature = Flux;
`ifdef VOLTAGE_ABSTOL
       abstol     = `VOLTAGE_ABSTOL;
`else
       abstol     = 1e-6;
`endif
endnature

// Conservative discipline
discipline electrical
       potential    Voltage;
       flow         Current;
enddiscipline

Title: Re: Need to use a pin named "I"
Post by IVerify on Oct 3rd, 2007, 12:09pm

Thanks!  This would have never occurred to me.  
I copied the disciplines.vams file making a local version of it with a different name.  I did the one line change  as you suggested (change access function name).  In my model, I then changed the include statement to use the new file, and changed the way I access currents to the new access name.    The model now compiles.   My next step will be to combine this models with others and to run mixed-level simulations.  I'm a bit concerned of unexpected consequences, but I'll find out soon enough.   :)

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