NTU-Exam 板


LINE

課程名稱︰計算機概論 課程性質︰選修 課程教師︰莊永裕 開課學院:電資學院 開課系所︰資工系 考試日期(年月日)︰2014.11.11 考試時限(分鐘):180 是否需發放獎勵金:是 (如未明確表示,則不予發放) 試題 : ┌─────────────────────────────────────┐ │CSIE 1000 Introduction to Computers National Taiwan University│ │Fall 2014 Department of CSIE│ │ │ │ Midterm Exam │ │ November 11, 2014 (total: 105 points) │ └─────────────────────────────────────┘ ˙ Use * to represent the irrelevant values and the values not specified in the question. ˙ Feel free to use circuits introduced in the class. The following are some circuits that you may need. Feel free to change the orientations of the gates, the positions of inputs and outputs and the number of bits. On the other hand, for any circuit that was not introduced in the class, you have to implement it before using. 圖:http://i.imgur.com/U37j02F.png 1. (8%) What are the 8-bit 2's complement representations of the following decimal numbers? Please give both their binary and hexadecimal representations. a. 45 b. -28 2. (8%) The INC circuit adds one to the input. The 4-bit INC circuit accepts a 4-bit input X and outputs a 4-bit Y so that Y = X + 1 (please ignore the overflow issue). Please design a 4-bit INC circuit using only 1-bit half adders. 3. (18%) Figure 1(a) shows a 2-bit comparator which has two 2-bit unsigned-integer inputs, X = X_1 X_0 and Y = Y_1 Y_0, and three output bits G, E, L for the conditions of X > Y, X = Y and X < Y, respectively. (a) Write down the truth table for the three boolean functions G, E and L. (6%) (b) Write down their SOP forms. (6%) (c) Use K-map to simplify their expressions if possible. (6%) No need to draw their circuit diagrams for this question. Figure 1: http://i.imgur.com/ua1VgJX.png 4. (8%) Design a 4-bit comparator as shown in Figure 1(b). Hint: Use the 2-bit comparator from the last question. Note that even if you do not answer the above question or your design is wrong, you can still use 2-bit comparators as black boxes in your design. 5. (12%) Design a circuit to implement the following pseudo code. Here, the variables A, B, X, Y, Z are registers containing 4-bit unsigned integers. Hint: in addition to registers, you will need a 4-bit comparator and some multiplexers. Similarly, you can just use 4-bit comparators as black boxes in this question no matter whether you answer the above question correctly. if (A < B) then Z := X + A else if (A == B) then Z := X + B else Y := A + B 6. (12%) In Hack ALU, the following configurations of inputs are used for (x + 1), (y - x) and (x | y). Explain why they work. ─────────────────── zx nx zy ny f no out ─────────────────── 0 1 1 1 1 1 x + 1 0 0 0 1 1 1 y - x 0 1 0 1 0 1 x | y ─────────────────── 7. (12%) Draw the required datapath on the datatpath sheet for (a) instruction fetch and the set of instructions {"jump register", "jump and link"}; and (b) the set of instructions {"sub", "load", "store indirect", "branch zero"} (without instruction fetch). Only draw the necessary part but not the whole TOY datapath. Add multiplexers only if necessary. Remember to sign your name and return the datatpath sheet with your answer sheet. datatpath sheet: http://i.imgur.com/vexG8Zy.png 8. (12%) Refer to the TOY architecture (Figure 3: note that the numbering could be different from the lecture), please specify the operations of MUX_PC, MUX_MEM, MUX_REGR, MUX_ALU, MUX_REGW, WRITE_REG, WRITE_MEM and ALU_OP during the execution stage for the instructions "add", "load indirect" and "jump register". As an example, for "jump and link", they would be MUX_PC = 0, MUX_MEM = *, MUX_REGR = *, MUX_ALU = 1, MUX_REGW = 01, WRITE_REG = 1, WRITE_MEM = 0, ALU_OP = *. (For ALU_OP, you only need to specify 3-bit ALU_control as specified in Figure 3.) Figure 3: http://i.imgur.com/AQgXLKa.jpg 9. (15%) Binary-coded decimal (BCD) is a binary encoding of decimal numbers where each decimal digit is represented by 4 bits. For example, the bit string 0100 1001 will be interpreted as 49 in decimal. In this question, you are asked to design a 2-digit decimal counter (2DC) which will count between 00 to 99 as shown in Figure 1(c). It has two inputs: a 2-bit op and an 8-bit D_in (representing a 2-digit BCD). You can assume that the input D_in is always valid. 2DC has two 4-bit outputs, D_1 and D_0, each for a decimal digit. They can be connected to two 7-segment displays as the outputs. You can use the 7-segment display decoder in homework #1 to control the displays. The 2DC counter has the following operations. Hint: implement 2DC using two 4-bit registers, one for a decimal digit. ──────────────────── op[1] op[0] operation semantics ──────────────────── 0 0 reset count = 0 0 1 set count = D_in 1 0 inc INC(count); 1 1 inc DEC(count); ──────────────────── INC(count) ≡ if (count < 99) count++; DEC(count) ≡ if (count > 0) count--; Figure 2: TOY reference card. ┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐ │15│14│13│12│11│10│ 9│ 8│ 7│ 6│ 5│ 4│ 3│ 2│ 1│ 0│ ┌────┼─┴─┴─┴─┼─┴─┴─┴─┼─┴─┴─┴─┼─┴─┴─┴─┤ │Format 1│ opcode │ dest d │ source s │ source t │ ├────┼───────┼───────┼───────┴───────┤ │Format 2│ opcode │ dest d │ addr │ └────┴───────┴───────┴───────────────┘ ┌─┬────────┬──┬─────────────┐ │#│ Operation │ Fmt│ Pseudocode │ ├─┼────────┼──┼─────────────┤ │0:│halt │ 1 │exit(0) │ ├─┼────────┼──┼─────────────┤ │1:│add │ 1 │R[d] ← R[s] + R[t] │ ├─┼────────┼──┼─────────────┤ │2:│subtract │ 1 │R[d] ← R[s] - R[t] │ ├─┼────────┼──┼─────────────┤ │3:│and │ 1 │R[d] ← R[s] & R[t] │ ├─┼────────┼──┼─────────────┤ │4:│xor │ 1 │R[d] ← R[s] ^ R[t] │ ├─┼────────┼──┼─────────────┤ │5:│shift left │ 1 │R[d] ← R[s] << R[t] │ ├─┼────────┼──┼─────────────┤ │6:│shift right │ 1 │R[d] ← R[s] >> R[t] │ ├─┼────────┼──┼─────────────┤ │7:│load addr │ 2 │R[d] ← addr │ ├─┼────────┼──┼─────────────┤ │8:│load │ 2 │R[d] ← mem[addr] │ ├─┼────────┼──┼─────────────┤ │9:│store │ 2 │mem[addr] ← R[d] │ ├─┼────────┼──┼─────────────┤ │A:│load indirect │ 1 │R[d] ← mem[R[t]] │ ├─┼────────┼──┼─────────────┤ │B:│store indirect │ 1 │mem[R[t]] ← R[d] │ ├─┼────────┼──┼─────────────┤ │C:│branch zero │ 2 │if (R[d] == 0) pc ← addr │ ├─┼────────┼──┼─────────────┤ │D:│branch positive │ 2 │if (R[d] > 0) pc ← addr │ ├─┼────────┼──┼─────────────┤ │E:│jump register │ 1 │pc ← R[t] │ ├─┼────────┼──┼─────────────┤ │F:│jump and link │ 2 │R[d] ← pc; pc ← addr │ └─┴────────┴──┴─────────────┘ Register 0 always 0. Loads from mem[FF] from stdin. Stores to mem[FF] to stdout. --



