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
4a459e87
Commit
4a459e87
authored
Sep 13, 2022
by
Tristan Gingold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rtl: simplify urv_decode and urv_exec
parent
98e08ba0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
17 deletions
+11
-17
urv_decode.v
rtl/urv_decode.v
+2
-2
urv_exec.v
rtl/urv_exec.v
+9
-15
No files found.
rtl/urv_decode.v
View file @
4a459e87
...
...
@@ -314,9 +314,9 @@ module urv_decode
case
(
d_opcode
)
`OPC_OP
:
x_is_add_o
<=
~
f_ir_i
[
30
]
&&
!
(
d_fun
==
`FUNC_SLT
||
d_fun
==
`FUNC_SLTU
)
;
x_is_add_o
<=
~
f_ir_i
[
30
]
;
`OPC_OP_IMM
:
x_is_add_o
<=
!
(
d_fun
==
`FUNC_SLT
||
d_fun
==
`FUNC_SLTU
)
;
x_is_add_o
<=
1
;
`OPC_BRANCH
:
x_is_add_o
<=
0
;
default:
...
...
rtl/urv_exec.v
View file @
4a459e87
...
...
@@ -263,26 +263,20 @@ module urv_exec
wire
[
32
:
0
]
alu_addsub_op1
=
{
d_is_signed_alu_op_i
?
alu_op1
[
31
]
:
1'b0
,
alu_op1
};
wire
[
32
:
0
]
alu_addsub_op2
=
{
d_is_signed_alu_op_i
?
alu_op2
[
31
]
:
1'b0
,
alu_op2
};
reg
[
32
:
0
]
alu_addsub_result
;
// ALU adder/subtractor
always
@*
if
(
d_is_add_i
)
alu_addsub_result
<=
alu_addsub_op1
+
alu_addsub_op2
;
else
alu_addsub_result
<=
alu_addsub_op1
-
alu_addsub_op2
;
wire
[
32
:
0
]
alu_add
=
alu_addsub_op1
+
alu_addsub_op2
;
wire
[
32
:
0
]
alu_sub
=
alu_addsub_op1
-
alu_addsub_op2
;
// the rest of the ALU
always
@*
case
(
d_fun_i
)
`FUNC_ADD
:
alu_result
<=
alu_addsub_result
[
31
:
0
]
;
`FUNC_XOR
:
alu_result
<=
alu_op1
^
alu_op2
;
`FUNC_OR
:
alu_result
<=
alu_op1
|
alu_op2
;
`FUNC_AND
:
alu_result
<=
alu_op1
&
alu_op2
;
`FUNC_SLT
:
alu_result
<=
alu_addsub_result
[
32
]
?
1
:
0
;
`FUNC_SLTU
:
alu_result
<=
alu_addsub_result
[
32
]
?
1
:
0
;
default:
alu_result
<=
32
'
hx
;
`FUNC_ADD
:
alu_result
<=
d_is_add_i
?
alu_add
[
31
:
0
]
:
alu_sub
[
31
:
0
]
;
`FUNC_XOR
:
alu_result
<=
alu_op1
^
alu_op2
;
`FUNC_OR
:
alu_result
<=
alu_op1
|
alu_op2
;
`FUNC_AND
:
alu_result
<=
alu_op1
&
alu_op2
;
`FUNC_SLT
,
`FUNC_SLTU
:
alu_result
<=
{
31'b0
,
alu_sub
[
32
]
}
;
default:
alu_result
<=
32
'
hx
;
endcase
// case (d_fun_i)
// barel shifter
...
...
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