-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
phy: use common cs control for sdr and ddr
use common cs control for sdr and ddr Signed-off-by: Fin Maaß <[email protected]>
- Loading branch information
1 parent
dcd9c19
commit d98c742
Showing
3 changed files
with
34 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# | ||
# This file is part of LiteSPI | ||
# | ||
# Copyright (c) 2024 Fin Maaß <[email protected]> | ||
# SPDX-License-Identifier: BSD-2-Clause | ||
|
||
from migen import * | ||
|
||
from litex.gen import * | ||
from litex.gen.genlib.misc import WaitTimer | ||
from litex.build.io import SDROutput | ||
|
||
class LiteSPICSControl(LiteXModule): | ||
def __init__(self, pads, cs, cs_delay): | ||
self.enable = enable = Signal() | ||
cs_n = Signal().like(pads.cs_n) | ||
|
||
self.timer = timer = WaitTimer(cs_delay + 1) # Ensure cs_delay cycles between XFers. | ||
|
||
self.comb += timer.wait.eq(cs != 0) | ||
self.comb += enable.eq(timer.done) | ||
self.comb += cs_n.eq(~(Replicate(enable, len(pads.cs_n)) & cs)) | ||
|
||
self.specials += SDROutput( | ||
i = cs_n, | ||
o = pads.cs_n | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters