K
kumar
Guest
Hello all,
I have one interesting point to make regarding system task $fgets().
testin = $fopen("test.txt", "r");
str_len = $fgets(l, testin);
$display("%s, %h, %d",l, l, str_len);
I have used Model-Sim, Active Hdl and NC-Sim in PC Environment and did
find that CR- Carriage Return is not displayed by Modelsim and Active
HDL simulators when $display is done .
Is there any reason for that?
But NC-Sim displays both CR and LF ie., its equivalent is 0d and 0a
hex value respectively.
Is it a bug in Model-Sim/ActiveHDL.
If NC-Sim is displaying the character CR+LF, Model-sim/Active-HDL just
reports LF.
But i should be able to display the character "CR" x0d.
Well one more point is that if i do $fseek, In Model-Sim/ActiveHDL it
would result in
p = $fseek(testin, -str_len-1, 1); to go back to the start/Begining of
the line.
but in NC-Sim i need to do just this
p = $fseek(testin, -str_len, 1);
Hence i have to use two different statements for differnet simulators.
Looks like Model-Sim and ActiveHdl is not displaying the character
value of "CR"
Can anybody help me out in this regard
Thanks in advance
Regards
Kumar
I have one interesting point to make regarding system task $fgets().
testin = $fopen("test.txt", "r");
str_len = $fgets(l, testin);
$display("%s, %h, %d",l, l, str_len);
I have used Model-Sim, Active Hdl and NC-Sim in PC Environment and did
find that CR- Carriage Return is not displayed by Modelsim and Active
HDL simulators when $display is done .
Is there any reason for that?
But NC-Sim displays both CR and LF ie., its equivalent is 0d and 0a
hex value respectively.
Is it a bug in Model-Sim/ActiveHDL.
If NC-Sim is displaying the character CR+LF, Model-sim/Active-HDL just
reports LF.
But i should be able to display the character "CR" x0d.
Well one more point is that if i do $fseek, In Model-Sim/ActiveHDL it
would result in
p = $fseek(testin, -str_len-1, 1); to go back to the start/Begining of
the line.
but in NC-Sim i need to do just this
p = $fseek(testin, -str_len, 1);
Hence i have to use two different statements for differnet simulators.
Looks like Model-Sim and ActiveHdl is not displaying the character
value of "CR"
Can anybody help me out in this regard
Thanks in advance
Regards
Kumar