Jump to content

Recommended Posts

Posted

I'm attempting to do some performance analysis of a network-on-a-chip I've created in SystemC. To do this, I want to automate multiple simulation runs so that I can find max/min/mean/variance of the values I am interested in.

My original idea was to simply wrap my main.cpp (the code that constructs the network out of modules and signals and begins the simulation) in a "for" loop and run through it x number of times. However, I am currently encountering error E113 after running through the "for" loop just once, which indicates that SystemC doesn't allow me to reconstruct the network while a simulation is running (understandably).

So, my question is now: How can I completely stop and reset my simulation environment at the end of my "for" loop to allow it to just do its thing x number of times?

Thanks in advance.

Posted

Hi,

for me, it is not clear what you want to do.

Do you want to measure simulation performance (execution time of the simulation)?

This could be done 'outside' of the actual simulaiton, e.g. in a shell script like

STARTTIME=$(date +%s)

run simulation

ENDTIME=$(date +%s)

echo $ENDTIME '-' $STARTTIME | bc -l

Repeat this in a loop as often as you want.

Or do you want to measure some internals in your model?

This can be done in the testbench modules, e.g.

some process in tb/stimulus module
{
 for (int i = 0; i < MAX; ++i)
 {
   // run simulation stimulus
   std::cout << i << and whatever you need << std::endl;
 }
} 

Posted

Hi,

for me, it is not clear what you want to do.

Do you want to measure simulation performance (execution time of the simulation)?

This could be done 'outside' of the actual simulaiton, e.g. in a shell script like

STARTTIME=$(date +%s)

run simulation

ENDTIME=$(date +%s)

echo $ENDTIME '-' $STARTTIME | bc -l

Repeat this in a loop as often as you want.

Or do you want to measure some internals in your model?

This can be done in the testbench modules, e.g.

some process in tb/stimulus module
{
 for (int i = 0; i < MAX; ++i)
 {
// run simulation stimulus
std::cout << i << and whatever you need << std::endl;
 }
}

Thanks for the response, and sorry if the first post wasn't clear.

Basically, the network I am modeling consists of sender and receiver nodes connected to switches. The sender nodes generate a packet with a random destination address and passes it off to the switch, which then routes it to other switches based on the destination. I have managed to make the code configurable via global definitions in a header file, which allow me to modify parameters including the speed of the sender/receiver/switch, the size of the network, and the way the switches are connected (fully-connected, square mesh, bitonic, etc.).

Right now, each simulation run is 50ms in length, and I record information regarding packets sent, dropped, number of stops, and time between sending and delivery to a .csv file, and the functioning of the network itself to a .vcd file.

My desired goal is to make it so that the code will automatically run a certain network configuration x times, generating a new .csv and .vcd log file each time. I can then use the data in these files with Excel/Matlab to perform some performance analysis on each network configuration in order to draw some conclusions such as maximum throughput, expected delay, etc.

In order for the code to do this, I need to be able to basically reset the simulation and re-run in x number of times. Is it possible (in SystemC code) to stop the simulator and completely unload it from memory so that I can then begin a new simulation using the same block of code as before?

Posted

In the accellera simulator, it is not possible to reset the simulation kernel or restart a simulation from the beginning.

Running the same configuration x times can be done by a shell script:

loop X

run simulation

rename result files

end loop

If you want to run several configurations automatically, it might help to read the configuration from an external (text/xml/...) file at the beginning of the simulation. Then, you can do it again in a shell skript:

loop

modify configuration file

loop X

run simulation

rename result files

end loop

end loop

Posted

In the accellera simulator, it is not possible to reset the simulation kernel or restart a simulation from the beginning.

Running the same configuration x times can be done by a shell script:

loop X

run simulation

rename result files

end loop

If you want to run several configurations automatically, it might help to read the configuration from an external (text/xml/...) file at the beginning of the simulation. Then, you can do it again in a shell skript:

loop

modify configuration file

loop X

run simulation

rename result files

end loop

end loop

Thanks for the response! I hadn't even considered renaming the output as part of the shell script. Works perfect!

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...