-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmsa_modifie.vhd
125 lines (117 loc) · 2.05 KB
/
msa_modifie.vhd
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity msa_hdl is
Port ( clkin : in STD_LOGIC;
rst : in STD_LOGIC;
b0 : in STD_LOGIC;
b1 : in STD_LOGIC;
gs : in STD_LOGIC;
enable_del : out STD_LOGIC);
end msa_hdl;
architecture Behavioral of msa_hdl is
type etat is (a,b,c,d,e,f,g,h);
type etats is array (positive range <>) of etat;
signal etatpres, etatsuiv : etat ;
signal etat1 : etats(1 to 5);
signal i : integer ;
begin
--registre d'état
xreg: process(rst,clkin)
begin
etat1 <= a & a & a & a & a ;
i <= 0 ;
if(rst = '1')then
etatpres <= etat1(0);
elsif(clkin'event and clkin = '1')then
etatpres <= etatsuiv;
end if;
end process;
--IFL
xifl: process(etatpres, b1,b0,gs)
begin
case etatpres is
when a =>
if(gs = '1' and b1 = '0' and b0 = '0')then
i <= i+ 1 ;
if(i = 5 ) then
etatsuiv <= h ;
else
etatsuiv <= etat1(i);
end if;
else
etatsuiv <= a;
end if;
when b =>
if(gs = '0')then
etatsuiv <= c;
else
etatsuiv <= b;
end if;
when c =>
if(gs = '1') then
if(b1 = '0' and b0 = '1') then
i <= i+ 1 ;
if(i = 5 ) then
etatsuiv <= h ;
else
etatsuiv <= etat1(i);
end if;
else
etatsuiv <= a;
end if;
else
etatsuiv <= c;
end if;
when d =>
if(gs = '0')then
etatsuiv <= e;
else
etatsuiv <= d;
end if;
when e =>
if(gs = '1') then
if(b1 = '1' and b0 = '0') then
i <= i+ 1 ;
if(i = 5 ) then
etatsuiv <= h ;
else
etatsuiv <= etat1(i);
end if;
else
etatsuiv <= a;
end if;
else
etatsuiv <= e;
end if;
-- On rajoute 2 états
when f =>
if(gs = '0')then
etatsuiv <= g;
else
etatsuiv <= f;
end if;
when g =>
if(gs = '1') then
if(b1 = '1' and b0 = '1') then
i <= i+ 1 ;
if(i = 5)then
etatsuiv <= h ;
else
etatsuiv <= etat1(i);
end if;
else
etatsuiv <= a;
end if;
else
etatsuiv <= g;
end if;
when h =>
etatsuiv <= h;
when others => etatsuiv <= a;
end case;
end process;
--OFL
enable_del <= '1' when etatpres = h else '0';
end Behavioral;