Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Million Address - Computer Engineering - Solved Exam, Exams of Computer Science

Main points of this past exam are: Million Address, Logic Design, Switch Level, Boolean Expression, Transistors, Memory and Shifting, Memory System, Indicate Bit Width, Incomplete Design, Encoding and Counting

Typology: Exams

2012/2013

Uploaded on 04/08/2013

sawant_111
sawant_111 ๐Ÿ‡ฎ๐Ÿ‡ณ

5

(1)

67 documents

1 / 6

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
ECE 2030 H Computer Engineering Spring 2004
5 problems, 9 pages Final Exam Solutions 30 April 2004
1
Problem 1 (3 parts, 30 points) Logic Design
Part A (16 points) For each expression below, create a switch level implementation using N and P type
switches. Assume both inputs and their complements are available. Your design should contain no shorts or
floats. Use as few transistors as possible.
Outy
B
D
C
Outx
D
A
F
B
C
C
B
E
F
D E
A
C
E
BA
E
A
D
F
F
OUTx = FEDCBA โ‹…++โ‹…+ )( OUTy = ))(( FEDCBA +โ‹…++
Part B (6 points) Transform the following Boolean expression to a form where it can be implemented using
switches (i.e., there should be no bars in the expression except for complements of the inputs A, B, C, etc.).
The behavior of the expression should remain unchanged.
HGFDECBAOutXโ‹…โ‹…โ‹…+โ‹…โ‹…= )( HGFDECBA โ‹…+โ‹…+โ‹…โ‹…= )(
HGFDECBAOut Xโ‹…+โ‹…โ‹…โ‹…โ‹…= )( HGFDECAB โ‹…++โ‹…+= ))()((
Part C (8 points) For the mixed-logic design below, determine the behavior and write as a Boolean
expression. Do not simplify the expression. Also determine the number of transistors used in the design.
A
B
C
D
E
F
OUTx
OUTX = FEDCBABA โ‹…+โ‹…โ‹…+++ ))(()( Number of
transistors: 2x6+2x8+6x2 = 40T
pf3
pf4
pf5

Partial preview of the text

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

5 problems, 9 pages Final Exam Solutions 30 April 2004

Problem 1 (3 parts, 30 points) Logic Design

Part A (16 points) For each expression below, create a switch level implementation using N and P type

switches. Assume both inputs and their complements are available. Your design should contain no shorts or

floats. Use as few transistors as possible.

Outy

B

C D

Out x

D A

F

B

C

B C

E

F

D E

A

C

E

A B

E

A

D

F

F

OUTx = ( A + B โ‹… C + D + E )โ‹… F OUTy = ( A + B )( C + D โ‹… E + F )

Part B (6 points) Transform the following Boolean expression to a form where it can be implemented using

switches (i.e., there should be no bars in the expression except for complements of the inputs A, B, C, etc.).

The behavior of the expression should remain unchanged.

Out X = ( A โ‹… B โ‹… C + E โ‹… FD )โ‹… G โ‹… H = ( A โ‹… B โ‹… C + E โ‹… FD )+ G โ‹… H

Out X = ( A โ‹… B โ‹… C โ‹… E โ‹… FD )+ G โ‹… H = (( AB + C )โ‹…( E + FD ))+ G โ‹… H

Part C (8 points) For the mixed-logic design below, determine the behavior and write as a Boolean

expression. Do not simplify the expression. Also determine the number of transistors used in the design.

A B C D E F

OUTx

OUTX = ( A + B )+(( A + B )โ‹… C โ‹… D )+ E โ‹… F

Number of

transistors:

2x6+2x8+6x2 = 40T

5 problems, 9 pages Final Exam Solutions 30 April 2004

Problem 2 (2 parts, 30 points) Memory and Shifting

Part A (18 points) Design a 4 million address by 4 bit memory system with four 1M x 4 memory

chips. Label all busses and indicate bit width. Assume R/W is connected and not shown here. Use a

decoder if necessary.

1M x 4

D

D

D

D

ADDR

CS

1M x 4

D

D

D

D

ADDR

CS

1M x 4

D

D

D

D

ADDR

CS

ADDR

MSEL

D

D

D

D

1M x 4

D

D

D

D

ADDR

CS

2-to- decoder

I

EN

O

O

A

A19:

I

A

O

O

Part B (12 points) Below is an incomplete design of a 2-bit shifter. In particular, the 3-to-1 muxes that

determine the two most significant bits and two least significant bits of the output, based on the shift type

(ST), do not have their inputs specified. Complete the design by filling in the twelve dashed boxes with the

appropriate inputs to the 3-to-1 muxes (e.g., โ€œ1โ€, โ€œX 2 โ€, etc.).

R 3-to-1 Mux

C L R 3-to-1 Mux

C L R 3-to-1 Mux

R C L 3-to-1 Mux

C L

2 Rot 3-to-1 Mux

1 Arith

0 Log

2 Rot 3-to-1 Mux

1 Arith

0 Log

Shift?

2 2

2 Rot 3-to-1 Mux

1 Arith

0 2 Log

2 Rot 3-to-1 Mux

1 Arith

0 Log 2

R 3-to-1 Mux

R C L 3-to-1 Mux

C L

5 problems, 9 pages Final Exam Solutions 30 April 2004

Problem 4 (5 parts, 35 points) Assembly Language Programming

Suppose we are writing part of the code for a program to do chromakeying. Chromakeying is used to

superpose a figure, such as a weatherman, on a background image, such as a weathermap. The subroutine

โ€œchromakeyโ€ is shown below; it calls two subroutines โ€œcreate_maskโ€ and โ€œmask_bโ€. The

create_mask subroutine takes as input register $1 and computes a mask value which it puts in register $3.

The mask_b subroutine takes a boolean value in $3 and puts its complement in $4. Most of chromakey

has been written, but instructions necessary for preserving registers across calls are missing.

Part A (8 points) To begin, define a Push and Pop stack macro below. Use $x to denote the value being

preserved. Use register $29 as the stack pointer.

label instruction comment

Push($x) addi $29, $29, 4 # increment stack ptr

sw $x,($29) # store $x on stack

Pop($x) lw $x,($29) # read $x from stack

addi $29, $29, -4 # decrement stack ptr

Part B (10 points) Assume we are using caller-save convention so the caller is responsible for pushing and

popping register values onto/from the stack to preserve them across subroutine calls. In the spaces provided

below, write any additional lines of code that must be added to chromakey to ensure that registers that are

needed after the calls to create_mask and mask_b are preserved. Use your Push and Pop macros.

chromakey: addi $12,$0,2000 # blue screen image starts at addr 2000 addi $15,$0,3024 # initialize $15 to upperbound addr 3024 loop: addi $13,$12,2000 # background image is 2000 away from blue scr. lw $1, ($12) # read in pixels from blue screen image lw $2, ($13) # read in pixels from background image Push($12) # preserve values of registers Push($15) # that are needed after the Push($1) # calls to subroutines (in case Push($2) # the subroutines write over Push($31) # the current register values) jal create_mask # $3 = create_mask($1) jal mask_B # $4 = not($3) Pop($31) # pop the register values off in Pop($2) # the reverse order in which they Pop($1) # were pushed Pop($15) Pop($12) and $6,$2,$3 # $6 = background pixels AND mask and $7,$1,$4 # $7 = blue screen pixels AND NOT(mask) or $8,$6,$7 # $8 = $6 or $ addi $14,$12,5000 (^) # output image is 5000 away from blue scr. sw $8, ($14) # save output image pixels addi $12,$12,4 # increment blue screen image address bne $12,$15,loop # loop back if still below upperbound jr $31 # return to caller

5 problems, 9 pages Final Exam Solutions 30 April 2004

Part C (8 points) How many words are read in from memory (using lw) by the chromakey program?

On each iteration, there are two โ€œlwโ€ instructions executed at the top of the loop and five โ€œlwโ€

instructions in the 5 stack pops. So there are 7 lwโ€™s times the number of iterations of the loop.

Register $12 controls the loop. It starts at 2000, is incremented by 4 on each iteration, and the loop

exits when $12 = $15 = 3024. So there are (3024-2000)/4 = 256 iterations. This means there are 7*

data words read in, or 1792 words.

total number of data words read: 1792 data words

Part D (5 points) What is the branch offset (in bytes) of the bne instruction in chromakey after you

insert the stack pushes and pops?

-32 instruction words * 4 bytes/word = -

branch offset: -

Part E (4 points) Given the following branch instruction, what is the branch target address?

address label instruction 6824 bne $7, $8, -

Branch target address = PC+4 + (-12*4) = 6828-48 = 6780