f



Get value from a text file (newbie)

Hello,

I have a question about the possibility to read some informations in a text
file.

For example, I have a entity 'scaler'. Can I do something like

architecture Behavioral of scaler0 is
    component scaler
        generic ( ???)
        port ( clr : in std_logic; clk : in std_logic; d : in
std_logic_vector(15 downto 0);
                  q : out std_logic_vector(15 downto 0));
    end component;
begin
    scaler0_c : scaler
        generic map ( ??? => 'filename of file containing initialisation
data')
        port map (......
......
end Behavioral;


Thank you in advance

smu


0
smu
8/19/2003 4:15:54 PM
comp.lang.vhdl 6430 articles. 2 followers. Post Follow

1 Replies
475 Views

Similar Articles

[PageSpeed] 10

smu a �crit :
> Hello,
> 
> I have a question about the possibility to read some informations in a text
> file.
> 

Yes you can. Here is a simple exemple:

entity A is
   generic(FILENAME: String := "foo.dat");
   port(K: out Integer);
end entity A;

use STD.TEXTIO.all;

architecture ARC of A is
   file INITFILE: Text open READ_MODE is FILENAME;
begin
   INITP: process
     variable L: Line;
     variable V: Integer;
   begin
     K <= 0;
     wait for 1 ns;
     READLINE(INITFILE, L);
     READ(L, V);
     K <= V;
     wait;
   end process INITP;
end architecture ARC;

entity ATB is
end entity ATB;

use STD.TEXTIO.all;

architecture SIM of ATB is
   signal K: Integer;
begin
   IA: entity WORK.A(ARC)
     generic map(FILENAME => "bar.txt")
     port map(K => K);
   MONITOR: process(K)
     variable L: Line;
   begin
     WRITE(L, K);
     WRITE(L, String'(" @ "));
     WRITE(L, NOW);
     WRITELINE(OUTPUT, L);
   end process MONITOR;
end architecture SIM;

Best regards,
-- 
Renaud Pacalet, ENST, 46 rue Barrault 75634 Paris Cedex 13
###### Tel. : 01 45 81 78 08 | Fax : 01 45 80 40 36 ######
# Fight Spam! Join EuroCAUCE: http://www.euro.cauce.org/ #

0
Renaud
8/20/2003 10:00:01 AM
Reply: