The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
May 5th, 2024, 10:23am
Pages: 1
Send Topic Print
Need to use a pin named "I" (Read 3766 times)
IVerify
New Member
*
Offline



Posts: 6

Need to use a pin named "I"
Oct 02nd, 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?
Back to top
 
 
View Profile   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1998
Massachusetts, USA
Re: Need to use a pin named "I"
Reply #1 - 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
Back to top
 
 

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
View Profile WWW   IP Logged
IVerify
New Member
*
Offline



Posts: 6

Re: Need to use a pin named "I"
Reply #2 - 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.   Smiley
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.