Advertisement
Guest User

dini

a guest
Jun 23rd, 2017
483
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.16 KB | None | 0 0
  1. -- ########################################################################
  2. -- $Software: busiac
  3. -- $section : hardware component
  4. -- $Id: terminateur.vhd 322 2015-05-29 06:43:59Z ia $
  5. -- $HeadURL: svn://lunix120.ensiie.fr/ia/cours/archi/projet/busiac/vhdl/terminateur.vhd $
  6. -- $Author : Ivan Auge (Email: auge@ensiie.fr)
  7. -- ########################################################################
  8. --
  9. -- This file is part of the BUSIAC software: Copyright (C) 2010 by I. Auge.
  10. --
  11. -- This program is free software; you can redistribute it and/or modify it
  12. -- under the terms of the GNU General Public License as published by the
  13. -- Free Software Foundation; either version 2 of the License, or (at your
  14. -- option) any later version.
  15. --
  16. -- BUSIAC software is distributed in the hope that it will be useful, but
  17. -- WITHOUT ANY WARRANTY ; without even the implied warranty of
  18. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
  19. -- Public License for more details.
  20. --
  21. -- You should have received a copy of the GNU General Public License along
  22. -- with the GNU C Library; see the file COPYING. If not, write to the Free
  23. -- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  24. --
  25. -- ######################################################################*/
  26.  
  27. -------------------------------------------------------------------------------
  28. -- ATTENTION:
  29. -- Ceci un template, les trous marqués "..." doivent être comblés pour
  30. -- pouvoir être compilé, puis fonctionné.
  31. -------------------------------------------------------------------------------
  32.  
  33. -------------------------------------------------------------------------------
  34. -- Ce module transfert tous les messages (????,addrsrc,addrdest,data) venant de
  35. -- busin.
  36. -- Si ????=???1, il transmet le messages sur busdump.
  37. -- Si ????=???0 et addrdest!=MYADDR, il transmet sur busout le message
  38. -- (???1,addrsrc,addrdest,data).
  39. -- Si addrdest==MYADDR, il transmet le message sur busdump.
  40. --
  41. -- Du coté busin, il suit le protocole "poignée de main" (signaux: busin,
  42. -- busin_valid, busin_eated).
  43. -- Du coté busout, il suit le protocole "poignée de main" (signaux: busout,
  44. -- busout_valid, busout_eated).
  45. -- Du coté busdump, il suit le protocole "poignée de main" (signaux: busdump,
  46. -- busdump_valid, busdump_eated).
  47. -------------------------------------------------------------------------------
  48.  
  49. library IEEE;
  50. use IEEE.std_logic_1164.all;
  51. use IEEE.numeric_std.all;
  52.  
  53.  
  54. entity F16 is
  55. generic(
  56. MYADDR : STD_LOGIC_VECTOR(7 downto 0) := "00001010"; -- 10
  57. FREQ : INTEGER := 50000000
  58. );
  59. port(
  60. clk : in STD_LOGIC;
  61. reset : in STD_LOGIC;
  62. businhs : in STD_LOGIC_VECTOR(23 downto 0);
  63. busouts : out STD_LOGIC_VECTOR(15 downto 0)
  64. );
  65. end F16;
  66.  
  67. architecture montage of F16 is
  68.  
  69. -------------------------------------------------------------------------------
  70. -- Partie Opérative
  71. -------------------------------------------------------------------------------
  72. -- Registre de transfert entre busin et busout
  73. type T_CMD_tft is (LOAD, NOOP);
  74. signal CMD_tft : T_CMD_tft ;
  75. signal R_tft : STD_LOGIC_VECTOR (23 downto 0);
  76.  
  77. type T_CMD_s is (LOAD, NOOP);
  78. signal CMD_s : T_CMD_s ;
  79. signal R_s : STD_LOGIC_VECTOR (15 downto 0);
  80.  
  81. -------------------------------------------------------------------------------
  82. -- Partie Contrôle
  83. -------------------------------------------------------------------------------
  84.  
  85. type STATE_TYPE is (
  86. ST_READ, -- etat initial où l'on 'mange' toutes les info qu'on reçoit
  87. ST_LOAD, -- etat où l'on transfert le contenu du registre dans le buss
  88. ST_PULSE); -- etat où l'on transfert le contenu du registre dans le bushs
  89. signal state : STATE_TYPE;
  90.  
  91. begin
  92.  
  93. -------------------------------------------------------------------------------
  94. -- Partie Opérative
  95. -------------------------------------------------------------------------------
  96.  
  97. process (clk,reset)
  98. begin if reset = '1' then
  99. R_s(15 downto 0) <= STD_LOGIC_VECTOR(TO_UNSIGNED(FREQ/100,16));
  100. elsif clk'event and clk = '1' then
  101. if (CMD_tft = LOAD) then
  102. R_tft <= businhs;
  103.  
  104. end if;
  105. -- R_tft
  106. if (CMD_s = LOAD) then
  107. R_s <= R_tft(15 downto 0);
  108.  
  109. end if;
  110. end if; end process;
  111.  
  112. busouts <= R_s;
  113. --busouths <= R_tft;
  114.  
  115. -------------------------------------------------------------------------------
  116. -- Partie Contrôle
  117.  
  118. -- fonction de transitition
  119. process (reset,clk)
  120. begin
  121. if reset = '1' then
  122. state <= ST_READ;
  123. elsif clk'event and clk = '1' then
  124. case state is
  125. when ST_READ =>
  126. state <= ST_LOAD;
  127. when ST_LOAD =>
  128. state <= ST_PULSE;
  129. when ST_PULSE =>
  130. state <= ST_READ;
  131. end case;
  132. end if;
  133. end process;
  134.  
  135. -- fonction de sortie
  136. with state select CMD_s <=
  137. LOAD when ST_LOAD,
  138. NOOP when others;
  139.  
  140. with state select CMD_tft <=
  141. LOAD when ST_READ,
  142. NOOP when others;
  143.  
  144. end montage;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement