The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Jul 16th, 2024, 10:24pm
Pages: 1
Send Topic Print
Accessing/Modifying "disciplines.vams" (Read 5351 times)
Prathap
New Member
*
Offline



Posts: 7
India
Accessing/Modifying "disciplines.vams"
Sep 25th, 2007, 5:01am
 
Hi,

Can we be able to actually modify the disciplines.vams file. I mean just as we have an "electrical" discipline (which contains two natures - voltage and current), can we have an user defined nature and discipline.

To be more specific, i am right now trying to model a PLL. A PLL has a frequency divider circuit. Of course there are models available for that (for instance , there is one Ken Kundert's model available in the Designer's Guide website). But i thought that we could possibly define a nature for frequency and access it thro' some user defined disciplines. For this i added this piece of code in my "disciplines.vams" file.


nature Frequency
            units = "Hz"
            access = Fr;
`ifdef FREQUENCY_ABSTOL
            abstol = `FREQUENCY_ABSTOL
`else
            abstol = 1e-12;
`endif
endnature

/// Conservative discipline

discipline period
             potential Frequency;
enddiscipline



But when i actually executed this discipline in the following program it gave me error. this is the code where i used it.


// VerilogA for PLL_Prathap, Freq_Discipline_Check, veriloga

`include "constants.vams"
`include "disciplines.vams"

`include "/h/prathsi/disciplines_modified.vams"           -------- Location where the modified discipline file is present

module Freq_Discipline_Check(in, out);
input in;
output out;

period in;
voltage in;
period out;

real temp, temp_1;

analog begin

     @(cross(V(in)-0.1, 1)) begin
     
           temp = Fr(in);
           temp_1 = 10 * temp;
           Fr(out) <+ transition(temp_1, 10n, 10n, 10n);

     end
     
endmodule


What i have done might be completely incorrect. If so please try to correct/guide me.


Thanks You.

Regards,
Prathap.
Back to top
 
 

Regards,
Prathap
View Profile   IP Logged
Stefan
Senior Member
****
Offline



Posts: 124

Re: Accessing/Modifying "disciplines.vams"
Reply #1 - Sep 25th, 2007, 5:32am
 
I think you're trying to MIX the disciplines, that's not possible.
The two natures voltage and current are dependent on each other and I don't think it's possible to define an additional third nature for it.
You could however declare a discipline that uses voltage as potential and "frequency" as flow.
However, I don't know if that wouldn't mess up everything also.
Back to top
 
 
View Profile 16731287   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1999
Massachusetts, USA
Re: Accessing/Modifying "disciplines.vams"
Reply #2 - Sep 25th, 2007, 6:11am
 
You may be having a problem because you're including the default one and your modified one.

I find that some simulators will find "disciplines.vams" in your working directory instead of the standard include directory, or alternately you can just not `include "disciplines.vams" and instead `include your modified one, and make it contain only the disciplines/natures that you really want.

Why do you have "in" as both voltage and period?  What exactly is the error message you got?
Back to top
 
 

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



Posts: 7
India
Re: Accessing/Modifying "disciplines.vams"
Reply #3 - Sep 25th, 2007, 11:54pm
 
Thanks Stefan & Geoffrey.  :)

I declared frequency as a flow. Then i removed the default declaration of disciplines (`include "disciplines.h"). I didnt get any errors.

But i realized i made had made a mistake in my code (a logical one). The module which i had posted was intended to divide the input frequency by 10 times. That is if the input freq if 10M then its output should be 1M. But after running the code i realized that it didnt work. Instead the voltage was multiplied by 10.

I actually thought that just like one can access the voltage of a node (using V()) or the current (using I()), we could access and calculate the frequency by Fr() (this Fr being a user defined one).  But then i came to know that potential or current can only be measured.
Back to top
 
 

Regards,
Prathap
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.