-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFSMUART.vhd
More file actions
66 lines (53 loc) · 1.47 KB
/
Copy pathFSMUART.vhd
File metadata and controls
66 lines (53 loc) · 1.47 KB
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
library ieee;
use ieee.std_logic_1164.all;
entity FSMUART is
port (
infoEtat : in std_logic_vector(1 downto 0);
UART_IRQ : in std_logic;
RSC : in std_logic_vector(7 downto 0);
ADDR2 : out std_logic_vector(1 downto 0);
Rw : out std_logic;
sel : out std_logic_vector(2 downto 0);
RCC : out std_logic;
Msg : out string(1 to 5);
end FSMUART;
architecture rtl of FSMUART is
component BAUD
port(Sysclk, rst_b: in std_logic;
Sel: in std_logic_vector(2 downto 0);
BclkX8: buffer std_logic;
Bclk: out std_logic);
end component;
component UART
port (
port (
UART_sel, R_W, clk, rst_b, RxD : in std_logic;
ADDR2: in std_logic_vector(1 downto 0);
DBUS : inout std_logic_vector(7 downto 0);
UART_IRQ, TxD : out std_logic);
end component;
component FSMController
port(
i_load: in std_logic;
clk_G, reset_G : in std_logic;
infoEtat : out std_logic_vector(1 downto 0);
end component;
begin
signal BaudSel : std_logic_vector(2 downto 0);
signal Bclk, BclkX8: std_logic;
signal Etat : std_logic_vector(1 downto 0);
VitesseBaud : BAUD port map(clk, rst_b, BaudSel, BclkX8, Bclk);
trafficlight : FSMController port map (1, Bclk, GReset, Etat);
process(Bclk)
begin
if Etat = "00" then
Msg <= "Pv_Lr"; --ETAPE A
elsif Etat = "01" then
Msg <="Pj_Lr"; --ETAPE B
elsif Etat = "10" then
Msg <="Pr_Lv"; --ETAPE C
elsif Etat = "11" then
Msg <="Pv_Lj"; --ETAPE D
end if;
end process;
end rtl;