No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

BancRegistres.vhd 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. ----------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date: 15.04.2021 08:23:48
  6. -- Design Name:
  7. -- Module Name: BancRegistres - Behavioral
  8. -- Project Name:
  9. -- Target Devices:
  10. -- Tool Versions:
  11. -- Description:
  12. --
  13. -- Dependencies:
  14. --
  15. -- Revision:
  16. -- Revision 0.01 - File Created
  17. -- Additional Comments:
  18. --
  19. ----------------------------------------------------------------------------------
  20. library IEEE;
  21. use IEEE.STD_LOGIC_1164.ALL;
  22. --use IEEE.STD_LOGIC_UNSIGNED.ALL;
  23. --use IEEE.STD_LOGIC_ARITH.ALL;
  24. -- Uncomment the following library declaration if using
  25. -- arithmetic functions with Signed or Unsigned values
  26. use IEEE.NUMERIC_STD.ALL;
  27. -- Uncomment the following library declaration if instantiating
  28. -- any Xilinx leaf cells in this code.
  29. --library UNISIM;
  30. --use UNISIM.VComponents.all;
  31. entity BancRegistres is
  32. Generic (Nb_bits : Natural;
  33. Addr_size : Natural;
  34. Nb_regs : Natural);
  35. Port ( AddrA : in STD_LOGIC_VECTOR (Addr_size-1 downto 0);
  36. AddrB : in STD_LOGIC_VECTOR (Addr_size-1 downto 0);
  37. AddrC : in STD_LOGIC_VECTOR (Addr_size-1 downto 0);
  38. AddrW : in STD_LOGIC_VECTOR (Addr_size-1 downto 0);
  39. W : in STD_LOGIC;
  40. DATA : in STD_LOGIC_VECTOR (Nb_bits-1 downto 0);
  41. RST : in STD_LOGIC;
  42. CLK : in STD_LOGIC;
  43. QA : out STD_LOGIC_VECTOR (Nb_bits-1 downto 0);
  44. QB : out STD_LOGIC_VECTOR (Nb_bits-1 downto 0);
  45. QC : out STD_LOGIC_VECTOR (Nb_bits-1 downto 0));
  46. end BancRegistres;
  47. -- ASK MEILLEURE IDEE UN TABLEAU
  48. architecture Behavioral of BancRegistres is
  49. signal REGISTRES : STD_LOGIC_VECTOR ((Nb_regs * Nb_bits)-1 downto 0) := (others => '0');
  50. begin
  51. process
  52. begin
  53. wait until CLK'event and CLK = '1';
  54. if (RST = '0') then
  55. REGISTRES <= (others => '0');
  56. else
  57. if (W = '1') then
  58. REGISTRES (((to_integer(unsigned(AddrW)) + 1) * Nb_bits - 1) downto Nb_bits * to_integer(unsigned(AddrW))) <= DATA;
  59. end if;
  60. end if;
  61. end process;
  62. QA <= REGISTRES (((to_integer(unsigned(AddrA)) + 1) * Nb_bits) - 1 downto Nb_bits * to_integer(unsigned(AddrA)));
  63. QB <= REGISTRES (((to_integer(unsigned(AddrB)) + 1) * Nb_bits) - 1 downto Nb_bits * to_integer(unsigned(AddrB)));
  64. QC <= REGISTRES (((to_integer(unsigned(AddrC)) + 1) * Nb_bits) - 1 downto Nb_bits * to_integer(unsigned(AddrC)));
  65. end Behavioral;