Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

these are the 2 files opened The class should be named ALU. It should have a public static method called doOperation with signature: public static

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
these are the 2 files opened image text in transcribed
image text in transcribed
image text in transcribed
The class should be named ALU. It should have a public static method called "doOperation" with signature: public static int doOperation(int op, int r2, int r3) In our instruction set (OurSA.txt), we have a list of operations which should be supported by our ALU. These are coded from 0000 through 1101, which correspond to integers 0 through 13. do Operation should do the appropriate operation from the list based on which value is passed as op and return the result of that operation on the input values. That is, if op is 0, then it should do operation 0000 which is subtraction and thus it should return r2-r3. If it is passed an invalid operatior the method is allowed to return anything it wants. There are tests on codepost.io for class and method name and then one test for each of the different operations. Shift and rotate operations will always have an r3 value between 0 and 31 inclusive. Any other operations can be passed any value for r2 and r3. Assignment Details Spring 2021 Computer Architecture (CIT-3322-02, CS... operations can be passed any value for r2 and r3. Notes: 1) This should probably be implemented via a large if/elseif/elseif statement or a switch statement 2) Some operations only work on a single value. These operations should operate on r2, not r3. 3) The right shift is an unsigned right shift which is the same as the >>> operator rather than >> 4) Please note that there are Java operators for most of the required operators. Check the bitwise operators slides ( 01 bits.pdf ) if you need a reminder of operators for shifting, bitwise and, or, not, and xor. 5) There is no built-in rotate operator in Java, but it can be implemented as follows: Left rotate: (rotate number v by b bits to the left) (v b) I (v >>> (32 - b)) operations can be passed any value for r2 and r3. Notes: 1) This should probably be implemented via a large if/elseif/elseif statement or a switch statement. 2) Some operations only work on a single value. These operations should operate on r2, not r3. 3) The right shift is an unsigned right shift which is the same as the >>> operator rather than >> 4) Please note that there are Java operators for most of the required operators. Check the bitwise operators slides ( 01_bits.pdf) if you need a reminder of operators for shifting, bitwise and, or, not, and xor. 5) There is no built-in rotate operator in Java, but it can be implemented as follows: Left rotate: (rotate number v by b bits to the left) 1) This should probably be implemented via a large if/elseifelseif statement or a switch statement 2) Some operations only work on a single value. These operations should operate on r2, not r3. 3) The right shift is an unsigned right shift which is the same as the >>> operator rather than >> 4) Please note that there are Java operators for most of the required operators. Check the bitwise operators slides (01 bits.pdf ) if you need a reminder of operators for shifting, bitwise and, or, not, and xor. 5) There is no built-in rotate operator in Java, but it can be implemented as follows: Left rotate: (rotate number v by b bits to the left) (v b) | (v >>> (32 - b)) Right rotate: (rotate number v by b bits to the right) (v >>> b) | (v

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Databases Technologies And Applications

Authors: Zongmin Ma

1st Edition

1599041219, 978-1599041216

More Books

Students also viewed these Databases questions

Question

What is the basis for Security Concerns in Cloud Computing?

Answered: 1 week ago

Question

Describe the three main Cloud Computing Environments.

Answered: 1 week ago