Docsity

4 Solved Problems Midterm Exam - Digital System Design | ECE 545, Exams of Digital Systems Design

Partial preview of the text

Download 4 Solved Problems Midterm Exam - Digital System Design | ECE 545 and more Exams Digital Systems Design in PDF only on Docsity!

GMU ECE 545

Fall 2007 Midterm

Name:_____________________________

G Number:_________________________

Score: __________

Problem 1 (5 points)

Design a combinational logic block SelL. The circuit takes in two N-bit signed twoโ€™s complement inputs A and B, and outputs the larger of the two: Specifically,

Z = A if A >=B, else Z = B

SelL

A

B

Z

N

N

N

Restriction: You are not allowed to use the comparison operators (<, <=, >, >=) in your block diagram or code. Use another method. You can use any other operators.

Note: This is a simple combinational logic block (no clock, reset, etc.)

(a) Draw the datapath block diagram of your circuit which shows the contents of SelL. Mark clearly the sizes of all buses. You can use basic building blocks such as logic gates, muxes, demuxes, decoders, priority encoders, adders, subtractors, multipliers, etc. (2 points)

(b) Write the synthesizable VHDL circuit for the SelL entity, including library declaration, entity declaration, and architecture. N should be a generic integer with a default value of 8. (2 points)

(c) Now we will enhance the design by adding an additional input: the input sel_large_small selects whether to output the larger or smaller of the two inputs:

If sel_large_small = 1 (i.e. put the largest input on Z) Z = A if A >=B, else Z = B If sel_large_small = 0 (i.e. put the smallest input on Z) Z = A if A < B, else Z = B

SelLS

A

B

Z

N

N

N

sel_large_small

Draw the datapath block diagram of your circuit which shows the contents of SelLS. Mark clearly the sizes of all buses. Design for minimum area/complexity. You do not need to code the VHDL. (1 point)

Timing Diagram:

clock

start

A A00^ A01^ A02^ A10^ A11^ A12^ A20^ A21^ A

B B00^ B01^ B02^ B10^ B11^ B12^ B20^ B21^ B

C C00^ C01^ C02^ C10^ C11^ C12^ C20^ C21^ C

D D00^ D01^ D02^ D10^ D11^ D12^ D20^ D21^ D

BURST 1 BURST 2 BURST 3

Interface:

Port Direction Bits Explanation clock in 1 System clock. resetn in 1 Active-low asynchronous system reset. A, B, C, D in N N-bit inputs from the A/D converters. start in 1 Signal set to high one cycle clock to indicate the start of 32 consecutive bursts. accumulator_out out N+7 Accumulator output. burst_zero out 6 Burst-zero counter output. done out 1 Set high when 32 bursts have been accumulated.

Problem 3 (5 points)

(a) Translate the ASM chart given below into the corresponding synthesizable VHDL code, including library declaration, entity declaration, and architecture. Assume resetn is an asynchronous active-low signal. (3 points) (b) Supplement the given waveform below with the values of state, inc, and jump. (2 points)

go

b

jump

a

b

stop, jump

inc

0 1

1

0

0

1

resetn

S

S

S

S

a

stop

inc

1

0

clock

resetn

a

b

state

inc

jump

(b) Translate the given block diagram to the corresponding synthesizable VHDL code, including library declaration and architecture. You do not need to code the entity declaration. (3 points)

Reset: Reset is an active-high synchronous signal. When reset is asserted high, the R register is reset to the value โ€œ11001โ€ for R[4] down to R[0] respectively, and the counter is reset to the value โ€œ0000โ€ (as described earlier) on the next rising clock edge.

Enable: Enable is an active-high synchronous signal. When enable is high, the R register takes in new data in normal operation. When enable is low, the R register holds its value. Reset has a higher priority than enable (i.e. if reset is high the register resets regardless of the value of enable).

Entity (you do not need to include this in your code):

entity prob4 is port (clock: in std_logic; reset: in std_logic; enable: in std_logic; din: in std_logic; dout: out std_logic); end prob4;

Note: Assume upcount is a component declared in the package mypack in the work library.

lookup table

up counter

R[4] R[3] R[2] R[1] R[0]

cout

ovfl rst

1

reset

0 1

1

clock

this function XORs all inputs to produce a one bit output

4

dout^ din

lookup table IN OUT 000 1 001 0 010 0 011 1 100 0 101 1 110 1 111 0

clock

1 1

= XOR function

enable