Jump to content
Sign in to follow this  
Viet Hoang

Simulation is stop when it encounter sc_start()

Recommended Posts

I've tried to reinstall systemC library, but after thing doesn't work correctly as before.

I  recompile and simulate an old project of mine  to test it but it seems that every time the simulate encounters the sc_start

the simulation is stopped and turn back to the terminal. This is showed in the picture.

Capture.PNG.a08bb45da637797b8e1440864b45b715.PNG

 

It should have continued to count up more and it does not show any information.

This is my old project and it worked before

This is the code of the top file. As I see, in the first count the for loop. It get out of the test

I also tried another code but it also show only the header of ALL RIGHT RESERVED of systemC

#include <iostream>
#include "scpu_testbench.h"
int sc_main (int argc, char* argv[]) {
  //1. Internal signal declaration
  sc_signal <bool> rst_n;
  //2. Create the clock 
  //Cycle: 2 ns
  //Duty cycle: 50%
  sc_clock clk("clk", 2, SC_NS, 0.5);
  //3. Instances
  scpu_testbench scpu_testbench_inst("scpu_testbench_inst");
    scpu_testbench_inst.clk(clk);
  //4. Create VCD file to trace
  #include "scpu_trace.h"
  //5. Start simulation
  cout << "3.Start simulation" << endl;
  int count = 0;
  for (int i = 0; i < 100; i++) {
    cout << "Simulation is running " << i << endl;
    sc_start(1, SC_NS); //One cycle
  }
  //6. Close the waveform file
  sc_close_vcd_trace_file (scpu_waveform);
  //7. END
  return 0;
}

Could anybody help me to find an idea for this?

Share this post


Link to post
Share on other sites

Hello @Viet Hoang,

I think these lines are a cause of concern.

12 hours ago, Viet Hoang said:

sc_clock clk("clk", 2, SC_NS, 0.5);

 

12 hours ago, Viet Hoang said:

sc_start(1, SC_NS); //One cycle

You are only running the simulation only for a "1 ns" much before the clock cycle.

Replace the following lines:

12 hours ago, Viet Hoang said:

for (int i = 0; i < 100; i++) { cout << "Simulation is running " << i << endl; sc_start(1, SC_NS); //One cycle }

With

sc_start();
// or with one below
// sc_start(300, SC_NS);

And stop the simulation using "Ctrl+C" (SINGINT) when running till end of simulation.

Hope it helps.

Regards,

Ameya Vikram Singh

Share this post


Link to post
Share on other sites

Hi @AmeyaVS,

I tried your suggestion and it doesn't work.

I understand your idea. But I think it is not really the root cause.

I built some project with systemC and never met this, it's really weird.

When I install the systemC library, I test it with the examples provided by the library, only 13/22 are passed.

It could be missing something between cygwin and sysc lib.

Share this post


Link to post
Share on other sites

Hello @Viet Hoang,

Did you enable the pthreads for the SystemC library build?

In cygwin the QThreads library is non-functional, that is why you are facing make check failures also.(13/22 passed tests)

You can find relevant discussions here:

https://forums.accellera.org/topic/5627-systemc-231-installation-problem-on-windows-7-with-cygwin/?do=findComment&comment=13595

If you are using you need to pass this command line option to cmake to use Pthreads for SystemC threads implementation:

-DENABLE_PTHREADS=ON

Regards,

Ameya Vikram Singh

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.

Sign in to follow this  

×
×
  • Create New...