Docsity

Languages and Compilers for Embedded System | CS 8803, Assignments of Computer Science

Toggle sidebar
bg1
CS8803 summer09 Prof. H.-H. S. Lee
Georgia Tech Page 1 of 5
CS8803 Languages & Compilers for Embedded System
Summer 2009
Homework Assignment #1
Assigned 05/25/09 Due in the first 5 min in class 06/01/09
1. (10%) Please do research and elaborate the differences between Intel’s hyper-threading (HT
Technology) in Pentium 4 Processor and the SMT (Simultaneous Multithreading) supported in
the Compaq Alpha 21464 (EV8).
Intel’s hyper-threading in Pentium 4 SMT in Compact Alpha 21464
2-way SMT
Replicated hardware contexts
- Next instruction pointer
- Instruction stream buffers
- ITLB
- Return stack predictor
- APIC
- Register Alias Tables
Shared resources
- Rename register pool
- Caches
- TLB
4-way SMT
Replicated hardware contexts
- Program counter
- Architected registers
Shared resources
- Rename register pool
- Instruction queue
- Caches
- TLB
- Branch predictors
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download Languages and Compilers for Embedded System | CS 8803 and more Assignments Computer Science in PDF only on Docsity!

Georgia Tech Page 1 of 5

CS8803 Languages & Compilers for Embedded System

Summer 2009

Homework Assignment

Assigned 05/25/09 Due in the first 5 min in class 06/01/

  1. (10%) Please do research and elaborate the differences between Intel’s hyper-threading (HT Technology) in Pentium 4 Processor and the SMT (Simultaneous Multithreading) supported in the Compaq Alpha 21464 (EV8).

Intel’s hyper-threading in Pentium 4 SMT in Compact Alpha 21464 2-way SMT

Replicated hardware contexts

  • Next instruction pointer
  • Instruction stream buffers
  • ITLB
  • Return stack predictor
  • APIC
  • Register Alias Tables

Shared resources

  • Rename register pool
  • Caches
  • TLB

4-way SMT

Replicated hardware contexts

  • Program counter
  • Architected registers Shared resources
  • Rename register pool
  • Instruction queue
  • Caches
  • TLB
  • Branch predictors

Georgia Tech Page 2 of 5

  1. (30%) Consider the following assembly code and answer the subsequent questions. Main: LDW R1, 0(R0) LDW R2, 4(R0) LDW R3, 8(R0) MUL R4, R1, R ADD R5, R2, R CMP R4, R BLE .L SUB R9, R9, R BLE .L SHR R2, R2,# ADD R1, R1, R STW R1, 12(R0) B .L .L1: SHL R2, R2, # SUB R1, R1, R STW R5, 16(R0) B .L .L3: SUB R4, R4, # ADD R3, R4, R MUL R5, R4, R B .L .L2: ADD R4, R2, R SUB R5, R4, R

2.1. (10%) Draw the control flow graph (CFG) for the above code.

  • BB LDW R1, 0(R0) LDW R2, 4(R0)LDW R3, 8(R0) MUL R4, R1, R ADD R5, R2, R CMP R4, R BLE .L
  • BB SHR R2, R2,#1ADD R1, R1, R STW R1, 12(R0) B .L3 - BB4SHL R2, R2, # SUB R1, R1, R STW R5, 16(R0)
  • BB5SUB R4, R4, #1 B .L ADD R3, R4, R MUL R5, R4, R2B .L
  • BB ADD R4, R2, R1SUB R5, R4, R
  • BB SUB R9, R9, R BLE .L

Cycle U-PIPE V-PIPE

2 LDW R2, 4(R0)

  • Georgia Tech Page 4 of - 1 LDW R1, 0(R0) SUB R9, R9, R - 4 MUL R4, R1, R2 ADD R5, R2, R 3 LDW R3, 8(R0) - 5 CMP R4, R5 SUB R4, R4, # - 6 SHR R2, R2, #1 BLE .L - 7 ADD R1, R1, R2 BLE .L - 8 STW R1, 12(R0) ADD R3, R4, R - 9 MUL R5, R4, R2 B .L
    • 10 SHL R2, R2, #1 B .L
    • 11 STW R5, 16(R0) SUB R1,R1, R
    • 12 B .L2 ADD R4, R2, R
    • 13 SUB R5, R4, R
  • IPC = 23 /13 = 1.

Georgia Tech Page 5 of 5

  1. (20%) Consider the following code. Each array expression indicates a memory instruction. (e.g., A = X[0] will load the value A from memory location X[0].) Please answer the following questions.

I1: A = X[0]

I2: B = Y[0]

I3: C = A + 1

I4: D = A * 2

I5: E = A + 3

I6: F = B + 4

I7: G = C * D

I8: G = G * F

I9: H = Y[G]

I10: I = E + H

I11: J = H * I

Functional units and latencies of each FU

  • Two integer add and subtraction unit: 1 cycle
  • One integer multiplication unit: 2 cycles
  • One load and store unit: 3 cycles

3.1. (10%) Draw the data dependence graph for the above code. (You can simply write down in instruction id such as i8 for each node.)

Georgia Tech Page 7 of 5

  1. (10%) The following diagram shows that the state of the expand instruction buffers after fetching instructions from the instruction cache. Based on the diagram, draw the figure of the instruction cache line when using following encoding schemes:

IBUF0 W00 W01 W03 W04 W

IBUF1 W09 W10 W11 W

(1) VLIW Fixed-Overhead Encoding

11011010 W00 W01 W03 W04 W06 01110100 W09 W10 W11 W

(2) VLIW Distributed Encoding

1 W00 1 W01 1 W03 1 W04 0 W06 1 W09 1 W10 1 W11 0 W

(3) Template-based VLIW Encoding. (Assume W00 is the beginning of a new template and each template. Use the simple form discussed in slide 18 of Lecture 4)

Temp0 W00 W01 W03 Temp1 W04 W06 W09 Temp2 W10 W11 W

Temp0 = (0->0), (1->1), (2->3), chain Temp1 = (0->4), (1->6); seq, (2->1),chain Temp2 = (0->2), (1->3), (2->5); seq

Georgia Tech Page 8 of 5

  1. (10%) Given two VLIW machine implementations called KU3 and KU7. KU3 can dispatch and execute 3 operations (or syllables) per cycle while KU7 can do 7. Assume all functional units are completely replicated for both machines, i.e., there is no resource hazard. All operations take one cycle to execute and there is no cache misses or branch-related penalty. Given the VLIW code sequence with stop bits (shown as a bold vertical bar: |) below, how many execution cycles are needed for KU3 and KU7? (Note that, M, I, B, F are distinct function units.)

VLIW I0 M I I

VLIW I1 M M I

VLIW I2 M M I

VLIW I3 M I B

VLIW I4 M F I

VLIW I5 M M I

VLIW I6 M I I

VLIW I7 M F B

VLIW I8 M I I

VLIW I9 B B B

KU3: 13 Cycles KU7: 6 Cycles

KU

M I I

M

M I M

M I

M I B

M F I

M

M I M

I

I M F

B M I

I B B

B

KU

M I I M

M I M M I

M I B M F I M

M I M I

I M F B M I

I B B B