Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Platform-independent core collection
Manage
Activity
Members
Labels
Plan
Issues
15
Issue boards
Milestones
Wiki
Code
Merge requests
5
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
Projects
Platform-independent core collection
Commits
2e0a1bf7
Commit
2e0a1bf7
authored
12 years ago
by
Wesley W. Terpstra
Browse files
Options
Downloads
Patches
Plain Diff
lm32: prevent truncation warnings by explicitly selecting low bits
parent
8f275b0c
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/wishbone/wb_lm32/src/lm32_decoder.v
+2
-2
2 additions, 2 deletions
modules/wishbone/wb_lm32/src/lm32_decoder.v
modules/wishbone/wb_lm32/src/lm32_shifter.v
+9
-5
9 additions, 5 deletions
modules/wishbone/wb_lm32/src/lm32_shifter.v
with
11 additions
and
7 deletions
modules/wishbone/wb_lm32/src/lm32_decoder.v
+
2
−
2
View file @
2e0a1bf7
...
...
@@ -651,8 +651,8 @@ assign immediate = select_high_immediate == `TRUE
:
extended_immediate
;
assign
branch_offset
=
select_call_immediate
==
`TRUE
?
call_immediate
:
branch_immediate
;
?
(
call_immediate
[
`LM32_PC_WIDTH
-
1
:
0
])
:
(
branch_immediate
[
`LM32_PC_WIDTH
-
1
:
0
])
;
endmodule
This diff is collapsed.
Click to expand it.
modules/wishbone/wb_lm32/src/lm32_shifter.v
+
9
−
5
View file @
2e0a1bf7
...
...
@@ -69,8 +69,9 @@ wire [`LM32_WORD_RNG] shifter_result_m;
/////////////////////////////////////////////////////
reg
direction_m
;
wire
[
`LM32_WORD_WIDTH
*
2
-
1
:
0
]
right_shift_result_x
;
reg
[
`LM32_WORD_RNG
]
left_shift_result
;
reg
[
`LM32_WORD_RNG
]
right_shift_result
;
reg
[
`LM32_WORD_RNG
]
right_shift_result
_m
;
reg
[
`LM32_WORD_RNG
]
left_shift_operand
;
wire
[
`LM32_WORD_RNG
]
right_shift_operand
;
wire
fill_value
;
...
...
@@ -99,15 +100,18 @@ assign fill_value = (sign_extend_x == `TRUE) && (direction_x == `LM32_SHIFT_OP_R
// Determine bits to shift in for right shift or rotate
assign
right_shift_in
=
{
`LM32_WORD_WIDTH
{
fill_value
}}
;
// Determine the result of the shifter
assign
right_shift_result_x
=
{
right_shift_in
,
right_shift_operand
}
>>
operand_1_x
[
`LM32_SHIFT_RNG
];
// Reverse bits to get left shift result
always
@
(
*
)
begin
for
(
shift_idx_1
=
0
;
shift_idx_1
<
`LM32_WORD_WIDTH
;
shift_idx_1
=
shift_idx_1
+
1
)
left_shift_result
[
`LM32_WORD_WIDTH
-
1
-
shift_idx_1
]
=
right_shift_result
[
shift_idx_1
];
left_shift_result
[
`LM32_WORD_WIDTH
-
1
-
shift_idx_1
]
=
right_shift_result
_m
[
shift_idx_1
];
end
// Select result
assign
shifter_result_m
=
direction_m
==
`LM32_SHIFT_OP_LEFT
?
left_shift_result
:
right_shift_result
;
assign
shifter_result_m
=
direction_m
==
`LM32_SHIFT_OP_LEFT
?
left_shift_result
:
right_shift_result
_m
;
/////////////////////////////////////////////////////
// Sequential Logic
...
...
@@ -118,14 +122,14 @@ always @(posedge clk_i `CFG_RESET_SENSITIVITY)
begin
if
(
rst_i
==
`TRUE
)
begin
right_shift_result
<=
{
`LM32_WORD_WIDTH
{
1'b0
}}
;
right_shift_result
_m
<=
{
`LM32_WORD_WIDTH
{
1'b0
}}
;
direction_m
<=
`FALSE
;
end
else
begin
if
(
stall_x
==
`FALSE
)
begin
right_shift_result
<=
{
right_shift_
in
,
right_shift_operand
}
>>
operand_1
_x
[
`LM32_
SHIFT
_RNG
];
right_shift_result
_m
<=
right_shift_
result
_x
[
`LM32_
WORD
_RNG
];
direction_m
<=
direction_x
;
end
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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