130 likes | 295 Views
An Execution-Driven Simulation Tool for Teaching Cache Memories in Introductory Computer Organization Courses. Julio Sahuquillo , and Ana Pont Computer Engineering Department Technical School of Applied Computer Science Polytechnic University of Valencia jsahuqui, apont@disca.upv.es.
E N D
An Execution-Driven Simulation Tool for Teaching Cache Memoriesin Introductory Computer Organization Courses Julio Sahuquillo, and Ana Pont Computer Engineering Department Technical School of Applied Computer Science Polytechnic University of Valencia jsahuqui, apont@disca.upv.es Salvador Petit, Noel Tomás Computer Engineering Department Faculty of Computer Science Polytechnic University of Valencia spetit@disca.upv.es, noetoar@eui.upv.es
Outline • Introduction and motivation • Cache memories • Tools used in the Academia • Classroom exercises • Goals of this work • PCSpim-cache • Features • Exercise example • More exercises • Conclusions
Cachememories • Identified as core topic in the Computer Organization/Architecture area of knowledgeby the joint IEEE Computer Society and ACM Computer Engineering • Computer Organization courses • Basis of caches • How to find a block? • Replacement algorithms • Computer Architecture courses • Advanced concepts • Victim caches • Coherence • Trace Cache
Tools used in the Academia • Academia tools • Different purposes: research, teach • Different complexity • Different simulators: trace and execution driven
Tools used in the Academia • Trace driven • Widely used in undergraduate courses because of simplicity • Trace • < memory operation > < address> • Read 4 0 C 0 4 8 • Read 4 0 C 0 4 C • … • Use • Mapping functions • Example: • Useless • Spatial locality, temporal locality, … • 4 0 C 0 4 8 tag set offset
Typical exercises at classrooms • Code based exercises: • Valuable pedagogical help and widely used at classrooms • This exercise illustrates spatial locality • No tool for undergraduates dealing with this kind of exercises sum = 0; for (i=0; i<N; i++) sum = sum + A[i] - Array A is located startingin a given memory address - The cache has a given geometry: size, ways, line size - Auxiliary variables in registers
Goal of this work • Main goal: a tool that provides support to perform code-based exercises, i.e., allowing the study of: • Temporal and spatial localities • Replacement algorithms • Write policies • … • Target students • Computer Organization course • How? • As an extension of PCSpim simulator, widely used,which runs MIPS32 assembly programs • Why? • Because of familiarity • “Our” students are trained with this assembly language simulator
PCSpim-Cache • Let us run PCspim-cache to ilustrate its features • Cache extension • Enabled/disabled through • Simulator – settings – cache simulation • Cache configuration • Options: data cache, instruction cache, or both • Cache settings • Allows to choose the cache geometry (size, ways and line size), write policy, and replacement algorithms
Exercise example • Example: sum of the elements of an Array and mapping functions • Students must obtain: • For a given cache, the sets in which Array_A and Array_B map to • Number of misses and classify them according to the three C’s
Exercise example • Mapping functions solution must be firstly solved using paper and pencil
More exercises • This academic year a lab session covering more exercises,like temporal locality and strides has beenperformed • Temporal locality • Strides
Conclusions • Code based exercises are a valuable pedagogical help, but no tool exists to be used by undergraduates • PCSpim-cache is a solution • Supports code based exercises performed at classrooms • Spatial locality, temporal locality, strides, … • Students can use PCSpim-cache to check their exercises • Visualizes how processor-memory work as a whole • Has been used in a lab session, with a wide acceptance among students • Source code is publicly available at http://www.disca.upv.es/spetit/spim.htm • An extension of this paper, covering a detailed lab with an assessment study, is going to be submitted to an educational journal