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
16384349
Commit
16384349
authored
Mar 13, 2018
by
Tristan Gingold
Committed by
Dimitris Lampridis
Mar 19, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify fetch.
parent
5cb47d99
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
9 deletions
+7
-9
urv_fetch.v
rtl/urv_fetch.v
+7
-9
No files found.
rtl/urv_fetch.v
View file @
16384349
...
...
@@ -54,17 +54,17 @@ module urv_fetch
reg
rst_d
;
reg
[
31
:
0
]
pc_next
;
reg
[
31
:
0
]
pc_plus_4
;
reg
dbg_mode
;
reg
[
2
:
0
]
pipeline_cnt
;
always
@*
if
(
x_bra_i
)
pc_next
<=
x_pc_bra_i
;
else
if
(
!
rst_d
||
f_stall_i
||
!
im_valid_i
||
dbg_mode
)
else
if
(
!
rst_d
||
f_stall_i
||
!
im_valid_i
||
dbg_mode
||
dbg_force_i
||
pipeline_cnt
!=
0
)
pc_next
<=
pc
;
else
pc_next
<=
pc
_plus_
4
;
pc_next
<=
pc
+
4
;
// Start fetching the next instruction
assign
im_addr_o
=
pc_next
;
...
...
@@ -76,7 +76,6 @@ module urv_fetch
begin
// PC = 0 at reset.
pc
<=
0
;
pc_plus_4
<=
4
;
f_pc_o
<=
0
;
f_ir_o
<=
0
;
...
...
@@ -104,9 +103,11 @@ module urv_fetch
if
(
!
dbg_mode
&&
(
dbg_force_i
||
x_dbg_toggle
||
pipeline_cnt
!=
0
))
begin
//
Try to enter in debug mode
.
//
Stall until the debug mode is set (pipeline flushed)
.
f_valid_o
<=
0
;
if
(
pipeline_cnt
==
4
)
// Ebreak enters directly in the debug mode. As it is
// considered as a branch, stages are killed.
if
(
pipeline_cnt
==
4
||
x_dbg_toggle
)
dbg_mode
<=
1
;
else
pipeline_cnt
<=
pipeline_cnt
+
1
;
...
...
@@ -116,8 +117,6 @@ module urv_fetch
// Default: insn not valid
f_valid_o
<=
0
;
pc_plus_4
<=
pc
+
4
;
if
(
x_dbg_toggle
)
begin
// Leave debug mode
...
...
@@ -139,7 +138,6 @@ module urv_fetch
end
else
if
(
im_valid_i
)
begin
pc_plus_4
<=
(
x_bra_i
?
x_pc_bra_i
:
pc_plus_4
)
+
4
;
f_ir_o
<=
im_data_i
;
// A branch invalidate the current instruction.
f_valid_o
<=
(
rst_d
&&
!
x_bra_i
)
;
...
...
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