Hi...
suppose i have a binary number i= 00110001
then i want to count the different run lengths present in this number and send it to output.
so i get three run lengths for given number as 2,0,3.
then for this i have written code which is as follows:
but in this code me getting syntax correct but as i tried to check its simulation using test bench waveform i get output o as always 'XXXX'.
so plz help me to find out the error..
suppose i have a binary number i= 00110001
then i want to count the different run lengths present in this number and send it to output.
so i get three run lengths for given number as 2,0,3.
then for this i have written code which is as follows:
Rich (BB code):
module runcount(i, o);
input [7:0] i;
output [3:0]o;
reg [3:0]o;
integer count=0;
integer j;
always@(i)
begin
for(j=7;j<=0;j=j-1)
begin
if(i[j]==0)
begin
count=count+1;
end
else
begin
o=count;
count=0;
end
end
end
endmodule
but in this code me getting syntax correct but as i tried to check its simulation using test bench waveform i get output o as always 'XXXX'.
so plz help me to find out the error..
Last edited by a moderator: