Jump to content

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now