[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[f-cpu] binary streams



hello,

in the Eurostar, i found the reason why my random
routin gave strange behaviour. This can be illutrated
by the following code :

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LIBRARY ieee;
    USE ieee.std_logic_1164.ALL;
    USE ieee.numeric_std.all;
--     USE ieee.std_logic_textio.all;
LIBRARY std;
    USE std.textio.ALL;

entity test is
end test;

architecture tst of test is

  type byte_stream is file of character ;
  file in_file  : byte_stream open read_mode is "in";
  file out_file : byte_stream open write_mode is "out";

begin  -- test

  process
    variable c : character;
    variable i : integer := 0;
    variable l : line;
  begin
    while not endfile(in_file) loop
      read(in_file,c);
      write(out_file,c);
      i := i+1;
    end loop;
    WRITE(l,i);
    WRITE(l,string'(" bytes copied "));
    writeline(output, l);
    wait;
  end process;

end tst;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

when run with vanilla or simili, the results are different.
given a text input file, simili will insert 0xD, 0xA pairs
for carriage returns. Well, it's a MSDOS thing.
Worse : simili "interprets" the input characters and particularly :
it stops on a "EOF" character (i don't know which) while
Vanilla copies texto the input to the output.
This is not revelant for the text i/O but i want to
handle "binary" files, that is : whatever the data is.
the different behaviours of the tools almost gave me headaches.

anyone can help ?

WHYGEE
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*************************************************************
To unsubscribe, send an e-mail to majordomo@seul.org with
unsubscribe f-cpu       in the body. http://f-cpu.seul.org/