NTU-Exam 板


LINE

课程名称︰计算机概论 课程性质︰选修 课程教师:庄永裕 开课学院:电资学院 开课系所︰资工系 考试日期(年月日)︰2015.11.03 考试时限(分钟):180分钟 试题 : ┌─────────────────────────────────────┐ │CSIE 1000 Introduction to Computers National Taiwan University│ │Fall 2015 Department of CSIE│ │ │ │ Midterm Exam │ │ November 3, 2015 (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. ˙ Note that you do not need to really wire up all components as long as you name the signals clearly. Circuits: http://i.imgur.com/CoOqHbj.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. 39 b. -19 _ 2. (10%) Show that (a) x · (x + y) = x and (b) (x + y)(x + y) = y using Boolean algebra rules (not truth table). 3. (8%) Implement a circuit to realize the 3-bit mod3 function. The circuit has a 3-bit input X = X_2 X_1 X_0 and a 2-bit output Y = Y_1 Y_0 satisfying Y = X%3. For example, if X is 101, then Y is 10 because 5%3 = 2. Write down the truth tables and its corresponding logic expressions for Y_1 and Y_0. 4. (15%) Design a two-bit multiplier which accepts two 2-bit inputs, X = X_1 X_0 and Y = Y_1 Y_0, and outputs a 4-bit number Z = Z_3 Z_2 Z_1 Z_0, where Z is the product of X and Y, i.e. Z = X × Y. (1) Write down the truth tables for Z_3, Z_2, Z_1, Z_0. (2) What are their sum of products expressions? (Do not simplify them.) (3) Use K-map to obtain the simplified expressions if possible. 5. (10%) In Hack ALU, the following configurations of inputs are used for -x and x + 1. Explain why they work. ────────────────── zx nx zy ny f no out ────────────────── 0 0 1 1 1 1 -x 0 1 1 1 1 1 x+1 ────────────────── 6. (12%) Draw the required datapath on the datatpath sheet for (a) instruction fetch and (b) the set of instructions {"xor", "store", "branch zero", "jump and link"} (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/iuVmv03.png 7. (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 "xor", "store indirect" and "branch if zero". 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, and 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/BmQTGVC.png 8. (15%) Assume that you are designing a processor for the Tic-Tac-Toe game in which two players, O and X, take turns marking the spaces in a 3×3 grid (Figure 1(a)). The player who first succeeds in placing three respective marks in a horizontal, vertical, or diagonal row wins the game. One of the key components for the processor would be a sequential circuit which stores the current configuration of the 3×3 grid. A grid cell could be in one of the three statuses: unoccupied, occupied by O and occupied by X, and thus can be represented by 2 bits. Design a (3×3)×2 memory chip for the purpose. The chip has two 2-bit addresses for the position of the cell, (x, y), a 2-bit W_data input and a 2-bit output R_data along with the clock and write enable. Figure 1(b) sketches its interface. You can assume that the inputs are all valid. For example, both X and Y are within the set {0, 1, 2}. Note that there are many design options. As long as the design works properly, it is a correct one. Figure 1: http://i.imgur.com/Khu5MQ6.png 9. (15%) What is output of the following TOY program? How many cycles does it take from starting to halting? 00: 000F 01: 0009 10: 8A00 11: 8B01 12: 2EAB 13: CE19 14: DE17 15: 2BBA 16: C012 17: 2AAB 18: C012 19: 9AFF 1A: 0000 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.163.254.247
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/NTU-Exam/M.1461561924.A.643.html ※ 编辑: rod24574575 (1.163.254.247), 04/25/2016 13:27:36
1F:→ rod24574575 : 已收资讯系! 04/25 13:28







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灯, 水草

请输入看板名称,例如:Soft_Job 或 站内搜寻

TOP