AHB-Lite3
Configuration and instantiation
首先,每当您想要创建AHB-Lite3总线时,您都需要一个配置对象。该配置对象是一个 AhbLite3Config 并具有以下参数:
| 参数名称 | 类型 | 默认值 | 描述 | 
|---|---|---|---|
| addressWidth | Int | HADDR的位宽(字节粒度) | |
| dataWidth | Int | HWDATA和HRDATA的位宽 | 
简而言之,AHB-Lite3总线在SpinalHDL库中是如下定义的:
case class AhbLite3(config: AhbLite3Config) extends Bundle with IMasterSlave {
  //  Address and control
  val HADDR = UInt(config.addressWidth bits)
  val HSEL = Bool()
  val HREADY = Bool()
  val HWRITE = Bool()
  val HSIZE = Bits(3 bits)
  val HBURST = Bits(3 bits)
  val HPROT = Bits(4 bits)
  val HTRANS = Bits(2 bits)
  val HMASTLOCK = Bool()
  //  Data
  val HWDATA = Bits(config.dataWidth bits)
  val HRDATA = Bits(config.dataWidth bits)
  //  Transfer response
  val HREADYOUT = Bool()
  val HRESP = Bool()
  override def asMaster(): Unit = {
    out(HADDR,HWRITE,HSIZE,HBURST,HPROT,HTRANS,HMASTLOCK,HWDATA,HREADY,HSEL)
    in(HREADYOUT,HRESP,HRDATA)
  }
}
这是一个简单的使用示例:
val ahbConfig = AhbLite3Config(
  addressWidth = 12,
  dataWidth    = 32
)
val ahbX = AhbLite3(ahbConfig)
val ahbY = AhbLite3(ahbConfig)
when(ahbY.HSEL) {
  // ...
}
变体
有一个AhbLite3Master变体,唯一的区别是缺少 HREADYOUT 信号。当互连线和从端使用 AhbLite3 时,此变体只能由主端使用。