Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Kestrel Collaboration
Kestrel LiteX
migen
Commits
c3708b3a
Commit
c3708b3a
authored
7 years ago
by
Florent Kermarrec
Browse files
Options
Download
Email Patches
Plain Diff
genlib/cdc/gearbox: add more margin on pointers (for cases where clocks are not perfectly aligned)
parent
8badc8c8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
migen/genlib/cdc.py
migen/genlib/cdc.py
+4
-3
No files found.
migen/genlib/cdc.py
View file @
c3708b3a
...
@@ -224,11 +224,12 @@ class Gearbox(Module):
...
@@ -224,11 +224,12 @@ class Gearbox(Module):
]
]
self
.
clock_domains
+=
cd_write
,
cd_read
self
.
clock_domains
+=
cd_write
,
cd_read
storage
=
Signal
(
lcm
(
iwidth
,
owidth
))
# TODO: optimize storage/resets for lowest ressource usage / lowest latency
storage
=
Signal
(
2
*
lcm
(
iwidth
,
owidth
))
wrchunks
=
len
(
storage
)
//
iwidth
wrchunks
=
len
(
storage
)
//
iwidth
rdchunks
=
len
(
storage
)
//
owidth
rdchunks
=
len
(
storage
)
//
owidth
wrpointer
=
Signal
(
max
=
wrchunks
,
reset
=
0
if
iwidth
>
owidth
else
wrchunks
-
1
)
wrpointer
=
Signal
(
max
=
wrchunks
,
reset
=
0
if
iwidth
>
owidth
else
wrchunks
//
2
)
rdpointer
=
Signal
(
max
=
rdchunks
,
reset
=
rdchunks
-
1
if
iwidth
>
owidth
else
0
)
rdpointer
=
Signal
(
max
=
rdchunks
,
reset
=
rdchunks
//
2
if
iwidth
>
owidth
else
0
)
self
.
sync
.
write
+=
\
self
.
sync
.
write
+=
\
If
(
wrpointer
==
wrchunks
-
1
,
If
(
wrpointer
==
wrchunks
-
1
,
...
...
This diff is collapsed.
Click to expand it.
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