Bonjour à tous,
Voila mon problème,
j'ai en entrée plusieurs registres que je veux mettre sous forme de matrice,
je voudrais ensuite vérifier la parité horizontale et verticale de cette matrice.
par exemple en entrée j'ai 4 registres 0000, 0001, 0010, 1111
je veux les mettre dans une matrice de tel sorte qu'ils soient:
0000
0001
0010
1111
pour pouvoir ensuite calculé la parité de chaque ligne et de chaque colonne.
Si quelqu'un à une idée je suis preneurs.
voila mon code
merci à tous
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68 ---------------------------------------------------------------------------------- -- Company: -- Engineer: -- -- Create Date: 14:02:50 05/21/2013 -- Design Name: -- Module Name: parity_matrice - Behavioral -- Project Name: -- Target Devices: -- Tool versions: -- Description: -- -- Dependencies: -- -- Revision: -- Revision 0.01 - File Created -- Additional Comments: -- ---------------------------------------------------------------------------------- library IEEE; use IEEE.STD_LOGIC_1164.ALL; -- Uncomment the following library declaration if using -- arithmetic functions with Signed or Unsigned values --use IEEE.NUMERIC_STD.ALL; -- Uncomment the following library declaration if instantiating -- any Xilinx primitives in this code. --library UNISIM; --use UNISIM.VComponents.all; entity test is generic ( size_i : integer :=4; size_j : integer :=4 ); end test; architecture behave of test is type dataout is array (size_i downto 0,size_j downto 0) of std_logic; signal a : dataout := ("0000", "1111", "1010","0100"); signal b_i : bit; signal b_j : bit; begin -- behave process variable parite_i : bit; variable parite_j : bit; begin -- process parite_i :='1'; parite_j :='1'; for i in 0 to size_i loop for j in 0 to size_j loop if a(i) ='1' then parite_i := not parite_i; end if; if a(j) ='1' then parite_j := not parite_j; end if; end loop; -- j end loop; -- i b_i <= parite_i; b_j <= parite_j; wait; end process; end behave;
Partager