Project

General

Profile

Download (3.71 KB) Statistics
| Branch: | Tag: | Revision:
1
-------------------------------------------------------------------------------------------------
2
-- Company   : CNES
3
-- Author    : Mickael Carl (CNES)
4
-- Copyright : Copyright (c) CNES.
5
-- Licensing : GNU GPLv3
6
-------------------------------------------------------------------------------------------------
7
-- Version         : V1
8
-- Version history :
9
--    V1 : 2015-04-10 : Mickael Carl (CNES): Creation
10
-------------------------------------------------------------------------------------------------
11
-- File name          : STD_07100_good.vhd
12
-- File Creation date : 2015-04-10
13
-- Project name       : VHDL Handbook CNES Edition
14
-------------------------------------------------------------------------------------------------
15
-- Softwares             :  Microsoft Windows (Windows 7) - Editor (Eclipse + VEditor)
16
-------------------------------------------------------------------------------------------------
17
-- Description : Handbook example: Simulation ending: good example
18
--
19
-- Limitations : This file is an example of the VHDL handbook made by CNES. It is a stub aimed at
20
--               demonstrating good practices in VHDL and as such, its design is minimalistic.
21
--               It is provided as is, without any warranty.
22
--               This example is compliant with the Handbook version 1.
23
--
24
-------------------------------------------------------------------------------------------------
25
-- Naming conventions:
26
--
27
-- i_Port: Input entity port
28
-- o_Port: Output entity port
29
-- b_Port: Bidirectional entity port
30
-- g_My_Generic: Generic entity port
31
--
32
-- c_My_Constant: Constant definition
33
-- t_My_Type: Custom type definition
34
--
35
-- My_Signal_n: Active low signal
36
-- v_My_Variable: Variable
37
-- sm_My_Signal: FSM signal
38
-- pkg_Param: Element Param coming from a package
39
--
40
-- My_Signal_re: Rising edge detection of My_Signal
41
-- My_Signal_fe: Falling edge detection of My_Signal
42
-- My_Signal_rX: X times registered My_Signal signal
43
--
44
-- P_Process_Name: Process
45
--
46
-------------------------------------------------------------------------------------------------
47

    
48
library IEEE;
49
use IEEE.std_logic_1164.all;
50
use IEEE.numeric_std.all;
51

    
52
entity STD_07100_good is
53
end STD_07100_good;
54

    
55
architecture Simulation of STD_07100_good is
56
   -- All signals for tested modules inputs/outputs
57
   signal Clock    : std_logic := '0';
58
   signal Reset_n  : std_logic;
59
   signal D_Signal : std_logic;
60
   signal Q_Signal : std_logic;
61

    
62
   -- Used to stop simulation when no more stimulus are present
63
   signal End_Sim : std_logic;
64

    
65
   component DFlipFlop
66
      port (
67
         i_Clock   : in  std_logic;     -- Clock signal
68
         i_Reset_n : in  std_logic;     -- Reset signal
69
         i_D       : in  std_logic;     -- D Flip-Flop input signal
70
         o_Q       : out std_logic;     -- D Flip-Flop output signal
71
         o_Q_n     : out std_logic      -- D Flip-Flop output signal, inverted
72
         );
73
   end component;
74
begin
75
   -- The D Flip-Flop to test
76
   T_DFlipFlop : DFlipFlop
77
      port map (
78
         i_Clock   => Clock,
79
         i_Reset_n => Reset_n,
80
         i_D       => D_Signal,
81
         o_Q       => Q_Signal,
82
         o_Q_n     => open
83
         );
84

    
85
   --CODE
86
   -- Clock process
87
   P_Clock : process
88
   begin
89
      while (End_Sim /= '1') loop       -- End_Sim is a std_logic signal
90
         Clock <= not Clock after 5 ns;
91
      end loop;
92
      wait;
93
   end process;
94

    
95
   -- Test process
96
   P_Test : process
97
   begin
98
      Reset_n  <= '0';
99
      D_Signal <= '0';
100
      wait until rising_edge(Clock);
101
      Reset_n  <= '1';
102
      wait until rising_edge(Clock);
103
      D_Signal <= '1';
104
      wait until rising_edge(Clock);
105
      D_Signal <= '0';
106

    
107
      End_Sim <= '1';
108
      wait;
109
   -- Or if your simulator supports VHDL-2008:
110
   -- finish(2);
111
   end process;
112
--CODE
113
end Simulation;
(123-123/126)