Gayathrirani
Newbie level 4
- Joined
- Jul 11, 2014
- Messages
- 7
- Helped
- 1
- Reputation
- 2
- Reaction score
- 1
- Trophy points
- 3
- Activity points
- 73
I've read data from txt file(containing pixels of image),Binarize it.Now i want the binarized output to be written into another txt file.Below is my coding.When i run it, i get the following error.
"# ** Error: (vsim-8323) D:/G/Reference materials/Sample codes/Iris Localization/imgbinary.v(25): $fwrite : Argument number 3 is an unpacked type, and may only be printed with the '%p' format.
# Error loading design" .What's wrong in this code??
"# ** Error: (vsim-8323) D:/G/Reference materials/Sample codes/Iris Localization/imgbinary.v(25): $fwrite : Argument number 3 is an unpacked type, and may only be printed with the '%p' format.
# Error loading design" .What's wrong in this code??
Code:
module file_readmemh_1;
reg [7:0] data_1 [0:1023];
reg [7:0] data_th [0:1023];
parameter th=8'b1000110;
initial $readmemh("lenaimghex_1.txt", data_1);
integer i,j,bin;
initial begin
$display("rdata:");
for (i=0; i < 1024; i=i+1)
$display("%d:%h",i,data_1[i]);
end
initial begin
for (j=0; j < 1024; j=j+1)
if (data_1[j]>=th)
begin
data_th[j]<=8'b1;
end
else
begin
data_th[j]<=8'b0;
end
end
initial begin
bin=$fopen("lena_binthresh.txt","w");
$fwrite(bin,"%h\n",data_th);
$fclose(bin);
end
endmodule
Last edited: