Skip to content

Commit 3ac79f9

Browse files
committed
Lab4-21 - submit .pdf
1 parent e4d9372 commit 3ac79f9

File tree

3 files changed

+63
-3
lines changed

3 files changed

+63
-3
lines changed

Lab04-2/Lab4-2/BranchPredictUnit.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ always @(posedge clk) begin
4848
end
4949

5050
/* Gshare */
51-
// assign predict_pc = (tag == tag_table[index]) && (PHT[index ^ BHSR] > 2'b01) ? BTB[index] : current_pc + 4;
51+
assign predict_pc = (tag == tag_table[index]) && (PHT[index ^ BHSR] > 2'b01) ? BTB[index] : current_pc + 4;
5252

5353
/* always not taken */
5454
// assign predict_pc = current_pc + 4;
5555

5656
/* always taken */
57-
assign predict_pc = (tag == tag_table[index]) ? BTB[index] : current_pc + 4;
57+
// assign predict_pc = (tag == tag_table[index]) ? BTB[index] : current_pc + 4;
5858

5959
endmodule
554 KB
Binary file not shown.

Lab04-2/submit/report-discussion.md

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,64 @@ Branch Prediction을 어떻게 하는지와 상관없이, 다음 로직을 구
2828
* 모든 레지스터의 값은 모두 동일하였다. 즉, Branch Prediction이 어떻든, 심지어 항상 PC를 0으로 예측하더라도 올바르게 동작한다.
2929
* control 명령어가 없는 basic, non-controlflow 테스트는 사이클 수가 동일하였다.
3030
* ifelse 테스트는 Always taken만 사이클 수가 높게 나왔다. 이는 Always taken 방법이 ifelse보다 반복문에 더 친숙하며, ifelse에서는 잘못된 예측이 많은 것으로 생각된다.
31-
* loop와 recursive 테스트에서 Gshare 구현이 Always not taken보다 오히려 더 사이클 수가 증가했는데, 이는 Gshare가 처음에 초기화 된 상태로 시작하고, 분기 예측에 익숙해지기까지 시간이 부족했기 때문이라고 생각된다.
31+
* loop와 recursive 테스트에서 Gshare 구현이 Always not taken보다 오히려 더 사이클 수가 증가했는데, 이는 Gshare가 처음에 초기화 된 상태로 시작하고, 분기 예측에 익숙해지기까지 시간이 부족했기 때문이라고 생각된다.
32+
33+
ubuntu@subvnic:~/CSED311/Lab04-2/Lab4-2$ ./convert
34+
Usage: ./convert [TestName or TestNumber]
35+
TestNumber:
36+
0) basic
37+
1) ifelse
38+
2) loop
39+
3) non-controlflow
40+
4) recursive
41+
ubuntu@subvnic:~/CSED311/Lab04-2/Lab4-2$ ./check
42+
Test 0
43+
TOTAL CYCLE : 35 (Answer : 36)
44+
Correct output : 32/32
45+
Test 1
46+
TOTAL CYCLE : 43 (Answer : 44)
47+
Correct output : 32/32
48+
Test 2
49+
TOTAL CYCLE : 326 (Answer : 323)
50+
Correct output : 32/32
51+
Test 3
52+
TOTAL CYCLE : 46 (Answer : 46)
53+
Correct output : 32/32
54+
Test 4
55+
TOTAL CYCLE : 1203 (Answer : 1188)
56+
Correct output : 32/32
57+
58+
FINAL REGISTER OUTPUT
59+
0 00000000 (Answer : 00000000)
60+
1 00000000 (Answer : 00000000)
61+
2 00002ffc (Answer : 00002ffc)
62+
3 00000000 (Answer : 00000000)
63+
4 00000000 (Answer : 00000000)
64+
5 00000000 (Answer : 00000000)
65+
6 00000000 (Answer : 00000000)
66+
7 00000000 (Answer : 00000000)
67+
8 00000000 (Answer : 00000000)
68+
9 00000000 (Answer : 00000000)
69+
10 0000000a (Answer : 0000000a)
70+
11 0000003f (Answer : 0000003f)
71+
12 fffffff1 (Answer : fffffff1)
72+
13 0000002f (Answer : 0000002f)
73+
14 0000000e (Answer : 0000000e)
74+
15 00000021 (Answer : 00000021)
75+
16 0000000a (Answer : 0000000a)
76+
17 0000000a (Answer : 0000000a)
77+
18 00000000 (Answer : 00000000)
78+
19 00000000 (Answer : 00000000)
79+
20 00000000 (Answer : 00000000)
80+
21 00000000 (Answer : 00000000)
81+
22 00000000 (Answer : 00000000)
82+
23 00000000 (Answer : 00000000)
83+
24 00000000 (Answer : 00000000)
84+
25 00000000 (Answer : 00000000)
85+
26 00000000 (Answer : 00000000)
86+
27 00000000 (Answer : 00000000)
87+
28 00000000 (Answer : 00000000)
88+
29 00000000 (Answer : 00000000)
89+
30 00000000 (Answer : 00000000)
90+
31 00000000 (Answer : 00000000)
91+
Correct output : 32/32

0 commit comments

Comments
 (0)