neha_agarwal2k3
Junior Member level 2
I have got to convert the following matlab code to verilog code as a part of my project work ..Some one plz help me....
/*This function takes in 500X500matrix as parameter and checks for each of the element for zero .If a non zero value is present ,it maintains a count of number of such values as well as maintains a summation of the position(row &column Value )
of all such elements*/
function npos=nposn(c)
c=double(c);
c=c-1;
countx=0;
county=0;
countpos=0;
for(i=1:500)
for(j=1:500)
if(c(i,j)~=0)
countx=countx+i-1;
county=county+j-1;
countpos=countpos+1;
end
end
end
posx=countx/countpos;
posy=county/countpos;
npos=[posx posy];
/*This function takes in 500X500matrix as parameter and checks for each of the element for zero .If a non zero value is present ,it maintains a count of number of such values as well as maintains a summation of the position(row &column Value )
of all such elements*/
function npos=nposn(c)
c=double(c);
c=c-1;
countx=0;
county=0;
countpos=0;
for(i=1:500)
for(j=1:500)
if(c(i,j)~=0)
countx=countx+i-1;
county=county+j-1;
countpos=countpos+1;
end
end
end
posx=countx/countpos;
posy=county/countpos;
npos=[posx posy];