Memory::Memory(Intrinsics::Module& moduleRef,const char* inName,const IR::MemoryType& inType) : name(inName) , type(inType) { initializeModule(moduleRef); if(moduleRef.impl->memoryMap.contains(name)) { Errors::fatalf("Intrinsic memory already registered: %s",name); } moduleRef.impl->memoryMap.set(name, this); }
Global::Global(Intrinsics::Module& moduleRef,const char* inName,IR::ValueType inType,IR::Value inValue) : name(inName) , type(inType) , value(inValue) { initializeModule(moduleRef); if(moduleRef.impl->globalMap.contains(name)) { Errors::fatalf("Intrinsic global already registered: %s",name); } moduleRef.impl->globalMap.set(name, this); }
int send_video_directory(char* cam_name, char* dir_name, char* remote_host, char* remote_port) { syslog (LOG_INFO, "send_video_directory called in vidlib.c"); // Open ports to the video server //int fd; fd = initializeModule(); openConnection(fd,remote_host,remote_port); // Write camera name to socket, plus one to include the null byte //TODO puts + null byte to avoid strlen call int n = write(fd, cam_name, strlen(cam_name) + 1); if (n < 0) { //error("ERROR writing to socket"); syslog(LOG_ERR, "ERROR writing to socket"); goto ERROR; } chdir(dir_name); DIR *dir; struct dirent *ent; if ((dir = opendir(".")) != NULL) { /* print all the files and directories within directory */ while ((ent = readdir(dir)) != NULL) { if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) { continue; } //printf ("%s, ", ent->d_name); if (send_video(fd, ent->d_name) == -1) { syslog(LOG_ERR, "error in send_video in vidlib"); break; } } closedir (dir); } else { /* could not open directory */ //perror (""); syslog(LOG_ERR, "could not open video directory"); } ERROR: closeConnection(fd); serialClose(fd); return 0; }
void polyIntegral_TB::stimulus(void){ double a = -5; double b = +5; double i = a; double result_TB = 0.0; double result_module = 0.0; initializeModule(); /* Generate the Stimulus */ while( i <= b ){ valid.write(1); oReady.write(1); result_TB = evaluatePolyIntegral ( i, b); /* Write generted test values to outpur ports */ lower_lim.write(i); upper_lim.write(b); do{ wait(); }while(ready.read()== 0); valid.write(0); do{ wait(); }while(oValid.read() == 0); result_module = F.read(); oReady.write(0); cout <<"t = "<<sc_time_stamp()<<"\t, limits(" << i <<" ," <<b<<" )\t"<<" , Correct result = " <<result_TB << "\tCalculated Result : " << result_module << "\t Relative Error = " <<(result_TB - result_module )<< endl; i = i + 0.25; wait(); } sc_stop(); }
Function::Function( Intrinsics::Module& moduleRef, const char* inName, void* inNativeFunction, IR::FunctionType inType, Runtime::CallingConvention inCallingConvention) : name(inName) , type(inType) , nativeFunction(inNativeFunction) , callingConvention(inCallingConvention) { initializeModule(moduleRef); if(moduleRef.impl->functionMap.contains(name)) { Errors::fatalf("Intrinsic function already registered: %s",name); } moduleRef.impl->functionMap.set(name, this); }