1. Write a code segment that adds the immediate values $29 and S42, with the final...
1. Write a code segment that adds the immediate values $29 and $42, with the final result located in register A. Determine the value of the result. 2. Write a code segment that uses one instruction to add 1 to register B. 3. Write a code segment that uses one instruction to subtract 1 from register X. 4. Write a code segment that loads the value $1234 into register D. 5. Write a code segment that loads S54 into B,...
1. Assume that you are given values in eax, ebx, ecx. Write an assembly code that does the following: eax = (ecx + edx ) - (eax + ebx) 2. Write a piece of code that copies the number inside al to ch. Example: Assume that Initially eax = 0x15DBCB19. At the end of your code ecx = 0x00001900. Your code must be as efficient as possible. 3. You are given eax = 0x5. Write one line of code in...
PLease give me this question Answer. Write working assembly code that successfully executes the following stack reverse Polish (postfix) based code. Your code must include the use of sub-routines Push, Pop, Subtract, Add Push A Push B Push C Add Push D Push F Subtract Subtract Push E Add Add Pop X A, 3 B, 5 C, 7 D, 2 E, 4 F, 1 What is the final value for X?
1.Write the "destination" register in the instruction 671A in a string of 4 bits. 2.The instruction 9158 uses two registers as operands, and a third register as a destination for the result. Which registers are used for the operands? 9 and 1 1 and 5 5 and 8 9 and 8 3. Translate the following instruction into English: 54F2 Add the bit patterns in registers F and 2 together as if they were presented in two's complement and leave the...
7 [24 marks] Consider the following MIPS code segment that is executed on a 5-stage pipeline architecture that does not implement forwarding or stalling in hardware. (1) add $4, $1, $1 (2) add $7, $4, $9 (3) lw $2, 40($8) (4) sub $8, $1, $2 (5) sw $8, 80(S2) (6) sub $2, $8, $4 (7) lw S8, 2($1) (8) add $8, $4, S2 Identify the data dependences that cause hazards. You are to use the following format to inform each...
You may not need as many lines 5: add, sub, addi, j, beq, bne, lw, sw. as we provide space for (4 pts) Write a MIPS program starting at address 20 that writes a value of 488 to register $7. Next, you will test if register $10 is equal to register $7. If the values are equal, continue execution at address 48; otherwise set the value in register $7 to $10 $21 (contents of register $10 subtract contents of register...
(Java) Write a code segment that uses a for loop and an in a statement to determine whether the value 13 is stored in a previously declared dimensional array named sportsScores. If the value 13 is stored in the array, then store the value true in a boolean flag variable named found. Otherwise, store false in found. The array sportsScores has 4 columns and 5 rows.
PCON is not a bit addressable register. Write a C code segment that makes sure that SMOD0 (bit 6) is cleared to ‘0’ and SMOD1 (bit 7) is set or cleared based on a defined value (i.e #define SMOD1 (1) would cause bit 7 to be set.). Hint: This can be done with as few as two instructions (one to clear and one to set).
Assume that ‘slt $1, $2, $3’ is executed with the implementation in the picture. Identify the value of the 9-bit control signals. Add u X ALU result 4 Add Shift left 2 RegDst Branch MemRead MemtoReg Control ALUOP Instruction [31-26 MemWrite ALUSRC RegWrite Instruction [25-21] Read register 1 Read Read PC address Instruction [20-16] data 1 Read Zero register 2 Instruction ALU ALU 31-0] Instruction memory Read data M Read Address Write result u M Instruction [15-11] register data 2...
5) Write TOY AL subprogram that implements the following subprogram interface: Label: SumEven On entry: Register $1 is the return address of the caller. Register $A is the address in memory of an array A. Register $s is the size of the array A. On exit: Register $F is the sum of the entries of A that are even (divisible by 2) No values in memory have changed. Any of the registers may have changed value. Hint: The TOY assembly...