ApbInterface constructor
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
]);
}