Docsity

Decimal Numbers - Computer Engineering - Solved Exam, Exams of Computer Science

Toggle sidebar
bg1
ECE 2030 H Computer Engineering Spring 2004
4 problems, 6 pages Exam Two Solutions 18 March 2004
1
Problem 1 (6 parts, 37 points) Numbers and Arithmetic
Part A (4 points) Convert these hexadecimal values into decimal notation:
hexadecimal notation decimal notation
0x373 256*3 + 16*7+3 = 883
0x5B.4 5*16 + 11+ 4/16 = 91.25
Part B (4 points) Convert these binary values into octal notation:
binary notation octal notation
1010011110 1236
11011010.11 332.6
Part C (10 points) For each problem below, (a) compute the addition using the rules of
arithmetic, (b) indicate whether an error occurs assuming all numbers are expressed using a five
bit two’s complement representation, and (c) indicate whether an error occurs assuming all
numbers are expressed using a five bit unsigned representation.
1 0 1
+ 1 0 1 1
1 0 0 1
+ 1 1 0 1 1
result 1 0 0 0 0 0 0 1 0 0
signed
error? Yes No
unsigned
error? No Yes
Part D (12 points) Convert each subtraction problem (X-Y=Z) below to an addition problem
(X+(-Y)=Z) and compute the result of the addition. Also indicate whether an error occurs
assuming all numbers are expressed using a five bit two’s complement representation and then
indicate whether an error occurs using a five bit unsigned representation.
1 1 0
- 1 1 0 1
0 0 1 1 0
⇒ + 1 0 0 1 1
1 0 1 1 0
- 1 0 0 1
1 0 1 1 0
⇒ + 1 0 1 1 1
Result 1 1 0 0 1 0 1 1 0 1
Signed
Error? No Yes
Unsigned
Error? Yes No
pf3
pf4
pf5

Partial preview of the text

Download Decimal Numbers - Computer Engineering - Solved Exam and more Exams Computer Science in PDF only on Docsity!

4 problems, 6 pages Exam Two Solutions 18 March 2004

Problem 1 (6 parts, 37 points) Numbers and Arithmetic

Part A (4 points) Convert these hexadecimal values into decimal notation:

hexadecimal notation decimal notation

0x373 2563 + 167+3 = 883**

0x5B.4 516 + 11+ 4/16 = 91.*

Part B (4 points) Convert these binary values into octal notation:

binary notation octal notation 1010011110 1236

11011010.11 (^) 332.

Part C (10 points) For each problem below, (a) compute the addition using the rules of arithmetic, (b) indicate whether an error occurs assuming all numbers are expressed using a five bit two’s complement representation, and (c) indicate whether an error occurs assuming all numbers are expressed using a five bit unsigned representation.

result 1 0 0 0 0^ 0 0 1 0 0

signed error?

Yes No

unsigned error? No Yes

Part D (12 points) Convert each subtraction problem (X-Y=Z) below to an addition problem (X+(-Y)=Z) and compute the result of the addition. Also indicate whether an error occurs assuming all numbers are expressed using a five bit two’s complement representation and then indicate whether an error occurs using a five bit unsigned representation.

  • 1 1 0 1
  • 1 0 0 1

Result 1 1 0 0 1^ 0 1 1 0 1

Signed

Error? No^ Yes

Unsigned

Error? Yes^ No

4 problems, 6 pages Exam Two Solutions 18 March 2004

Part E (3 points) What is the minimum number of bits needed to accurately represent the following decimal numbers in an unsigned representation?

a) 145: 8 bits.

b) 256.75: 11 bits.

Part F (4 points) What is the minimum number of bits needed to accurately represent the following decimal numbers in a signed two’s complement representation?

a) 256.75: 12 bits.

b) – 75: 8 bits.

Problem 2 (3 parts, 18 points) Counter Design

Part A (5 points) Design a toggle cell using transparent latches and basic gates (AND, OR, NAND, NOR, XOR, and NOT). Use icons for the latches. Your toggle cell should have an active high toggle enable

input TE , an active low clear input Clear , two-phase non-overlapping clock inputs Φ 1 and Φ 2 , and an

output Out. The Clear signal has precedence over TE. Label all signals.

In Out

En

Latch

In Out

En

Latch

TE Out

Clear

4 problems, 6 pages Exam Two Solutions 18 March 2004

Problem 3 (3 parts, 24 points) State Machines

Part A (10 points) Given the following state table, draw the state machine diagram using the state

bubbles below. The variables S 1 S 0 denote the current state and NS 1 NS 0 denote the next state. A / B is 1 when A is asserted and 0 when B is asserted.

S 1 S (^0) A / B NS 1 NS 0 X S 1 S (^0) A / B NS 1 NS 0 X

0 0 0 1 1 1 1 0 0 0 1 0 0 0 1 0 1 0 1 0 1 1 1 0 0 1 0 0 0 0 1 1 0 1 0 0 0 1 1 1 0 0 1 1 1 0 0 1

00

11 10

01

A/

A/

B/X A/ A/X

B/

B/

B/

Part B (5 points) The primary output of this state machine is S 1 and S 0. What is its function?

It’s a 2-bit nonsaturating up/down counter.

Part C (9 points) Give simplified boolean expressions for the next state variables and for X.

NS 1 = S 1 ⊕ S 0 ⊕ A

NS 0 = S 0

X = S 1 S 0 A + S 1 BS 0

4 problems, 6 pages Exam Two Solutions 18 March 2004

Problem 4 (2 parts, 21 points) Registers and Timing

Part A (6 points) Complete the truth table to describe the behavior of the circuit below. In the Comment column, give a one-word description of each case (e.g., “Set”).

A OUT

B

A B OUT Comment 0 0 0 1 1 0 1 1

Q 0

Disallowed Reset Set Latch

Part B (15 points) Consider the register implemented below.

In Out

En

Latch

In Out

En

Latch

0

1

mux out IN s

WE

OUT

A

Φ 1 Φ 2

B

RE

Assume the following signals are applied to your register. Draw the signal at point A (output of the first latch), the signal at point B (output of second latch), and the output signal Out. Assume A, B, and Out start at zero. If a float occurs on any signal, indicate this by shading the interval of time during which it is floating.

Φ 1

Φ 2

In

WE

B

A

Out

RE