• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC Design
  3. Verilog-A read file separated by delays

Stats

  • Locked Locked
  • Replies 12
  • Subscribers 127
  • Views 21776
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Verilog-A read file separated by delays

kennethbrun
kennethbrun over 13 years ago

I want to create a Verilog-A module (intended for Spectre simulations) that will read a stimuli file on some predefined format and apply the stimulis to the outputs.

The input stimuli file format could be like this:

OUT1=1

OUT2=0

# = 25

OUT1=0

OUT2=0

 

In the above file, the intention is to initially set OUT1/2 to some well-defined value and then change them 25 time units (ps in this case) later. I create the file myself (in another tool) and the format is not fixed in any sense, but the basic concept is, that it should include both timing and signal/value information.

 

 I've been trying to create this Verilog-A module, but I got stuck while trying to create the time delay. Below is my Verilog-A code so far. After some initial setup, the idea is that I run a check at each time unit step (~1ps). If a delay counter is higher than 0, then I count it down, if not: then I read the file (and potentially changes the delay counter when "#=250" is read).

When simulated 500ps in Spectre,  the last to output assignments are never effectuated. According to my debugging, it seems that the file pointer has reached EOF when exiting the inner loop. But I do not understand this, and I cannot see any alternative implementation to avoid this problem - any suggestions for a way through this?

 -----------

 module vloga_component(vdd1v2,out1, out2);
   output out1;
   electrical out1;
   output out2;
   electrical out2;
   input  vdd1v2;
   electrical vdd1v2;
   
   parameter string fileString = "/tmp/default" ;

   integer   fd;
   integer   testint1,testint2;
   integer   out1var,out2var;
   
   string signalName;
   integer   signalVal;
   integer   delayCounter;
   
   analog
     begin
    // THIS BLOCK IS FOR FILE READING:
    @(initial_step)
      begin
         delayCounter = 0;
         fd = $fopen(fileString, "r");
      end // @ (initial_step)
    @(timer(0,1e-12))
      begin
         if(delayCounter>0)
           begin
          // PART OF LOOP WHERE THE DELAY IS IMPLEMENTED
          delayCounter = delayCounter-1;
          $display("Remaining delay: %d ps", delayCounter);
           end
         else
           begin
          // PART OF LOOP WHERE THE FILE IS READ
          while (delayCounter==0 && (!$feof(fd)))
            begin
                    testint1 = $fscanf(fd, "%s=%d", signalName, signalVal);
               case(signalName)
             "#" :
             begin
                $display("WE GOT A MATCH: %s = %d ; TEST2=%d",signalName,signalVal,testint1);
                $display("Delay: %d ps", signalVal);
                delayCounter=signalVal;
             end
             "OUT1" :
               begin
                  $display("WE GOT A MATCH: %s = %d ; TEST2=%d",signalName,signalVal,testint1);
                  out1var = signalVal;
               end
             "OUT2" :
               begin
                  $display("WE GOT A MATCH: %s = %d ; TEST2=%d",signalName,signalVal,testint1);
                  out2var = signalVal;
               end
             default $strobe("Error. Too weird: %s", signalName);
               endcase // case(signalName)
               
            end
          
           end // else: !if(delayCounter>0)
      end
    V(out1) <+ transition(out1var,0,1e-12);
    V(out2) <+ transition(out2var,0,1e-12);

     end

   
endmodule
-----------

 Best regards,

Kenneth

  • Cancel
Parents
  • kennethn
    kennethn over 11 years ago

    RobinCommander said:

    I take it this isn't possible?

    I started on something similar, but it sounds like it isn't going to work.

     

    Hi Robin,

     

    I succeeded with the task the last time. I'm currently busy, but will post you ideas within a couple of days. Don't remember the details, but I can look them up...

    /Kenneth

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • kennethn
    kennethn over 11 years ago

    RobinCommander said:

    I take it this isn't possible?

    I started on something similar, but it sounds like it isn't going to work.

     

    Hi Robin,

     

    I succeeded with the task the last time. I'm currently busy, but will post you ideas within a couple of days. Don't remember the details, but I can look them up...

    /Kenneth

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information