Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
U
urv-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
urv-core
Commits
63d1ad2c
Commit
63d1ad2c
authored
Jun 29, 2022
by
Tristan Gingold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
urv_fetch: add f_kill, add comments
parent
edf32c1b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
3 deletions
+15
-3
urv_fetch.v
rtl/urv_fetch.v
+15
-3
No files found.
rtl/urv_fetch.v
View file @
63d1ad2c
...
...
@@ -34,6 +34,7 @@ module urv_fetch
input
f_stall_i
,
// Instruction memory
// im_rd_o is maintained as long as the instruction is needed.
output
[
31
:
0
]
im_addr_o
,
output
im_rd_o
,
input
[
31
:
0
]
im_data_i
,
...
...
@@ -67,13 +68,18 @@ module urv_fetch
reg
[
2
:
0
]
pipeline_cnt
;
wire
frozen
;
assign
frozen
=
(
f_stall_i
// Set by x_bra_i until the next instruction has been fetched.
// The instruction being fetched before the branch has to be discarded.
reg
f_kill
;
// Set as long as no instruction has to be fetched.
assign
frozen
=
(
f_stall_i
||
dbg_mode
||
dbg_force_i
||
pipeline_cnt
!=
0
)
;
always
@*
if
(
x_bra_i
)
pc_next
<=
x_pc_bra_i
;
else
if
(
rst_d
||
frozen
||
!
im_valid_i
)
else
if
(
rst_d
||
frozen
||
f_kill
||
!
im_valid_i
)
pc_next
<=
pc
;
else
pc_next
<=
pc
+
4
;
...
...
@@ -94,6 +100,7 @@ module urv_fetch
f_pc_o
<=
0
;
f_ir_o
<=
0
;
f_valid_o
<=
0
;
f_kill
<=
0
;
// Allow to start in debug mode.
dbg_mode
<=
dbg_force_i
;
...
...
@@ -156,10 +163,15 @@ module urv_fetch
f_ir_o
<=
im_data_i
;
// A branch invalidate the current instruction.
// Not valid on the first cycle
f_valid_o
<=
(
!
rst_d
&&
!
x_bra_i
)
;
f_valid_o
<=
(
!
rst_d
&&
!
x_bra_i
&&
!
f_kill
)
;
// The instruction has been killed.
f_kill
<=
0
;
end
else
begin
// If a branch has been executed, the instruction being
// fetch must not be executed. Kill it.
f_kill
<=
f_kill
|
x_bra_i
;
f_valid_o
<=
0
;
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment