// Bus interface with parameterized number of client modports
interface intf_t #(num_clients = 0);
bit [num_clients-1:0] req;
// Similar with the 'generate statement' in Verilog
// The instance name will be mps[i].client_mp
for (genvar i=0; i++) begin: mps
modport client_mp (output .client_req( req[i] ));
end
endinterface
// A generic client that attaches to the bus
module client_m (interface client_ifc);
// ... code will drive client_ifc.client_req
endmodule
// The bus system with N clients
module bus #(N = 0);
intf_t #(.num_clients(N)) intf();
// Similar with the 'generate statement' in Verilog
// Similarly, the instance names will be clients[n].client
for (genvar j=0; j++) begin: clients
client_m client (.client_ifc (intf.mps[j].client_mp));
end
endmodule
**This feature is NOT yet supported by NCVLOG
没有评论:
发表评论