Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
STITCH
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
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
Show more breadcrumbs
Pascal Engeler
STITCH
Commits
209da0df
Commit
209da0df
authored
6 months ago
by
Pascal Engeler
Browse files
Options
Downloads
Patches
Plain Diff
Finished unwrapper implementation
parent
00427189
No related branches found
Branches containing commit
No related tags found
1 merge request
!2
Resolve "Distance wrapping invalidates lock sum"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
stitch_project/stitch/DistanceUnwrapper.vhd
+61
-4
61 additions, 4 deletions
stitch_project/stitch/DistanceUnwrapper.vhd
with
61 additions
and
4 deletions
stitch_project/stitch/DistanceUnwrapper.vhd
+
61
−
4
View file @
209da0df
...
...
@@ -39,6 +39,7 @@ signal current_state : STATE_T := IDLE_S;
signal
currentDistance
:
STD_LOGIC_VECTOR
(
24
downto
0
)
:
=
(
others
=>
'0'
);
signal
prevDistance
:
STD_LOGIC_VECTOR
(
24
downto
0
)
:
=
(
others
=>
'0'
);
signal
latchedDistance
:
STD_LOGIC_VECTOR
(
24
downto
0
)
:
=
(
others
=>
'0'
);
signal
distanceInWide
:
STD_LOGIC_VECTOR
(
24
downto
0
)
:
=
(
others
=>
'0'
);
signal
calcDelta
:
STD_LOGIC_VECTOR
(
24
downto
0
)
:
=
(
others
=>
'0'
);
...
...
@@ -47,6 +48,8 @@ signal corrDelta : STD_LOGIC_VECTOR(24 downto 0) := "0001000000000000000000000";
signal
corrDeltaN
:
STD_LOGIC_VECTOR
(
24
downto
0
)
:
=
"1111000000000000000000000"
;
signal
currentOffset
:
STD_LOGIC_VECTOR
(
24
downto
0
)
:
=
(
others
=>
'0'
);
signal
newIsLarger
:
STD_LOGIC
:
=
'0'
;
signal
dr_prev
:
STD_LOGIC
:
=
'0'
;
begin
...
...
@@ -54,6 +57,8 @@ begin
distanceInWide
(
20
downto
0
)
<=
distance_in
;
distanceInWide
(
24
downto
21
)
<=
(
others
=>
'0'
);
distance_out
<=
currentDistance
;
dr_update
:
process
(
clk100
)
begin
...
...
@@ -63,6 +68,7 @@ begin
end
process
;
proc
:
process
(
clk100
)
begin
if
rising_edge
(
clk100
)
then
...
...
@@ -71,29 +77,80 @@ begin
when
IDLE_S
=>
if
dr
=
'1'
and
dr_prev
=
'0'
then
current_state
<=
STATE1
;
latchedDistance
<=
distanceInWide
;
--calculate relevant delta distance here
if
prevDistance
>
distanceInWide
then
newIsLarger
<=
'0'
;
calcDelta
<=
prevDistance
-
distanceInWide
;
else
newIsLarger
<=
'1'
;
calcDelta
<=
distanceInWide
-
prevDistance
;
end
if
;
else
current_state
<=
IDLE_S
;
latchedDistance
<=
latchedDistance
;
newIsLarger
<=
newIsLarger
;
calcDelta
<=
calcDelta
;
end
if
;
currentOffset
<=
currentOffset
;
currentDistance
<=
currentDistance
;
dr_out
<=
'0'
;
prevDistance
<=
prevDistance
;
when
STATE1
=>
current_state
<=
STATE2
;
--calculate change to offset here
if
calcDelta
>
maxDelta
then
--we have wrapped around
if
newIsLarger
then
--went negative
currentOffset
<=
currentOffset
+
corrDeltaN
;
else
--went more positive
currentOffset
<=
currentOffset
+
corrDelta
;
end
if
;
else
currentOffset
<=
currentOffset
;
end
if
;
latchedDistance
<=
latchedDistance
;
newIsLarger
<=
newIsLarger
;
calcDelta
<=
calcDelta
;
currentDistance
<=
currentDistance
;
dr_out
<=
dr_out
;
prevDistance
<=
prevDistance
;
when
STATE2
=>
--calculate output distance, set next prevDistance here
current_state
<=
STATE3
;
--calculate output distance here
currentDistance
<=
currentOffset
+
latchedDistance
;
latchedDistance
<=
latchedDistance
;
newIsLarger
<=
newIsLarger
;
calcDelta
<=
calcDelta
;
currentOffset
<=
currentOffset
;
dr_out
<=
dr_out
;
prevDistance
<=
latchedDistance
;
when
STATE3
=>
--set output ready here
current_state
<=
IDLE_S
;
--set output ready here
dr_out
<=
'1'
;
latchedDistance
<=
latchedDistance
;
newIsLarger
<=
newIsLarger
;
calcDelta
<=
calcDelta
;
currentOffset
<=
currentOffset
;
currentDistance
<=
currentDistance
;
prevDistance
<=
prevDistance
;
end
case
;
else
currentDistance
<=
(
others
=>
'0'
);
prevDistance
<=
(
others
=>
'0'
);
current_state
<=
IDLE_S
;
latchedDistance
<=
(
others
=>
'0'
);
newIsLarger
<=
'0'
;
calcDelta
<=
(
others
=>
'0'
);
currentOffset
<=
(
others
=>
'0'
);
dr_out
<=
'0'
;
end
if
;
end
if
;
...
...
This diff is collapsed.
Click to expand it.
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