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([
Logic.port('PCLK'),
Logic.port('PRESETn'),
], [
ApbDirection.misc
]);
setPorts([
Logic.port('PADDR', addrWidth),
Logic.port('PPROT', 3),
Logic.port('PNSE'),
Logic.port('PENABLE'),
Logic.port('PWRITE'),
Logic.port('PWDATA', dataWidth),
Logic.port('PSTRB', dataWidth ~/ 8),
if (userReqWidth != 0) Logic.port('PAUSER', userReqWidth),
if (userDataWidth != 0) Logic.port('PWUSER', userDataWidth),
], [
ApbDirection.fromRequester,
ApbDirection.fromRequesterExceptSelect,
]);
setPorts([
for (var i = 0; i < numSelects; i++) Logic.port('PSEL$i'),
], [
ApbDirection.fromRequester,
]);
setPorts([
Logic.port('PREADY'),
Logic.port('PRDATA', dataWidth),
if (includeSlvErr) Logic.port('PSLVERR'),
Logic.port('PWAKEUP'),
if (userDataWidth != 0) Logic.port('PRUSER', userDataWidth),
if (userRespWidth != 0) Logic.port('PBUSER', userRespWidth),
], [
ApbDirection.fromCompleter
]);
}