The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Jul 16th, 2024, 8:24pm
Pages: 1
Send Topic Print
Test bench design - tasks (Read 6714 times)
jjrael
New Member
*
Offline



Posts: 8

Test bench design - tasks
Aug 24th, 2007, 10:09am
 
All,

I am starting to write verilogAMS test benches to verify the functionality of my schematics and models. I want to reuse my code so I am trying to fold them into a task. However, I am running into problems when I try to pass a analog signal to the task. For example I have a task call e_20MHz and I pass it an "analog" port:

e_20MHz(I0.X1);

My task is define:

  task e_20MHz;
     input in1;
     real  in1;

     real         tp0;
     real         tp1;
     real         tp_val;
     begin
        tp0 = V(in1);
        #25 tp1 = V(in1);
        tp_val = (tp0 - tp1)/2.0;
        $fdisplay(d_fd,"%7.3f\tE@20MHz XO\t%5.2g", $abstime*1e6, tp_val);        
     end
  endtask // e_20MHz


When I run, I get this error:

verilog.vams
        tp0 = V(in1);
                  |
ncvlog: *E,EXPBON (/xxx/verilog.vams,87|19):  Expecting only branch or node type arguments [5.2(AMSLRM)].
        #25 tp1 = V(in1);
                      |
ncvlog: *E,EXPBON (/xxx/verilog.vams,88|23):  Expecting only branch or node type arguments [5.2(AMSLRM)].
       module xxx.v_XO2:verilogams
               errors: 2, warnings: 0


Any ideas?


Back to top
 
 
View Profile   IP Logged
Mighty Mouse
Community Member
***
Offline

Here I come to save
the day!

Posts: 75
Fantasyland
Re: Test bench design - tasks
Reply #1 - Aug 24th, 2007, 10:57am
 
Have you tried declaring in1 as being electrical? That seems to be what is missing.

-MM
Back to top
 
 
View Profile   IP Logged
jjrael
New Member
*
Offline



Posts: 8

Re: Test bench design - tasks
Reply #2 - Aug 24th, 2007, 11:04am
 
ncvlog did not like that at all:



     electrical in1;
                  |
ncvlog: *E,MISEXX (/xxx/verilog.vams,80|19): expecting an '=' or '<=' sign in an assignment [9.2(IEEE)].


jr
Back to top
 
 
View Profile   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1999
Massachusetts, USA
Re: Test bench design - tasks
Reply #3 - Aug 27th, 2007, 5:20am
 
Are you `including discipline.vams (or .h) to get the definition of electrical?

Also, I'm thinking that V() isn't allowed in tasks (I know it's not allowed in functions).  You need a module with an electrical port, and then have a real variable Vin1 = V(in1)  that gets passed to the task.  In any case, you shouldn't have real and electrical applied to the same input.
Back to top
 
 

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
View Profile WWW   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.