LinkersBinary and Text FilesMemory UsageUsing SPIMMemory UsageMIPS conventions for memory usageNot hardware enforced.Programmer/Assembler/Linker/Loader conventionsDivide memory in 3 parts: text, data,&stack segmentsFigure: Memory Layout() Assembler, Linker, and SPIM October 13, 2008 8 / 17Using SPIM1Linkers2Binary and Text Files3Memory Usage4Using SPIM() Assembler, Linker, and SPIM October 13, 2008 9 / 17Using SPIMSPIMSimulates SPIMWhat it doesn’t simulateInstruction timingsActual memoryInstructions in memory may differ() Assembler, Linker, and SPIM October 13, 2008 10 / 17Using SPIMSPIM InterfaceFigure: SPIM Interface() Assembler, Linker, and SPIM October 13, 2008 11 / 17Using SPIMAssembly program skeletonFigure: Skeleton MIPS program() Assembler, Linker, and SPIM October 13, 2008 12 / 17Using SPIMAssembler SyntaxComments begin with #Labels: alphanumeric, , .; begin with an alphabetDirectives begin with a .Register addressing: $8, $16 or $t0, $s0() Assembler, Linker, and SPIM October 13, 2008 13 / 17Using SPIMAssembler SyntaxData declarations: .datasyntax: name: storage type value(s)types possible: .byte, .word, .space, .asciiznum: .word 5array1: .byte ‘a’, ‘b’() Assembler, Linker, and SPIM October 13, 2008 14 / 17Using SPIMSimple MIPS programFigure: Simple MIPS program() Assembler, Linker, and SPIM October 13, 2008 15 / 17Using SPIMSystem Callssyscall instruction for OS-like commandsLoad the proper code in $v0, call syscallFigure: syscall codes() Assembler, Linker, and SPIM October 13, 2008 16 / 17Using SPIMMIPS program us ing syscallFigure: MIPS program that uses syscall() Assembler, Linker, and SPIM October 13, 2008 17 /
View Full Document