Initial commit for fpga-shells
This commit is contained in:
244
src/main/scala/ip/xilinx/Xilinx.scala
Normal file
244
src/main/scala/ip/xilinx/Xilinx.scala
Normal file
@ -0,0 +1,244 @@
|
||||
// See LICENSE for license details.
|
||||
package sifive.fpgashells.ip.xilinx
|
||||
|
||||
import Chisel._
|
||||
import chisel3.core.{Input, Output, attach}
|
||||
import chisel3.experimental.{Analog}
|
||||
|
||||
import sifive.blocks.devices.pinctrl.{BasePin}
|
||||
|
||||
//========================================================================
|
||||
// This file contains common devices used by our Xilinx FPGA flows and some
|
||||
// BlackBox modules used in the Xilinx FPGA flows
|
||||
//========================================================================
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// IBUFDS
|
||||
//-------------------------------------------------------------------------
|
||||
//IP : xilinx unisim IBUFDS. SelectIO Differential Signaling Input
|
||||
// Buffer unparameterized
|
||||
|
||||
class IBUFDS extends BlackBox {
|
||||
val io = new Bundle {
|
||||
val O = Bool(OUTPUT)
|
||||
val I = Bool(INPUT)
|
||||
val IB = Bool(INPUT)
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// IBUFG
|
||||
//-------------------------------------------------------------------------
|
||||
/** IBUFG -- Clock Input Buffer */
|
||||
|
||||
class IBUFG extends BlackBox {
|
||||
val io = new Bundle {
|
||||
val O = Output(Clock())
|
||||
val I = Input(Clock())
|
||||
}
|
||||
}
|
||||
|
||||
object IBUFG {
|
||||
def apply (pin: Clock): Clock = {
|
||||
val pad = Module (new IBUFG())
|
||||
pad.io.I := pin
|
||||
pad.io.O
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// IOBUF
|
||||
//-------------------------------------------------------------------------
|
||||
/** IOBUF -- Bidirectional IO Buffer. */
|
||||
|
||||
class IOBUF extends BlackBox {
|
||||
val io = new Bundle {
|
||||
val O = Output(Bool())
|
||||
val IO = Analog(1.W)
|
||||
val I = Input(Bool())
|
||||
val T = Input(Bool())
|
||||
}
|
||||
}
|
||||
|
||||
object IOBUF {
|
||||
def apply (pin: Analog, ctrl: BasePin): Bool = {
|
||||
val pad = Module(new IOBUF())
|
||||
pad.io.I := ctrl.o.oval
|
||||
pad.io.T := ~ctrl.o.oe
|
||||
ctrl.i.ival := pad.io.O & ctrl.o.ie
|
||||
attach(pad.io.IO, pin)
|
||||
pad.io.O & ctrl.o.ie
|
||||
}
|
||||
|
||||
// Creates an output IOBUF
|
||||
def apply (pin: Analog, in: Bool): Unit = {
|
||||
val pad = Module(new IOBUF())
|
||||
pad.io.I := in
|
||||
pad.io.T := false.B
|
||||
attach(pad.io.IO, pin)
|
||||
}
|
||||
|
||||
// Creates an input IOBUF
|
||||
def apply (pin: Analog): Bool = {
|
||||
val pad = Module(new IOBUF())
|
||||
pad.io.I := false.B
|
||||
pad.io.T := true.B
|
||||
attach(pad.io.IO, pin)
|
||||
pad.io.O
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// PULLUP
|
||||
//-------------------------------------------------------------------------
|
||||
/** PULLUP : can be applied to Input to add a Pullup. */
|
||||
|
||||
class PULLUP extends BlackBox {
|
||||
val io = new Bundle {
|
||||
val O = Analog(1.W)
|
||||
}
|
||||
}
|
||||
|
||||
object PULLUP {
|
||||
def apply (pin: Analog): Unit = {
|
||||
val pullup = Module(new PULLUP())
|
||||
attach(pullup.io.O, pin)
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// mmcm
|
||||
//-------------------------------------------------------------------------
|
||||
/** mmcm: This is generated by the Xilinx IP Generation Scripts */
|
||||
|
||||
class mmcm extends BlackBox {
|
||||
val io = new Bundle {
|
||||
val clk_in1 = Input(Clock())
|
||||
val clk_out1 = Output(Clock())
|
||||
val clk_out2 = Output(Clock())
|
||||
val clk_out3 = Output(Clock())
|
||||
val resetn = Input(Bool())
|
||||
val locked = Output(Bool())
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// reset_sys
|
||||
//-------------------------------------------------------------------------
|
||||
/** reset_sys: This is generated by the Xilinx IP Generation Scripts */
|
||||
|
||||
class reset_sys extends BlackBox {
|
||||
val io = new Bundle {
|
||||
val slowest_sync_clk = Input(Clock())
|
||||
val ext_reset_in = Input(Bool())
|
||||
val aux_reset_in = Input(Bool())
|
||||
val mb_debug_sys_rst = Input(Bool())
|
||||
val dcm_locked = Input(Bool())
|
||||
val mb_reset = Output(Bool())
|
||||
val bus_struct_reset = Output(Bool())
|
||||
val peripheral_reset = Output(Bool())
|
||||
val interconnect_aresetn = Output(Bool())
|
||||
val peripheral_aresetn = Output(Bool())
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// reset_mig
|
||||
//-------------------------------------------------------------------------
|
||||
/** reset_mig: This is generated by the Xilinx IP Generation Scripts */
|
||||
|
||||
class reset_mig extends BlackBox {
|
||||
val io = new Bundle {
|
||||
val slowest_sync_clk = Input(Clock())
|
||||
val ext_reset_in = Input(Bool())
|
||||
val aux_reset_in = Input(Bool())
|
||||
val mb_debug_sys_rst = Input(Bool())
|
||||
val dcm_locked = Input(Bool())
|
||||
val mb_reset = Output(Bool())
|
||||
val bus_struct_reset = Output(Bool())
|
||||
val peripheral_reset = Output(Bool())
|
||||
val interconnect_aresetn = Output(Bool())
|
||||
val peripheral_aresetn = Output(Bool())
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// PowerOnResetFPGAOnly
|
||||
//-------------------------------------------------------------------------
|
||||
/** PowerOnResetFPGAOnly -- this generates a power_on_reset signal using
|
||||
* initial blocks. It is synthesizable on FPGA flows only.
|
||||
*/
|
||||
|
||||
// This is a FPGA-Only construct, which uses
|
||||
// 'initial' constructions
|
||||
class PowerOnResetFPGAOnly extends BlackBox {
|
||||
val io = new Bundle {
|
||||
val clock = Input(Clock())
|
||||
val power_on_reset = Output(Bool())
|
||||
}
|
||||
}
|
||||
|
||||
object PowerOnResetFPGAOnly {
|
||||
def apply (clk: Clock): Bool = {
|
||||
val por = Module(new PowerOnResetFPGAOnly())
|
||||
por.io.clock := clk
|
||||
por.io.power_on_reset
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// vc707clk_wiz_sync
|
||||
//-------------------------------------------------------------------------
|
||||
//IP : xilinx mmcm with "NO_BUFFER" input clock
|
||||
|
||||
class vc707clk_wiz_sync extends BlackBox {
|
||||
val io = new Bundle {
|
||||
val clk_in1 = Bool(INPUT)
|
||||
val clk_out1 = Clock(OUTPUT)
|
||||
val clk_out2 = Clock(OUTPUT)
|
||||
val clk_out3 = Clock(OUTPUT)
|
||||
val clk_out4 = Clock(OUTPUT)
|
||||
val clk_out5 = Clock(OUTPUT)
|
||||
val clk_out6 = Clock(OUTPUT)
|
||||
val clk_out7 = Clock(OUTPUT)
|
||||
val reset = Bool(INPUT)
|
||||
val locked = Bool(OUTPUT)
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// vc707reset
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
class vc707reset() extends BlackBox
|
||||
{
|
||||
val io = new Bundle{
|
||||
val areset = Bool(INPUT)
|
||||
val clock1 = Clock(INPUT)
|
||||
val reset1 = Bool(OUTPUT)
|
||||
val clock2 = Clock(INPUT)
|
||||
val reset2 = Bool(OUTPUT)
|
||||
val clock3 = Clock(INPUT)
|
||||
val reset3 = Bool(OUTPUT)
|
||||
val clock4 = Clock(INPUT)
|
||||
val reset4 = Bool(OUTPUT)
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// sdio_spi_bridge
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
class sdio_spi_bridge() extends BlackBox
|
||||
{
|
||||
val io = new Bundle{
|
||||
val clk = Clock(INPUT)
|
||||
val reset = Bool(INPUT)
|
||||
val sd_cmd = Analog(1.W)
|
||||
val sd_dat = Analog(4.W)
|
||||
val spi_sck = Bool(INPUT)
|
||||
val spi_cs = Bool(INPUT)
|
||||
val spi_dq_o = Bits(INPUT,4)
|
||||
val spi_dq_i = Bits(OUTPUT,4)
|
||||
}
|
||||
}
|
18
src/main/scala/ip/xilinx/ibufds_gte2/ibufds_gte2.scala
Normal file
18
src/main/scala/ip/xilinx/ibufds_gte2/ibufds_gte2.scala
Normal file
@ -0,0 +1,18 @@
|
||||
// See LICENSE for license details.
|
||||
package sifive.fpgashells.ip.xilinx.ibufds_gte2
|
||||
|
||||
import Chisel._
|
||||
|
||||
//IP : xilinx unisim IBUFDS_GTE2
|
||||
//Differential Signaling Input Buffer
|
||||
//unparameterized
|
||||
|
||||
class IBUFDS_GTE2 extends BlackBox {
|
||||
val io = new Bundle {
|
||||
val O = Bool(OUTPUT)
|
||||
val ODIV2 = Bool(OUTPUT)
|
||||
val CEB = Bool(INPUT)
|
||||
val I = Bool(INPUT)
|
||||
val IB = Bool(INPUT)
|
||||
}
|
||||
}
|
@ -0,0 +1,401 @@
|
||||
// See LICENSE for license details.
|
||||
package sifive.fpgashells.ip.xilinx.vc707axi_to_pcie_x1
|
||||
|
||||
import Chisel._
|
||||
import freechips.rocketchip.config._
|
||||
import freechips.rocketchip.diplomacy._
|
||||
import freechips.rocketchip.amba.axi4._
|
||||
import freechips.rocketchip.tilelink.{IntSourceNode, IntSourcePortSimple}
|
||||
|
||||
// IP VLNV: xilinx.com:customize_ip:vc707pcietoaxi:1.0
|
||||
// Black Box
|
||||
// Signals named _exactly_ as per Vivado generated verilog
|
||||
// s : -{lock, cache, prot, qos}
|
||||
|
||||
trait VC707AXIToPCIeX1IOSerial extends Bundle {
|
||||
//serial external pins
|
||||
val pci_exp_txp = Bool(OUTPUT)
|
||||
val pci_exp_txn = Bool(OUTPUT)
|
||||
val pci_exp_rxp = Bool(INPUT)
|
||||
val pci_exp_rxn = Bool(INPUT)
|
||||
}
|
||||
|
||||
trait VC707AXIToPCIeX1IOClocksReset extends Bundle {
|
||||
//clock, reset, control
|
||||
val axi_aresetn = Bool(INPUT)
|
||||
val axi_aclk_out = Clock(OUTPUT)
|
||||
val axi_ctl_aclk_out = Clock(OUTPUT)
|
||||
val mmcm_lock = Bool(OUTPUT)
|
||||
}
|
||||
|
||||
//scalastyle:off
|
||||
//turn off linter: blackbox name must match verilog module
|
||||
class vc707axi_to_pcie_x1() extends BlackBox
|
||||
{
|
||||
val io = new Bundle with VC707AXIToPCIeX1IOSerial
|
||||
with VC707AXIToPCIeX1IOClocksReset {
|
||||
//refclk
|
||||
val REFCLK = Bool(INPUT)
|
||||
|
||||
//clock, reset, control
|
||||
val INTX_MSI_Request = Bool(INPUT)
|
||||
val INTX_MSI_Grant = Bool(OUTPUT)
|
||||
val MSI_enable = Bool(OUTPUT)
|
||||
val MSI_Vector_Num = Bits(INPUT,5)
|
||||
val MSI_Vector_Width = Bits(OUTPUT,3)
|
||||
|
||||
//interrupt
|
||||
val interrupt_out = Bool(OUTPUT)
|
||||
|
||||
//axi slave
|
||||
//-{lock, cache, prot, qos}
|
||||
//slave interface write address
|
||||
val s_axi_awid = Bits(INPUT,4)
|
||||
val s_axi_awaddr = Bits(INPUT,32)
|
||||
val s_axi_awregion = Bits(INPUT,4)
|
||||
val s_axi_awlen = Bits(INPUT,8)
|
||||
val s_axi_awsize = Bits(INPUT,3)
|
||||
val s_axi_awburst = Bits(INPUT,2)
|
||||
//val s_axi_awlock = Bool(INPUT)
|
||||
//val s_axi_awcache = Bits(INPUT,4)
|
||||
//val s_axi_awprot = Bits(INPUT,3)
|
||||
//val s_axi_awqos = Bits(INPUT,4)
|
||||
val s_axi_awvalid = Bool(INPUT)
|
||||
val s_axi_awready = Bool(OUTPUT)
|
||||
//slave interface write data
|
||||
val s_axi_wdata = Bits(INPUT,64)
|
||||
val s_axi_wstrb = Bits(INPUT,8)
|
||||
val s_axi_wlast = Bool(INPUT)
|
||||
val s_axi_wvalid = Bool(INPUT)
|
||||
val s_axi_wready = Bool(OUTPUT)
|
||||
//slave interface write response
|
||||
val s_axi_bready = Bool(INPUT)
|
||||
val s_axi_bid = Bits(OUTPUT,4)
|
||||
val s_axi_bresp = Bits(OUTPUT,2)
|
||||
val s_axi_bvalid = Bool(OUTPUT)
|
||||
//slave interface read address
|
||||
val s_axi_arid = Bits(INPUT,4)
|
||||
val s_axi_araddr = Bits(INPUT,32)
|
||||
val s_axi_arregion = Bits(INPUT,4)
|
||||
val s_axi_arlen = Bits(INPUT,8)
|
||||
val s_axi_arsize = Bits(INPUT,3)
|
||||
val s_axi_arburst = Bits(INPUT,2)
|
||||
//val s_axi_arlock = Bits(INPUT,1)
|
||||
//val s_axi_arcache = Bits(INPUT,4)
|
||||
//val s_axi_arprot = Bits(INPUT,3)
|
||||
//val s_axi_arqos = Bits(INPUT,4)
|
||||
val s_axi_arvalid = Bool(INPUT)
|
||||
val s_axi_arready = Bool(OUTPUT)
|
||||
//slave interface read data
|
||||
val s_axi_rready = Bool(INPUT)
|
||||
val s_axi_rid = Bits(OUTPUT,4)
|
||||
val s_axi_rdata = Bits(OUTPUT,64)
|
||||
val s_axi_rresp = Bits(OUTPUT,2)
|
||||
val s_axi_rlast = Bool(OUTPUT)
|
||||
val s_axi_rvalid = Bool(OUTPUT)
|
||||
|
||||
//axi master
|
||||
//-{id,region,qos}
|
||||
//slave interface write address ports
|
||||
//val m_axi_awid = Bits(OUTPUT,4)
|
||||
val m_axi_awaddr = Bits(OUTPUT,32)
|
||||
//val m_axi_awregion = Bits(OUTPUT,4)
|
||||
val m_axi_awlen = Bits(OUTPUT,8)
|
||||
val m_axi_awsize = Bits(OUTPUT,3)
|
||||
val m_axi_awburst = Bits(OUTPUT,2)
|
||||
val m_axi_awlock = Bool(OUTPUT)
|
||||
val m_axi_awcache = Bits(OUTPUT,4)
|
||||
val m_axi_awprot = Bits(OUTPUT,3)
|
||||
//val m_axi_awqos = Bits(OUTPUT,4)
|
||||
val m_axi_awvalid = Bool(OUTPUT)
|
||||
val m_axi_awready = Bool(INPUT)
|
||||
//slave interface write data ports
|
||||
val m_axi_wdata = Bits(OUTPUT,64)
|
||||
val m_axi_wstrb = Bits(OUTPUT,8)
|
||||
val m_axi_wlast = Bool(OUTPUT)
|
||||
val m_axi_wvalid = Bool(OUTPUT)
|
||||
val m_axi_wready = Bool(INPUT)
|
||||
//slave interface write response ports
|
||||
val m_axi_bready = Bool(OUTPUT)
|
||||
//val m_axi_bid = Bits(INPUT,4)
|
||||
val m_axi_bresp = Bits(INPUT,2)
|
||||
val m_axi_bvalid = Bool(INPUT)
|
||||
//slave interface read address ports
|
||||
//val m_axi_arid = Bits(OUTPUT,4)
|
||||
val m_axi_araddr = Bits(OUTPUT,32)
|
||||
//val m_axi_arregion = Bits(OUTPUT,4)
|
||||
val m_axi_arlen = Bits(OUTPUT,8)
|
||||
val m_axi_arsize = Bits(OUTPUT,3)
|
||||
val m_axi_arburst = Bits(OUTPUT,2)
|
||||
val m_axi_arlock = Bits(OUTPUT,1)
|
||||
val m_axi_arcache = Bits(OUTPUT,4)
|
||||
val m_axi_arprot = Bits(OUTPUT,3)
|
||||
//val m_axi_arqos = Bits(OUTPUT,4)
|
||||
val m_axi_arvalid = Bool(OUTPUT)
|
||||
val m_axi_arready = Bool(INPUT)
|
||||
//slave interface read data ports
|
||||
val m_axi_rready = Bool(OUTPUT)
|
||||
//val m_axi_rid = Bits(INPUT,4)
|
||||
val m_axi_rdata = Bits(INPUT,64)
|
||||
val m_axi_rresp = Bits(INPUT,2)
|
||||
val m_axi_rlast = Bool(INPUT)
|
||||
val m_axi_rvalid = Bool(INPUT)
|
||||
|
||||
//axi lite slave for control
|
||||
val s_axi_ctl_awaddr = Bits(INPUT,32)
|
||||
val s_axi_ctl_awvalid = Bool(INPUT)
|
||||
val s_axi_ctl_awready = Bool(OUTPUT)
|
||||
val s_axi_ctl_wdata = Bits(INPUT,32)
|
||||
val s_axi_ctl_wstrb = Bits(INPUT,4)
|
||||
val s_axi_ctl_wvalid = Bool(INPUT)
|
||||
val s_axi_ctl_wready = Bool(OUTPUT)
|
||||
val s_axi_ctl_bresp = Bits(OUTPUT,2)
|
||||
val s_axi_ctl_bvalid = Bool(OUTPUT)
|
||||
val s_axi_ctl_bready = Bool(INPUT)
|
||||
val s_axi_ctl_araddr = Bits(INPUT,32)
|
||||
val s_axi_ctl_arvalid = Bool(INPUT)
|
||||
val s_axi_ctl_arready = Bool(OUTPUT)
|
||||
val s_axi_ctl_rdata = Bits(OUTPUT,32)
|
||||
val s_axi_ctl_rresp = Bits(OUTPUT,2)
|
||||
val s_axi_ctl_rvalid = Bool(OUTPUT)
|
||||
val s_axi_ctl_rready = Bool(INPUT)
|
||||
}
|
||||
}
|
||||
//scalastyle:off
|
||||
|
||||
//wrap vc707_axi_to_pcie_x1 black box in Nasti Bundles
|
||||
|
||||
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, perms)) =>
|
||||
ResourceMapping(address, BigInt(0x02000000) << 64, perms) },
|
||||
"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(
|
||||
slaves = Seq(AXI4SlaveParameters(
|
||||
address = List(AddressSet(0x60000000L, 0x1fffffffL)),
|
||||
resources = Seq(Resource(device, "ranges")),
|
||||
executable = true,
|
||||
supportsWrite = TransferSizes(1, 256),
|
||||
supportsRead = TransferSizes(1, 256))),
|
||||
beatBytes = 8)))
|
||||
|
||||
val control = AXI4SlaveNode(Seq(AXI4SlavePortParameters(
|
||||
slaves = Seq(AXI4SlaveParameters(
|
||||
address = List(AddressSet(0x50000000L, 0x03ffffffL)),
|
||||
resources = device.reg("control"),
|
||||
supportsWrite = TransferSizes(1, 4),
|
||||
supportsRead = TransferSizes(1, 4),
|
||||
interleavedId = Some(0))), // AXI4-Lite never interleaves responses
|
||||
beatBytes = 4)))
|
||||
|
||||
val master = AXI4MasterNode(Seq(AXI4MasterPortParameters(
|
||||
masters = Seq(AXI4MasterParameters(
|
||||
name = "VC707 PCIe",
|
||||
id = IdRange(0, 1),
|
||||
aligned = false)))))
|
||||
|
||||
val intnode = IntSourceNode(IntSourcePortSimple(resources = device.int))
|
||||
|
||||
lazy val module = new LazyModuleImp(this) {
|
||||
// The master on the control port must be AXI-lite
|
||||
require (control.edgesIn(0).master.endId == 1)
|
||||
// Must have exactly the right number of idBits
|
||||
require (slave.edgesIn(0).bundle.idBits == 4)
|
||||
|
||||
class VC707AXIToPCIeX1IOBundle extends Bundle with VC707AXIToPCIeX1IOSerial
|
||||
with VC707AXIToPCIeX1IOClocksReset;
|
||||
|
||||
val io = new Bundle {
|
||||
val port = new VC707AXIToPCIeX1IOBundle
|
||||
val slave_in = slave.bundleIn
|
||||
val control_in = control.bundleIn
|
||||
val master_out = master.bundleOut
|
||||
val REFCLK = Bool(INPUT)
|
||||
val interrupt_out = intnode.bundleOut
|
||||
}
|
||||
|
||||
val blackbox = Module(new vc707axi_to_pcie_x1)
|
||||
|
||||
val s = io.slave_in(0)
|
||||
val c = io.control_in(0)
|
||||
val m = io.master_out(0)
|
||||
|
||||
//to top level
|
||||
blackbox.io.axi_aresetn := io.port.axi_aresetn
|
||||
io.port.axi_aclk_out := blackbox.io.axi_aclk_out
|
||||
io.port.axi_ctl_aclk_out := blackbox.io.axi_ctl_aclk_out
|
||||
io.port.mmcm_lock := blackbox.io.mmcm_lock
|
||||
io.port.pci_exp_txp := blackbox.io.pci_exp_txp
|
||||
io.port.pci_exp_txn := blackbox.io.pci_exp_txn
|
||||
blackbox.io.pci_exp_rxp := io.port.pci_exp_rxp
|
||||
blackbox.io.pci_exp_rxn := io.port.pci_exp_rxn
|
||||
io.interrupt_out(0)(0) := blackbox.io.interrupt_out
|
||||
blackbox.io.REFCLK := io.REFCLK
|
||||
|
||||
//s
|
||||
//AXI4 signals ordered as per AXI4 Specification (Release D) Section A.2
|
||||
//-{lock, cache, prot, qos}
|
||||
//-{aclk, aresetn, awuser, wid, wuser, buser, ruser}
|
||||
//global signals
|
||||
//aclk :=
|
||||
//aresetn :=
|
||||
//slave interface write address
|
||||
blackbox.io.s_axi_awid := s.aw.bits.id
|
||||
blackbox.io.s_axi_awaddr := s.aw.bits.addr
|
||||
blackbox.io.s_axi_awlen := s.aw.bits.len
|
||||
blackbox.io.s_axi_awsize := s.aw.bits.size
|
||||
blackbox.io.s_axi_awburst := s.aw.bits.burst
|
||||
//blackbox.io.s_axi_awlock := s.aw.bits.lock
|
||||
//blackbox.io.s_axi_awcache := s.aw.bits.cache
|
||||
//blackbox.io.s_axi_awprot := s.aw.bits.prot
|
||||
//blackbox.io.s_axi_awqos := s.aw.bits.qos
|
||||
blackbox.io.s_axi_awregion := UInt(0)
|
||||
//blackbox.io.awuser := s.aw.bits.user
|
||||
blackbox.io.s_axi_awvalid := s.aw.valid
|
||||
s.aw.ready := blackbox.io.s_axi_awready
|
||||
//slave interface write data ports
|
||||
//blackbox.io.s_axi_wid := s.w.bits.id
|
||||
blackbox.io.s_axi_wdata := s.w.bits.data
|
||||
blackbox.io.s_axi_wstrb := s.w.bits.strb
|
||||
blackbox.io.s_axi_wlast := s.w.bits.last
|
||||
//blackbox.io.s_axi_wuser := s.w.bits.user
|
||||
blackbox.io.s_axi_wvalid := s.w.valid
|
||||
s.w.ready := blackbox.io.s_axi_wready
|
||||
//slave interface write response
|
||||
s.b.bits.id := blackbox.io.s_axi_bid
|
||||
s.b.bits.resp := blackbox.io.s_axi_bresp
|
||||
//s.b.bits.user := blackbox.io.s_axi_buser
|
||||
s.b.valid := blackbox.io.s_axi_bvalid
|
||||
blackbox.io.s_axi_bready := s.b.ready
|
||||
//slave AXI interface read address ports
|
||||
blackbox.io.s_axi_arid := s.ar.bits.id
|
||||
blackbox.io.s_axi_araddr := s.ar.bits.addr
|
||||
blackbox.io.s_axi_arlen := s.ar.bits.len
|
||||
blackbox.io.s_axi_arsize := s.ar.bits.size
|
||||
blackbox.io.s_axi_arburst := s.ar.bits.burst
|
||||
//blackbox.io.s_axi_arlock := s.ar.bits.lock
|
||||
//blackbox.io.s_axi_arcache := s.ar.bits.cache
|
||||
//blackbox.io.s_axi_arprot := s.ar.bits.prot
|
||||
//blackbox.io.s_axi_arqos := s.ar.bits.qos
|
||||
blackbox.io.s_axi_arregion := UInt(0)
|
||||
//blackbox.io.s_axi_aruser := s.ar.bits.user
|
||||
blackbox.io.s_axi_arvalid := s.ar.valid
|
||||
s.ar.ready := blackbox.io.s_axi_arready
|
||||
//slave AXI interface read data ports
|
||||
s.r.bits.id := blackbox.io.s_axi_rid
|
||||
s.r.bits.data := blackbox.io.s_axi_rdata
|
||||
s.r.bits.resp := blackbox.io.s_axi_rresp
|
||||
s.r.bits.last := blackbox.io.s_axi_rlast
|
||||
//s.r.bits.ruser := blackbox.io.s_axi_ruser
|
||||
s.r.valid := blackbox.io.s_axi_rvalid
|
||||
blackbox.io.s_axi_rready := s.r.ready
|
||||
|
||||
//ctl
|
||||
//axi-lite slave interface write address
|
||||
blackbox.io.s_axi_ctl_awaddr := c.aw.bits.addr
|
||||
blackbox.io.s_axi_ctl_awvalid := c.aw.valid
|
||||
c.aw.ready := blackbox.io.s_axi_ctl_awready
|
||||
//axi-lite slave interface write data ports
|
||||
blackbox.io.s_axi_ctl_wdata := c.w.bits.data
|
||||
blackbox.io.s_axi_ctl_wstrb := c.w.bits.strb
|
||||
blackbox.io.s_axi_ctl_wvalid := c.w.valid
|
||||
c.w.ready := blackbox.io.s_axi_ctl_wready
|
||||
//axi-lite slave interface write response
|
||||
blackbox.io.s_axi_ctl_bready := c.b.ready
|
||||
c.b.bits.id := UInt(0)
|
||||
c.b.bits.resp := blackbox.io.s_axi_ctl_bresp
|
||||
c.b.valid := blackbox.io.s_axi_ctl_bvalid
|
||||
//axi-lite slave AXI interface read address ports
|
||||
blackbox.io.s_axi_ctl_araddr := c.ar.bits.addr
|
||||
blackbox.io.s_axi_ctl_arvalid := c.ar.valid
|
||||
c.ar.ready := blackbox.io.s_axi_ctl_arready
|
||||
//slave AXI interface read data ports
|
||||
blackbox.io.s_axi_ctl_rready := c.r.ready
|
||||
c.r.bits.id := UInt(0)
|
||||
c.r.bits.data := blackbox.io.s_axi_ctl_rdata
|
||||
c.r.bits.resp := blackbox.io.s_axi_ctl_rresp
|
||||
c.r.bits.last := Bool(true)
|
||||
c.r.valid := blackbox.io.s_axi_ctl_rvalid
|
||||
|
||||
//m
|
||||
//AXI4 signals ordered per AXI4 Specification (Release D) Section A.2
|
||||
//-{id,region,qos}
|
||||
//-{aclk, aresetn, awuser, wid, wuser, buser, ruser}
|
||||
//global signals
|
||||
//aclk :=
|
||||
//aresetn :=
|
||||
//master interface write address
|
||||
m.aw.bits.id := UInt(0)
|
||||
m.aw.bits.addr := blackbox.io.m_axi_awaddr
|
||||
m.aw.bits.len := blackbox.io.m_axi_awlen
|
||||
m.aw.bits.size := blackbox.io.m_axi_awsize
|
||||
m.aw.bits.burst := blackbox.io.m_axi_awburst
|
||||
m.aw.bits.lock := blackbox.io.m_axi_awlock
|
||||
m.aw.bits.cache := blackbox.io.m_axi_awcache
|
||||
m.aw.bits.prot := blackbox.io.m_axi_awprot
|
||||
m.aw.bits.qos := UInt(0)
|
||||
//m.aw.bits.region := blackbox.io.m_axi_awregion
|
||||
//m.aw.bits.user := blackbox.io.m_axi_awuser
|
||||
m.aw.valid := blackbox.io.m_axi_awvalid
|
||||
blackbox.io.m_axi_awready := m.aw.ready
|
||||
|
||||
//master interface write data ports
|
||||
m.w.bits.data := blackbox.io.m_axi_wdata
|
||||
m.w.bits.strb := blackbox.io.m_axi_wstrb
|
||||
m.w.bits.last := blackbox.io.m_axi_wlast
|
||||
//m.w.bits.user := blackbox.io.m_axi_wuser
|
||||
m.w.valid := blackbox.io.m_axi_wvalid
|
||||
blackbox.io.m_axi_wready := m.w.ready
|
||||
|
||||
//master interface write response
|
||||
//blackbox.io.m_axi_bid := m.b.bits.id
|
||||
blackbox.io.m_axi_bresp := m.b.bits.resp
|
||||
//blackbox.io.m_axi_buser := m.b.bits.user
|
||||
blackbox.io.m_axi_bvalid := m.b.valid
|
||||
m.b.ready := blackbox.io.m_axi_bready
|
||||
|
||||
//master AXI interface read address ports
|
||||
m.ar.bits.id := UInt(0)
|
||||
m.ar.bits.addr := blackbox.io.m_axi_araddr
|
||||
m.ar.bits.len := blackbox.io.m_axi_arlen
|
||||
m.ar.bits.size := blackbox.io.m_axi_arsize
|
||||
m.ar.bits.burst := blackbox.io.m_axi_arburst
|
||||
m.ar.bits.lock := blackbox.io.m_axi_arlock
|
||||
m.ar.bits.cache := blackbox.io.m_axi_arcache
|
||||
m.ar.bits.prot := blackbox.io.m_axi_arprot
|
||||
m.ar.bits.qos := UInt(0)
|
||||
//m.ar.bits.region := blackbox.io.m_axi_arregion
|
||||
//m.ar.bits.user := blackbox.io.s_axi_aruser
|
||||
m.ar.valid := blackbox.io.m_axi_arvalid
|
||||
blackbox.io.m_axi_arready := m.ar.ready
|
||||
|
||||
//master AXI interface read data ports
|
||||
//blackbox.io.m_axi_rid := m.r.bits.id
|
||||
blackbox.io.m_axi_rdata := m.r.bits.data
|
||||
blackbox.io.m_axi_rresp := m.r.bits.resp
|
||||
blackbox.io.m_axi_rlast := m.r.bits.last
|
||||
//blackbox.io.s_axi_ruser := s.bits.ruser
|
||||
blackbox.io.m_axi_rvalid := m.r.valid
|
||||
m.r.ready := blackbox.io.m_axi_rready
|
||||
}
|
||||
}
|
105
src/main/scala/ip/xilinx/vc707mig/vc707mig.scala
Normal file
105
src/main/scala/ip/xilinx/vc707mig/vc707mig.scala
Normal file
@ -0,0 +1,105 @@
|
||||
// See LICENSE for license details.
|
||||
package sifive.fpgashells.ip.xilinx.vc707mig
|
||||
|
||||
import Chisel._
|
||||
import chisel3.experimental.{Analog,attach}
|
||||
import freechips.rocketchip.config._
|
||||
|
||||
// IP VLNV: xilinx.com:customize_ip:vc707mig:1.0
|
||||
// Black Box
|
||||
|
||||
trait VC707MIGIODDR extends Bundle {
|
||||
val ddr3_addr = Bits(OUTPUT,14)
|
||||
val ddr3_ba = Bits(OUTPUT,3)
|
||||
val ddr3_ras_n = Bool(OUTPUT)
|
||||
val ddr3_cas_n = Bool(OUTPUT)
|
||||
val ddr3_we_n = Bool(OUTPUT)
|
||||
val ddr3_reset_n = Bool(OUTPUT)
|
||||
val ddr3_ck_p = Bits(OUTPUT,1)
|
||||
val ddr3_ck_n = Bits(OUTPUT,1)
|
||||
val ddr3_cke = Bits(OUTPUT,1)
|
||||
val ddr3_cs_n = Bits(OUTPUT,1)
|
||||
val ddr3_dm = Bits(OUTPUT,8)
|
||||
val ddr3_odt = Bits(OUTPUT,1)
|
||||
|
||||
val ddr3_dq = Analog(64.W)
|
||||
val ddr3_dqs_n = Analog(8.W)
|
||||
val ddr3_dqs_p = Analog(8.W)
|
||||
}
|
||||
|
||||
//reused directly in io bundle for sifive.blocks.devices.xilinxvc707mig
|
||||
trait VC707MIGIOClocksReset extends Bundle {
|
||||
//inputs
|
||||
//"NO_BUFFER" clock source (must be connected to IBUF outside of IP)
|
||||
val sys_clk_i = Bool(INPUT)
|
||||
//user interface signals
|
||||
val ui_clk = Clock(OUTPUT)
|
||||
val ui_clk_sync_rst = Bool(OUTPUT)
|
||||
val mmcm_locked = Bool(OUTPUT)
|
||||
val aresetn = Bool(INPUT)
|
||||
//misc
|
||||
val init_calib_complete = Bool(OUTPUT)
|
||||
val sys_rst = Bool(INPUT)
|
||||
}
|
||||
|
||||
//scalastyle:off
|
||||
//turn off linter: blackbox name must match verilog module
|
||||
class vc707mig(implicit val p:Parameters) extends BlackBox
|
||||
{
|
||||
val io = new Bundle with VC707MIGIODDR
|
||||
with VC707MIGIOClocksReset {
|
||||
// User interface signals
|
||||
val app_sr_req = Bool(INPUT)
|
||||
val app_ref_req = Bool(INPUT)
|
||||
val app_zq_req = Bool(INPUT)
|
||||
val app_sr_active = Bool(OUTPUT)
|
||||
val app_ref_ack = Bool(OUTPUT)
|
||||
val app_zq_ack = Bool(OUTPUT)
|
||||
//axi_s
|
||||
//slave interface write address ports
|
||||
val s_axi_awid = Bits(INPUT,4)
|
||||
val s_axi_awaddr = Bits(INPUT,30)
|
||||
val s_axi_awlen = Bits(INPUT,8)
|
||||
val s_axi_awsize = Bits(INPUT,3)
|
||||
val s_axi_awburst = Bits(INPUT,2)
|
||||
val s_axi_awlock = Bits(INPUT,1)
|
||||
val s_axi_awcache = Bits(INPUT,4)
|
||||
val s_axi_awprot = Bits(INPUT,3)
|
||||
val s_axi_awqos = Bits(INPUT,4)
|
||||
val s_axi_awvalid = Bool(INPUT)
|
||||
val s_axi_awready = Bool(OUTPUT)
|
||||
//slave interface write data ports
|
||||
val s_axi_wdata = Bits(INPUT,64)
|
||||
val s_axi_wstrb = Bits(INPUT,8)
|
||||
val s_axi_wlast = Bool(INPUT)
|
||||
val s_axi_wvalid = Bool(INPUT)
|
||||
val s_axi_wready = Bool(OUTPUT)
|
||||
//slave interface write response ports
|
||||
val s_axi_bready = Bool(INPUT)
|
||||
val s_axi_bid = Bits(OUTPUT,4)
|
||||
val s_axi_bresp = Bits(OUTPUT,2)
|
||||
val s_axi_bvalid = Bool(OUTPUT)
|
||||
//slave interface read address ports
|
||||
val s_axi_arid = Bits(INPUT,4)
|
||||
val s_axi_araddr = Bits(INPUT,30)
|
||||
val s_axi_arlen = Bits(INPUT,8)
|
||||
val s_axi_arsize = Bits(INPUT,3)
|
||||
val s_axi_arburst = Bits(INPUT,2)
|
||||
val s_axi_arlock = Bits(INPUT,1)
|
||||
val s_axi_arcache = Bits(INPUT,4)
|
||||
val s_axi_arprot = Bits(INPUT,3)
|
||||
val s_axi_arqos = Bits(INPUT,4)
|
||||
val s_axi_arvalid = Bool(INPUT)
|
||||
val s_axi_arready = Bool(OUTPUT)
|
||||
//slave interface read data ports
|
||||
val s_axi_rready = Bool(INPUT)
|
||||
val s_axi_rid = Bits(OUTPUT,4)
|
||||
val s_axi_rdata = Bits(OUTPUT,64)
|
||||
val s_axi_rresp = Bits(OUTPUT,2)
|
||||
val s_axi_rlast = Bool(OUTPUT)
|
||||
val s_axi_rvalid = Bool(OUTPUT)
|
||||
//misc
|
||||
val device_temp = Bits(OUTPUT,12)
|
||||
}
|
||||
}
|
||||
//scalastyle:on
|
Reference in New Issue
Block a user