Lab 1: Basics
The assignment is to load the value of variable X from a memory location and
save the value in variable Y. Assume the value of X is stored at memory
address 4000, the value of Y is stored at memory address 4004, and registers
$s0 and $s1 contain the memory addresses 4000 and 4004:
Sol:
Lab 2: Arithmetic expression - add/sub
Given the mapping of registers to variables below, write a program to
implement the following expression:
Z=A+B+C−D
Use only $t0 as a temporary register during implementation.
Registers Variables
$s0 A
$s1 B
$s2 C
$s3 D
$s4 Z
Sol:
Lab 3: Max of 3 - slt/branch
Write a program that stores the maximum of three values. The values are
stored in $s0, $s1, and $s2. Store the result in $s3.
Note: Use the '+' button under the Registers display to initialize register values
for $s0, $s1, and $s2.
Ex: If the values of $s0, $s1, and $s2 are initialized in the simulator as:
Registers Data
$s0 5
$s1 9
$s2 8
the result is stored in $s3:
$s0 5
$s1 9
$s2 8
$s3 9
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps
- i. Briefly explain how the addition of 2 binary numbers takes place with the help of a flow chart using an Intel microprocessor.ii.Write a pseudocode for the above flow chart and a code in any of the simplest assembly language.iii. Perform i. and ii. above for subtraction operation.arrow_forwardAssume a CPU with a fixed 32-bit instruction length has the following instruction format:opcode mode [operand1] [operand2] [operand3]The mode encodes the number of operands and each operand’s mode. For instance, one mode indicates three registers, another indicates two registers and an immediate datum, another indicates a main memory reference, etc. Assume there are 94 instructions and 22 modes. Answer the following.a. One mode indicates three registers. How many registers can be referenced in this mode?b. One mode indicates two registers and an immediate datum in two’s complement. Assuming there are 32 registers, what is the largest immediate datum that can be referenced?c. One mode has a destination register and a source memory address (an unsignednumber). Assuming 16 registers, what is the largest memory reference available?d. One mode has two memory addresses, both using base displacement. In both, the basesare stored in index registers and the displacements are specified in the…arrow_forwardII. macro named mComp16 that compares two unsigned 16-bit memory operands (op1, op2) and implement the following pseudo code. (Syntax: MSE16 vall, opl, op2) while (int2 >= intl) { add ebx,2 if (ebx > int2) mov ebx,0 else mov ebx, intl vall = ebxarrow_forward
- 10.- Consider the following code and pictureLoop1MOVLW 0x32MOVWF REG2DECFSZ REG2,FGOTO LOOP1 If the system clock frequency is aMHz and each machine cycle consumes 4 cycles of it. Calculate the delay time of the LOOP1 loop. Include the execution difference time of the DECFSZ instruction in the last cycle. Select an answerA) 0.6.sB) 6msC)6usD) 60usarrow_forwardAssume: CPU Clock = 1 GHz 1 OP requires 5 clock cycles (arithmetic instruction, conditional, etc.) 1 memory access requires 100 clock cycles (Read or Write) Problem size: N = 1,000,000 (1 million) There is no cost associated with the loop index variable: do not count any arithmetic instructions for initializing or incrementing the loop index value, do not count any memory accesses for accessing and using the loop index variable in your computation of a sum. Assume the loop index variable is "free of charge" There is no memory cost of accessing and updating your accumulator variable (e.g., sum += ...), but there is an arithmetic operation involved in updating the accumulator variable. Questions: 1. For algorithm #1 shown below (direct sum): • How many arithmetic instructions are required by this algorithm? • How many memory accesses are required by this algorithm? • How many clocks are required by this algorithm? • What is the CPI (cycles per instruction) required by this algorithm? •…arrow_forward10) Functions in high-level languages often declare local variables just below the return address on the stack. Write an instruction that you could put at the beginning of an assembly language subroutine that would reserve space for two integer doubleword variables. Then, assign the values 1000h and 2000h to the two local variables.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education