I need help just starting the algorithm for Direct Memory Mapping. I understand the semi-pseudo and I even did a few practice numbers/addresses by hand, drawing a diagram for my buffers. When it comes to putting it in C code, I'm stumped. The data members that I am working with are: tCache.buffers->age tCache.buffers->tag tCache.buffers->validBit tCache.nBufferQty tCache.nBufferSize tCache.nCacheHit tCache.nCacheMiss tCache.nTotalAccess tRunData->nBufferQty tRunData->nBufferSize tRunData->nCacheHit tRunData->nCacheMiss strAddrList[][MAXADDRLEN] ( addresses )
Basically my logic would fall into here: // Process each memory address in the current test run and determine hits and misses. for(i = 0; i < cache.nTotalAccesses; ++i) { unsigned int address; sscanf_s(strAddrList[i], "%X", &address); // Convert hex string to a usable int address value. // Code to process each memory address should go here: }
Join our real-time social learning platform and learn together with your friends!