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

Subversion Repositories saturn

[/] [saturn/] [trunk/] [IPCommunication/] [flux_chgclk.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 DavidRAMBA
--============================================================================= 
2
--  TITRE : flux_chgclk
3
--  DESCRIPTION : 
4
--       Passe un flux de donnée d'une horlgoe clks à clkd
5
--       Passe le flux à travers une FIFO à 2 horloges asynchrones
6
--  FICHIER :        flux_chgclk.vhd 
7
--=============================================================================
8
--  CREATION 
9
--  DATE              AUTEUR    PROJET  REVISION 
10
--  10/04/2014  DRA        SATURN       V1.0 
11
--=============================================================================
12
--  HISTORIQUE  DES  MODIFICATIONS :
13
--  DATE              AUTEUR    PROJET  REVISION 
14
--=============================================================================
15
 
16
LIBRARY IEEE;
17
USE IEEE.STD_LOGIC_1164.ALL;
18
USE IEEE.STD_LOGIC_ARITH.ALL;
19
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
20
Library UNISIM;
21
use UNISIM.vcomponents.all;
22
 
23
ENTITY flux_chgclk IS
24
   PORT (
25
      -- Ports système
26
      clks     : IN  STD_LOGIC;                    -- Clock du flux entrant
27
      clkd     : IN  STD_LOGIC;                    -- Clock du flux sortant
28
      rst_n    : IN  STD_LOGIC;                    -- Reset général système
29
 
30
      datas    : IN  STD_LOGIC_VECTOR(7 DOWNTO 0); -- Flux source
31
      vals     : IN  STD_LOGIC;                    -- Validant du flux source
32
      sofs     : IN  STD_LOGIC;                    -- Début de trame du flux source
33
      eofs     : IN  STD_LOGIC;                    -- Fin de trame du flux source
34
      crcoks   : IN  STD_LOGIC;                    -- Signal de trame bonne pour flux source
35
 
36
      datad    : OUT STD_LOGIC_VECTOR(7 DOWNTO 0); -- Idem pour le flux destination
37
      vald     : OUT STD_LOGIC;
38
      sofd     : OUT STD_LOGIC;
39
      eofd     : OUT STD_LOGIC;
40
      crcokd   : OUT STD_LOGIC
41
      );
42
END flux_chgclk;
43
 
44
ARCHITECTURE rtl of flux_chgclk is
45
   SIGNAL vectin     : STD_LOGIC_VECTOR(10 DOWNTO 0); -- Pour fabriquer le vecteur d'entrée de la FIFO
46
   SIGNAL vectout    : STD_LOGIC_VECTOR(10 DOWNTO 0); -- Pour lire la FIFO
47
   SIGNAL empty      : STD_LOGIC;                     -- FIFO vide
48
   SIGNAL wren       : STD_LOGIC;                     -- Signal d'écriture dans la FIFO
49
 
50
   COMPONENT fifo_ckgclk
51
      PORT (
52
         rst    : IN STD_LOGIC;
53
         wr_clk : IN STD_LOGIC;
54
         rd_clk : IN STD_LOGIC;
55
         din    : IN STD_LOGIC_VECTOR(10 DOWNTO 0);
56
         wr_en  : IN STD_LOGIC;
57
         rd_en  : IN STD_LOGIC;
58
         dout   : OUT STD_LOGIC_VECTOR(10 DOWNTO 0);
59
         full   : OUT STD_LOGIC;
60
         empty  : OUT STD_LOGIC
61
      );
62
   END COMPONENT;
63
 
64
BEGIN
65
   -- Le vecteur écrit dans la FIFO est composé des données et des signaux de controle EOF, SOF, CRCOK
66
   vectin <= crcoks & eofs & sofs & datas;
67
   wren <= vals OR eofs;   -- Le VAL n'est pas actif pendant le EOF, on force wren pour le EOF soit dans la FIFO
68
 
69
   inst_chgclk :  fifo_ckgclk
70
   PORT MAP(
71
      rst    => NOT(rst_n),
72
      wr_clk => clks,
73
      rd_clk => clkd,
74
      din    => vectin,
75
      wr_en  => wren,
76
      rd_en  => '1',
77
      dout   => vectout,
78
      full   => open,
79
      empty  => empty
80
   );
81
 
82
   -- Réaffectation des signaux en focntion du vecteur de sortie
83
   crcokd <= vectout(10);
84
   eofd   <= vectout(9);
85
   sofd   <= vectout(8);
86
   datad  <= vectout(7 DOWNTO 0);
87
   vald <= NOT(empty);     -- La FIFO non vide indique une donnée disponible
88
 
89
END rtl;
90
 

powered by: WebSVN 2.1.0

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