Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
Implement the following cpp program in MIPS, upload the MIPS source code and the screenshot of program execution results
int multiply(int x, int y)
{
int product=0;
if(x>y)
for(int i=0;i<y;i++)
product+=x;
if(y>x)
for(int i=0;i<x;i++)
product+=y;
return product;
}
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Convert the following into Pep/9 Assembler: #include using namespace std; int square(int n){ int i; int sq; sq = 0; for (i = 0; i < n; i++){ sq = sq + n; } return sq; } int main (){ int num; cout << "Enter a number: "; cin >> num; cout << num << " squared = " << square(num) << endl; return 0; }arrow_forwardFind the problem with the logic of the below program, assuming all system calls are successful. The problem is not about compile or run-time errors! int fd [2]; pipe (fd); for (int i = 0; i < 10; ++i) { int childpid if (childpid = fork (); 0) { } == close (fd[0]); for (int j = 0; j < 10; ++j) write(fd [1], j, sizeof(int)); exit(0);arrow_forwardpublic static void main(String[] args) { for(int a = 0; a < n; a++) //n foo(); //n } public static foo() { for(int a = 0; a < n; a++) //n System.out.println(a); } Log Exponent Rule: Consider the following logarithm a(x) = log2 X°. Note that we can rewrite this using the "log roll" as c * log2 X. Since constants are factored out during asymptotic analysis, you can simply drop the constant multiplier (which on a log is it's exponent). • Example f(x) = log2 X6 f(x) becomes6 * log2 X, and O(log2 X) Log Base Rule: You may omit the base of the log and assume its base-2. Transitivity: if a < b< c, then a < c. Related to big , if a = 5x² + 3xand I'm trying to prove that a is less than or equal to (i.e, bounded by) x2, we would write5x? + 3x < c * x2 and find some pair of c, k such that this relationship holds. Using transitivity, 5x? + 3xarrow_forwardConvert the following into Pep/9 Assembler: #include <iostream>using namespace std;int square(int n){ int i; int sq; sq = 0; for (i = 0; i < n; i++){ sq = sq + n; } return sq;}int main (){ int num; cout << "Enter a number: "; cin >> num; cout << num << " squared = " << square(num) << endl; return 0;} Submit: Source file along with screen captures showing the program running in the Pep simulator.arrow_forwardExample: The Problem Input File Using C programming language write a program that simulates a variant of the Tiny Machine Architecture. In this implementation memory (RAM) is split into Instruction Memory (IM) and Data Memory (DM). Your code must implement the basic instruction set architecture (ISA) of the Tiny Machine Architecture: //IN 5 //OUT 7 //STORE O //IN 5 //OUT 7 //STORE 1 //LOAD O //SUB 1 55 67 30 55 67 1 LOAD 2- ADD 3> STORE 4> SUB 5> IN 6> OUT 7> END 8> JMP 9> SKIPZ 31 10 41 30 //STORE O 67 //OUT 7 11 /LOAD 1 //OUT 7 //END 67 70 Output Specifications Each piece of the architecture must be accurately represented in your code (Instruction Register, Program Counter, Memory Address Registers, Instruction Memory, Data Memory, Memory Data Registers, and Accumulator). Data Memory will be represented by an integer array. Your Program Counter will begin pointing to the first instruction of the program. Your simulator should provide output according to the input file. Along with…arrow_forwardImplement the following C++ program in MIPS, upload the MIPS source code and the screenshot of program execution results. int multiply(int x, int y){ int product=0;if(x>y) for(int i=0;i<y;i++) product+=x;if(y>x) for(int i=0;i<x;i++) product+=y;return product;}arrow_forwardAnswser must be in MIPSzy assembly language. Max of 3 - Brancharrow_forwardConsider this program: int main(void) { int pid = fork(); if (pid > e) { printf("1ine\n"); pid - fork(); printf("line\n"); fork (); if (pid == 0) printf("line\n"); return e; How many times is printf called? How many processes have run after they have all terminated?arrow_forwardConsider the following C functions and assembly code:arrow_forwardarrow_back_iosarrow_forward_ios
Recommended textbooks for you
- 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
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education