You are on page 1of 2

ECC 3201 COMPUTER ARCHITECTURE

SEMESTER 2 2019/2020

Question 1

Figure 1 shows a datapath for R-type instructions which consits of a register file and an
arithmetic logic unit (ALU). These instructions are also known as aritmetic-logical-
instructions since they perform aritmetic or logical operations.

The register file contains all the registers and provides two read ports and one write
port. The register file always provides the contents of the registers corresponding to the
read register inputs on the outputs, while the writes must be explicitly controlled with the
write control signal. The inputs carrying the register number to the register file are all 5
bits wide, whereas the lines carrying data values are 32 bits wide.

The operation to be performed by the ALU is controlled with the ALU operation signal
(ALU_OP), which will be 3 bits wide.

ALU_OP
REGISTERS
READ
REGISTER 1 READ ALU
A
READ DATA 1 RESULTS
INSTRUCTION REGISTER 2
WRITE
ALU
REGISTER READ ALU
B
WRITE DATA 2 FLAGS
DATA

WRITE

Figure 1: Datapath for R-type instruction

1
(a) Explain the function of the register file.
(b) Explain the function of the arithmetic logic unit (ALU).
(c) Determine the number of registers inside the register file.
(d) Determine the maximum number of operations can be performed by the ALU.

Question 2

Consider a segment of a C program which contained three variables, a, b and c.

a = b + c;

A compiler translates this C program to MIPS instruction. The C compiler produces

add a, b, c

This instruction is a symbolic representation of what the processor understands, it is


also called an assembly language instruction. The MIPS notation instructs the
processor to add two variables b and c and to put their sum in a. The C compiler may
assign the variables, a, b and c to the registers $9, $10 and $11 respectivley.

(a) Determine the compiled MIPS assembly code.


(b) Determine the instructions at the READ REGISTER 1, READ REGISTER 2 and
WRITE REGISTER lines in Figure 1.
(c) Determine the contents of the registers $9, $10 and $11 after this instruction if
the intial contents of the registers $9, $10 and $11 are 100, 450 and 210
respectivley.

You might also like