hi sir/mam
i am facing an issue that is in foreach loop
my question is
int a[4];
initial
begin
foreach(a[i]) a[i]=i;
foreach(a[i]) $display(“\tValue of a[%0d]=%0d”,i,a[i]);
end
this will print in the form of
Value of a[0]=0
Value of a[1]=1
Value of a[2]=2
Value of a[3]=3
but if int a[3:0] i am declaring this is printing as
Value of a[3]=3
Value of a[2]=2
Value of a[1]=1
Value of a[0]=0
definition of foreach is Foreach loop iterates through each index starting from index 0. but failed when int a[3:0] ? can any one clear me.