Skip to content

Instantly share code, notes, and snippets.

@allexoll
Created July 28, 2021 08:37
Show Gist options
  • Save allexoll/60592f9cdd988fac5749ec5389d55276 to your computer and use it in GitHub Desktop.
Save allexoll/60592f9cdd988fac5749ec5389d55276 to your computer and use it in GitHub Desktop.
apb3 macEth spinalhdl
package SolSoc.lib
import spinal.core._
import spinal.lib._
import spinal.lib.bus.amba3.apb.{Apb3, Apb3Config, Apb3SlaveFactory}
import spinal.lib.com.eth.{MacEth, MacEthParameter, Mii, MiiParameter, MiiRxParameter, MiiTxParameter, PhyIo}
object Apb3MacEthConfig{
def getApb3Config = Apb3Config(
addressWidth = 6,
dataWidth = 32
)
}
case class Apb3MacEth(p : MacEthParameter,
txCd : ClockDomain,
rxCd : ClockDomain) extends Component{
val io = new Bundle{
val bus = slave(Apb3(Apb3MacEthConfig.getApb3Config))
val phy = master(PhyIo(p.phy))
val interrupt = out Bool ()
}
val mac = new MacEth(p, txCd, rxCd)
io.phy <> mac.io.phy
val busCtrl = Apb3SlaveFactory(io.bus)
val bridge = mac.io.ctrl.driveFrom(busCtrl)
io.interrupt := bridge.interruptCtrl.pending
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment