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

Subversion Repositories fast-crc

[/] [fast-crc/] [trunk/] [vhdl/] [big_xor_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 big_xor_tb is end big_xor_tb;
11
 
12
architecture structural of big_xor_tb is
13
 
14
component big_xor
15
  port (
16
    phi2        : in std_logic;
17
    reset       : in std_logic;
18
    input_input : in std_logic_vector(15 downto 0);
19
    fcs_input   : in std_logic_vector(15 downto 0);
20
    gf_input    : in std_logic_vector(15 downto 0);
21
    output      : out std_logic_vector(31 downto 0));
22
end component;
23
 
24
signal phi2, reset : std_logic;
25
signal input_input : std_logic_vector(15 downto 0);
26
signal fcs_input   : std_logic_vector(15 downto 0);
27
signal gf_input    : std_logic_vector(15 downto 0);
28
signal output      : std_logic_vector(31 downto 0);
29
 
30
signal phi1        : std_logic;
31
-- Necessary to be able to run the process that generates phi1
32
 
33
-- We also specify the files used to get the data and to put the data back
34
file file_read_input : text is in "/h/d1/c/x00jn/CRC_generator/data/data_xor_input.dat";
35
file file_read_fcs   : text is in "/h/d1/c/x00jn/CRC_generator/data/data_xor_fcs.dat";
36
file file_read_gf    : text is in "/h/d1/c/x00jn/CRC_generator/data/data_xor_gf.dat";
37
file file_out        : text is out "/h/d1/c/x00jn/CRC_generator/data/data_xor_out.dat";
38
 
39
begin  -- structural
40
 
41
 
42
  -- Important: These parameters have been calculated for a 500MHz
43
  -- relative clock -2 ns per stage-
44
  p_phi1: process
45
  begin  -- process p_phi1
46
    phi1 <= '1', '0' after 2.1 ns;
47
    wait for 4.2 ns;
48
  end process p_phi1;
49
 
50
  p_phi2: process
51
  begin  -- process p_phi2
52
    phi2 <= '1', '0' after 0.3 ns, '1' after 1.8 ns;
53
    wait for 4.2 ns;
54
  end process p_phi2;
55
 
56
  p_reset: process
57
  begin  -- process p_reset
58
    reset <= '0' after 10 ns, '1' after 30 ns;
59
    wait;
60
  end process p_reset;
61
 
62
  p_input: process (phi1)
63
    variable line_input : line;
64
    variable line_fcs : line;
65
    variable line_gf : line;
66
    variable file_input : bit_vector(15 downto 0);
67
    variable file_fcs : bit_vector(15 downto 0);
68
    variable file_gf : bit_vector(15 downto 0);
69
  begin  -- process p_input
70
   if phi1'event and phi1='1' then
71
    -- We just verify the end of a file (the files will be done of the same length)
72
    if (not (endfile(file_read_input))) then
73
      readline (file_read_input, line_input);
74
      read(line_input, file_input);
75
      input_input <= To_StdLogicVector(file_input);
76
 
77
      readline (file_read_fcs, line_fcs);
78
      read(line_fcs, file_fcs);
79
      fcs_input <= To_StdLogicVector(file_fcs);
80
 
81
      readline (file_read_gf, line_gf);
82
      read(line_gf, file_gf);
83
      gf_input <= To_StdLogicVector(file_gf);
84
      -- wait for 2 ns;                    -- IMPORTANT!! Modify this to change
85
                                        -- the speed of the incoming data!
86
    end if;
87
   end if;
88
  end process p_input;
89
 
90
  p_output: process (phi2)
91
    variable output_file : bit_vector(31 downto 0);
92
    variable line : line;
93
  begin  -- process p_output
94
    if phi2'event and phi2 = '1' then  -- rising clock edge
95
      output_file:=To_BitVector(output);
96
      write(line,output_file);
97
      writeline(file_out,line);
98
    end if;
99
  end process p_output;
100
 
101
  big_xor_1 : big_xor port map (phi2 => phi2, reset => reset, gf_input => gf_input,
102
                                input_input => input_input, fcs_input => fcs_input,
103
                                output => output);
104
 
105
end structural;
106
 
107
configuration cfg_big_xor_structural of big_xor_tb is
108
 
109
  for structural
110
    for big_xor_1: big_xor use entity work.big_xor(behavior); end for;
111
  end for;
112
 
113
end cfg_big_xor_structural;
114
 

powered by: WebSVN 2.1.0

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