ApbInterface constructor

ApbInterface({
  1. int addrWidth = 32,
  2. int dataWidth = 32,
  3. int userReqWidth = 0,
  4. int userDataWidth = 0,
  5. int userRespWidth = 0,
  6. bool includeSlvErr = false,
  7. bool includeWakeup = false,
  8. int numSelects = 1,
})

Construct a new instance of an APB interface.

Implementation

ApbInterface({
  this.addrWidth = 32,
  this.dataWidth = 32,
  this.userReqWidth = 0,
  this.userDataWidth = 0,
  this.userRespWidth = 0,
  this.includeSlvErr = false,
  this.includeWakeup = false,
  this.numSelects = 1,
}) {
  _validateParameters();

  setPorts([
    Port('PCLK'),
    Port('PRESETn'),
  ], [
    ApbDirection.misc
  ]);

  setPorts([
    Port('PADDR', addrWidth),
    Port('PPROT', 3),
    Port('PNSE'),
    Port('PENABLE'),
    Port('PWRITE'),
    Port('PWDATA', dataWidth),
    Port('PSTRB', dataWidth ~/ 8),
    if (userReqWidth != 0) Port('PAUSER', userReqWidth),
    if (userDataWidth != 0) Port('PWUSER', userDataWidth),
  ], [
    ApbDirection.fromRequester,
    ApbDirection.fromRequesterExceptSelect,
  ]);

  setPorts([
    for (var i = 0; i < numSelects; i++) Port('PSEL$i'),
  ], [
    ApbDirection.fromRequester,
  ]);

  setPorts([
    Port('PREADY'),
    Port('PRDATA', dataWidth),
    if (includeSlvErr) Port('PSLVERR'),
    Port('PWAKEUP'),
    if (userDataWidth != 0) Port('PRUSER', userDataWidth),
    if (userRespWidth != 0) Port('PBUSER', userRespWidth),
  ], [
    ApbDirection.fromCompleter
  ]);
}