Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program which calculate the value of the following expression ( a + b )

ID: 3578202 • Letter: W

Question

Write a program which calculate the value of the following expression

( a + b ) – ( c – d )

a. Execute program using go and single step commands

b. Compare source code with the code generated by the simulator, what differences you determine.

Below you can find links to Mars simulator, description of MIPS assembler and PCSPIM simulator that will be used by us for the second programming assignment. I recommend you to check if the links are working and to download MARS simulator and to check if you are able to run it at your computer.

http://pages.cs.wisc.edu/~larus/spim.html - PCSPIM simulator PCSIM simulator

http://pages.cs.wisc.edu/~larus/HP_AppA.pdf - Appendix A - Description of MIPS assembler and simulator

http://courses.missouristate.edu/KenVollmar/MARS/ - MARS simulator - Missouri State University

Explanation / Answer

.file 1 "" .section .mdebug.abi32 .previous .gnu_attribute 4, 1 .abicalls .rdata .align 2 $LC0: .ascii "
Enter the value of a,b,c,d:" .align 2 $LC1: .ascii "%d%d%d%d" .align 2 $LC2: .ascii "
Evaluated expression is:%f" .text .align 2 .globl main $LFB0 = . .set nomips16 .ent main .type main, @function main: .frame $fp,64,$31 # vars= 24, regs= 2/0, args= 24, gp= 8 .mask 0xc0000000,-4 .fmask 0x00000000,0 .set noreorder .cpload $25 .set nomacro addiu $sp,$sp,-64 $LCFI0: sw $31,60($sp) $LCFI1: sw $fp,56($sp) movz $31,$31,$0 $LCFI2: move $fp,$sp $LCFI3: .cprestore 24 lw $2,%got($LC0)($28) nop addiu $4,$2,%lo($LC0) lw $2,%call16(printf)($28) nop move $25,$2 jalr $25 nop lw $28,24($fp) addiu $5,$fp,36 addiu $3,$fp,40 addiu $2,$fp,44 addiu $4,$fp,48 sw $4,16($sp) lw $4,%got($LC1)($28) nop addiu $4,$4,%lo($LC1) move $6,$3 move $7,$2 lw $2,%call16(scanf)($28) nop move $25,$2 jalr $25 nop lw $28,24($fp) lw $3,36($fp) lw $2,40($fp) nop subu $2,$3,$2 mtc1 $2,$f0 nop cvt.s.w $f2,$f0 lw $3,44($fp) lw $2,48($fp) nop subu $2,$3,$2 mtc1 $2,$f4 nop cvt.s.w $f0,$f4 sub.s $f0,$f2,$f0 swc1 $f0,32($fp) lwc1 $f0,32($fp) nop cvt.d.s $f0,$f0 lw $2,%got($LC2)($28) nop addiu $4,$2,%lo($LC2) mfc1 $7,$f0 mfc1 $6,$f1 lw $2,%call16(printf)($28) nop move $25,$2 jalr $25 nop lw $28,24($fp) move $2,$0 move $sp,$fp lw $31,60($sp) lw $fp,56($sp) addiu $sp,$sp,64 j $31 nop .set macro .set reorder .end main $LFE0: .size main, .-main .section .eh_frame,"aw",@progbits $Lframe1: .4byte $LECIE1-$LSCIE1 $LSCIE1: .4byte 0x0 .byte 0x1 .globl __gxx_personality_v0 .ascii "zP" .uleb128 0x1 .sleb128 -4 .byte 0x1f .uleb128 0x5 .byte 0x0 .4byte __gxx_personality_v0 .byte 0xc .uleb128 0x1d .uleb128 0x0 .align 2 $LECIE1: $LSFDE1: .4byte $LEFDE1-$LASFDE1 $LASFDE1: .4byte $LASFDE1-$Lframe1 .4byte $LFB0 .4byte $LFE0-$LFB0 .uleb128 0x0 .byte 0x4 .4byte $LCFI0-$LFB0 .byte 0xe .uleb128 0x40 .byte 0x4 .4byte $LCFI2-$LCFI0 .byte 0x11 .uleb128 0x1e .sleb128 2 .byte 0x11 .uleb128 0x1f .sleb128 1 .byte 0x4 .4byte $LCFI3-$LCFI2 .byte 0xd .uleb128 0x1e .align 2 $LEFDE1: .ident "GCC: (Debian 4.4.5-8) 4.4.5"

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote