• 沒有找到結果。

Homework 1

N/A
N/A
Protected

Academic year: 2022

Share "Homework 1"

Copied!
2
0
0

加載中.... (立即查看全文)

全文

(1)

922 25300 Computer Organization and Assembly Languages National Taiwan University

Fall 2010 Department of CSIE

Homework 1

October 04, 2010 Due date: October 18, 2009

1. (12%) What is the binary representation of the following hexadecimal numbers? What are the decimal numbers they represent when interpreted as unsigned and signed integers.

a. F4 b. 9F

2. (8%) Prove that (a){NOT, AND} and (b) {NOR} are universal.

3. (10%) Prove (a) A(A + B) = AB and (b) A + AB = A + B both algebraically and using the truth table.

4. (10%) A 4-to-2 encoder has four inputs A3, A2, A1, A0and two outputs Z1, Z0. Only one of the four inputs can be 1 at a time. Assume that Aiis on, the output (Z1, Z0) will correspond to the binary representation of i. For example, when input A2=1, (Z1, Z0)=(1,0) because102 = 210. Create the truth table for the 4-to-2 encoder and implement it with logic gates.

5. (20%) As shown in the following diagram, design a 4-bit comparator which has two 4-bit unsigned integer inputs, X3X2X1X0and Y3Y2Y1Y0, and a 3-bit output for the conditions of X > Y , X = Y and X < Y , respectively. Hint: design a 1-bit comparator first.

4-bit comparator

X Y

4 4

X>Y X=Y X<Y

X>Y X=Y X<Y

6. (20%) Design a binary multiplier that multiplies two 3-bit unsigned integers, X = X2X1X0 and Y = Y2Y1Y0, and a 6-bit output Z = Z5Z4. . . Z0and Z = X × Y , where X0, Y0and Z0are LSBs. You may use the notation X[n..m] to identify a portion of wires. For example, X[2..1] means the set of wires, X2X1. 7. (20%) Design a circuit to implement a16 × 8 queue (Figure 1(a)). There are 16 words in the queue and each word is 8-bit. A queue is a data structure based on the principle of First-In-First-Out (FIFO). Pointers front and end point to the head and the tail of the queue. Two operations can be used to change the content of the queue. Dequeue removes an element from the front and enqueue inserts an element at the end. For example, Figure 1(b) shows an empty queue. Initially, both pointers are 0000. In Figure 1(c), enqueue 1 inserts an element ’1’ into the queue, and end is updated to 0001, the address of the next available slot for insertion. In Figure 1(d), enqueue 2 inserts an element ’2’ into the queue and end is updated to 0010. In Figure 1(e), dequeue removes it from the queue and update front as 0001, the next valid element.

Two 1-bit inputs W and op determine the operation of the queue circuit as the following. Other than dequeue and enqueue, length return the number of valid elements in the queue and read reads the content of the front element without modifying the queue. Note that the pointers could be wrapped around. You need to take care of this, but you can assume that the number of elements in the queue is always less than 16. The queue also has an 8-bit input Din, the element to be inserted and an 8-bit output Dout. (You can assume that both front and end are initialized as 0000.)

1

(2)

16 x 8 queue

8 8

Din W op

Dout

0 1 2 3 4 5 6 7 8 9 A B C D E F end front

0 1 2 3 4 5 6 7 8 9 A B C D E F end front

1 0

1 2 3 4 5 6 7 8 9 A B C D E F end front

1 2

0 1 2 3 4 5 6 7 8 9 A B C D E F end

front 2

(a)16 × 8 queue. (b) empty queue (c) enqueue 1 (d) enqueue 2 (e) dequeue Figure 1: Queue.

W op operation semantics

0 0 length Dout=number of elements in the queue.

0 1 read Dout= queue[front]

1 0 dequeue front++;

1 1 enqueue queue[end]=Din; end++;

2

參考文獻

相關文件

Full credit if they got (a) wrong but found correct q and integrated correctly using their answer.. Algebra mistakes -1% each, integral mistakes

(12%) Among all planes that are tangent to the surface x 2 yz = 1, are there the ones that are nearest or farthest from the origin?. Find such tangent planes if

[r]

Part (a) can be established based on the density formula for variable transforma- tions.. Part (b) can be established with the moment

Al atoms are larger than N atoms because as you trace the path between N and Al on the periodic table, you move down a column (atomic size increases) and then to the left across

39) The osmotic pressure of a solution containing 22.7 mg of an unknown protein in 50.0 mL of solution is 2.88 mmHg at 25 °C. Determine the molar mass of the protein.. Use 100°C as

Dublin born Oscar Wilde (1854-1900) established himself as one of the leading lights of the London stage at the end of the nineteenth century?. A poet and prose writer as well, it

Please create a timeline showing significant political, education, legal and social milestones for women of your favorite country.. Use the timeline template to record key dates