Exp2_CacheMemory

August 9, 2017 | Author: Sing Ho | Category: Cpu Cache, Computer Data, Computer Programming, Data, Computer Hardware
Share Embed Donate


Short Description

Download Exp2_CacheMemory...

Description

UNIVERSITI TUNKU ABDUL RAHMAN FACULTY OF ENGINEERING AND SCIENCE B.Eng.(Hons) Electrical, Electronic and Communications UEEL3573 Computer Architecture and Organisation

Experiment: Cache Memory Objective To study and understand the cache memory system, and investigate factors that will affect its practical performance.

Preliminary: Cache memory Read the lecture notes on cache memory, study its basic functions, and understand the terms like the capacity, tag and line (i.e. block) size. A cache is a small memory, but is faster than the main memory. The following program (next page) contains two parts each calculating the sum of all the matrix elements. The only difference between the two is that they visit the matrix elements in a different order. This may seem unimportant, but with a cache memory, it may make a big difference. Read and understand the program.

Experiment Create an empty Win32 console project in Microsoft Visual C++. Type the following program in a new file item (.cpp). Build and run it, and go through all questions on the next page. #include #include #define N 1024 #define M 1024

//number of rows //number of columns

main() { DWORD start, stop; char *matrix; matrix = (char*)new char[N*M];//create storage for an NxM matrix memset(matrix, 1, N*M); //fill up the matrix with the number 1. /////////////// Part 1 ///////////////// start = GetTickCount(); //get current time for(int repeat=0; repeat
View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF