Reputation: 140
#ifndef RAM_H
#define RAM_H
#include <systemc.h>
SC_MODULE(ram) {
void ram_proc();
SC_HAS_PROCESS(ram);
private:
sc_clock clock;
};
#endif
then in the ram.cpp I have the following code
#include "ram.h"
ram::ram(sc_module_name name_): clock("clock",1,SC_NS) {std::cout<<"I am in clock "<<std::endl;}
{ //the error is occurring hier
SC_THREAD(ram_proc);
}
void ram::ram_proc () {
std::cout<<"I am in method ram_proc "<<std::endl;
}
The problem is that I am getting this error:
expected unqualified-id before ‘{’ token {
Upvotes: 0
Views: 238
Reputation: 180660
Fixing for indentation and new lines your code looks like
void ram::ram(sc_module_name name_): clock("clock",1,SC_NS)
{
std::cout<<"I am in clock "<<std::endl;
} // <- constructor ends here
{ //the error is occurring hier
SC_THREAD(ram_proc);
}
As you can see you have two blocks of code. The first block is the constructor body. The second block is not linked to anything. If you want the block containing SC_THREAD(ram_proc);
to be in the the constructor then you need
void ram::ram(sc_module_name name_): clock("clock",1,SC_NS)
{
std::cout<<"I am in clock "<<std::endl;
SC_THREAD(ram_proc);
}
Upvotes: 5