Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

lustrec-tests / vhdl_json / vhdl_files / 2-exportOK / cnes_guidelines / rule / data / STD_01600_bad.vhd @ 2051e520

History | View | Annotate | Download (3.86 KB)

1 2051e520 Arnaud Dieumegard
-------------------------------------------------------------------------------------------------
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-13 : Mickael Carl (CNES): Creation
10
-------------------------------------------------------------------------------------------------
11
-- File name          : STD_01600_bad.vhd
12
-- File Creation date : 2015-04-13
13
-- Project name       : VHDL Handbook CNES Edition
14
-------------------------------------------------------------------------------------------------
15
-- Softwares             :  Microsoft Windows (Windows 7) - Editor (Eclipse + VEditor)
16
-------------------------------------------------------------------------------------------------
17
-- Description : Handbook example: Entity port sort: bad 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
library work;
53
use work.pkg_HBK.all;
54
55
--CODE
56
entity STD_01600_bad is
57
   -- We sort port by name
58
   port (
59
      i_A1      : in  std_logic;        -- First Mux, first input
60
      i_A2      : in  std_logic;        -- Second Mux, first input
61
      i_B1      : in  std_logic;        -- First Mux, second input
62
      i_B2      : in  std_logic;        -- Second Mux, second input
63
      i_Sel1    : in  std_logic;        -- First Mux, selector input
64
      i_Sel2    : in  std_logic;        -- Second Mux, selector input
65
      i_Clock   : in  std_logic;        -- Clock input
66
      i_Reset_n : in  std_logic;        -- Reset input
67
      o_Q1      : out std_logic;        -- First module output
68
      o_Q2      : out std_logic         -- Second module output
69
      );
70
end STD_01600_bad;
71
--CODE
72
73
architecture Behavioral of STD_01600_bad is
74
   signal Q1      : std_logic;          -- First module output
75
   signal Q2      : std_logic;          -- Second module output
76
   signal OutMux1 : std_logic;          -- First Mux output
77
   signal OutMux2 : std_logic;          -- Second Mux output
78
begin
79
   -- First Mux, output to be synced
80
   Mux1 : Mux
81
      port map (
82
         i_A => i_A1,
83
         i_B => i_B1,
84
         i_S => i_Sel1,
85
         o_O => OutMux1
86
         );
87
88
   -- Second Mux, output to be synced
89
   Mux2 : Mux
90
      port map (
91
         i_A => i_A2,
92
         i_B => i_B2,
93
         i_S => i_Sel2,
94
         o_O => OutMux2
95
         );
96
97
   -- Synchronizes the Mux outputs
98
   P_SyncMux : process(i_Reset_n, i_Clock)
99
   begin
100
      if (i_Reset_n = '0') then
101
         Q1 <= '0';
102
         Q2 <= '0';
103
      else
104
         if (rising_edge(i_Clock)) then
105
            Q1 <= OutMux1;
106
            Q2 <= OutMux2;
107
         end if;
108
      end if;
109
   end process;
110
111
   o_Q1 <= Q1;
112
   o_Q2 <= Q2;
113
end Behavioral;
114
--CODE