7. "Write a program to evaluate the following arithmetic statement X = [A * (B + C) - D] / (E + F - G) i) using a general register computer with three-address instructions ii) using an accumulator type computer with one-address instructions iii) using a stack organized computer with zero-address operation instructions."
Q: 53. Write an instruction sequence that generates a byte-size integer in the memory location defined…
A: Write an instruction sequence that generates a byte size integer in the memory location defined as…
Q: Consider the expression: A = -B * (C + D) Write the three - address code for this expression and…
A: In compiler design concepts the three address code is one type type of intermediate code which is…
Q: 4. Write a program to evaluate the following arithmetic statement: A* [B + C* (D + E)] F* (G + H) X…
A: The given arithmetic statement can be expressed in different instruction formats.
Q: Assume that variables i and k are in registers s0 and s1, respectively and that B is an integer…
A: variables i and k are in registers s0 and s1, respectively and that B is an integer array whose base…
Q: |Task 1 Write (using minimum number of instructions) and execute a program to copy three hexadecimal…
A: We have to write a assembly language program for hexadecimal numbers.Hexadecimals have advantage…
Q: Write an assembly program implementing following function, where the variables x and f are positive…
A: Here we write simple assembly code for this function:…
Q: 2) Generate the three address code for the following program segment and apply code optimization to…
A: Task : Given the sample code. The task is to convert to three address codes.
Q: Convert the following C statements into equivalent MIPS assembly language: a = 10; b =…
A: a = 10; b = 0; for (b = 10; b =! 100 ; b++) { b = b - a; D[i] = a - 3; C[3] = b + 10; }
Q: (3) (a) Write an assembly language program with proper comment for the following : A block of data…
A: Given:
Q: Write a program for 8085 microprocessor the following function. F = X2 – 2X+5. Where X £ 5.
A: 25 - 10 +5 20Ans
Q: . 2) You are required to write an Assembly Language program segment to perform the operation Ci =…
A: Given 2. 2) You are required to write an Assembly Language program segment to perform…
Q: 2. Write an inline assembly language function to be used with C/C++ that rotates a number n places…
A: Find a code implementation below.
Q: Convert the following C statements into equivalent MIPS assembly language: a = 10; b = 0; for (b =…
A: corresponding MIPS code with comment is as follows:
Q: 4. Write a subroutine to set bits 6, 4, and 2 of every element in an array in data memory. array…
A: Input : Array to the subroutine Output : Values set at position 6 , 4 and 2.
Q: Describe the sequence of operations that might go on inside the computer during the execution phase…
A:
Q: 14. Translate function f into MIPS assembly language. If you need to use registers St0 through $t7,…
A: The program is an given below :
Q: Write in MIPS Assembly language a well-documented program consisting of the two following functions.…
A: .globl main .textmain: jal driver # call function driver…
Q: Q5) Write the MIPS assembly code of the following C/JAVA code. If (x>=5) :-2y/(x-5.0); else := y;…
A: Task : Given the code snippet in C/Java. The task is to find the equivalent code in Assembly.
Q: Translate the following C statement to an equivalent MIPS assembly program. Assume that the…
A:
Q: Give an assembly language assembler directive statement (s) that initialize the values 13, F7H, -9…
A:
Q: Q. "Write a program to evaluate the following arithmetic statement X = [A * (B + C) - D] /(E + F -…
A: Given: Write a program to evaluate the following arithmetic statement X = (A * (B+C) - D] /…
Q: b) For the following C statement, write the corresponding LEGV8 assembly code. Assume that the…
A: (b) For the following C statement, write the corresponding LEGv8 assembly code. Assume that the…
Q: Let’s assume that A is an array of 100 words (32-bit) and that the compiler has associated the…
A: Compiled MIPS code: t in $s2, base address of A in $s3 Index 4 requires offset of 32 lw $t0, 32($s3)…
Q: 6. The directive that updates the location counter to the next even address while executing a series…
A: Actually, given question regarding directives.
Q: 16. a) Write the following expression in postfix (reverse Polish) notation. Remember the rules of…
A: Answer : In order to convert a given infix expression into the postfix notation what we essentially…
Q: Write a function in MIPS assembly that copy the value of the 8th element of a word array to the 5th…
A: NOTE: we are assuming the word size of array is 4 byte. Code: fun: li $t0, 7 sll $t0 ,$t0 ,2 add…
Q: Long arith(long x,long y,long z) { |long t1=x+y; long t2=z+t1; Long t3=x+4; long t4=y*48; Long…
A: Answer is given below:
Q: 5-Translate the following C program to MIPS assembly program (Please ex- plain each instruction in…
A: Converting above c program into MIPS code
Q: Problem 3 Assume the function declaration for g is as follow int g(int a); Translate function f into…
A: Question:
Q: 7. "Write a program to evaluate the following arithmetic statement X = * (B + C) - D] / (E + F - G)…
A: Given:
Q: Consider the following C function: void f(int **, int a, int b) { if (x != 0) { *x += a; } return; }…
A: Even though most programming is now carried out in high level languages, a good understanding of the…
Q: Identify basic blocks and hence draw control flow graph for the following code. = read () ; b: read…
A: The question is to draw the CFG with respect to the given program.
Q: a.) Write the MIPS code for the CĪJAVA code below. If you use any saved registers, save them to…
A: import java.util.*;class Demo{ static int func(int a, int pow) { if (pow > 1 )…
Q: 10. Write the corresponding LEGV8 code for the following fragment of C code for ( int i = 0; i<50;…
A: To write corresponding LEGv8 code for the given C code and find no. of instructions and data memory…
Q: Give an assembly language assembler directive statement(s) that initialize the values 13, F7H, -9…
A:
Q: Q3) Write a program to compare two block of 20 (8-bit) data elements, the first block started at…
A: Answer is given below.
Q: Program 11.4 Write an assembly language program using instructions of TMS320C5× processors to divide…
A: Example : Algorithm : Assign value 500 in SI and 600 in DI Move the contents of [SI] in BL and…
Q: 1). a) What is a pointer in C/C++? Please describe the process of referencing and dereferencing a…
A:
Q: Question 01 : (a) Write an assembly language program for the Intel 8086 microprocessor that adds two…
A:
Q: 9. a) Write a simple assembly program to store values ex25 and ex86 into locations ex40000030 and…
A: Part A) LDR R0,=0x40000030 ; load memory location to R0 LDR R1, =0x40000025 ; load memory…
Q: Below is the initial content of Stack: | Ox2964 | Ox 1252 <<<< Top of Stack Ох 298| | OXE298 |…
A: In the above stack 1.pc ( program counter ) is increased +2, 0x 988 2.STKPTR:point to the top of…
Q: 2.3 [5] For the following C statement, what is the corresponding MIPS assembly code? Assume that…
A: To do: For the given C statement write the MIPS assembly code.
Q: (c) For the following C statement, write a minimal sequence of LEGV8 assembly instructions that…
A: Here I have solution only for the (c) one. as the C statement: A = D[2] << 4
Q: 4- What should be the value of {N} loaded to CX register in the following assembly subroutine so…
A: In the subroutine there is a loop, MOV CX, n Back:…
Q: Exercise 6.33 Write a function in high-level code that takes a 10-entry array of 32-bit integers…
A: Memory organization The purpose of memory is to store teams of bits, and deliver them (to the…
Q: 5. Write a program to evaluate the arithmetic statement: X= (A*[B+C*(D+E)])/(F*(G+H)) i. Using a…
A: Program for the evaluation of an arithmetic statement using 3 address, 2 address, 1 address…
Q: Assume that the integer variables f, g, and h are assigned to registers Ss0, Ss1, and Ss2…
A:
Q: Write a program in C++ language to illustrates how a pointer variable works. Follow the instruction…
A: Pointer stores the address of another variable. When the value at the address pointed by the pointer…
Q: 3. For the following loop, write the equivalent C code routine. Assume that the registers $s1, Ss2,…
A: Given: The registers holding the variables are as follows: $s1 ← A $s2 ← B $t1 ← i $t2 ← temp
Step by step
Solved in 2 steps with 3 images
- translate the following MIPS code to C. Assume that the variables i, j, and k areassigned to the registers $s0, $s1, and $s2, respectively. Assume that the baseaddress of the array A is in registers $s6.Loop: blt $s0, $s1, Exitbge $s1, $s2, Exitaddi $s1, $s1, 5j LoopExit:addi $t0, $zero, 4ble $s0, $t0, Donesll $t1, $s0, 2add $t2, $s6, $t1sw $zero, 0($t2)Done:Translate the following LEGv8 code to C. Assume that the variables f, g, h, i, and j are assigned to registers X0, X1, X2, X3, and X4, respectively. Assume that the base address of the arrays A and B are in registers X6 and X7, respectively. ADDI X9, X6, #8 ADD X10, X6, XZR STUR X10, [X9, #0] LDUR X9, [X9, #0] ADD X0, X9, X10Let’s assume that A is an array of 100 words (32-bit) and that the compiler has associated the variables s and t with the registers $s1 and $s2 respectively. Let’s also assume that the starting address, or base address, of the array is in $s3. Compile this C assignment statement: A[10] = A[4]+ t;
- (Practice) a. Using Figure 2.14 and assuming the variable name rate is assigned to the byte at memory address 159, determine the addresses corresponding to each variable declared in the following statements. Also, fill in the correct number of bytes with the initialization data included in the declaration statements. (Use letters for the characters, not the computer codes that would actually be stored.) floatrate; charch1=M,ch2=E,ch3=L,ch4=T; doubletaxes; intnum,count=0; b. Repeat Exercise 9a, but substitute the actual byte patterns that a computer using the ASCII code would use to store characters in the variables ch1, ch2, ch3, and ch4. (Hint: Use Appendix B.)Modify the code below: Add code to display both sum and diff in a hexadecimal format on the screen, all bytes must be stored in a reversed sequence order. code: .386 ; Tells MASM to use Intel 80386 instruction set..MODEL FLAT ; Flat memory modeloption casemap:none ; Treat labels as case-sensitive INCLUDE IO.H ; header file for input/output .STACK 100h ; (default is 1-kilobyte stack) .const ; Constant data segment .DATA ; Begin initialized data segment op1 QWORD 0A2B2A40675981234h ; first 64-bit operand for additionop2 QWORD 08010870001234502h ; second 64-bit operand for addition sum DWORD 3 dup(?) ; 96-bit sum = ????????????????????????h op3 DWORD 2h, 0h, 0h ; 96-bit operand to subtract: 20000000200000002h .CODE ; Begin code segment_main PROC ; Beginning of code;-----------------------------------------------------------------------------; add two 64 bit numbers and store the result as 96 bit sum;-----------------------------------------------------------------------------mov EAX,…implement cache memory code in c++ please
- Convert given code to LEGv8 code:int f, g, y //global 64-bit variablesint sum (int a, int b) { // at memory address X0+1000.return (a +b)} int main (void) // at memory address X0 + 800{f=2;g=3;y= sum (f, g);return y;}Convert this code, making valid assumptions about registers and register use. Notethat brackets and global variable declarations are not affecting the addresses of the instructionsin memory.Q1- Write a program in assembly language for the 8085 microprocessor to send one byte of data located at the memory address (3000H ) using SOD at a baud rate of 1200. Information: The 8085 processor operates at a frequency of 3.072 MHz . When sending the required byte, you must adhere to the following: The two high bits of the start bits(1 1) must be sent, after that the data bits are sent, after that the low bit of the stop bit (0) is sent. The following flowchart will help you. The solution must be integrated and include the calculation of the baudrate delay time25: . Find the time delay in the following program if the crystal frequency is 1 MHz. Do not ignore the time delay due to the first and last instruction. DELAY: LDI R16, 30 AGAIN: LDI R17, 35 HERE: NOP NOP DEC R17 BRNE HERE DEC R16 BRNE AGAIN RET 26: Write a program to display 2 on 7 segment. A 7 segment is connected to PortD.
- NASM CODE, modify the code below Write an assembly program for the processor family x86-32 that reads three signed interger numbers from the standard input and writes the greatest of them on the console. Use the C functions scanf and printf for the management of data input and data output. section .datamsg db "The largest number is: %d", 0xa,0v1 equ -47v2 equ 32v3 equ 21num1 times 4 db 0num2 times 4 db 0num3 times 4 db 0 section .textextern printfglobal main ;must be declared for using gcc main: ;tell linker entry point mov dword [num1], v1mov dword [num2], v2mov dword [num3], v3 mov ecx, [num1]cmp ecx, [num2]jg check_third_nummov ecx, [num2]check_third_num: cmp ecx, [num3]jg _exitmov ecx, [num3]_exit:;Print the greatest numberpush ecxpush msgcall printf ;Exit process mov eax, 1int 80h[Note: You are allowed to use only instructions implemented by the actual MIPS hardwareprovided in attached photos below. Use assembly language format from the references orthe book. Note, base ten numbers are listed as normal (e.g. 23), binary numbers areprefixed with 0b and hexadecimal numbers are prefixed with 0x.] Write a C program and corresponding assembly program based on MIPS ISA that reads three edges for a triangle and computes the perimeter if the input is valid. Otherwise, display that the input is invalid. The input is valid if the sum of every pair of two edges is greater than the remaining edge. [Direction: You can consult any resources such as books, online references, and videosfor this assignment, however, you have to properly cite and paraphrase your answerswhen it is necessary.] solve it any how urgently please.Please look at the entire text below. Please solve and show all work. Thank you. What is the corresponding MIPS assembly code for the following C statement? Assume that the variables f, g, h, i, and j are assigned to register $s0, $s1, $s2, $s3, and $s4, respectively. Assume that the base address of the arrays A and B are in registers $s6 and $s7, respectively. B[8] = A[i−j] Translate the following C code to MIPS. Assume that the variables f, g, h, i, and j are assigned to register $s0, $s1, $s2, $s3, and $s4, respectively. Assume that the base address of the arrays A and B are in registers $s6 and $s7, respectively. Assume that the elements of the arrays A and B are 8-byte words: B[8] = A[i] + A[j] Assume that registers $s0 and $s1 hold the values 0x80000000 and 0xD0000000, respectively. What is the value of $t0 for the following assembly code? add $t0, $s0, $s1 Is the result in $t0 the desired result, or has there been an overflow? For the contents of registers $s0 and $s1 as…