{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

ece314_sec3_TA - Section Notes Project 2 and the C...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
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: o Decode the instruction o Fetch the register values o Compute and store new register values or memory addresses o Load 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.pdf Compiling C Programs You can compile your own C programs by typing: gcc filename.c –o <executable name> o If you don’t use the –o option to supply an executable name, an executable file called a.out will be created on the linuxpool. o You can specify compiler optimizations with –O0, -O1, -O2, -O3.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon