devices: include DTS meta-data
This commit is contained in:
parent
baccd5ada2
commit
46aa6b0ac4
@ -286,6 +286,6 @@ object GPIOInputPinCtrl {
|
|||||||
|
|
||||||
// Magic TL2 Incantation to create a TL2 Slave
|
// Magic TL2 Incantation to create a TL2 Slave
|
||||||
class TLGPIO(w: Int, c: GPIOParams)(implicit p: Parameters)
|
class TLGPIO(w: Int, c: GPIOParams)(implicit p: Parameters)
|
||||||
extends TLRegisterRouter(c.address, interrupts = c.width, beatBytes = w)(
|
extends TLRegisterRouter(c.address, "gpio", Seq("sifive,gpio0"), interrupts = c.width, beatBytes = w)(
|
||||||
new TLRegBundle(c, _) with HasGPIOBundleContents)(
|
new TLRegBundle(c, _) with HasGPIOBundleContents)(
|
||||||
new TLRegModule(c, _, _) with HasGPIOModuleContents)
|
new TLRegModule(c, _, _) with HasGPIOModuleContents)
|
||||||
|
@ -535,6 +535,6 @@ trait HasI2CModuleContents extends Module with HasRegMap {
|
|||||||
|
|
||||||
// Magic TL2 Incantation to create a TL2 Slave
|
// Magic TL2 Incantation to create a TL2 Slave
|
||||||
class TLI2C(w: Int, c: I2CParams)(implicit p: Parameters)
|
class TLI2C(w: Int, c: I2CParams)(implicit p: Parameters)
|
||||||
extends TLRegisterRouter(c.address, interrupts = 1, beatBytes = w)(
|
extends TLRegisterRouter(c.address, "i2c", Seq("sifive,i2c0"), interrupts = 1, beatBytes = w)(
|
||||||
new TLRegBundle(c, _) with HasI2CBundleContents)(
|
new TLRegBundle(c, _) with HasI2CBundleContents)(
|
||||||
new TLRegModule(c, _, _) with HasI2CModuleContents)
|
new TLRegModule(c, _, _) with HasI2CModuleContents)
|
||||||
|
@ -95,6 +95,6 @@ trait HasMockAONModuleContents extends Module with HasRegMap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class TLMockAON(w: Int, c: MockAONParams)(implicit p: Parameters)
|
class TLMockAON(w: Int, c: MockAONParams)(implicit p: Parameters)
|
||||||
extends TLRegisterRouter(c.address, interrupts = 2, size = c.size, beatBytes = w, concurrency = 1)(
|
extends TLRegisterRouter(c.address, "aon", Seq("sifive,aon0"), interrupts = 2, size = c.size, beatBytes = w, concurrency = 1)(
|
||||||
new TLRegBundle(c, _) with HasMockAONBundleContents)(
|
new TLRegBundle(c, _) with HasMockAONBundleContents)(
|
||||||
new TLRegModule(c, _, _) with HasMockAONModuleContents)
|
new TLRegModule(c, _, _) with HasMockAONModuleContents)
|
||||||
|
@ -62,6 +62,6 @@ trait HasPWMModuleContents extends Module with HasRegMap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class TLPWM(w: Int, c: PWMParams)(implicit p: Parameters)
|
class TLPWM(w: Int, c: PWMParams)(implicit p: Parameters)
|
||||||
extends TLRegisterRouter(c.address, interrupts = c.ncmp, size = c.size, beatBytes = w)(
|
extends TLRegisterRouter(c.address, "pwm", Seq("sifive,pwm0"), interrupts = c.ncmp, size = c.size, beatBytes = w)(
|
||||||
new TLRegBundle(c, _) with HasPWMBundleContents)(
|
new TLRegBundle(c, _) with HasPWMBundleContents)(
|
||||||
new TLRegModule(c, _, _) with HasPWMModuleContents)
|
new TLRegModule(c, _, _) with HasPWMModuleContents)
|
||||||
|
@ -109,8 +109,9 @@ class SPITopModule[B <: SPITopBundle](c: SPIParamsBase, bundle: => B, outer: TLS
|
|||||||
|
|
||||||
abstract class TLSPIBase(w: Int, c: SPIParamsBase)(implicit p: Parameters) extends LazyModule {
|
abstract class TLSPIBase(w: Int, c: SPIParamsBase)(implicit p: Parameters) extends LazyModule {
|
||||||
require(isPow2(c.rSize))
|
require(isPow2(c.rSize))
|
||||||
val rnode = TLRegisterNode(address = AddressSet(c.rAddress, c.rSize-1), beatBytes = w)
|
val device = new SimpleDevice("spi", Seq("sifive,spi0"))
|
||||||
val intnode = IntSourceNode(1)
|
val rnode = TLRegisterNode(address = AddressSet(c.rAddress, c.rSize-1), device = device, beatBytes = w)
|
||||||
|
val intnode = IntSourceNode(IntSourcePortSimple(resources = device.int))
|
||||||
}
|
}
|
||||||
|
|
||||||
class TLSPI(w: Int, c: SPIParams)(implicit p: Parameters) extends TLSPIBase(w,c)(p) {
|
class TLSPI(w: Int, c: SPIParams)(implicit p: Parameters) extends TLSPIBase(w,c)(p) {
|
||||||
|
@ -260,6 +260,6 @@ trait HasUARTTopModuleContents extends Module with HasUARTParameters with HasReg
|
|||||||
|
|
||||||
// Magic TL2 Incantation to create a TL2 UART
|
// Magic TL2 Incantation to create a TL2 UART
|
||||||
class TLUART(w: Int, c: UARTParams)(implicit p: Parameters)
|
class TLUART(w: Int, c: UARTParams)(implicit p: Parameters)
|
||||||
extends TLRegisterRouter(c.address, interrupts = 1, beatBytes = w)(
|
extends TLRegisterRouter(c.address, "serial", Seq("sifive,uart0"), interrupts = 1, beatBytes = w)(
|
||||||
new TLRegBundle(c, _) with HasUARTTopBundleContents)(
|
new TLRegBundle(c, _) with HasUARTTopBundleContents)(
|
||||||
new TLRegModule(c, _, _) with HasUARTTopModuleContents)
|
new TLRegModule(c, _, _) with HasUARTTopModuleContents)
|
||||||
|
@ -26,10 +26,12 @@ class XilinxVC707MIGIO extends Bundle with VC707MIGUnidirectionalIODDR
|
|||||||
}
|
}
|
||||||
|
|
||||||
class XilinxVC707MIG(implicit p: Parameters) extends LazyModule with HasXilinxVC707MIGParameters {
|
class XilinxVC707MIG(implicit p: Parameters) extends LazyModule with HasXilinxVC707MIGParameters {
|
||||||
|
val device = new MemoryDevice
|
||||||
val node = TLInputNode()
|
val node = TLInputNode()
|
||||||
val axi4 = AXI4InternalOutputNode(Seq(AXI4SlavePortParameters(
|
val axi4 = AXI4InternalOutputNode(Seq(AXI4SlavePortParameters(
|
||||||
slaves = Seq(AXI4SlaveParameters(
|
slaves = Seq(AXI4SlaveParameters(
|
||||||
address = Seq(AddressSet(p(ExtMem).base, p(ExtMem).size-1)),
|
address = Seq(AddressSet(p(ExtMem).base, p(ExtMem).size-1)),
|
||||||
|
resources = device.reg,
|
||||||
regionType = RegionType.UNCACHED,
|
regionType = RegionType.UNCACHED,
|
||||||
executable = true,
|
executable = true,
|
||||||
supportsWrite = TransferSizes(1, 256*8),
|
supportsWrite = TransferSizes(1, 256*8),
|
||||||
|
@ -23,12 +23,13 @@ class XilinxVC707PCIeX1(implicit p: Parameters) extends LazyModule {
|
|||||||
val slave = TLInputNode()
|
val slave = TLInputNode()
|
||||||
val control = TLInputNode()
|
val control = TLInputNode()
|
||||||
val master = TLOutputNode()
|
val master = TLOutputNode()
|
||||||
val intnode = IntSourceNode(1)
|
val intnode = IntOutputNode()
|
||||||
|
|
||||||
val axi_to_pcie_x1 = LazyModule(new VC707AXIToPCIeX1)
|
val axi_to_pcie_x1 = LazyModule(new VC707AXIToPCIeX1)
|
||||||
axi_to_pcie_x1.slave := AXI4Buffer()(TLToAXI4(idBits=4)(slave))
|
axi_to_pcie_x1.slave := AXI4Buffer()(TLToAXI4(idBits=4)(slave))
|
||||||
axi_to_pcie_x1.control := AXI4Buffer()(AXI4Fragmenter(lite=true, maxInFlight=4)(TLToAXI4(idBits=0)(control)))
|
axi_to_pcie_x1.control := AXI4Buffer()(AXI4Fragmenter(lite=true, maxInFlight=4)(TLToAXI4(idBits=0)(control)))
|
||||||
master := TLWidthWidget(8)(AXI4ToTL()(AXI4Fragmenter()(axi_to_pcie_x1.master)))
|
master := TLWidthWidget(8)(AXI4ToTL()(AXI4Fragmenter()(axi_to_pcie_x1.master)))
|
||||||
|
intnode := axi_to_pcie_x1.intnode
|
||||||
|
|
||||||
lazy val module = new LazyModuleImp(this) {
|
lazy val module = new LazyModuleImp(this) {
|
||||||
val io = new Bundle {
|
val io = new Bundle {
|
||||||
@ -40,7 +41,6 @@ class XilinxVC707PCIeX1(implicit p: Parameters) extends LazyModule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
io.port <> axi_to_pcie_x1.module.io.port
|
io.port <> axi_to_pcie_x1.module.io.port
|
||||||
io.interrupt(0)(0) := axi_to_pcie_x1.module.io.interrupt_out
|
|
||||||
|
|
||||||
//PCIe Reference Clock
|
//PCIe Reference Clock
|
||||||
val ibufds_gte2 = Module(new IBUFDS_GTE2)
|
val ibufds_gte2 = Module(new IBUFDS_GTE2)
|
||||||
|
@ -5,6 +5,7 @@ import Chisel._
|
|||||||
import config._
|
import config._
|
||||||
import diplomacy._
|
import diplomacy._
|
||||||
import uncore.axi4._
|
import uncore.axi4._
|
||||||
|
import uncore.tilelink2.{IntSourceNode, IntSourcePortSimple}
|
||||||
import junctions._
|
import junctions._
|
||||||
|
|
||||||
// IP VLNV: xilinx.com:customize_ip:vc707pcietoaxi:1.0
|
// IP VLNV: xilinx.com:customize_ip:vc707pcietoaxi:1.0
|
||||||
@ -167,9 +168,33 @@ class vc707axi_to_pcie_x1() extends BlackBox
|
|||||||
|
|
||||||
class VC707AXIToPCIeX1(implicit p:Parameters) extends LazyModule
|
class VC707AXIToPCIeX1(implicit p:Parameters) extends LazyModule
|
||||||
{
|
{
|
||||||
|
val device = new SimpleDevice("pci", Seq("xlnx,axi-pcie-host-1.00.a")) {
|
||||||
|
override def describe(resources: ResourceBindings): Description = {
|
||||||
|
val Description(name, mapping) = super.describe(resources)
|
||||||
|
val intc = "pcie_intc"
|
||||||
|
def ofInt(x: Int) = Seq(ResourceInt(BigInt(x)))
|
||||||
|
def ofMap(x: Int) = Seq(0, 0, 0, x).flatMap(ofInt) ++ Seq(ResourceReference(intc)) ++ ofInt(x)
|
||||||
|
val extra = Map(
|
||||||
|
"#address-cells" -> ofInt(3),
|
||||||
|
"#size-cells" -> ofInt(2),
|
||||||
|
"#interrupt-cells" -> ofInt(1),
|
||||||
|
"device_type" -> Seq(ResourceString("pci")),
|
||||||
|
"interrupt-map-mask" -> Seq(0, 0, 0, 7).flatMap(ofInt),
|
||||||
|
"interrupt-map" -> Seq(1, 2, 3, 4).flatMap(ofMap),
|
||||||
|
"ranges" -> resources("ranges").map { case Binding(_, ResourceAddress(address, _, _, _)) =>
|
||||||
|
ResourceMapping(address, 0) },
|
||||||
|
"interrupt-controller" -> Seq(ResourceMap(labels = Seq(intc), value = Map(
|
||||||
|
"interrupt-controller" -> Nil,
|
||||||
|
"#address-cells" -> ofInt(0),
|
||||||
|
"#interrupt-cells" -> ofInt(1)))))
|
||||||
|
Description(name, mapping ++ extra)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val slave = AXI4SlaveNode(Seq(AXI4SlavePortParameters(
|
val slave = AXI4SlaveNode(Seq(AXI4SlavePortParameters(
|
||||||
slaves = Seq(AXI4SlaveParameters(
|
slaves = Seq(AXI4SlaveParameters(
|
||||||
address = List(AddressSet(0x60000000L, 0x1fffffffL)),
|
address = List(AddressSet(0x60000000L, 0x1fffffffL)),
|
||||||
|
resources = Seq(Resource(device, "ranges")),
|
||||||
executable = true,
|
executable = true,
|
||||||
supportsWrite = TransferSizes(1, 256),
|
supportsWrite = TransferSizes(1, 256),
|
||||||
supportsRead = TransferSizes(1, 256),
|
supportsRead = TransferSizes(1, 256),
|
||||||
@ -179,6 +204,7 @@ class VC707AXIToPCIeX1(implicit p:Parameters) extends LazyModule
|
|||||||
val control = AXI4SlaveNode(Seq(AXI4SlavePortParameters(
|
val control = AXI4SlaveNode(Seq(AXI4SlavePortParameters(
|
||||||
slaves = Seq(AXI4SlaveParameters(
|
slaves = Seq(AXI4SlaveParameters(
|
||||||
address = List(AddressSet(0x50000000L, 0x03ffffffL)),
|
address = List(AddressSet(0x50000000L, 0x03ffffffL)),
|
||||||
|
resources = device.reg,
|
||||||
supportsWrite = TransferSizes(1, 4),
|
supportsWrite = TransferSizes(1, 4),
|
||||||
supportsRead = TransferSizes(1, 4),
|
supportsRead = TransferSizes(1, 4),
|
||||||
interleavedId = Some(0))), // no read interleaving b/c AXI-lite
|
interleavedId = Some(0))), // no read interleaving b/c AXI-lite
|
||||||
@ -189,6 +215,8 @@ class VC707AXIToPCIeX1(implicit p:Parameters) extends LazyModule
|
|||||||
id = IdRange(0, 1),
|
id = IdRange(0, 1),
|
||||||
aligned = false)))))
|
aligned = false)))))
|
||||||
|
|
||||||
|
val intnode = IntSourceNode(IntSourcePortSimple(resources = device.int))
|
||||||
|
|
||||||
lazy val module = new LazyModuleImp(this) {
|
lazy val module = new LazyModuleImp(this) {
|
||||||
// The master on the control port must be AXI-lite
|
// The master on the control port must be AXI-lite
|
||||||
require (control.edgesIn(0).master.endId == 1)
|
require (control.edgesIn(0).master.endId == 1)
|
||||||
@ -204,7 +232,7 @@ class VC707AXIToPCIeX1(implicit p:Parameters) extends LazyModule
|
|||||||
val control_in = control.bundleIn
|
val control_in = control.bundleIn
|
||||||
val master_out = master.bundleOut
|
val master_out = master.bundleOut
|
||||||
val REFCLK = Bool(INPUT)
|
val REFCLK = Bool(INPUT)
|
||||||
val interrupt_out = Bool(OUTPUT)
|
val interrupt_out = intnode.bundleOut
|
||||||
}
|
}
|
||||||
|
|
||||||
val blackbox = Module(new vc707axi_to_pcie_x1)
|
val blackbox = Module(new vc707axi_to_pcie_x1)
|
||||||
@ -222,7 +250,7 @@ class VC707AXIToPCIeX1(implicit p:Parameters) extends LazyModule
|
|||||||
io.port.pci_exp_txn := blackbox.io.pci_exp_txn
|
io.port.pci_exp_txn := blackbox.io.pci_exp_txn
|
||||||
blackbox.io.pci_exp_rxp := io.port.pci_exp_rxp
|
blackbox.io.pci_exp_rxp := io.port.pci_exp_rxp
|
||||||
blackbox.io.pci_exp_rxn := io.port.pci_exp_rxn
|
blackbox.io.pci_exp_rxn := io.port.pci_exp_rxn
|
||||||
io.interrupt_out := blackbox.io.interrupt_out
|
io.interrupt_out(0)(0) := blackbox.io.interrupt_out
|
||||||
blackbox.io.REFCLK := io.REFCLK
|
blackbox.io.REFCLK := io.REFCLK
|
||||||
|
|
||||||
//s
|
//s
|
||||||
|
Loading…
Reference in New Issue
Block a user