while using the fwrite in verilog....... as mentioned below....
$fwrite(file,"a=%d @=%d",a,addr);
if the value of a is negative i am getting the data in the file as.........for eg....-1 as 65535 but i need to print it as -1 in the file do any one know other format of writting the data so i colud write negative values as -1 in my file.....
while using the fwrite in verilog....... as mentioned below....
$fwrite(file,"a=%d @=%d",a,addr);
if the value of a is negative i am getting the data in the file as.........for eg....-1 as 65535 but i need to print it as -1 in the file do any one know other format of writting the data so i colud write negative values as -1 in my file.....
module test;
integer file;
reg signed [15:0] a, addr;
initial begin
a = -1;
addr = 100;
file = $fopen("test");
$fwrite(file,"a=%d @=%d",a,addr);
end
endmodule // test
i think if you have declared the variable 'a' as register data type, there is a possibility that it might not show the negative value since it might be unsigned by default. Plz check the fwrite statement with 'a' declared as an integer and see if the same problem occurs.
When I try the code above and simulate using Isim, the output has only one character, instead of "MIN_1 is -1 PLUS_1 is 1", the output is just M. Anyone could tell me how to solve it? Is it because I did the wrong simulation?
Thanks