Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MINOTAuR
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MINOTAuR
MINOTAuR
Commits
82d5abd9
Commit
82d5abd9
authored
4 years ago
by
Alban Gruin
Browse files
Options
Downloads
Patches
Plain Diff
frontend: disable branch prediction, mkI
Signed-off-by:
Alban Gruin
<
alban.gruin@irit.fr
>
parent
33682980
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/ariane.sv
+1
-0
1 addition, 0 deletions
src/ariane.sv
src/frontend/frontend.sv
+24
-16
24 additions, 16 deletions
src/frontend/frontend.sv
with
25 additions
and
16 deletions
src/ariane.sv
+
1
−
0
View file @
82d5abd9
...
...
@@ -281,6 +281,7 @@ module ariane import ariane_pkg::*; #(
.
fetch_entry_ready_i
(
fetch_ready_id_if
),
.
has_mem_access_o
(
has_mem_access_if_verif
),
.
branch_speculation_o
(
bsp_if_perf
),
.
enable_bp_i
(
1'b0
),
.
*
);
...
...
This diff is collapsed.
Click to expand it.
src/frontend/frontend.sv
+
24
−
16
View file @
82d5abd9
...
...
@@ -46,7 +46,9 @@ module frontend import ariane_pkg::*; #(
input
logic
fetch_entry_ready_i
,
// ID acknowledged this instruction
output
logic
has_mem_access_o
,
output
logic
branch_speculation_o
output
logic
branch_speculation_o
,
input
logic
enable_bp_i
);
// Instruction Cache Registers, from I$
logic
[
FETCH_WIDTH
-
1
:
0
]
icache_data_q
;
...
...
@@ -179,7 +181,7 @@ module frontend import ariane_pkg::*; #(
4'b0001
:
begin
ras_pop
=
1'b0
;
ras_push
=
1'b0
;
if
(
btb_prediction_shifted
[
i
].
valid
)
begin
if
(
btb_prediction_shifted
[
i
].
valid
&
enable_bp_i
)
begin
predict_address
=
btb_prediction_shifted
[
i
].
target_address
;
cf_type
[
i
]
=
ariane_pkg
::
JumpR
;
end
...
...
@@ -195,26 +197,30 @@ module frontend import ariane_pkg::*; #(
// return
4'b0100
:
begin
// make sure to only alter the RAS if we actually consumed the instruction
ras_pop
=
ras_predict
.
valid
&
instr_queue_consumed
[
i
];
ras_push
=
1'b0
;
predict_address
=
ras_predict
.
ra
;
cf_type
[
i
]
=
ariane_pkg
::
Return
;
ras_pop
=
ras_predict
.
valid
&
instr_queue_consumed
[
i
];
if
(
enable_bp_i
)
begin
predict_address
=
ras_predict
.
ra
;
cf_type
[
i
]
=
ariane_pkg
::
Return
;
end
end
// branch prediction
4'b1000
:
begin
ras_pop
=
1'b0
;
ras_push
=
1'b0
;
// if we have a valid dynamic prediction use it
if
(
bht_prediction_shifted
[
i
].
valid
)
begin
taken_rvi_cf
[
i
]
=
rvi_branch
[
i
]
&
bht_prediction_shifted
[
i
].
taken
;
taken_rvc_cf
[
i
]
=
rvc_branch
[
i
]
&
bht_prediction_shifted
[
i
].
taken
;
// otherwise default to static prediction
end
else
begin
// set if immediate is negative - static prediction
taken_rvi_cf
[
i
]
=
rvi_branch
[
i
]
&
rvi_imm
[
i
][
riscv
::
VLEN
-
1
];
taken_rvc_cf
[
i
]
=
rvc_branch
[
i
]
&
rvc_imm
[
i
][
riscv
::
VLEN
-
1
];
if
(
enable_bp_i
)
begin
// if we have a valid dynamic prediction use it
if
(
bht_prediction_shifted
[
i
].
valid
)
begin
taken_rvi_cf
[
i
]
=
rvi_branch
[
i
]
&
bht_prediction_shifted
[
i
].
taken
;
taken_rvc_cf
[
i
]
=
rvc_branch
[
i
]
&
bht_prediction_shifted
[
i
].
taken
;
// otherwise default to static prediction
end
else
begin
// set if immediate is negative - static prediction
taken_rvi_cf
[
i
]
=
rvi_branch
[
i
]
&
rvi_imm
[
i
][
riscv
::
VLEN
-
1
];
taken_rvc_cf
[
i
]
=
rvc_branch
[
i
]
&
rvc_imm
[
i
][
riscv
::
VLEN
-
1
];
end
if
(
taken_rvi_cf
[
i
]
||
taken_rvc_cf
[
i
])
cf_type
[
i
]
=
ariane_pkg
::
Branch
;
end
if
(
taken_rvi_cf
[
i
]
||
taken_rvc_cf
[
i
])
cf_type
[
i
]
=
ariane_pkg
::
Branch
;
end
default:
;
// default: $error("Decoded more than one control flow");
...
...
@@ -227,7 +233,9 @@ module frontend import ariane_pkg::*; #(
end
// calculate the jump target address
if
(
taken_rvc_cf
[
i
]
||
taken_rvi_cf
[
i
])
begin
predict_address
=
addr
[
i
]
+
(
taken_rvc_cf
[
i
]
?
rvc_imm
[
i
]
:
rvi_imm
[
i
]);
if
(
rvi_jump
[
i
]
||
rvc_jump
[
i
]
||
enable_bp_i
)
begin
predict_address
=
addr
[
i
]
+
(
taken_rvc_cf
[
i
]
?
rvc_imm
[
i
]
:
rvi_imm
[
i
]);
end
end
end
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment