The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Mar 28th, 2024, 11:07pm
Pages: 1
Send Topic Print
Simulation Speed in verilogams: Digital Context versus Analog Context (Read 423 times)
Zorro
Community Member
***
Offline



Posts: 63

Simulation Speed in verilogams: Digital Context versus Analog Context
May 20th, 2014, 2:15am
 
Dear Designer's Guide Team,

Let's assume that I have a verilogams module where I have to implement some functionality and I can do that either in the digital context or in the analog context. Which approach will simulate faster?
I understand that by using verilogams by default the digital and analog kernel will be used by default, so this is where my question arises.

I will try to explain with an example. I want to monitor an analog signal. I can do something like this using only the digital context:


   always @(   above(V(vdda_v)-(vdda_v_LoRange)) or above((vdda_v_HiRange)-V(vdda_v)) or                // vdda_v rises above the low threshold or falls below the high threshold
                   above((vdda_v_LoRange-dv)-V(vdda_v)) or above(V(vdda_v)-(vdda_v_HiRange+dv))          // vdda_v rises above the high threshold or falls below the low threshold  
   ) begin
                 
       if (    (V(vdda_v)>=vdda_v_LoRange) && (V(vdda_v)<=vdda_v_HiRange)    ) begin
           vdda_v_state    = 1'b1;
           vdda_v_flag     = 1'b1;
           
       end else begin
           vdda_v_state    = 1'b0;
           if (vdda_v_flag==1'b1) begin
               $fstrobe(output_file, "WARNING: V(vdda_v)=%gV is exceeding the defined safety ranges at time=%gus\n", V(vdda_v), $realtime);    
           end
       end                      
   end  

I can also write the previous code in a very similar way in the analog context i.e. inside the analog begin... end block.

So, my questions are:

1. If I write my code only in the digital context, will the simulation run faster?

2. If there is no analog begin...end block inside the module, will this make the simulation run faster? Or, by default, because it is a verilogams module both analog and digital engines/kernel will be activated (by default) and there will be no difference in the simulation speed.

3. This question is more related to the approach or the way of writing the code. Which approach would be more recommended in terms of simulation speed? To use, if possible, only the digital context or it does not make any considerable difference?

Regards and thank you for your feedback!
Zorro
Back to top
 
 
View Profile   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1998
Massachusetts, USA
Re: Simulation Speed in verilogams: Digital Context versus Analog Context
Reply #1 - Jul 8th, 2014, 7:53am
 
If there's no analog block, then I wouldn't expect the analog solver to be "activated" -- or at least, even if it is started up, it will be rarely called and/or take large timesteps.

Part of the answer to your question might depend on what sort of signals you are working with; your example was monitoring an analog signal, and it could be that it is more efficient to monitor that from an analog block, rather than having the simulator hand off values between analog and digital.
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.