Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

How would I go about making a program in Java that would act like an ALU. With 8

ID: 3936392 • Letter: H

Question

How would I go about making a program in Java that would act like an ALU. With 8 bits for each thing going through each logic micro operation such as 10001000 AND 11111111 would equal 10001000. The micro operations it has to have are load, store, shift-left, and shift-right, add, add-with-carry, sub, increment, and, or, xor, and complement,set-a-flag, clear-a-flag, test-a-flag, branch-if-zero, and branch-if-carry. If someone could help me get started or set me on the right path I'd really appreciate it.

Explanation / Answer

You will have to design the whole functionality using BitSet datatype in java to have this implemented.

Create a class with BitSet member variable.

Then create functions for each functionality.

Each function will take the member variable and the argument passed (if in case of add, sub, mul, div) to do the operations.

All your operations will be on the BitSet data variable type. it is of vector type and will have boolean value for each bit. This will make your job easier.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote