Reputation: 37
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?
Upvotes: 1
Views: 223
Reputation: 742
I believe you haven't specified the /vmg
option while compiling your code. The /vmg
option is required because of the way SystemC implements method processes.
Upvotes: 1