The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
How do I translate this MIPS instruction to machine code? I have provided how to calculate the target address and a sample mips file. Please Help, I don't need help creating the c program just need to understand how to properly translate it.Â
Â
I. Assembly Input FileYou should be able to read and parse the contents of a simple MIPS assemblyprogram, which will be redirected through standard input (i.e. do not try to open afile in your program). You can assume that every line of the program will containeither a directive or an instruction. No lines will be blank and a label will not appearon a line by itself. You may also assume that there are no more than 100 lines in anassembly file. Lines containing directives have the following format (where bracketsindicate an optional element):[optional_label:]<tab>directive[<tab>operand]Lines containing instructions have the following format:[optional_label:]<tab>instruction<tab>operandsOperands are always comma-separated with no whitespace appearing betweenoperands.The supported directives are listed in the following table. You may assume that theentire .text segment always precedes the .data segment. You may also assume thatthe memory allocation directives only ever have a single operand.DirectiveMeaning.dataIndicates the start of the data section..textIndicates the start of the text section..spacenAllocate n bytes of memory..wordwAllocate a word in memory and initialize with w.The supported instructions include the following. You may wish to consult anadditional MIPS reference page for more specific information about the instructionsand their machine code formats.InstructionTypeOpcode/Funct (decimal)SyntaxADDR32add $rd,$rs,$rtADDII8addi $rt,$rs,immedNORR39nor $rd,$rs,$rtORII13ori $rt, $rs, immedSLLR0sll $rd, $rt, shamtLUII15lui $rt, immedSWI43sw $rt,immed($rs)LWI35lw $rt,immed($rs)BNEI5bne $rs,$rt,labelJJ2j labelLA--la $rx,labelThe registers to be recognized include the following.RegistersDecimal Representation$t0-$t78-15
Attachments: