課程名稱︰計算機結構
課程性質︰必修
課程教師︰洪士灝
開課學院:電資學院
開課系所︰資工系
考試日期(年月日)︰2016/11/17
考試時限(分鐘):180分鐘左右
試題 :
1. (30pts) A lot of people are taling about Internet of Things(IoT). According
to Wikipedia:
IoT is the internetworking of physical devices, vehicles(also referred to as
"connected devices" and "smart devices"), buildings and other items --
embedded with electronics, software, sensors, actuators, and network
connectivety that enable these objects to collect and exchange data. The IoT
allows objects to be sensed and/or controlled remotely across existing network
infrastructure, creating opportunities for more direct integration of the
physical world into computer-based systems, and resulting in improved
efficiency, accracy and economic benefit. Experts estimate that the IoT will
consist of almost 50 billion objects by 2020.
Typically, IoT is expected to offer advanced connectivity of devices, systems,
and services that goes beyond machine-to-machine (M2M) communications and
covers a variety of protocols, domains, and applications.The interconnection
of these embedded devices (including smart objects), is expected to usher
in automation in nearly all fields, while also enabling advanced applications
like a smart grid, and expanding to the areas such as smart cities.
"Things," in the IoT sense, can refer to a wide variety of devices such as
heart monitoring implants, biochip transponders on farm animals, electric
clams in coastal waters, automobiles with built-in sensors, DNA analysis
devices for environmental/food/pathogen monitoring or field operation devices
that assist firefighters in search and rescue operations. Legal scholars
suggest to look at "Things" as an "inextricable mixture of hardware,
software, data and service".These devices collect useful data with the
help of various existing technologies and then autonomously flow the data
between other devices. Current market examples include home automation
(also known as smart home devices) such as the control and automation of
lighting, heating (like smart thermostat), ventilation, air conditioning
(HVAC)
systems, and appliances such as washer/dryers, robotic vacuums, air purifiers
, ovens or refrigerators/freezers that use Wi-Fi for remote monitoring.
As well as the expansion of Internet-connected automation into a plethora of
new application areas, IoT is also expected to generate large amounts of data
from diverse locations, with the consequent necessity for quick aggregation
of the data, and an increase in the need to index, store, and process such
data more effectively. IoT is one of the platforms of today's Smart City, and
Smart Energy Management Systems.
The concept of the Internet of Things was invented by and term coined by
Peter T. Lewis in September 1985 in a speech he delivered at a U.S. Federal
Communications Commission (FCC) supported session at the Congressional Black
Caucus 15th Legislative Weekend Conference.
Please answer the following questions as complete as possible.
(a)(10pts)Since the concept of IoT was "invented" in 1985, why do people start
to talk about it until recently?(There are several reasons).
(b)(10pts)What kind(s) of computers are needed for this IoT Era? For each kind
, please list example applications, describe its typical system configuration
and the design issues.
(c)(10pts)Similar things can be said about the rise of Artificial Intellifence
(AI) in recent years. Actually, AI was very popular in '80s, but it suddenly
stopped to talk about it(at least from the industry's point of view) Why? How
does this relate to computer architecture?
2. (20pts)Please answer the following questions after reading the MIPS
assembly
code in the next page. Note that you do NOT need to understand the entire
program to analyze the performance, as compilers and processors do not
understand the entire program either. The instruction bltz is "branch on less
than zero", which branches to the label if the register is less than zero.
You can write your ansewers directly on Page 3.
(a)(10pts)A basic block is a sequence of instructions without branches, except
possibly at the end, and without branch targets or branch labels, except
possibly at the beginning. One of the first early phases of compilation is
breaking the program into basic blocks.
Please identify all the basic block(s) in this assembly code.
(b)(10pts)A data dependency in computer science is a situation in which a
program statement(instruction) refers to the data of a preceding statement.
Please identify all the data dependencies in this assembly code.
ASSEMBLY CODE
1 start:
2 lw $t0, 0($gp) #fetch i
3 bltz $t0, def #i<0 ->default
4 slti $t1, $t0, 3 #i<3?
5 beq $t1, $zero, def #no, -> default
6 sll $t0, $t0, 2 #turn i into a byte offset
7 add $t2, $t0, $gp
8 lw $t2, 1064($t2) #fetch the branch table entry
9 jr $t2 #go...
10 is0: sw $zero, 28($gp) #A[0] = 0
11 j case_done
12 is1:
13 is2: addi $t0, $zero, 1 # = 1
14 sw $t0, 32($gp) #A[1] = 1
15 j case_done
16 def: addi $t0, $zero, -1 # = -1
17 sw $t0, 28(gp) #A[0] = -1
18 j case_done
19 case_done:
20 lw $t0, 0($gp) #fetch i
21 lw $t1, 4($gp) #fetch N
22 alt $t1, $t0, $t1 #set $t1 to 1 if $t0 < $t1, to 0 otherwise
23 beq $t1, $zero, skip #branch if result of slt is 0(i.e., !(i<N))
24 sll $t0, $t0, 2 #i as a byte offset
25 add $t0, $t0, $gp #&A[i] - 28
26 sw $zero, 28($t0) #A[i] = 0
27 skip:
28 add $t0, $gp, $zero #&A[0] - 28
29 lw $t1, 4($gp) #fetch N
30 sll $t1, $t1, 2 #N as byte offset
31 add $t1, $t1, $gp #&A[N] - 28
32 ori $t2, $zero, 256 #MAX_SIZE
33 top:
34 sltu $t3, $t0, $t1 #have we reached the final address?
35 beq $t3, $zero, loop_end #yes, we're done
36 sw $t2, 28($t0) #A[i] = 0
37 addi $t0, $t0, 4 #update $t0 to point to next element
38 j top #go to top of loop
39 loop_end:
-ASSEMBLY END-
3. (40pts)Let us analyze the performance of the assembly code on Page 3 for
the 5-stage pipelined MIPS datapath shown below. Note that the branch
instruction are handle in the EX stage, and there is no data forwarding unit.
(a)(10pts)Data hazards can stall the pipeline and cause pieline bubbles. Data
hazards mainly come from data dependencies, but not all data dependencies can
cause data hazards.
Please identify all the pipeline bubbles cause by data hazards in the
assembly code.
(b)(10pts)Control hazards can stall the pipeline and cause pipeline bubbles.
Please identify all the pipeline bubbles cause by control hazards in the
assembly code.
(c)(10pts)Branch prediction can reduce the penalty caused by contrl hazards
only if the prediction is correct.
Please discuss the likelihood of correct prediction for the branches in the
assembly code. Which branches can be predicted with high probability? Why?
(d)(10pts)Loop unrolling is a common technique to eliminate data hazards and
speed up the execution. If you have not noticed, Lines 33~39 constitute a
loop. Please unroll the loop 4 times(write down the unrolled code on the
answer sheet) and estimate the resulted performance.
4. (10pts)Assume we have convented the processor in Problem 3 into a static
dual-issue processor, which can execute 2 instructions per cycle, as shown
in the following figure.
Instruction type Pipe stages
ALU or branch instruction IF ID EX MEM WB
Load or store instruction IF ID EX MEM WB
ALU or branch instruction IF ID EX MEM WB
Load or store instruction IF ID EX MEM WB
ALU or branch instruction IF ID EX MEM WB
Load or store instruction IF ID EX MEM WB
ALU or branch instruction IF ID EX MEM WB
Load or store instruction IF ID EX MEM WB
(a)(5pts)Calculate the number of cycles needed to execute the assembly
codes for the loop constituted by Lines 33~39 on Page 3.
(b)(5pts)Calculate the number of cycles needed to execute the assembly
codes for the loop after you unroll it 4 times as in your answer to
Question 3(d).
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.43.94.48
※ 文章網址: https://www.ptt.cc/bbs/NTU-Exam/M.1486026616.A.49B.html