Jump to content

Recommended Posts

Hello everyone,

 

I’m new in systemc and in this forum.

 

I successfully downloaded and installed systemc-2.3.0 on MSVC-2010 (Windows 7)

 

I can compile and run the examples.

BUT when I write an own program it doesn’t work.

For example I wrote this simple program.

 

#include "systemc.h"#define WIDTH  4
SC_MODULE(adder) {
   sc_in<sc_uint<WIDTH> > a, b;     sc_out<sc_uint<WIDTH> > sum;
  void do_add() {      sum.write(a.read() + b.read())  }
  SC_CTOR(adder)       {    SC_METHOD(do_add);       sensitive << a << b;  }
};

 

systemc.lib(sc_main_main.obj) : error LNK2019: unresolved external symbol
> _sc_main referenced in function _sc_elab_and_sim
> Debug/addieren.exe : fatal error LNK1120: 1 unresolved externals
 

It seems that the compiler can’t find systemc.lib, but I have add additional libraries in the properties and set the environment variable.

I checked it many times but I always got the above-mentioned messages.

 

Can you help me?

 

Thanks in advance.

 

Regards,

Aydin

 

Uni Bochum

Share this post


Link to post
Share on other sites

Hi.

 

The problem is not that the linker cannot find the systemc.lib. It searches for an implementation of 'sc_main'.

 

Each SystemC-Modell has to provide a function sc_main(int,char*[]). In some commercial simulator tools this can be replaced by an explicit top module. But with the accellera simulator you need to implement the function. 

In the sc_main function you instantiate your top level module and/or connect it to a testbench. And you call sc_start here to start the simulation.

 

int sc_main(int argc,char*[] argv)
{
  Top top("top");
  sc_start();
  return 0;
}

 

Greetings 

Ralph

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

×