COMP1036辅导、Java，c++程序辅导

School of Computer Science
Computer Fundamentals (COMP1036) Autumn 2021
Custom ALU
Deadline: 17:00 Friday 10th of December, 2021
Collaborating in small groups of up to three students is permitted, but
you must implement your own programs (absolutely do not copy and
Note that lacking proper comments will lose mark.
Description
Previous exercises have used combinatorial logic and sequential logic to construct
many of the various logic circuits that form the basis of a computer. In this exercise,
we will put some of these circuits together to build a custom 16-bit ALU chip, with
the capacity to save and re-use the output.
The core of our simplified ALU is represented pictorially below and consists of
two 16-bit inputs, x and y, and one 16-bit output. It also has a series of control
inputs, which can be used to select what function the ALU performs. Specifically,
you need to implement the following features:
Figure 1: ALU Schematic
1
1. Subtract y from x
(5 marks)
2. Multiply x by y (x, y ∈ [−100, 100])
(5 marks)
3. Divide x by 2 (x >0, keep quotient only)
(5 marks)
4. Calculate an exponential expression, x
y
(x ∈ (0, 7], y ∈ (0, 5])
(5 marks)
5. Decide if x is bigger than y, output = 1 if true, -1 if false
(5 marks)
The five control signals, S, M, D, F, and GL, are used to control the output
produced by the ALU by selecting between the output of the five possible
functions it can perform. Specifically, we have:
if (S == 1) set out = x-y // integer 2’s complement subtraction
if (M == 1) set out = x*y // integer 2’s complement multiplication
if (D == 1) set out = x/2 // integer 2’s complement division by 2
if (F == 1) set out = x^y // integer 2’s complement exponentiation
if (GL == 1),
if (x>y) set out = 1
if (x<=y) set out = -1
You can assume that only one signal will be active at once, and so the order
you select between the possible outputs doesn’t matter. The project skeleton
is supplied in the file CUSALU.hdl
Submission
You should zip all your files into one zip file to “Coursework1 Assignment”.
You should name your file as: YOURSTUDENTID YOURNAME.zip. Submit your
zip file onto Moodle submission page. Please note that every next submission
overwrites all the files in the previous one. If you submit several times,
make sure that your last submission includes all the necessary files. Include all
required chips, instructions for use, and any instruction text file. For late submission,
the standard late submission policy applies, i.e. 5% mark deduction
for every 24 hours.