Jump to content
Khushi

How to insert timings in an untimed model

Recommended Posts

Insert timing delays with sc_core::wait(sc_time) method as called out by either the specification or your best understanding of the likely RTL result.

Perhaps you have a function that compresses a JPEG image and experience shows that it take 550 to 568 clocks on an existing design. If you think you can improve the algorithm by 30% then using some statistical approach:

#include <systemc>
#include <random>
sc_core::sc_time const period { 15.0, SC_NS }; //< clock period
...

void compress_jpeg( args... ) {
  unsigned int seed = 1;
  std::default_random_engine generator { seed };
  std::uniform_distribution<int> distribution { 550, 568 };
  
  // Compress jpeg using software methods
  ...
  
  wait( 0.30 * distribution(generator) * period );
}

No magic. Accuracy is dependent on your experience and best effort WAG. You may have a more sophisticated time calculation if you think you know more.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...