Skip to content
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

Object model updates for AHB and AXI #2427

Merged
merged 5 commits into from
Apr 27, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 22 additions & 17 deletions src/main/scala/diplomaticobjectmodel/model/OMPorts.scala
Original file line number Diff line number Diff line change
Expand Up @@ -124,21 +124,26 @@ case class SystemPort(
_types: Seq[String] = Seq("SystemPort", "OutboundPort", "OMPort", "OMDevice", "OMComponent", "OMCompoundType")) extends OutboundPort

object OMPortMaker {
val protocolSpecifications = Map[ProtocolType, String](
AHBProtocol -> "AMBA 3 AHB-Lite Protocol",
AXI4Protocol -> "AMBA 3 AXI4-Lite Protocol",
APBProtocol -> "AMBA 3 APB Protocol",
TLProtocol -> "TileLink specification"
)
val protocolSpecifications: (ProtocolType, SubProtocolType) => String = {
case (AHBProtocol, AHBLiteSubProtocol) => "AHB Lite Protocol"
case (AHBProtocol, AHBFullSubProtocol) => "AHB Full Protocol"
case (AXI4Protocol, AXI4SubProtocol) => "AXI Protocol"
case (AXI4Protocol, AXI4LiteSubProtocol) => "AXI Lite Protocol"
case (APBProtocol, APBSubProtocol) => "APB Protocol"
case (TLProtocol, TL_UHSubProtocol) => "TileLink Protocol"
case (TLProtocol, TL_ULSubProtocol) => "TileLink Protocol"
case (TLProtocol, TL_CSubProtocol) => "TileLink Protocol"
case _ => "Invalid Protocol"
}

val protocolSpecificationVersions = Map[ProtocolType, String](
AHBProtocol -> "1.0",
AXI4Protocol -> "1.0",
AHBProtocol -> "3",
AXI4Protocol -> "4",
APBProtocol -> "1.0",
mwachs5 marked this conversation as resolved.
Show resolved Hide resolved
TLProtocol -> "1.8"
)

def specVersion(protocol: ProtocolType, version: String): Option[OMSpecification] = Some(OMSpecification(protocolSpecifications(protocol), version))
def specVersion(protocol: ProtocolType, subProtocol: SubProtocolType, version: String): Option[OMSpecification] = Some(OMSpecification(protocolSpecifications(protocol, subProtocol), version))

val portNames = Map[PortType, String](
SystemPortType -> "System Port",
Expand All @@ -158,14 +163,14 @@ object OMPortMaker {
val documentationName = portNames(portType)

val omProtocol = (protocol, subProtocol) match {
case (AXI4Protocol, AXI4SubProtocol) => AXI4(specification = specVersion(protocol, version))
case (AXI4Protocol, AXI4LiteSubProtocol) => AXI4_Lite(specification = specVersion(protocol, version))
case (AHBProtocol, AHBLiteSubProtocol) => AHB_Lite(specification = specVersion(protocol, version))
case (AHBProtocol, AHBFullSubProtocol) => AHB(specification = specVersion(protocol, version))
case (APBProtocol, APBSubProtocol) => APB(specification = specVersion(protocol, version))
case (TLProtocol, TL_UHSubProtocol) => TL_UH(specification = specVersion(protocol, version))
case (TLProtocol, TL_ULSubProtocol) => TL_UL(specification = specVersion(protocol, version))
case (TLProtocol, TL_CSubProtocol) => TL_C(specification = specVersion(protocol, version))
case (AXI4Protocol, AXI4SubProtocol) => AXI4(specification = specVersion(protocol, subProtocol, version))
case (AXI4Protocol, AXI4LiteSubProtocol) => AXI4_Lite(specification = specVersion(protocol, subProtocol, version))
case (AHBProtocol, AHBLiteSubProtocol) => AHB_Lite(specification = specVersion(protocol, subProtocol, version))
case (AHBProtocol, AHBFullSubProtocol) => AHB(specification = specVersion(protocol, subProtocol, version))
case (APBProtocol, APBSubProtocol) => APB(specification = specVersion(protocol, subProtocol, version))
case (TLProtocol, TL_UHSubProtocol) => TL_UH(specification = specVersion(protocol, subProtocol, version))
case (TLProtocol, TL_ULSubProtocol) => TL_UL(specification = specVersion(protocol, subProtocol, version))
case (TLProtocol, TL_CSubProtocol) => TL_C(specification = specVersion(protocol, subProtocol, version))
case _ => throw new IllegalArgumentException(s"protocol $protocol, subProtocol $subProtocol")
}

Expand Down