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
04a4e12b
Commit
04a4e12b
authored
4 years ago
by
Alban Gruin
Browse files
Options
Downloads
Patches
Plain Diff
frontend: remove the RAS
Signed-off-by:
Alban Gruin
<
alban.gruin@irit.fr
>
parent
549281aa
No related branches found
No related tags found
No related merge requests found
Pipeline
#457
failed
3 years ago
Stage: build
Stage: write-back
Stage: write-through
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/frontend/frontend.sv
+6
-20
6 additions, 20 deletions
src/frontend/frontend.sv
with
6 additions
and
20 deletions
src/frontend/frontend.sv
+
6
−
20
View file @
04a4e12b
...
@@ -158,7 +158,7 @@ module frontend import ariane_pkg::*; #(
...
@@ -158,7 +158,7 @@ module frontend import ariane_pkg::*; #(
// unconditional jumps with known target -> immediately resolved
// unconditional jumps with known target -> immediately resolved
assign
is_jump
[
i
]
=
instruction_valid
[
i
]
&
(
rvi_jump
[
i
]
|
rvc_jump
[
i
]);
assign
is_jump
[
i
]
=
instruction_valid
[
i
]
&
(
rvi_jump
[
i
]
|
rvc_jump
[
i
]);
// unconditional jumps with unknown target -> BTB
// unconditional jumps with unknown target -> BTB
assign
is_jalr
[
i
]
=
instruction_valid
[
i
]
&
~
is_return
[
i
]
&
~
is_call
[
i
]
&
(
rvi_jalr
[
i
]
|
rvc_jalr
[
i
]
|
rvc_jr
[
i
]);
assign
is_jalr
[
i
]
=
instruction_valid
[
i
]
&
(
rvi_jalr
[
i
]
|
rvc_jalr
[
i
]
|
rvc_jr
[
i
]);
// cf that needs a prediction
// cf that needs a prediction
assign
is_cf
[
i
]
=
instruction_valid
[
i
]
&
(
rvi_branch
[
i
]
|
rvc_branch
[
i
]
|
rvi_jalr
[
i
]
|
rvc_jalr
[
i
]
|
rvc_jr
[
i
]);
assign
is_cf
[
i
]
=
instruction_valid
[
i
]
&
(
rvi_branch
[
i
]
|
rvc_branch
[
i
]
|
rvi_jalr
[
i
]
|
rvc_jalr
[
i
]
|
rvc_jr
[
i
]);
...
@@ -178,10 +178,10 @@ module frontend import ariane_pkg::*; #(
...
@@ -178,10 +178,10 @@ module frontend import ariane_pkg::*; #(
// lower most prediction gets precedence
// lower most prediction gets precedence
for
(
int
i
=
INSTR_PER_FETCH
-
1
;
i
>=
0
;
i
--
)
begin
for
(
int
i
=
INSTR_PER_FETCH
-
1
;
i
>=
0
;
i
--
)
begin
unique
case
(
{
is_branch
[
i
],
is_return
[
i
],
is_jump
[
i
],
is_jalr
[
i
]
}
)
unique
case
(
{
is_branch
[
i
],
is_jump
[
i
],
is_jalr
[
i
]
}
)
4
'b000
0
:
;
// regular instruction e.g.: no branch
3
'b000
:
;
// regular instruction e.g.: no branch
// unconditional jump to register, we need the BTB to resolve this
// unconditional jump to register, we need the BTB to resolve this
4
'b00
0
1
:
begin
3
'b001
:
begin
ras_pop
=
1'b0
;
ras_pop
=
1'b0
;
ras_push
=
1'b0
;
ras_push
=
1'b0
;
if
(
btb_prediction_shifted
[
i
].
valid
)
begin
if
(
btb_prediction_shifted
[
i
].
valid
)
begin
...
@@ -190,23 +190,15 @@ module frontend import ariane_pkg::*; #(
...
@@ -190,23 +190,15 @@ module frontend import ariane_pkg::*; #(
end
end
end
end
// its an unconditional jump to an immediate
// its an unconditional jump to an immediate
4
'b0
0
10
:
begin
3
'b010
:
begin
ras_pop
=
1'b0
;
ras_pop
=
1'b0
;
ras_push
=
1'b0
;
ras_push
=
1'b0
;
taken_rvi_cf
[
i
]
=
rvi_jump
[
i
];
taken_rvi_cf
[
i
]
=
rvi_jump
[
i
];
taken_rvc_cf
[
i
]
=
rvc_jump
[
i
];
taken_rvc_cf
[
i
]
=
rvc_jump
[
i
];
cf_type
[
i
]
=
ariane_pkg
::
Jump
;
cf_type
[
i
]
=
ariane_pkg
::
Jump
;
end
end
// 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
;
end
// branch prediction
// branch prediction
4
'b100
0
:
begin
3
'b100
:
begin
ras_pop
=
1'b0
;
ras_pop
=
1'b0
;
ras_push
=
1'b0
;
ras_push
=
1'b0
;
// if we have a valid dynamic prediction use it
// if we have a valid dynamic prediction use it
...
@@ -224,12 +216,6 @@ module frontend import ariane_pkg::*; #(
...
@@ -224,12 +216,6 @@ module frontend import ariane_pkg::*; #(
default:
;
default:
;
// default: $error("Decoded more than one control flow");
// default: $error("Decoded more than one control flow");
endcase
endcase
// if this instruction, in addition, is a call, save the resulting address
// but only if we actually consumed the address
if
(
is_call
[
i
])
begin
ras_push
=
instr_queue_consumed
[
i
];
ras_update
=
addr
[
i
]
+
(
rvc_call
[
i
]
?
2
:
4
);
end
// calculate the jump target address
// calculate the jump target address
if
(
taken_rvc_cf
[
i
]
||
taken_rvi_cf
[
i
])
begin
if
(
taken_rvc_cf
[
i
]
||
taken_rvi_cf
[
i
])
begin
predict_address
=
addr
[
i
]
+
(
taken_rvc_cf
[
i
]
?
rvc_imm
[
i
]
:
rvi_imm
[
i
]);
predict_address
=
addr
[
i
]
+
(
taken_rvc_cf
[
i
]
?
rvc_imm
[
i
]
:
rvi_imm
[
i
]);
...
...
This diff is collapsed.
Click to expand it.
Ghost User
@ghost
mentioned in commit
a59bf2fb
·
7 months ago
mentioned in commit
a59bf2fb
mentioned in commit a59bf2fbede4994c9b93fe6698ef590b15a48689
Toggle commit list
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