testAtanFP.vhd


1
library IEEE;
2
use IEEE.STD_LOGIC_1164.all;
3
4
entity testbnch is
5
end entity TESTBNCH;
6
7
architecture stimulus of TESTBNCH is
8
------------------------------------------------
9
COMPONENT arctanFP is
10
  port (nrst    : in std_logic;
11
      clk     : in std_logic;
12
      ceatan     : in std_logic;-- startimpuls afkt
13
      Xinp      :in std_logic_vector(31 downto 0);-- input X FP FP  format
14
      Yinp      :in std_logic_vector(31 downto 0);-- input Y FP FP  format
15
      atanFPo    :OUT std_logic_vector(31 downto 0):=X"00000000"-- output Winkel(rad) in FP  format
16
      );
17
end COMPONENT;
18
19
--====================================================================
20
  constant sim_cyc: time := 10 ns; -- 10 ns=100 MHz = system clk,clk =100Mhz
21
22
--======================================================
23
    signal tb_nrst         : std_logic  := '0';
24
    signal tb_clk          : std_logic  := '0';
25
   signal tb_ceatan        : std_logic  := '0';
26
    signal tb_Xinp          : std_logic_vector(31 downto 0) := (others => '0');  --input X FP FP  format
27
    signal tb_Yinp           : std_logic_vector(31 downto 0) := (others => '0'); --input Y FP FP  format
28
    signal tb_atanFPo           : std_logic_vector(31 downto 0) := (others => '0');  --output Winkel(rad) in FP  format
29
   
30
  
31
---===============================================================================================
32
begin
33
------------------------------------------------
34
UUT:arctanFP
35
    port map
36
    (
37
     nrst     => tb_nrst,     -- : in  std_logic;
38
        clk     => tb_clk,      -- : in  std_logic;
39
      ceatan  => tb_ceatan, -- startimpuls afkt
40
      Xinp   => tb_Xinp,  -- input X FP FP  format
41
      Yinp   => tb_Yinp,  -- input Y FP FP  format
42
      atanFPo => tb_atanFPo   -- output Winkel(rad) in FP  format
43
      );
44
--====================================================================
45
46
-------------------------------------------------------------------
47
--==========================================================
48
----------CLK= 100 MHz-----------------------------
49
    CLK_1: process
50
    begin
51
       tb_clk <= '0';
52
       WAIT FOR (sim_cyc*2 - 1 ns);
53
    WHILE TRUE LOOP
54
      tb_clk <= NOT tb_clk;
55
          wait for (sim_cyc);--simcyc*2/2
56
        END LOOP;    
57
    end process;
58
59
---------------------------------------------------------------
60
    stimulus: process
61
    begin
62
      tb_nrst <= '0';
63
      WAIT for 5 us;
64
      tb_nrst <= '1';-- reseted 
65
      -----------------------------------
66
      -------45Grd = 0.785398163 -----
67
      -------30Grd = 0.523598776 -----
68
      -----------------------------------
69
      --tb_Xinp <= X"3f800000";--1.0
70
      tb_Xinp <= X"3f032916";-- 0.512345678
71
      tb_Yinp <= X"3f032916";--0.512345678
72
     --------------------------
73
     tb_ceatan  <= '1'; -- startimpuls
74
     WAIT FOR sim_cyc*2;
75
     tb_ceatan  <= '0';
76
     ---------------------------
77
      
78
        wait;
79
    end process;
80
   
81
82
83
end architecture stimulus;