2

I have a simple C++ function which parse CSV (10-10k rows) file line-by-line and insert each field in defined structure, array of structures to be more specific.

Now I want to measure parsing time using systemc methods (without C++ utilities, e.g clock()) and include it in simulation like any other process and generate trace file - is it possible at all?

For couple of days I am struggling doing that in every possible way. Actually I have realised that sc_time_stamp() is useless in that particular case as it only shows declared sc_start() simulation elapsed time.

I thought it will be as simple as:

  1. wait() until pos.edg
  2. parseFile()
  3. signal.write(1)
  4. doOtherStuff()

but apparently it's not...

Internet is full of adders, counters and other logic stuff examples but I did not found anything related to my problem.

Thanks in advance!

nervuzz
  • 416
  • 3
  • 10

2 Answers2

0

SystemC is a modeling library. So you can only measure simulation time with sc_time_stamp. If you want to measure physical time you will need to measure it with some other C/C++ library (Easily measure elapsed time).

Then, if you want to add this time to your simulation time, you can put

wait( measured_parsing_time );
Community
  • 1
  • 1
random
  • 3,868
  • 3
  • 22
  • 39
0

Your question "measure parsing time using systemc" and the pseudo code example you gave appear to indicate you want to measure real-time. The pseudo-code

wait some-event
parseFile()
signal.write(1)
...

Will take exactly zero simulation time since (unless parseFile() itself has wait statements) parseFile() is carried out in one delta cycle. If parseFile() does have wait statements (wait 10ms for example) then in simulation time it will take 10 ms. The only way systemc has of knowing how long a process takes to complete is if you tell it.

systemcpro
  • 856
  • 1
  • 7
  • 15