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

Subversion Repositories cfft

[/] [cfft/] [trunk/] [sim/] [tb_cfft1024x12_read_from_file.vhd] - Blame information for rev 14

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 sradio
library IEEE;
2
use IEEE.STD_LOGIC_1164.all;
3
use IEEE.STD_LOGIC_ARITH.all;
4
use std.textio.all;
5
use IEEE.std_logic_textio.all;
6
 
7
entity tb_cfft1024x12 is
8
 
9
end tb_cfft1024x12;
10
 
11
architecture tb of tb_cfft1024x12 is
12
 
13
component cfft1024X12
14
         port(
15
                 clk : in STD_LOGIC;
16
                 rst : in STD_LOGIC;
17
                 start : in STD_LOGIC;
18 13 sradio
                 invert : in std_logic;
19 12 sradio
                 Iin : in STD_LOGIC_VECTOR(11 downto 0);
20
                 Qin : in STD_LOGIC_VECTOR(11 downto 0);
21
                 inputbusy : out STD_LOGIC;
22
                 outdataen : out STD_LOGIC;
23
                 Iout : out STD_LOGIC_VECTOR(13 downto 0);
24
                 Qout : out STD_LOGIC_VECTOR(13 downto 0);
25
                 OutPosition : out STD_LOGIC_VECTOR( 9 downto 0 )
26
             );
27
end component;
28
 
29
signal  clk : STD_LOGIC;
30
signal  rst : STD_LOGIC;
31
signal  start : STD_LOGIC;
32 13 sradio
signal  invert : std_logic;
33 12 sradio
signal  Iin : STD_LOGIC_VECTOR(11 downto 0);
34
signal  Qin : STD_LOGIC_VECTOR(11 downto 0);
35
signal  inputbusy : STD_LOGIC;
36
signal  outdataen : STD_LOGIC;
37
signal  Iout : STD_LOGIC_VECTOR(13 downto 0);
38
signal  Qout : STD_LOGIC_VECTOR(13 downto 0);
39
signal  output_position:std_logic_vector(9 downto 0 );
40
constant clkprd : time:=10 ns;
41
 
42
begin
43
f: cfft1024x12 port map(clk=>clk,
44
                        rst =>rst,
45
                        start=> start,
46 13 sradio
                        invert=>invert,
47 12 sradio
                        Iin=>Iin,
48
                        Qin=>Qin,
49
                        inputbusy=>inputbusy,
50
                        outdataen=>outdataen,
51
                        Iout=>Iout,
52
                        Qout=>Qout,
53
                        OutPosition=>output_position);
54
 
55
clockgen: process
56
begin
57
        clk <= '1';
58
        wait for clkprd/2;
59
        clk <= '0';
60
        wait for clkprd/2;
61
end process;
62
 
63
fileread: process
64
file FileIn1 : text is in  "bindata"; -- bindata is a file containing 1-1024
65
in binary.
66
variable LineIn1   : line;
67
variable InputTmp1 :std_logic_vector(11 downto 0);
68
begin
69
                rst<='1';
70
                wait until clk'EVENT and clk='1';
71
                rst<='0';
72
                wait until clk'EVENT and clk='1';
73 13 sradio
                invert<='0';
74 12 sradio
                start<='1';
75
                wait until clk'EVENT and clk='1';
76
                start<='0';
77
 
78
                while  not( endfile( FileIn1)) loop
79
                        readline( FileIn1, LineIn1);
80
                        read(LineIn1, InputTmp1);
81
                        Iin<=InputTmp1;
82
                        Qin<="000000000000";
83
                        wait until clk'EVENT and clk='1';
84
                end loop;
85
 
86
                wait until outdataen'EVENT and outdataen='1';
87
                wait for 15000 ns;
88
end process;
89
 
90
end tb;

powered by: WebSVN 2.1.0

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