jalal.baba
Junior Member level 1
Can anyone please help me read decimal(just) values from a text file
my text is a.text :
my code is :
and my results is:
my text is a.text :
Code:
3 4 14 3 24 5
Code Verilog - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 `define Lenght 6 integer p,r,c; integer file,stat,out,i; reg [7:0] face[0:`Lenght-1]; initial begin file=$fopen("a.txt","r"); $display ("reading file....."); i=0; while (! $feof(file)) begin stat=$fscanf(file,"%d\n",face[i]); i=i+1; end $fclose(file); for(i=0;i<`Lenght;i=i+1) begin $display("face[i]=%d",face[i]); end end
and my results is:
thanks3
4
1
4
3
2