OpenCores
URL https://opencores.org/ocsvn/fast-crc/fast-crc/trunk

Subversion Repositories fast-crc

[/] [fast-crc/] [trunk/] [vhdl/] [CRC_top_tb.vhd] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 trueno
library IEEE;
2
use IEEE.std_logic_1164.all;
3
use IEEE.std_logic_arith.all;
4
 
5
-- synopsys synthesis on
6
library STD;
7
use STD.TEXTIO.all;
8
-- synopsys synthesis off
9
 
10
entity CRC_top_tb is end CRC_top_tb;
11
 
12
architecture structural of CRC_top_tb is
13
 
14
component CRC_top
15
  port (
16
    phi1    : in    std_logic;
17
    phi2    : in    std_logic;
18
    reset   : in    std_logic;
19
    input   : in    std_logic_vector(15 downto 0);
20
    fcs_out : out std_logic_vector(31 downto 0));
21
end component;
22
 
23
signal phi1, phi2, reset : std_logic;
24
signal input             : std_logic_vector(15 downto 0);
25
signal fcs_out           : std_logic_vector(31 downto 0);
26
 
27
-- We also specify the files used to get the data and to put the data back
28
 
29
file file_read : text is in "/h/d1/c/x00jn/CRC_generator/data/data_in.dat";
30
file file_out  : text is out "/h/d1/c/x00jn/CRC_generator/data/data_out.dat";
31
 
32
begin  -- structural
33
 
34
 
35
  -- Important: These parameters have been calculated for a 500MHz
36
  -- relative clock -2 ns per stage-
37
  p_phi1: process
38
  begin  -- process p_phi1 
39
    phi1 <= '1', '0' after 2.1 ns;
40
    wait for 4.2 ns;
41
  end process p_phi1;
42
 
43
  p_phi2: process
44
  begin  -- process p_phi2
45
    phi2 <= '1', '0' after 0.3 ns, '1' after 1.8 ns;
46
    wait for 4.2 ns;
47
  end process p_phi2;
48
 
49
  p_reset: process
50
  begin  -- process p_reset
51
    reset <= '0' after 10 ns, '1' after 30 ns;
52
    wait;
53
  end process p_reset;
54
 
55
  p_input: process (phi1)
56
    variable input_file : bit_vector(15 downto 0);
57
    variable line : line;
58
  begin  -- process p_input
59
   if phi1'event and phi1='1' then
60
    if (not (endfile(file_read))) then
61
      readline (file_read, line);
62
      read(line, input_file);
63
      input <= To_StdLogicVector(input_file);
64
--      wait for 2 ns;                    -- IMPORTANT!! Modify this to change
65
--                                        -- the speed of the incoming data!
66
    end if;
67
   end if;
68
  end process p_input;
69
 
70
  p_output: process (phi2)
71
    variable output_file : bit_vector(31 downto 0);
72
    variable line : line;
73
  begin  -- process p_output
74
    if phi2'event and phi2 = '1' then  -- rising clock edge
75
      output_file:=To_BitVector(fcs_out);
76
      write(line,output_file);
77
      writeline(file_out,line);
78
    end if;
79
  end process p_output;
80
 
81
  CRC_1 : CRC_top port map (phi1 => phi1, phi2 => phi2, reset => reset,
82
                            input => input, fcs_out => fcs_out);
83
 
84
end structural;
85
 
86
configuration cfg_CRC_top_tb_structural of CRC_top_tb is
87
 
88
  for structural
89
    for CRC_1: CRC_top use entity work.CRC_top(structural); end for;
90
  end for;
91
 
92
end cfg_CRC_top_tb_structural;

powered by: WebSVN 2.1.0

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