COMPUTER ORG I
COMPUTER ORG I CDA 3100
Popular in Course
Popular in Computer Design Architecture
This 5 page Class Notes was uploaded by Brendan Price on Thursday September 17, 2015. The Class Notes belongs to CDA 3100 at Florida State University taught by Staff in Fall. Since its upload, it has received 70 views. For similar materials see /class/205549/cda-3100-florida-state-university in Computer Design Architecture at Florida State University.
Reviews for COMPUTER ORG I
Report this Material
What is Karma?
Karma is the currency of StudySoup.
You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!
Date Created: 09/17/15
When selected PCSpim for Windows will record the position of its windows when you exit and restore them to the same location the next time you run PCSpim Bare machine When selected you can simulate a bare MIPS machine without pseudoinstructions or the additional addressing modes provided by the assembler Allow pseudo instructions If this setting is selected pseudoinstructions are allowed in your program otherwise if the setting is not selected they are not allowed Load trap le If this setting is selected the standard exception handler and startup code is loaded When an exception occurs SPIM jumps to location 80000080hex which must contain code to service the exception In addition the trap handler contains startup code that invokes the routine main Without the startup rou tine SPIM begins execution at the instruction labeled istart The default trap le comes with PCSpim but you can choose another using Browse button Mapped IO If this setting is selected the memorymapped lO facility is enabled Programs that use SPIM syscalls to read from the terminal cannot also use memorymapped lO Quiet When this setting is enabled PCSpim does not print a message at exceptions otherwise a message is printed when an exception occurs D s way 17 avewindawpasmans Ban22 l eneva vegxslevs m hexademma J 1 Enemy WW vagmevs m hexademma I gave machme W MEWEd Mn 17 AHawEseudamsnuchans F gmet l Laad nap Me Lav Me Figure A2 PCSpim drmllalnr smug dialnghnx ume and e nn Ynu can mwme nnlme nap imam wnh me smu atnrby selecnng HelprgtHelpitoprcs mm me menu bar Simulator 5 em39ng chplm has a gaphm mta39face in View 112 curtail 521mg nf39he snmn alnr see FxgureA 2 When ynu mm P ynur pragam selecl s 7 gtS ftmgs hm me menu bar me sxmula39m39 chplm anew yen in change he smu a39m39 settings and relnad wur prngam 1r ynu want in change mme gtR Ioad mm m mmubar vemm wnhnulthe gaphm mla39face Display Ynu can select in Vieme regle Carmen39s m deuma nrhemdeumal nataunn mhe chedcbnxes m tents Wm be displayed m hmdeum nnuhnn Sm 39 w n 39 39 n5 0x00400000 0x8fa40000 lw 4 029 89 lw a0 0sp The rst number on the line in square brackets is the hexadecimal memory address of the instruction The second number is the instructions numerical encoding again displayed as a hexadecimal number The third item is the instruction s mnemonic description Everything following the semicolon is the actual line from your assembly le that produced the instruction The number 89 is the line number in that le Some times nothing is on the line after the semicolon This means that the instruction was produced by SPIM as part of translating a pseudoinstruction To run your program click on the Go button in the toolbar Alternatively you can select SimulatorgtG0 from the menu bar Your program will begin execution If you want to stop the execution of your program select SimulatorgtBreak from the menu bar Alternatively you can type ControlC when PCSpim applica tion window is in focus A dialog box will appear and ask if you want to continue execution Select No to break the execution Before doing anything you can look at memory and registers contents in the Register display window to nd out what your program was doing When you understand what happened you can either continue the program by selecting SimulatorgtCanlinue or stop your program by selecting Simulator gtBreak from the menu bar If your program reads or writes from the terminal PCSpim pops up another window called the console All characters that your program writes appear on the console and everything that you type as input to your program should be typed in this window Suppose your program does not do what you expect What can you do SPIM has two features that help debug your program The rst and perhaps the most useful is singlestepping which allows you to run your program an instruction at a time Select SimulatorgtSingle7Slep to execute only one instruction Alterna tively you can press the F10 function key to single step Each time you step through a program PCSpim will execute the next instruction in your program updates the display and returns control to you You can also choose the number of instructions in your program to step by selecting SimulatorgtMull iple7Slep instead of single stepping through your program A dialog box will appear and ask you the number of instructions to step What do you do if your program runs for a long time before the bug arises You could singlestep until you get to the bug but that can take a long time and it is easy to get so bored and inattentive that you step past the problem A better alternative is to use a breakpoint which tells PCSpim to stop your program imme diately before it executes a particular instruction Select SimulatorgtBreakpainls from the menu bar The PCSpim program pops up a dialog box window with two boxes The top box is for you to enter breakpoint address and the second box is a list of active breakpoints Type in the rst box the address of the instruction at which you want to stop Or if the instruction has a global label you can just type the name of the label Labeled breakpoints are a particularly convenient way to stop at the rst instruction of a procedure To actu ally set the breakpoint and click on the button labeledAdd When you are done adding breakpoints click on the button labeled Close You can then run your program When the simulator is about to execute the breakpointed instruction PCSpim pops up a dialog box with the instruction s address and asks if you want to continue the execution The Yes button continues running your program and the N0 button stops your program If you want to delete a breakpoint you can select Sim ulatorgtBreakpainls from the menu bar click on the address in the dialog box and click on the button labeled Remove Singlestepping and setting breakpoints will probably help you nd a bug in your program quickly How do you x it Go back to the editor that you used to create your program and change your source le After you have made the changes to your source le simply reload it into PCSpim for Windows by choosing Sim ulatorgtRelaadlt lenamegt from the menu bar This causes PCSpim to clear its memory and registers and return the processor to the state it was in when PCSpim rst started Once the simulator has reinitialized itself it will reload your recently modi ed le asm Simulate the virtual MIPS machine provided by the assembler This is the default pseudo Allow the input assembly code to contain pseudoinstructions This is the default nopseudo Do not allow pseudoinstructions in the input assembly code notrap Do not load the standard exception handler and startup code This exception handler handles exceptions When an exception occurs SPlM jumps to location 8000008011 which must contain code to service the exception In addition this le contains start up code that invokes the routine main Without the startup routine SPlM begins exe cution at the instruction labeled istart trap Load the standard exception handler and startup code This is the default noquiet Print a message when an exception occurs This is the default quiet Do not print a message at exceptions nomapped7io Disable the memorymapped lO facility This is the default mapped7io Enable the memorymapped lO facility Programs that use SPlM syscalls to read from the terminal cannot also use memorymappe l 0 le Load and execute the assembly code in the le execute Load and execute the code in the MIPS executable le a cut This command is only available when SPlM runs on a system containing a MIPS processor s ltseggt size Sets the initial size of memory segment seg to be size bytes The memory segments are namedtext data stack ktext and kdata The text segment contains instructions from a program The data segment holds the program s data The stack segment holds its runtime stack In addition to running a program SPlM also executes system code that handles interrupts and exceptions This code resides in a separate part of the address space called the kernel The ktext segment holds this code s instructions and kdata holds its data There is no kstack segment since the system code uses the same stack as the program For example the pair of arguments sdata 2000000 starts the user data segment at 2000000 bytes l ltseggt size Sets the limit on how large memory segment seg can grow to be size bytes The mem ory segments that can grow are data stack and kdata Loading and Running a Program Let s see how to load and run a program The rst thing to do is to select the open le icon from the toolbar Alternatively you can select from the menu bar FilegtOpen A le open dialog box will appear for you to select the appropriate assembly le Select the appropriate assembly le and click on the button labeled Open in the dialog box If simulator settings are not correct for the le and it fails to load PCSpim will provide you an opportunity to change simulator settings and automatically reload the le If you change your mind click on the button labeled Cancel and PCSpim removes the dialog box When you load an assembly le PCSpim removes dialog box then loads your program and redraws the screen to display its instructions and data If you have not done so change the view of the four display win dows to a tiled format by selecting from the menu bar WindowsgtTile You should be able to see the pro gram in the Text segment window display Each instruction in the Text segment window display is shown on a line that looks like Im II nunnnnn nunnnn General Riglsters Ln n u x 1 x nxnmnnnna nxzmznnne d s 1 Ux Svscall gngnnnnng eddu sn s9 n DXDDADDDDC axuueuu93 lt e naa Segmzm EIxEIEIEIEIEIEIEIEI nxsesssns EIxZEIZEISASS DXS7SESQ7A DxAAAAAJZEI DXSSSAEIEIEIB 1 gxnngegsu 74735554 Mmages See the me README for e full EDerlght nenee Menurv end reglsters have been cleared end the slmulatur relnltlal D LempdusTESTSAlubare s hes been successfully Jeeded 3 Fm Heh mes n yi ave Pseuda Mahmudimedmnen 17 AJ PC xim39lwindow inkr ne and the emene semen af ne nmuhlox smM chmmmdeLine Opn39nns The waned vemn of po accept Lhe anvilmg emnnendhne Spoon Jane Sxmuhu n bare MIPS michm wmhvulpnudmnmumm m the nddunnd addrex xngmoden mwded hthe menu Imphe dmee
Are you sure you want to buy this material for
You're already Subscribed!
Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'