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

Subversion Repositories fast-crc

[/] [fast-crc/] [trunk/] [vhdl/] [CRC_top_syn_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
file file_read : text is in "/h/d1/c/x00jn/CRC_generator/data/data_in.dat";
29
file file_out  : text is out "/h/d1/c/x00jn/CRC_generator/data/data_out.dat";
30
 
31
begin  -- structural
32
 
33
 
34
  -- Important: These parameters have been calculated for a 500MHz
35
  -- relative clock -2 ns per stage-
36
  p_phi1: process
37
  begin  -- process p_phi1 
38
    phi1 <= '1', '0' after 2.1 ns;
39
    wait for 4.2 ns;
40
  end process p_phi1;
41
 
42
  p_phi2: process
43
  begin  -- process p_phi2
44
    phi2 <= '1', '0' after 0.3 ns, '1' after 1.8 ns;
45
    wait for 4.2 ns;
46
  end process p_phi2;
47
 
48
  p_reset: process
49
  begin  -- process p_reset
50
    reset <= '0' after 10 ns, '1' after 30 ns;
51
    wait;
52
  end process p_reset;
53
 
54
  p_input: process (phi1)
55
    variable input_file : bit_vector(15 downto 0);
56
    variable line : line;
57
  begin  -- process p_input
58
   if phi1'event and phi1='1' then
59
    if (not (endfile(file_read))) then
60
      readline (file_read, line);
61
      read(line, input_file);
62
      input <= To_StdLogicVector(input_file);
63
--      wait for 2 ns;                    -- IMPORTANT!! Modify this to change
64
--                                        -- the speed of the incoming data!
65
    end if;
66
   end if;
67
  end process p_input;
68
 
69
  p_output: process (phi2)
70
    variable output_file : bit_vector(31 downto 0);
71
    variable line : line;
72
  begin  -- process p_output
73
    if phi2'event and phi2 = '1' then  -- rising clock edge
74
      output_file:=To_BitVector(fcs_out);
75
      write(line,output_file);
76
      writeline(file_out,line);
77
    end if;
78
  end process p_output;
79
 
80
  CRC_1 : CRC_top port map (phi1 => phi1, phi2 => phi2, reset => reset,
81
                            input => input, fcs_out => fcs_out);
82
 
83
end structural;
84
 
85
configuration cfg_CRC_top_tb_syn_structural of CRC_top_tb is
86
 
87
  for structural
88
    for CRC_1: CRC_top use entity work.CRC_top(SYN_structural); end for;
89
  end for;
90
 
91
end cfg_CRC_top_tb_syn_structural;

powered by: WebSVN 2.1.0

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