CprE 381 Homework 1 [Note: This homework covers material on the construction and definition of ISAs and begins to get you introduced to MIPS.

CprE381Homework1

[Note:Thishomework coversmaterialontheconstructionanddefinitionofISAsandbeginsto getyouintroducedtoMIPS.ItalsohasyoustarttorunMIPSprogramsthroughasimulator (SPIMorMARS)thatyouwilluse goingforwardbothinhomework ANDtohelptestyourterm project. AlittleextratimespentworkingwithSPIM nowwillpayofflater.]

1. ISAs a. IdentifythefollowingaspectsasmoreRISC-likeormoreCISC-like i. Variable-lengthinstructions ii. Memory-memoryoperations iii. Load-storearchitectures iv. Regularinstructionformats v. Manyinstructions vi. Fewinstructions b. IdentifyifthefollowingchoicesareISAchoices,ABI(butnotISA)choices,or micro-architecturechoices(notethatsomeofthesemayhavemultiple answers): i. Numberofnamedregisters ii. Numberofcyclesaninstructiontakestoexecute iii. Whetherornotimmediateoperands canbeuseddirectlyinarithmetic instructions iv. Whichregisternumberisthestackpointer v. Which,ifany,registersnumbersproduceconstants(e.g.,0or-1) vi. Whichregisternumberspassargumentstofunctioncalls vii. Whichregisternumbersaretemporaryorsaved viii. Addressableaddressrangeformemoryoperations ix. TypeofadderusedintheALU x. WhichinstructionsupdatethePC xi. Whichbitsofaninstructioncorrespondtotheopcodeoranoperand xii. Numberoffunctionalunitsintheprocessor

2. MIPS a. IdentifythreeproductsnotmentionedinlecturethatuseaMIPS-based processor. b. MIPSdoesnothaveatruemov instruction (mov dst, src #dest=src). Whywouldsuchasimple,basicinstructionnotbeincludedinaRISCISA? List threearithmeticorlogicalinstructionsorinstructionsequencesnotmentioned duringlecturethatproducethesameeffectasamov instruction. c. Whatdoesthefollowingprogramdo(giveadescriptioninEnglishsentences)? xor $1, $1, $2 xor $2, $1, $2 xor $1, $1, $2 d. Assumethatvariables a,b,c,andd aremappedtoregisters$s0,$s1,$s2, and$s3,respectively.WriteaMIPSprogramthatimplementsa = b * 2 + c/4 + d%8 usingonlyadd,sub,addi, and,andi,or,ori,sll,andsrl instructions.Sinceb,c,andd mustnotbeoverwritten,useasmanytemporary registers($t0-$t9) asneeded.

3. SPIM/MARs a. ReadtheintroductiontoSPIMsimulatorinP&HA.9.Notethatyou probablywill notunderstandeverythinginthissection,yet,sincewehavehavenotcovered thecorrespondingmaterial,butitwillprovideyouwithareasonableoverview. However,youshouldbeabletoanswer:doesSPIMsimulatetheABI,ISA,and/or microarchitectureofMIPS? b. Loadprob3.sintoyoursimulator.Runthreetimeswithdifferentinputsand reporttheresult.Lookingatthecode,whatdoesthisprogramdo? c. Modifyprob3.stoprintthe mathematical floorofanaverageof8inputs(this shouldrequireadding1(one)lineofassemblycode andchanginganumberor two). Submityournewprogramasprob3_.s. 

Leave a Reply