NCCU_Exam 板


LINE

课程名称:计算机组织与结构 课程性质:必修 课程范围:第一至第四章 开课教师:徐国伟 开课学院:理学院 开课系级:资科三 考试日期(年月日):2012/11/23 考试时限(Mins):3小时 附注: 可以带计算机 (能不能带字典我忘了,好像可以?) 试题本文: Q1.[25 points] Choose the best answer for each of the following multiple choice questions. Justify your answers when necessary. 1. Which one of the following descriptions is correct? (a) An instruction is a command that computer hardware understands and obeys. (b) An assembly language is a symbolic representaion of machine instructions. (c) A machine language is a binary representation of machine instructions. (d) All of the above. (e) None of the above. 2. Which one of the following descriptions about instruction set architecture (ISA) is true? (a) It is an abstract interface between the hardware and the lowest-level soft- ware that encompasses all the information necessary to write a machine language program that will run correctly. (b) It allows computer designers to talk about functions independently from the hardware that performs them. (c) Maintaining it as a constant enables many implementation of that archi- tecture - presumably varying in cost and performance - to run identical soft- ware. (d) All of the above. (e) None of the above. 3. Which one of the following descriptions about how the hardware and software affect performance is true? (a) All algorithm, programming language, compiler, and instruction set archi- tecture may affect instruction count. (b) All algorithm, programming language, compiler, and instruction set archi- tecture may affect CPI (clock cycles per instruction). (c) Only instruction set architecture affects clock rate. (d) All of the above. (e) None of the above. 4. Which one of the following descriptions about performance is true? (a) Execution time is the only valid and unimpeachable measure of performance. (b) We should always expect the imporvement of one aspect of a computer to in- crease overall performance by an amount proportional to the size of the im- provement. (c) We should always measure performance based on one of clock rate, in- struction count, or CPI; that is, we should always use a subset of the perfor- mance equaation as a performance metric. (d) All of the above. (e) None of the above. 5. Which one of the following descriptins about instructions is true? (a) More powerful instructions mean higher performance. (b) Write in assembly language to achieve the highest performance. (c) The importance of commercial binary compatibility means successful instuction sets do not change. (d) All of the above. (e) None of the above. Q2. [10 points] The figure given below is the abstraction of the organization of a computer discussed in class, showing the five classic components of a com- puter. What are they (1, 2, 3, 4, and 5 in the figure) respectively? You need to clarify which one is which. (请参考课本的图,即有input、output、datapath、memory的图,每章一开始的那张图) Q3. [10 points] Consider two different implementations of the same instruction set architecture. There are four classes of instructions, A, B, C, and D. The clock rate and CPI of each implementation are given in the following table. --------------------------------------------------------------------------- | Implementation | Clock rate | CPI Class A | Class B | Class C | Class D | --------------------------------------------------------------------------- | P1 | 1.5 GHz | 1 | 2 | 3 | 4 | --------------------------------------------------------------------------- | P2 | 2 GHz | 2 | 2 | 2 | 2 | --------------------------------------------------------------------------- Given a program with 1000000 instructions divided into classes as follows: 10% class A, 20% class B, 50% class C and 20% class D. What is the weighted average CPI for each implementaion? What is the execution time for each implementation? Please show all your work to support your answers for this question; answers without supporting work will earn no points. Q4. [20 points] The following table shows the number of instructions for a program. ----------------------------------------- | Arith | Store | Load | Branch | Total | ----------------------------------------- | 500 | 50 | 100 | 50 | 700 | ----------------------------------------- Assuming that Arith instructions take 1 cycle, Load and Store 5 cycles and Branch 2 cycles, what is the execution time of the program in a 2 GHz processor and what is the CPI for the program? If the number of load instructions can be reduced by one-half, what is the speed-up and what is the new CPI? Please show all your work to support your answers for this question; answers without sup- porting work will earn no points. Q5. [10 points] Hexadecimal (base 16) is commonly used numbering system for representing values in computers. Consider the following two hexadecimal num- bers: A is 0D32 and B is DD17. What is the num of A and B if they represent un- signed 16-bit hexadecimal numbers? What is the sum of A and B if they repre- sent signed 16-bit hexadecimal numbers stored in sign-magnitude format? The results should be written in hexadecimal. Please show all your work to support your answers for this question; answers without supporting work will earn no points. Q6. [10 points] The following C procedure swaps array elements. void swap (int v[], int k) { int temp; temp = v[k]; v[k] = v[k+1]; v[k+1] = temp; } Below is the ARM asssembly code segment for the above C procedure. Assume that the first argument (the address of v) is in r0, the second argument (the index k) is in r1, the local variable is in r2, the temporary for v[k+1] is in r3, and the address of v[k] is in r12. Please fill in the blanks. swap: ADD r12, r0, r1, _________ LDR r2, [r12, #0] ADR r3, [r12, #4] STR ______, [r12, #0] STR ______, [r12, #4] MOV pc, lr The following C procedure sorts array elements by using the above C procedure. void sort ( int v[], int n ) { int i, j; for (i=0; i<n; i+=1) { for (j=i-1; j>=0 && v[j] > v[j+1]; j-=1) { swap(v,j); } } } Below is the ARM assembly code segment for the above C procedure. Assume that the first argument (the address of v) is in r0, the second argument (the index n) is in r1, the local variable i is in r2, the local variable j is in r3, a copy of v[j] is in r4, a copy of v[j+1] is in r5, a copy of v is in r6, a copy of n is in r7, and the address of v[j] is in r12. Please fill in the blanks. sort: SUB sp, sp, #20 STR lr, [sp, #16] STR r7, [sp, #12] STR r6, [sp, #8] STR r3, [sp, #4] STR r2, [sp, #0] MOV r6, r0 MOV r7, r1 MOV r2, #0 for1tst:CMP r2, r1 BGE ______ SUB r3, r2, #1 for2tst:CMP r3, #0 BLT ______ ADD r12, r0, r3, ______ LDR r4, [r12, #0] LDR r5, [r12, #4] CMP r4, r5 BLE ______ MOV r0, r6 MOV r1, r3 BL ______ SUB r3, r3, #1 B ______ exit2: ADD r2, r2, #1 B ______ exit1: LDR r2, [sp, #0] LDR r3, [sp, #4] LDR r6, [sp, #8] LDR r7, [sp, #12] LDR lr, [sp, #16] ADD sp, sp, #20 MOV pc, lr Q7. [15 points] Consider the classic 5-stage pipeline in MIPS. The table given below shows the operation times for major functional units and also the time required for each instruction calss. We assume that the multiplexors, control unit, PC accesses, and sign extension unit have no delay, and also that all pipeline stages take a single clock cycle. Compare nonpipelined (single-cycle) and pipelined designs based on their execution of three load word instructions given below. We assume that both use the same hardware components. ---------------------------------------------------------------- | Instruction class | IF | ID | ALU | MEM | WB | ---------------------------------------------------------------- | Load word | 200 ps | 100 ps | 200ps | 200ps | 100 ps | lw $1, 100($0) ---------------------------------------------------------------- | Store word | 200 ps | 100 ps | 200ps | 200ps | | lw $2, 200($0) ---------------------------------------------------------------- | R-format | 200 ps | 100 ps | 200ps | | 100 ps | lw $3, 300($0) ---------------------------------------------------------------- | Branch | 200 ps | 100 ps | 200ps | | | ---------------------------------------------------------------- What is the clock cycle time for nonpipelined design, and what is that for pipelined design? What is ethe speed-up from pipelining? What is the total exe- cution time for the three instructions for nonpipelined design, and what is that for pipelined design? Please show all your work to support your answers for this question; answers without supporting work will earn no points. 选择题答案: DDDAE --



※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 220.137.162.209







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