Question: For this assignment you should implement a register bank with 8 registers. It will be like the one which we implemented in class as a
For this assignment you should implement a register bank with 8 registers. It will be like the one which we implemented in class as a circuit, except that you will implement it in Java and it will store int values (32 bits) rather than 16 bit values. It should be named RegisterBank. It should have a constructor which takes no arguments. It should have two methods: public void set(int registerNumber, int value) Should put value into the register identified by registerNumber unless registerNumber is 0. If registerNumber is 0, it should do nothing. Putting a new value into a register will completely replace the previous value which was stored there. public int get(int registerNumber) Should get the value which was most recently stored into the register identified by registerNumber and return it unless registerNumber is 0. If registerNumber is 0, it should return 0 regardless of any past calls to set. In both methods registerNumber will be a number from 0 to 7. The register bank in class stored 16 bit numbers. For simplicity, this one will store 32 bit numbers (ints). Do not remove or change any bits before storing the number.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
