qtspim tutorial

6
QtSpim Tutorial Contents 1. Installation 2. Usage 3. Overview 4. First Program Installation We will be using SPIM, a MIPS simulator, in order to learn assembly programming. The current version of SPIM is "QtSPIM", aka SPIM using the Qt crossplatform application GUI framework: Install the Qt framework that SPIM requires: unix> sudo apt‐get install qt4‐dev‐tools qt4‐doc libqt4‐help Download a prepackaged version of SPIM for Linux that uses the Qt GUI framework: (If you are running an older 32bit Linux installation, change 64 to 32 below) unix> wget http://sourceforge.net/projects/spimsimulator/files/qtspim_9.1.12_linux64.deb Install the QtSPIM package: unix> sudo dpkg ‐i qtspim_9.1.12_linux64.deb Usage To launch QtSPIM: unix> qtspim & Overview After launching QtSPIM, the main window should appear as shown below.

Upload: annadwimarjusalinah

Post on 17-Nov-2015

17 views

Category:

Documents


1 download

DESCRIPTION

Assembly language

TRANSCRIPT

  • QtSpimTutorialContents

    1. Installation2. Usage3. Overview4. FirstProgram

    Installation

    WewillbeusingSPIM,aMIPSsimulator,inordertolearnassemblyprogramming.ThecurrentversionofSPIMis"QtSPIM",akaSPIMusingtheQtcrossplatformapplicationGUIframework:

    InstalltheQtframeworkthatSPIMrequires:

    unix>sudoaptgetinstallqt4devtoolsqt4doclibqt4help

    DownloadaprepackagedversionofSPIMforLinuxthatusestheQtGUIframework:(Ifyouarerunninganolder32bitLinuxinstallation,change64to32below)

    unix>wgethttp://sourceforge.net/projects/spimsimulator/files/qtspim_9.1.12_linux64.deb

    InstalltheQtSPIMpackage:

    unix>sudodpkgiqtspim_9.1.12_linux64.deb

    Usage

    TolaunchQtSPIM:

    unix>qtspim&

    Overview

    AfterlaunchingQtSPIM,themainwindowshouldappearasshownbelow.

    http://qt.nokia.com/http://qt.nokia.com/http://spimsimulator.sourceforge.net/

  • Therearethreeprimarysectionscontainedwithinthiswindow:TheRegisterpanel,Memorypanel,andMessagespanel.

    RegisterPanel

    TheRegisterpanel(shownbelow)showsthecontentsofalltheMIPSregisters.Therearetwotabsinthispanel:oneforthefloatingpointregistersandonefortheintegerregisters.Theintegerregistersincludegeneralpurposeregisters(R1R31),alongwithspecialpurposeregisterssuchastheProgramCounter(PC).

  • MemoryPanel

    TheMemorypanelhastwotabs:DataandText.TheTexttabshowsthecontentsoftheProgrammemoryspace.Fromlefttoright,thisincludes:

    1. Thememoryaddressofaninstructioninhexadecimal(showninbrackets)2. Thecontentsofthatmemoryaddressinhexadecimal.Inbinaryform,thisistheactualMIPS

    instructionthattheprocessorruns!3. The"humanreadable"assemblylanguageinstructionusingthehardwareregisternumbers

    (showninbold).4. Theassemblylanguageprogramyouwroteusingsymbolicregisternamesandmemory

    addresssymbols(showninitalics)

  • TheDatatabshowsthecontentsoftheDatamemoryspace.Thisincludesthevariablesandarraydatayoucreate,alongwiththestackcontent.

  • MessagesPanel

    TheMessagespaneldisplaysmessagesfromQtSPIMtotheuser.

    FirstProgram

    AvarietyofMIPSexampleprogramsareavailabletoyou.Startwiththefirstprogramexample1.asmbydownloadingittoyourcomputer.

    LoadyourfirstprogrambyselectingFile>ReinitializeandLoadFile.(RecallthatthenewUbuntu"Unity"GUIdoesn'tshowthetopofscreenmenubaruntilyoumouseoverit).Thisclearstheregisterspaceandresetsthesimulator.(Otherwise,youcouldloadandrunseveralprogramsinarowonthesamemachinestate.)

    YoucanscrolldownintheTextpanetoseethattheassemblycodehasbeenloadedintoProgrammemoryspace.Inthiscase,thefirstinstructionisatmemorylocation0x00400024.(Whydoesn'titstartatmemoryaddresszero?Theprogramstartswiththefunctionmain(),butthereissomecode

    http://ecs-network.serv.pacific.edu/ecpe-170/tutorials/example1.asm/viewhttp://ecs-network.serv.pacific.edu/ecpe-170/tutorials/mips-example-programs

  • thatrunsbeforemain).

    Nowthattheprogramhasbeenloaded,youcanrunasimulationoftheassemblyinstructions.Youhavethreechoices:

    1. Runtheprogramfrombeginningtoend(viathe"play"Run/ContinuebuttonorF5).Thisisusefulforseeingthefinaloutputoftheprogram.

    2. Stepthroughtheprogramonelineatatime(viathe"123"SingleStepbuttonorF10).Thisisusefultoseehoweachassemblyinstructionaffectsthemachinestate(i.e.memoryandregistervalues).

    3. Runtheprogramuntilyoureachabreakpoint(whichcanbesetbyrightclickingonanylineintheMemorypanel.

    Stepthroughthecompleteprogram,figureoutwhatitdoes,andmakesureyouunderstandhowtheQtSPIMenvironmentworks.