CS211computer architecture

CS211computer architecture
WeChat:yj4399_
Sina Visitor System

  1. Inthisassignment,youwillimplementanAdvancedBitwiseFizzBuzz(seemoreaboutFizzBuzzhere).ThistaskinvolvesapplyingFizzBuzzlogictoeachbitofa32-bitinteger,withatwistofhandlingthemostsignificantbit(MSb)differently.Allnumberswillbe32-bitintsrepresentedin2’scomplementform.Youwillpracticebitwiseoperations,stringhandling,andcommand-lineargumentprocessinginC../hw2{32-bitinteger}voidpreComputeResults()Purpose:Topre-computeandstoretheFizzBuzzresultsforeachbitpositioninthecachearray.Tasks:●Foreverypossiblebitposition,fillinthelogictostore'Z'forpositionsdivisiblebyboth3and5,'R'forpositionsdivisibleby3,and'U'forpositionsdivisibleby5.Youshouldonlyperformthisreplacementifthebitissetto1.●Ensurethatnon-replaceablebitsarehandledappropriately(e.g.,non-divisiblebitsandzerobits).Example:Bits11100101Pos76543210OutSRU0010ZObservations:1.Position7issettoSsincetheMSb=1(seemoreinAdvancedBitwiseFizzBuzz())2.Position6issettoRsinceBit=1andbitposition6isdivisibleby33.Position3issetto0sinceBit=0,eventhoughbitposition3isdivisibleby3.©CreatedbyAJDiLeoforuseinRutgersUniversity’sCS211Fall2023courseinstructedbyJayKania.

  2. CS211computer architecture_第1张图片

    char*getFizzBuzzForBit(intposition)Purpose:Toretrievethepre-computedFizzBuzzresultforaspecificbitposition.Tasks:●ImplementthefunctiontoreturnthecorrectFizzBuzzvaluefromthecacheforthegivenbitposition.voidadvancedBitwiseFizzBuzz(int32_tN)Purpose:ToperformtheadvancedBitwiseFizzBuzzlogicontheinputnumber.Tasks:●ApplytheFizzBuzzlogictoeachbitoftheinputnumber.●Replacethesignbitwith'S'onlyifthenumberisnegative.●PrintthebitoritsFizzBuzzresult,withaspaceeveryfourbits.●Ensurethebitstringisoutputtedfromlefttoright,MSbtoLSb.GettingStartedYoushouldfirstdownloadandexpandtheprovidedfiles:tarxvfhw2-provided.tarYoucandownloadtheselocallyandthencopythemtoilabusingscp:[email protected]:~/cs211(assumingyouhaveacs211directoryinyourrootdirectory).NOTE:ALLCOMPILATION,TESTING,ANDEXECUTIONMUSTBEPERFORMEDONTHEILAB.Thisiscompulsorytoensureastandardizedtestingandgradingenvironmentforallstudents.Tocompiletheprogram,youshouldusegcc:gcchw2.c-ohw2Andtorunityoushould:./hw2{int32}©CreatedbyAJDiLeoforuseinRutgersUniversity’sCS211Fall2023courseinstructedbyJayKania.

  3. CS211computer architecture_第2张图片

    AutograderMakesureyourautograderisinthesamedirectoryashw2.c.Runthefollowingcommand:python3hw2-autograder.pyAddtestcasesasneededonline40ofhw2-autograder.pySubmissionONLYSUBMIThw2.ctoCanvas.ItisimportantthatyouonlyuploadthecompletedCfile.Wewillnotacceptatar,zip,etc.©CreatedbyAJDiLeoforuseinRutgersUniversity’sCS211Fall2023courseinstructedbyJayKania.

你可能感兴趣的:(c语言)