Answered step by step
Verified Expert Solution
Question
1 Approved Answer
the ALU and the register file, then you will connect them together and run a simple machine code program on them. In order to ensure
the ALU and the register file, then you will connect them together and run a simple machine code
program on them.
In order to ensure that your design is related to yourself, various aspects of the design will be dictated by
your student ID number. These include the machine code used by your design, the contents of the register
file. This means that every student should have a unique design.
You have to work individually in this project and submit a report about your design and implementation
of this project.
Part
The ALU
Write a VERILOG description of an ALU with two bit inputs, A and B and a bit output Result
module alu
The result is derived from one or both of the inputs according to the value of a bit opcode. The
operations that the ALU can perform are listed below:
a b
a b
aie the absolute value of a
a
max a bie the maximum of a and b
min a bie the minimum of a and b
avgabie the average of a and b the integer part only and remainder is ignored
not a
a or b
a and b
a xor b
The opcode that will be used to represent each of these operations is determined by the last digit of your
students ID number. The table below shows which opcode you should use in your design for each
instruction.
Digit of
ID no
a b
a b
a
a
maxab
min ab
avgab
not a
a or b
a and b
a xor b
So for example if your ID is then the last digit is
Then ab is to be represented by opcode ab is to be represented by opcode a is to be represented
by opcode and so onThese are shown as denary base values; your design may use binary or
hexadecimal values.
The register file
Inside a modern processor there is a very small amount of memory that is used to hold the operands that it
is presently working on This is called the register file, and normally has the following appearance
module regfile
This is a very small fast RAM, typically holding x bit words, and therefore requiring a bit address
to select out one of the bit words. It is unlike normal RAM in that it can process three addresses at the
same time, two of which are always read operations, and one of which is always written to
Output produces the item within the register file that is address by Address Similarly Output
produces the item within the register file that is address by Address Input is used to supply a value that
is written into the location addressed by Address
The initial values stored in the register file are determined by the secondfromlast digit of your student
ID and are shown in the table below:
ID
Location
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started