Aaron0127 Posted March 17, 2018 Report Share Posted March 17, 2018 Hi, I am new to SystemC, I have installed SystemC 2.3.2 successfully in Visual Studio 2017. The only problem that I have is with sc_main() function. The compiler complained the entry point cannot be found. I understand that the default entry point in VS is int main(). I have read IEEE Std 1666-2011 clause 4.3 about sc_main() and sc_elab_and_sim(). I tried to use following code to start simulation. But it failed. The compiler showed error message: "identifier "sc_eabl_and_sim" is undefined". int main(int arg, char* argv[]) { sc_elab_and_sim(arg, argv); //The rest code for simulation and testbench ... } How do I make sc_main(int arg, char* argv[]) function work in VS 2017? If not possible, how to properly call sc_eabl_and_sim(int arg, char* argv[]) in an int main(int arg, char* argv[]) to start a simulation? Quote Link to comment Share on other sites More sharing options...
AmeyaVS Posted March 17, 2018 Report Share Posted March 17, 2018 Hello @Aaron0127, The entry point for creating the simulation models and starting simulation is supposed to be implemented within sc_main function. This was done to support the EDA tools vendors to support extensive debugging capability with their tools. In the available open source implementation the main function is provided by the SystemC library itself. Only the sc_main function implementation has to be provided by you. Hope it helps. Regards, Ameya Vikram Singh Quote Link to comment Share on other sites More sharing options...
Aaron0127 Posted March 17, 2018 Author Report Share Posted March 17, 2018 Hello @AmeyaVS, Thanks for reply, does this mean that I only need to use sc_main function. I manually changed the entry point of the project in Visual Studio from main()to sc_main(), and I get this compiling error "a subsystem can't be inferred and must be defined". Quote Link to comment Share on other sites More sharing options...
David Black Posted March 17, 2018 Report Share Posted March 17, 2018 Don't change the default entry point and don't define main. Main is already pre-compiled inside the library! Quote Link to comment Share on other sites More sharing options...
Aaron0127 Posted March 18, 2018 Author Report Share Posted March 18, 2018 Hello @David Black, If I use int main(int arg, char* argv[]) as the entry point, the project does compile and run. But I'm not sure that this is correct. Quote Link to comment Share on other sites More sharing options...
maehne Posted March 19, 2018 Report Share Posted March 19, 2018 It is correct that your SystemC application compiles and runs correct if you leave the default entry point at main() and provide yourself only sc_main(). This is by design, as you can read up in clauses 4.2 and 4.3 of IEEE Std 1666-2011. Subclause 4.3.2 states: Quote The function main that is the entry point of the C++ program may be provided by the implementation or by the application. If function main is provided by the implementation, function main shall initiate the mechanisms for elaboration and simulation as described in this subclause. If function main is provided by the application, function main shall call the function sc_elab_and_sim, which is the entry point into the SystemC implementation. The SystemC library provides a main() function, which calls sc_elab_and_sim(), and which in turn then calls the sc_main(), which you have to provide to set up your model and control elaboration and simulation. Quote Link to comment Share on other sites More sharing options...
DS1701 Posted April 13, 2018 Report Share Posted April 13, 2018 @Aaron0127 try this : Project->property->Linker->All Option->Subsystem : Console (/SUBSYSTEM:CONSOLE) Regards, Hook Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.