OpenCores
URL https://opencores.org/ocsvn/gfir/gfir/trunk

Subversion Repositories gfir

[/] [gfir/] [trunk/] [vhdl/] [src/] [tb_pack.vhd] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 ahmed.shah
----------
2
--! @file
3
--! @brief The test-bench supporting package.
4
----------
5
library IEEE;
6
use IEEE.std_logic_1164.all;
7
use IEEE.std_logic_arith.all;
8
use std.textio.all;
9
 
10
package tb_pack is
11
 
12
  procedure ReadData( constant filename     : in  string;
13
                      signal   bpsdm_data   : out std_logic_vector;
14
                      signal   clk          : in  std_ulogic;
15
                      signal   finished     : out std_ulogic );
16
 
17
end tb_pack;
18
 
19
package body tb_pack is
20
 
21
  procedure ReadData( constant filename   : in  string;
22
                      signal   bpsdm_data   : out std_logic_vector;
23
                      signal   clk          : in  std_ulogic;
24
                      signal   finished     : out std_ulogic ) is
25
 
26
    file inputfile      : text open read_mode is filename;
27
    variable inputline  : line;
28
    variable data       : integer;
29
  begin
30
    while not endfile(inputfile) loop
31
      -- read one line of the file
32
      readline(inputfile, inputline);
33
      -- read one integer number from that line
34
      read(inputline, data);
35
      -- output data at rising clock edge, converting the integer number to a
36
      -- bit vector using the given vector length and either signed or unsigned
37
      -- input
38
      wait until rising_edge(clk);
39
        bpsdm_data <= std_logic_vector(conv_signed(data, bpsdm_data'length))   after 0 ns;
40
    end loop;
41
    -- as soon as last line is reached, output information that finished
42
    -- reading contents
43
    finished  <= '1';
44
  end procedure ReadData;
45
 
46
end tb_pack;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.