本次英国代写主要为C++ CPU实现的assignment
Assignment Overview
The overall aim of your assignment is to build a software based implementation of a
Central Processing Unit (CPU). Such an implementation should be capable of emulating
the execution of machine code instructions. The implementation should be written in the
‘C’ programming language but you are free to use ‘C++’ if you are more comfortable with
the latter. You are free to use any compiler you wish, however the GNU tool-chain is
recommended. CPUs can clearly be very complex devices, hence you will not be expected
to build a fully compliant implementation. However the more complete the implementation,
the higher the final grade will be. The CPU to be simulated will be loosely based on the
standard ARM architecture. You will be provided with a datasheet which will specify the
nature of the device (e.g, register count, status register format etc. and the instruction set
to be supported). In order for the simulation to work your program will also have to provide
some virtual peripheral devices, e.g. Some virtual RAM will be required and virtual
display?.
The project has been broken down into three requirements described as follows.
Requirement 1 – Instruction Decoding and Disassembling: 40 Marks
The first requirement will be to develop a program which is capable of decoding ARM
based instructions from their native form (machine code) and displaying these as
Assembly language instructions. This should result in the development of a computer
program which has the ability to fetch, decode and display the instructions within the
provided instruction set.
One key aspect you will have to consider is how the instructions will be defined and read
by your program. The op-codes should be stored in your virtual RAM (or ROM if you
decide to include such a feature). However these codes need to get into the virtual
machine somehow. Initially you may want to consider hard-coding some simple
instructions for testing purposes. Later you may decide to load the instructions from a file.
As the program is executing it should display the original op-code value along with the
assembly language equivalent. For example, given the following machine code
hexadecimal op-codes –
E3 A0 00 01
E3 A0 10 02
E0 80 20 01
E2 82 20 05
The program should output something similar to the following.
Op-Code Assembly Mnemonic
E3 A0 00 01
E3 A0 10 02
E0 80 20 01
E2 82 20 05
MOV r0,#l
MOV rl,#2
ADD r2,r0,rl
ADD r2,r2,#5