Section Notes: Project 2 and the C Programming Language 1 What is Project 2? ❧The core of the project is to write the part of gmipc that actually executes instructions. You will implement the body of the function OneStep(), a function that simulates the execution of a single MIPS instruction. ❧Your code will operate on one instruction at a time, doing the following actions: oDecode the instruction oFetch the register values oCompute and store new register values or memory addresses oLoad values from memory or store values to memory ❧You are given some skeleton code which must be filled in to “simulate” the effects of all the instructions on the processor state. ❧You are given a pointer to memory and a pointer to the register file, but you should not modify memory directly – instead use the two interface functions provided, one for storing and one for loading. Hint:Keep in mind that you have to do a “load” to simulate the effects of a “store” properly. Exercises ❧What is the processor state? Answer : Type of instruction + Values of registers/memory at a particular point ❧Why do you have to do a “load” to simulate a “store”? Answer : Can only fetch and store words. Don’t want to overwrite existing memory not involved in store. C Resources ❧Brian Kernighan and Dennis Ritchie. The C Programming Language. Prentice Hall PTR; 2 edition (March 22, 1988) ❧Notes on Programming in C can be found at http://www.csl.cornell.edu/courses/ece314/tutorials/pike_C.html❧A tutorial on C for Java programmers and other resources can be found at http://www.csl.cornell.edu/courses/ece314/tutorials/cforjava.htm❧Recommended style of programming: http://www.csl.cornell.edu/courses/ece314/tutorials/cstyle.pdfCompiling C Programs ❧You can compile your own C programs by typing: gcc filename.c –o <executable name> oIf you don’t use the –o option to supply an executable name, an executable file called a.outwill be created on the linuxpool. oYou can specify compiler optimizations with –O0, -O1, -O2, -O3.
has intentionally blurred sections.
Sign up to view the full version.