-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Re-add gmiiToSgmiiBridge
after migration
#11
Open
lmbollen
wants to merge
1
commit into
main
Choose a base branch
from
add-gmii-bridge
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+606
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,124 @@ | ||
{- | | ||
Copyright : (C) 2024, Google LLC | ||
License : BSD2 (see the file LICENSE) | ||
Maintainer : QBayLogic B.V. <devops@qbaylogic.com> | ||
|
||
Contains a wrapper for the Xilinx GMII to SGMII PMA | ||
|
||
"LogiCORE IP Ethernet 1000BASE-X PCS/PMA or SGMII" | ||
|
||
https://www.xilinx.com/xsw/gig_ethernet_pcs_pma | ||
|
||
Currently only the Verilog primitive is supported. | ||
-} | ||
|
||
{-# LANGUAGE RecordWildCards #-} | ||
{-# LANGUAGE ViewPatterns #-} | ||
|
||
module Clash.Cores.Xilinx.Ethernet.Gmii ( | ||
-- * GMII SGMII bridge function | ||
gmiiSgmiiBridge, | ||
-- * GMII interface | ||
Gmii (..), | ||
-- * GMII SGMII bridge function output | ||
BridgeOutput (..), | ||
-- ** Status fields | ||
Status (..), | ||
Pause (..), | ||
-- * PHY LVDS signals | ||
Lvds (..), | ||
-- * Bridge configuration | ||
Config (..), | ||
AutoNegConfig (..), | ||
DuplexMode (..), | ||
LinkSpeed (..)) where | ||
|
||
import Clash.Explicit.Prelude | ||
|
||
import Clash.Cores.Xilinx.Ethernet.Gmii.Internal | ||
import Clash.Signal.Internal (DiffClock (..)) | ||
|
||
-- | A subset of the relevant output signals of the GMII to SGMII bridge | ||
data BridgeOutput gmii125 sgmii625 = BridgeOutput | ||
{ bridgeLvdsOut :: Signal sgmii625 Lvds | ||
-- ^ LVDS output to the PHY | ||
, bridgeGmiiRx :: Signal gmii125 Gmii | ||
-- ^ GMII output to the MAC | ||
, bridgeClk125 :: Clock gmii125 | ||
-- ^ Clock output for the 125 MHz domain | ||
, bridgeRst125 :: Reset gmii125 | ||
-- ^ Active high reset output for the 125 MHz domain | ||
, bridgeStatus :: Signal gmii125 Status | ||
-- ^ Status vector | ||
} | ||
|
||
{- | Wrapper for the LogiCORE IP Ethernet 1000BASE-X PCS/PMA or SGMII, configured to | ||
function as a GMII to SGMII bridge using LVDS in MAC mode. Currently only the Verilog | ||
primitive is supported. | ||
-} | ||
gmiiSgmiiBridge :: | ||
forall sgmii625 gmii125. | ||
KnownDomain sgmii625 => | ||
KnownDomain gmii125 => | ||
DomainPeriod sgmii625 ~ Picoseconds 1600 => | ||
DomainPeriod gmii125 ~ Nanoseconds 8 => | ||
DomainActiveEdge sgmii625 ~ 'Rising => | ||
DomainActiveEdge gmii125 ~ 'Rising => | ||
HasAsynchronousReset sgmii625 => | ||
HasSynchronousReset gmii125 => | ||
DomainResetPolarity sgmii625 ~ 'ActiveHigh => | ||
DomainResetPolarity gmii125 ~ 'ActiveHigh => | ||
-- | Reference clock coming from the PHY | ||
DiffClock sgmii625 -> | ||
-- | Asynchronous reset for the bridge | ||
Reset sgmii625 -> | ||
-- | Signal detect from the PHY. Either connect to the PHY's signal detect or use | ||
-- a constant @True@, otherwise the link will never come up. The IP core considers this | ||
-- an asynchronous signal, so synchronisation logic is not needed. | ||
Signal sgmii625 Bool -> | ||
-- | Configuration for the bridge | ||
Signal gmii125 Config -> | ||
-- | Auto negotiation configuration for the bridge | ||
Signal gmii125 AutoNegConfig -> | ||
-- | Restart auto negotiation | ||
Signal gmii125 Bool -> | ||
-- | LVDS input from the PHY | ||
Signal sgmii625 Lvds -> | ||
-- | GMII input from the MAC | ||
Signal gmii125 Gmii -> | ||
-- | Output record, see @BridgeOutput@ | ||
BridgeOutput gmii125 sgmii625 | ||
gmiiSgmiiBridge refClk refRst signalDetect bridgeConfig anConfig anRestart lvdsIn gmiiTx = BridgeOutput{..} | ||
where | ||
( bridgeClk125 | ||
, activeHighRxRst | ||
, lvdsOutP | ||
, lvdsOutN | ||
, gmiiRxD | ||
, gmiiRxDv | ||
, gmiiRxEr | ||
, fmap fromStatusVector -> bridgeStatus | ||
) = | ||
gmiiSgmiiBridgePrim | ||
clockP | ||
clockN | ||
refRst | ||
signalDetect | ||
bridgeConfig | ||
(toAutoNegConfigVector <$> anConfig) | ||
anRestart | ||
lvdsInP | ||
lvdsInN | ||
gmiiTxD | ||
gmiiTxEn | ||
gmiiTxEr | ||
|
||
bridgeRst125 = unsafeFromActiveHigh activeHighRxRst | ||
bridgeLvdsOut = Lvds <$> lvdsOutP <*> lvdsOutN | ||
(DiffClock clockP clockN) = refClk | ||
lvdsInP = pChannel <$> lvdsIn | ||
lvdsInN = nChannel <$> lvdsIn | ||
gmiiTxD = gmiiData <$> gmiiTx | ||
gmiiTxEn = gmiiValid <$> gmiiTx | ||
gmiiTxEr = gmiiError <$> gmiiTx | ||
bridgeGmiiRx = Gmii <$> gmiiRxD <*> gmiiRxDv <*> gmiiRxEr |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this a mistake? I think you only use
tasty-hunit
which is already in thebuild-depends
.