Jump to content

Aaron0127

Members
  • Content Count

    8
  • Joined

  • Last visited

  1. Aaron0127

    SC_METHOD Eception

    Could you tell me a little about reproducer? I'm not familiar with this terminology. Thank you
  2. Aaron0127

    SC_METHOD Eception

    Hi @Roman Popov, I try to include as many detail as I can. In testbench.cpp, I initialise the gcrypt object. class testbench : public sc_core::sc_module { public: vworks::models::gcrypt g; testbench(sc_core::sc_module_name name): sc_core::sc_module(name), g("g"){ //code initialze connection and signal } The constructor of gcrypt is: gcrypt::gcrypt(sc_module_name name): gcrypt_base(name) { SC_METHOD(on_clock_update); sensitive << clock; dont_initialize(); }; void gcrypt::on_clock_update() { if (clock.read() == 0) { SC_REPORT_WARNING(name(), "Invalid clock port value of 0"); _ns_per_cycle = 0; return; } _ns_per_cycle = 1e9 / clock.read(); } The gcrypt_base constructor is: gcrypt_base::gcrypt_base(sc_module_name name) : sc_module(name), ... { ... } When I run the testbench.cpp in Visual Studio 2017, the exception was thrown in SC_METHOD(on_clock_update) in gcrypt.cpp. The exception error is: Exception thrown at 0x6FB78281 (vcruntime140d.dll) in SystemCModuleTest.exe: 0xC0000005: Access violation reading location 0x115348EF. Thanks, Chao
  3. Aaron0127

    SC_METHOD Eception

    Hi, I'm trying to use a SC_METHOD in my simulation. Here is the code: gcrypt::gcrypt(sc_module_name name): gcrypt_base(name) { SC_METHOD(on_clock_update); sensitive << clock; dont_initialize(); }; void gcrypt::on_clock_update() { if (clock.read() == 0) { SC_REPORT_WARNING(name(), "Invalid clock port value of 0"); _ns_per_cycle = 0; return; } _ns_per_cycle = 1e9 / clock.read(); } The gcrypt_base constructor is: gcrypt_base::gcrypt_base(sc_module_name name) : sc_module(name), ... { ... } I get this exception thrown by SC_METHOD: Exception thrown at 0x6FB78281 (vcruntime140d.dll) in SystemCModuleTest.exe: 0xC0000005: Access violation reading location 0x115348EF. I saw the __vfptr value was "Unable to read memory". How to solve this problem? Thanks, Chao
  4. Aaron0127

    define sc_main in VS 2017

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

    define sc_main in VS 2017

    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".
  6. Aaron0127

    define sc_main in VS 2017

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

    Install SystemC on Visual Studio 2017

    I had the same problems, after I set Code Generation in c/c++ tab in project property, these issues are gone. But I get the error "entry point must be defined". How do I fix it? Thanks.
  8. Aaron0127

    User Guide for systemc 2.3.2

    Hi, I spent hours trying to install systemC on visual studio 2017, i have encountered a problem. when I include the systemc.h file, the vs shows the error "unrecognized preprocessing directive". I followed the install instruction carefully in INSTALLATION file. update: I fixed the issue.
×