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

Subversion Repositories spi_slave

[/] [spi_slave/] [trunk/] [bench/] [vhdl/] [bin2gray_tb.vhd] - Blame information for rev 38

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 dkoethe
-------------------------------------------------------------------------------
2
-- Title      : Testbench for design "bin2grey"
3
-- Project    : 
4
-------------------------------------------------------------------------------
5
-- File       : bin2gray_tb.vhd
6
-- Author     : 
7
-- Company    : 
8
-- Created    : 2007-10-22
9
-- Last update: 2007-10-22
10
-- Platform   : 
11
-- Standard   : VHDL'87
12
-------------------------------------------------------------------------------
13
-- Description: 
14
-------------------------------------------------------------------------------
15
-- Copyright (c) 2007 
16
-------------------------------------------------------------------------------
17
-- Revisions  :
18
-- Date        Version  Author  Description
19
-- 2007-10-22  1.0      d.koethe        Created
20
-------------------------------------------------------------------------------
21
library ieee;
22
use ieee.std_logic_1164.all;
23
use ieee.std_logic_unsigned.all;
24
use ieee.std_logic_arith.all;
25
-------------------------------------------------------------------------------
26
 
27
entity bin2gray_tb is
28
 
29
end bin2gray_tb;
30
 
31
-------------------------------------------------------------------------------
32
 
33
architecture behavior of bin2gray_tb is
34
 
35
  component gray2bin
36
    generic (
37
      width : integer);
38
    port (
39
      in_gray : in  std_logic_vector(width-1 downto 0);
40
      out_bin : out std_logic_vector(width-1 downto 0));
41
  end component;
42
 
43
  component bin2gray
44
    generic (
45
      width : integer);
46
    port (
47
      in_bin   : in  std_logic_vector(width-1 downto 0);
48
      out_gray : out std_logic_vector(width-1 downto 0));
49
  end component;
50
 
51
  component gray_adder
52
    generic (
53
      width : integer);
54
    port (
55
      in_gray  : in  std_logic_vector(width-1 downto 0);
56
      out_gray : out std_logic_vector(width-1 downto 0));
57
  end component;
58
 
59
  -- component generics
60
  constant width : integer := 4;
61
 
62
  -- component ports
63
  signal in_bin           : std_logic_vector(width-1 downto 0);
64
  signal out_gray         : std_logic_vector(width-1 downto 0);
65
  signal out_bin          : std_logic_vector(width-1 downto 0);
66
  signal out_gray_add_one : std_logic_vector(width-1 downto 0);
67
 
68
begin  -- behavior
69
 
70
  -- component instantiation
71
  bin2gray_1 : bin2gray
72
    generic map (
73
      width => width)
74
    port map (
75
      in_bin   => in_bin,
76
      out_gray => out_gray);
77
 
78
 
79
  gray2bin_1 : gray2bin
80
    generic map (
81
      width => width)
82
    port map (
83
      in_gray => out_gray,
84
      out_bin => out_bin);
85
 
86
 
87
  gray_adder_1 : gray_adder
88
    generic map (
89
      width => width)
90
    port map (
91
      in_gray  => out_gray,
92
      out_gray => out_gray_add_one);
93
 
94
 
95
  -- waveform generation
96
  WaveGen_Proc : process
97
  begin
98
    for i in 0 to 2**width-1 loop
99
      in_bin <= conv_std_logic_vector(i, width);
100
      wait for 10 ns;
101
 
102
    end loop;  -- i
103
    assert false report "Simulation Sucessful" severity failure;
104
 
105
  end process WaveGen_Proc;
106
 
107
 
108
 
109
end behavior;
110
 
111
-------------------------------------------------------------------------------
112
 
113
configuration bin2gray_tb_behavior_cfg of bin2gray_tb is
114
  for behavior
115
  end for;
116
end bin2gray_tb_behavior_cfg;
117
 
118
-------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

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