CEG 2131 - Fall 2006 - Final
CEG 2131 - Fall 2006 - Final
CEG 2131 - Fall 2006 - Final
Number:___________________________________________________
Notes:
• You may use the back of the pages for any side work. This will not be
marked.
• No notes or texts are permitted. You have to abide by the University’s
regulations regarding the conduct of exams.
• Calculators are not allowed
• Instruction formats and PSR format for the ARC, microcode format and
decode format for microinstruction address are given on page 13.
• ARC ALU operations and COND table are given on page 14.
• Microprogram for the ARC is given on page 15 & 16.
CEG2131 Final exam Page 2 of 16
3. The decimal equivalent of the four-bit two’s complement 1111 is equal to:
(a) - 8
(b) – 1
(c) 1
(d) None of these
4. The ARC architecture uses 32 bit integer data type. Each integer is stored as a
collection of bytes. ARC uses:
(a) big-endian format
(b) little-endian format
(c) Both little-endian and big-endian format
(d) None of these
7. In the memory format of ARC instructions for the st instruction the source register is
given by:
(a) register %rd
(b) register %rs1
(c) the addition of %rs1 and %rs2
(d) sim13
9. Register transfer language (RTL) is a low level HDL. Each statement consists of:
(a) Data portion and transfer portion.
(b) Transfer portion of many registers.
(c) Line number and transfer portion
(d) None of these.
(i) Represent .254 x 103 in a normalized base 8 floating point format with a sign bit,
followed by a 3-bit excess 4 exponent, followed by four base 8 digits.
Solution:
Step #1: Convert to the target base.
.254 x 103 = 25410. Using the remainder method, we find that 25410 = 376 x 80:
254/8 = 31 R 6
31/8 = 3 R 7
3/8 = 0 R 3
Step #2: Normalize: 376 x 80 = .376 x 83.
Step #3: Fill in the bit fields, with a positive sign (sign bit = 0), an exponent of 3 + 4 = 7
(excess 4), and 4-digit fraction = .3760:
0 111 . 011 111 110 000
The radix point may not be written explictly in the bit pattern.
(ii) Write the IEEE 754 single precision bit pattern for +0:
(iii) Add (173)10 and (827)10 in signed BCD use the necessary digits in the result.
Part B (8 marks):
Show the process of serial unsigned multiplication for 1101 (multiplicand) multiplied by
1010 (multiplier).
1101
C A Q Comments
1010
Given two unsigned numbers stored in memory locations X and Y. Write ARC assembly
program to perform XOR operation on these numbers, divide the result by 4 and store the
final result in memory location Z.
Solution:
.begin
org 2048
ld [X] , %r1
ld [Y] , %r2
orncc %r1, %r0, %r3 !complement X
orncc %r2 , %r0 , %r4 !complement Y
andcc %r1, %r4, %r5 ! X Y’
andcc %r3, %r2, %r6 !X’ Y
orcc %r5 , %r6, %r7 ! X Y’ + X’ Y
st %r7 , [Z]
jmpl %r15 + 4 , %r0
.end
Given two unsigned numbers stored in registers %r1 and %r2. Add these two numbers
and store the result in register %r3. Use the method of subroutine linkage using stack.
Solution:
Line 1604
Line 1605
Line 1606
Line 1607
Solution:
A B XOR XNOR
0 0 0 1
1 0 1 0
0 1 1 0
1 1 0 1
XNOR = AB + A B
/immediate
GOTO 1615;
8Kbyte of RAM located at address following the ROM block and using 8Kbyte chip
Eight memory mapped peripheral each requires 32Kbyte in the 256byte range following
the RAM block
(a) Draw the memory map of the system use hexadecimal format to define the
memory range for each of these blocks
(b) Draw the circuit for the address decoder.
Solution:
ROM1 4K 0000-0FFF
ROM2 4K 1000-1FFF
ROM3 4K 2000-2FFF
ROM4 4K 3000-3FFF
RAM 8K 4000-5FFF
P1 32K 6000-601F
P2 32K 6020-603F
P3 32K 6040-605F
P4 32K 6060-607F
P5 32K 6080-609F
P6 32K 60A0-60BF
P7 32K 60C0-60DF
P8 32K 60E0-60FF
ROM line A12-A13 for selection and A0-A11 for memory location
RAM line A14 = 1 and A13 = 0 and A0 to A12 for memory location