[an error occurred while processing this directive]
|
module One_Counters (BD , O);
parameter CODE_LENGTH = 3;
parameter BUS_LENGTH = 8;
`define BusType [BUS_LENGTH-1:0]
`define CodeType [CODE_LENGTH :0]
input `BusType BD;
output `CodeType O;
function `CodeType one_amount;
input `BusType T;
reg `CodeType C;
integer i;
begin
C=0;
for (i=0; i <= (BUS_LENGTH-1); i = i+1) if (T[i]==1) C=C + 1;
one_amount=C;
end
endfunction // one_amountassign O=one_amount(BD);assign O=one_amount(BD);
endmodule // One_Counters
E-mail: info@telesys.ru