※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 1.160.228.135
※ 文章網址: http://webptt.com/m.aspx?n=bbs/NTU-Exam/M.1416537600.A.1C8.html
1F:→ rod24574575 : 已收資訊系! 11/21 10:41







like.gif 您可能會有興趣的文章
icon.png[問題/行為] 貓晚上進房間會不會有憋尿問題
icon.pngRe: [閒聊] 選了錯誤的女孩成為魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一張
icon.png[心得] EMS高領長版毛衣.墨小樓MC1002
icon.png[分享] 丹龍隔熱紙GE55+33+22
icon.png[問題] 清洗洗衣機
icon.png[尋物] 窗台下的空間
icon.png[閒聊] 双極の女神1 木魔爵
icon.png[售車] 新竹 1997 march 1297cc 白色 四門
icon.png[討論] 能從照片感受到攝影者心情嗎
icon.png[狂賀] 賀賀賀賀 賀!島村卯月!總選舉NO.1
icon.png[難過] 羨慕白皮膚的女生
icon.png閱讀文章
icon.png[黑特]
icon.png[問題] SBK S1安裝於安全帽位置
icon.png[分享] 舊woo100絕版開箱!!
icon.pngRe: [無言] 關於小包衛生紙
icon.png[開箱] E5-2683V3 RX480Strix 快睿C1 簡單測試
icon.png[心得] 蒼の海賊龍 地獄 執行者16PT
icon.png[售車] 1999年Virage iO 1.8EXi
icon.png[心得] 挑戰33 LV10 獅子座pt solo
icon.png[閒聊] 手把手教你不被桶之新手主購教學
icon.png[分享] Civic Type R 量產版官方照無預警流出
icon.png[售車] Golf 4 2.0 銀色 自排
icon.png[出售] Graco提籃汽座(有底座)2000元誠可議
icon.png[問題] 請問補牙材質掉了還能再補嗎?(台中半年內
icon.png[問題] 44th 單曲 生寫竟然都給重複的啊啊!
icon.png[心得] 華南紅卡/icash 核卡
icon.png[問題] 拔牙矯正這樣正常嗎
icon.png[贈送] 老莫高業 初業 102年版
icon.png[情報] 三大行動支付 本季掀戰火
icon.png[寶寶] 博客來Amos水蠟筆5/1特價五折
icon.pngRe: [心得] 新鮮人一些面試分享
icon.png[心得] 蒼の海賊龍 地獄 麒麟25PT
icon.pngRe: [閒聊] (君の名は。雷慎入) 君名二創漫畫翻譯
icon.pngRe: [閒聊] OGN中場影片:失蹤人口局 (英文字幕)
icon.png[問題] 台灣大哥大4G訊號差
icon.png[出售] [全國]全新千尋侘草LED燈, 水草

請輸入看板名稱,例如:BabyMother站內搜尋

TOP