Commit 71388fd5c75f285ae02833501290a824e5b87093
0 parents
seance 2
Showing
15 changed files
with
385 additions
and
0 deletions
Show diff stats
162 KB
1 | +++ a/Exercice_1/Asynchronous_Reset.vhd | |
... | ... | @@ -0,0 +1,57 @@ |
1 | +---------------------------------------------------------------------------------- | |
2 | +-- Company: | |
3 | +-- Engineer: | |
4 | +-- | |
5 | +-- Create Date: 17.10.2023 17:47:42 | |
6 | +-- Design Name: | |
7 | +-- Module Name: Exercice_1 - 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 | + | |
21 | + | |
22 | +library IEEE; | |
23 | +use IEEE.STD_LOGIC_1164.ALL; | |
24 | +use IEEE.NUMERIC_STD.ALL; | |
25 | +-- Uncomment the following library declaration if using | |
26 | +-- arithmetic functions with Signed or Unsigned values | |
27 | + | |
28 | +-- Uncomment the following library declaration if instantiating | |
29 | +-- any Xilinx leaf cells in this code. | |
30 | +--library UNISIM; | |
31 | +--use UNISIM.VComponents.all; | |
32 | + | |
33 | +entity Asynchronous_Reset is | |
34 | + generic(N : natural := 64); | |
35 | + Port ( | |
36 | + reset : in std_logic; | |
37 | + clk_in : in std_logic; | |
38 | + A : in SIGNED(N-1 downto 0); | |
39 | + B : in SIGNED(N-1 downto 0); | |
40 | + Resultat : out SIGNED(2*N -1 downto 0) | |
41 | + ); | |
42 | +end Asynchronous_Reset; | |
43 | + | |
44 | +architecture Behavioral of Asynchronous_Reset is | |
45 | + signal produit : signed(2*N-1downto 0); | |
46 | +begin | |
47 | +-- Reset asynchrone process. | |
48 | +Mlutiplier: process(clk_in, reset) | |
49 | + begin | |
50 | + if reset='1' then | |
51 | + produit <= (others =>'0'); | |
52 | + elsif rising_edge(clk_in) then | |
53 | + produit <= A*B; | |
54 | + end if; | |
55 | + end process; | |
56 | + Resultat <= produit; | |
57 | +end Behavioral; | |
0 | 58 | \ No newline at end of file | ... | ... |
1 | +++ a/Exercice_1/README.md | ... | ... |
159 KB
1 | +++ a/Exercice_1/Synchronous_Reset.vhd | |
... | ... | @@ -0,0 +1,59 @@ |
1 | +---------------------------------------------------------------------------------- | |
2 | +-- Company: รCOLE POLYTECHNIQUE DE LILLE - POLYTECH LILLE. | |
3 | +-- Engineer: | |
4 | +-- | |
5 | +-- Create Date: 17.10.2023 17:47:42 | |
6 | +-- Design Name: Synchronous Reset signed generic multiplier. | |
7 | +-- Module Name: Synchronous RESET - Behavioral | |
8 | +-- Project Name: Synchronous Reset signed generic multiplier. | |
9 | +-- Target Devices: BASYS3 | |
10 | +-- Tool Versions: | |
11 | +-- Description: | |
12 | +-- | |
13 | +-- Dependencies: | |
14 | +-- | |
15 | +-- Revision: | |
16 | +-- Revision 0.01 - File Created | |
17 | +-- Additional Comments: | |
18 | +-- | |
19 | +---------------------------------------------------------------------------------- | |
20 | + | |
21 | +library IEEE; | |
22 | +use IEEE.STD_LOGIC_1164.ALL; | |
23 | +use IEEE.NUMERIC_STD.ALL; | |
24 | +-- Uncomment the following library declaration if using | |
25 | +-- arithmetic functions with Signed or Unsigned values | |
26 | + | |
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 | + | |
32 | +entity Synchronous_Reset is | |
33 | + -- Dรฉclaration de N comme generic pour varier le nombre des bits des entrรฉs A et B. | |
34 | + generic(N : natural := 64); | |
35 | + Port ( | |
36 | + reset : in std_logic; -- Dรฉclaration du reset comme input. | |
37 | + clk_in : in std_logic; -- Dรฉclaration de l'horloge. | |
38 | + A : in SIGNED(N-1 downto 0); -- L'entrรฉe A sur N Bits. | |
39 | + B : in SIGNED(N-1 downto 0); -- L'entrรฉe B sur N Bits | |
40 | + Resultat : out SIGNED(2*N -1 downto 0) -- Le rรฉsultat du produit sur 2*N Bits. | |
41 | + ); | |
42 | +end Synchronous_Reset; | |
43 | + | |
44 | +architecture Behavioral of Synchronous_Reset is | |
45 | + signal produit : signed(2*N-1downto 0); -- Dรฉclarataion du signal intรฉrmidiaire pour les calculs. | |
46 | +begin | |
47 | +-- Reset synchrone process. => liste de sensibilitรฉ du processus ne contient pas le RESET. | |
48 | +Mlutiplier: process(clk_in) | |
49 | + begin | |
50 | + if rising_edge(clk_in) then -- Tester si il y a un font montant sur l'horloge. | |
51 | + if reset='1' then -- Teseter le reset pour le remise ร ZERO du systรจme. | |
52 | + produit <= (others =>'0'); | |
53 | + else | |
54 | + produit <= A*B; -- Calculer le produit A*B a l'aide du bibliothรฉque IEEE.NUMERIC_STD | |
55 | + end if; | |
56 | + end if; | |
57 | + end process; | |
58 | + Resultat <= produit; -- Affectation du signal a la rรฉsultat. | |
59 | +end Behavioral; | |
0 | 60 | \ No newline at end of file | ... | ... |
167 KB
1 | +++ a/Exercice_2/RAM_ReadWrite.vhd | |
... | ... | @@ -0,0 +1,66 @@ |
1 | +---------------------------------------------------------------------------------- | |
2 | +-- Company: รCOLE POLYTECHNIQUE DE LILLE | |
3 | +-- Engineer: | |
4 | +-- | |
5 | +-- Create Date: 19.10.2023 15:35:32 | |
6 | +-- Design Name: Random Access Memory Read Write. | |
7 | +-- Module Name: RAM_ReadWrite - Behavioral | |
8 | +-- Project Name: Random Access Memory Read Write. | |
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 | + | |
21 | + | |
22 | +library IEEE; | |
23 | +use IEEE.STD_LOGIC_1164.ALL; | |
24 | +use IEEE.NUMERIC_STD.ALL; -- Utilisation de NUMERIC_STD pour faire la conversion std_logic_vector to integer. | |
25 | +use IEEE.STD_LOGIC_UNSIGNED.ALL; | |
26 | +-- Uncomment the following library declaration if using | |
27 | +-- arithmetic functions with Signed or Unsigned values | |
28 | +--use IEEE.NUMERIC_STD.ALL; | |
29 | + | |
30 | +-- Uncomment the following library declaration if instantiating | |
31 | +-- any Xilinx leaf cells in this code. | |
32 | +--library UNISIM; | |
33 | +--use UNISIM.VComponents.all; | |
34 | + | |
35 | +entity RAM_ReadWrite is | |
36 | + generic( | |
37 | + Address_Bits : positive :=8; -- Declaration de nombre des Bits de l'adress mรฉmoire 8Bits => 256 case mรฉmoire. | |
38 | + Data_Bits : positive :=8 -- Dรฉclaration de nombre des Bits des donnรฉes. | |
39 | + ); | |
40 | + Port ( | |
41 | + clk_in, Read_en, Write_en : std_logic; -- Le signal d'horloge, Enable lecture mรฉmoire et รฉcriture mรฉmoire signals | |
42 | + Address : in std_logic_vector(Address_Bits-1 downto 0); -- L'address pour acceder au case mรฉmoire. | |
43 | + Data_in : in std_logic_vector(Data_Bits-1 downto 0); -- Les donnรฉes a รฉcrire dans le RAM. | |
44 | + Data_out : out std_logic_vector(Data_Bits-1 downto 0) -- Les donnรฉes a lire depuis la mรฉmoire RAM. | |
45 | + ); | |
46 | +end RAM_ReadWrite; | |
47 | +-- Dรฉfinition de l'archรฉticture de l'entitรฉ RAM_ReadWrite. | |
48 | +architecture Behavioral of RAM_ReadWrite is | |
49 | +-- Dรฉclaration de la mรฉmoire comme un tableau de 2**Address_Bits = 256 cases mรฉmoires. | |
50 | +-- Chaque case est une vecteur de 8 Btis (Data_Bits-1 donwto 0) = 8 | |
51 | +type RAM is array (0 to 2**Address_Bits-1) of std_logic_vector(Data_Bits-1 downto 0); | |
52 | +-- Dรฉclaration d'un signal mรฉmoire pour la manipulation de lรฉcture et รฉcriture. | |
53 | +signal memory : RAM := (others => (others => '0')); | |
54 | +begin | |
55 | + RAM_ReadWrite :process(clk_in) | |
56 | + begin | |
57 | + if(rising_edge(clk_in)) then | |
58 | + if(Write_en = '1') then -- Si l'option รฉcriture de mรฉmoire est activรฉ on รฉcris dans le mรฉmoire | |
59 | + memory(to_integer(unsigned(Address))) <= Data_in; -- Affectation des donnรฉes ร la case avec (address) | |
60 | + end if; | |
61 | + if(Read_en = '1') then -- Si l'option lรฉcture de mรฉmoire est activรฉ on lit dans le mรฉmoire | |
62 | + Data_out <= memory(to_integer(unsigned(Address))); -- Lรฉcriture de la case en Data_out. | |
63 | + end if; | |
64 | + end if; | |
65 | + end process; | |
66 | +end Behavioral; | ... | ... |
1 | +++ a/Exercice_2/README.md | ... | ... |
1 | +++ a/Exercice_2/ROM_Infering.vhd | |
... | ... | @@ -0,0 +1,64 @@ |
1 | +---------------------------------------------------------------------------------- | |
2 | +-- Company: | |
3 | +-- Engineer: | |
4 | +-- | |
5 | +-- Create Date: 19.10.2023 16:14:20 | |
6 | +-- Design Name: | |
7 | +-- Module Name: ROM_Infering - 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 | + | |
21 | + | |
22 | +library IEEE; | |
23 | +use IEEE.STD_LOGIC_1164.ALL; | |
24 | +use IEEE.NUMERIC_STD.ALL; -- Utilisation de NUMERIC_STD pour faire la conversion std_logic_vector to integer. | |
25 | +-- Uncomment the following library declaration if using | |
26 | +-- arithmetic functions with Signed or Unsigned values | |
27 | +--use IEEE.NUMERIC_STD.ALL; | |
28 | + | |
29 | +-- Uncomment the following library declaration if instantiating | |
30 | +-- any Xilinx leaf cells in this code. | |
31 | +--library UNISIM; | |
32 | +--use UNISIM.VComponents.all; | |
33 | + | |
34 | +entity ROM_Infering is | |
35 | + generic( | |
36 | + Address_Bits : Integer := 5; -- Les adress mรฉmoires sot sur 5 bits donc 32 Case mรฉmoire. (Juste pour simplifier loading aprรฉs). | |
37 | + Data_Bits : Integer := 8 -- Dรฉclaration de nombre des Bits des donnรฉes. | |
38 | + ); | |
39 | + Port ( | |
40 | + Read_en, clk_in : in std_logic; -- Le signal d'horloge, | |
41 | + address: in std_logic_vector(Address_Bits-1 downto 0); -- L'address pour acceder au case mรฉmoire. | |
42 | + Data_out : out std_logic_vector(Data_Bits-1 downto 0) -- Les donnรฉes a lire depuis la mรฉmoire RAM. | |
43 | + ); | |
44 | +end ROM_Infering; | |
45 | + | |
46 | +architecture Behavioral of ROM_Infering is | |
47 | +-- Dรฉclaration de la mรฉmoire comme un tableau de 2**Address_Bits = 32 cases mรฉmoires. | |
48 | +-- Chaque case est une vecteur de 8 Btis (Data_Bits-1 donwto 0) = 8 | |
49 | +type ROM is array (0 to 2**Address_Bits-1) of std_logic_vector(Data_Bits-1 downto 0); | |
50 | +-- Affectation manuelle des 32 cases mรฉmoire avec des valeurs en Hexadรฉcimal X"AA" ou en binaire par "00001101" example. | |
51 | +signal ROM_memory : ROM := (X"00",X"01",X"10",X"11",X"20",X"21",X"22",X"30", | |
52 | + X"31",X"32",X"33",X"40",X"41",X"42",X"43",X"44", | |
53 | + X"50",X"51",X"52",X"53", X"54",X"55",X"60",X"61", | |
54 | + X"62",X"63",X"64",X"65", X"66",X"67",X"68",X"69"); | |
55 | +begin | |
56 | + ROM_Read : process(clk_in) | |
57 | + begin | |
58 | + if(rising_edge(clk_in)) then | |
59 | + if Read_en = '1' then -- Si le signal d'entrรฉes Read_enable est activรฉ en lit a partir du mรฉmoire. | |
60 | + Data_out <= ROM_memory(to_integer(unsigned(address))); | |
61 | + end if; | |
62 | + end if; | |
63 | + end process; | |
64 | +end Behavioral; | ... | ... |
155 KB
1 | +++ a/Exercice_3/InOut_Pin.vhd | |
... | ... | @@ -0,0 +1,46 @@ |
1 | +---------------------------------------------------------------------------------- | |
2 | +-- Company: | |
3 | +-- Engineer: | |
4 | +-- | |
5 | +-- Create Date: 19.10.2023 17:24:45 | |
6 | +-- Design Name: | |
7 | +-- Module Name: InOut_Pin - 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 | + | |
21 | + | |
22 | +library IEEE; | |
23 | +use IEEE.STD_LOGIC_1164.ALL; | |
24 | + | |
25 | +-- Uncomment the following library declaration if using | |
26 | +-- arithmetic functions with Signed or Unsigned values | |
27 | +--use IEEE.NUMERIC_STD.ALL; | |
28 | + | |
29 | +-- Uncomment the following library declaration if instantiating | |
30 | +-- any Xilinx leaf cells in this code. | |
31 | +--library UNISIM; | |
32 | +--use UNISIM.VComponents.all; | |
33 | + | |
34 | +entity InOut_Pin is | |
35 | + Port ( Pin : inout STD_LOGIC); | |
36 | +end InOut_Pin; | |
37 | + | |
38 | +architecture Behavioral of InOut_Pin is | |
39 | +begin | |
40 | + Inout_Pin :process(Pin) | |
41 | + begin | |
42 | + if(rising_edge(Pin)) then | |
43 | + Pin <= '0'; | |
44 | + end if; | |
45 | + end process; | |
46 | +end Behavioral; | |
0 | 47 | \ No newline at end of file | ... | ... |
1 | +++ a/Exercice_3/README.md | ... | ... |
1 | +++ a/Exercice_4/Adder_Generic.vhd | |
... | ... | @@ -0,0 +1,54 @@ |
1 | +---------------------------------------------------------------------------------- | |
2 | +-- Company: | |
3 | +-- Engineer: | |
4 | +-- | |
5 | +-- Create Date: 08.10.2023 15:22:15 | |
6 | +-- Design Name: | |
7 | +-- Module Name: Generic unsigned full Adder - 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.NUMERIC_STD.ALL; | |
23 | +use ieee.std_logic_unsigned.all; | |
24 | + | |
25 | +-- Uncomment the following library declaration if instantiating | |
26 | +-- any Xilinx leaf cells in this code. | |
27 | +--library UNISIM; | |
28 | +--use UNISIM.VComponents.all; | |
29 | +entity Adder_Generic is | |
30 | + generic( N : Integer := 256); | |
31 | + Port ( | |
32 | + clk_in, reset : in std_logic; | |
33 | + a_in, b_in : in std_logic_vector(N-1 downto 0); | |
34 | + s_out : out std_logic_vector(N downto 0) | |
35 | + ); | |
36 | +end Adder_Generic; | |
37 | +-- | |
38 | +architecture Behavioral of Adder_Generic is | |
39 | +signal ain_add : signed(N downto 0); | |
40 | +signal bin_add : signed(N downto 0); | |
41 | +signal s_out_d : signed(N downto 0); | |
42 | +begin | |
43 | + s_out_d <= ain_add + bin_add; | |
44 | + process(clk_in, reset) | |
45 | + begin | |
46 | + if reset = '1' then | |
47 | + s_out <= (others => '0'); | |
48 | + elsif rising_edge(clk_in) then | |
49 | + ain_add <= resize(signed(a_in),N+1); | |
50 | + bin_add <= resize(signed(b_in),N+1); | |
51 | + s_out <= std_logic_vector(s_out_d); | |
52 | + end if; | |
53 | + end process; | |
54 | +end Behavioral; | |
0 | 55 | \ No newline at end of file | ... | ... |
1 | +++ a/Exercice_4/Adder_full_signed.vhd | |
... | ... | @@ -0,0 +1,39 @@ |
1 | +library ieee; | |
2 | +use ieee.std_logic_1164.all; | |
3 | +use ieee.numeric_std.all; | |
4 | + | |
5 | +entity Adder_full_signed is | |
6 | +generic( N : integer := 512); | |
7 | +port ( | |
8 | + i_clk : in std_logic; | |
9 | + i_add1 : in std_logic_vector(N-1 downto 0); | |
10 | + i_add2 : in std_logic_vector(N-1 downto 0); | |
11 | + o_sum : out std_logic_vector(N downto 0)); | |
12 | +end Adder_full_signed; | |
13 | + | |
14 | +architecture rtl of Adder_full_signed is | |
15 | + | |
16 | +signal r_add1 : signed(N downto 0); | |
17 | +signal r_add2 : signed(N downto 0); | |
18 | +signal w_sum : signed(N downto 0); | |
19 | + | |
20 | +begin | |
21 | + | |
22 | +-- combinatorial adder | |
23 | + w_sum <= r_add1 + r_add2; | |
24 | + | |
25 | +r_process : process(i_clk) | |
26 | +begin | |
27 | + if(rising_edge(i_clk)) then | |
28 | + | |
29 | + -- register input and extend sign | |
30 | + r_add1 <= resize(signed(i_add1),N+1); | |
31 | + r_add2 <= resize(signed(i_add2),N+1); | |
32 | + | |
33 | + -- register output | |
34 | + o_sum <= std_logic_vector(w_sum); | |
35 | + | |
36 | + end if; | |
37 | +end process r_process; | |
38 | + | |
39 | +end rtl; | |
0 | 40 | \ No newline at end of file | ... | ... |
1 | +++ a/README.md | ... | ... |