-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJackController.vhd
153 lines (150 loc) · 5.41 KB
/
JackController.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
use IEEE.std_logic_unsigned.all;
entity JackController is
port (
clk : in std_logic;
RX_RS485 : in std_logic;
TX_RS485 : out std_logic;
DIR_RS485 : out std_logic;
Parameter_Bank_Jack_ID : in std_logic_vector(2 downto 0);
Parameter_Bank_Read_Request : out std_logic;
Parameter_Bank_Read_Address : out std_logic_vector(7 downto 0);
Parameter_Bank_Read_Response : in std_logic;
Parameter_Bank_Read_Data : in std_logic_vector(15 downto 0);
Parameter_Bank_Write_Request : out std_logic;
Parameter_Bank_Write_Address : out std_logic_vector(7 downto 0);
Parameter_Bank_Write_Data : out std_logic_vector(15 downto 0);
Parameter_Bank_Write_Done : in std_logic
);
end JackController;
architecture Behavioral of JackController is
component Debounce is
generic (
depth : in natural
);
port (
clk : in std_logic;
original : in std_logic;
filtered : out std_logic
);
end component;
component Frame_Transmitter is
port (
clk : in std_logic;
TX_RS485 : out std_logic;
Tx_Start : in std_logic;
Tx_Frame_Type : in std_logic_vector(1 downto 0);
Tx_Jack_Nember : in std_logic_vector(2 downto 0);
Tx_Parameter_Address : in std_logic_vector(7 downto 0);
Tx_Parameter_Value : in std_logic_vector(15 downto 0);
Tx_Busy : out std_logic
);
end component;
component Frame_Receiver is
port (
clk : in std_logic;
RX_RS485 : in std_logic;
Rx_Ready : out std_logic;
Rx_Frame_Type : out std_logic_vector(1 downto 0);
Rx_Jack_Nember : out std_logic_vector(2 downto 0);
Rx_Parameter_Address : out std_logic_vector(7 downto 0);
Rx_Parameter_Value : out std_logic_vector(15 downto 0)
);
end component;
component Jack_Controller_Main_State_Machine is
port (
clk : in std_logic;
DIR_RS485 : out std_logic;
Tx_Start : out std_logic;
Tx_Frame_Type : out std_logic_vector(1 downto 0);
Tx_Jack_Nember : out std_logic_vector(2 downto 0);
Tx_Parameter_Address : out std_logic_vector(7 downto 0);
Tx_Parameter_Value : out std_logic_vector(15 downto 0);
Tx_Busy : in std_logic;
Rx_Ready : in std_logic;
Rx_Frame_Type : in std_logic_vector(1 downto 0);
Rx_Jack_Nember : in std_logic_vector(2 downto 0);
Rx_Parameter_Address : in std_logic_vector(7 downto 0);
Rx_Parameter_Value : in std_logic_vector(15 downto 0);
Parameter_Bank_Jack_ID : in std_logic_vector(2 downto 0);
Parameter_Bank_Read_Request : out std_logic;
Parameter_Bank_Read_Address : out std_logic_vector(7 downto 0);
Parameter_Bank_Read_Response : in std_logic;
Parameter_Bank_Read_Data : in std_logic_vector(15 downto 0);
Parameter_Bank_Write_Request : out std_logic;
Parameter_Bank_Write_Address : out std_logic_vector(7 downto 0);
Parameter_Bank_Write_Data : out std_logic_vector(15 downto 0);
Parameter_Bank_Write_Done : in std_logic
);
end component;
signal Tx_Start : std_logic := '0';
signal Tx_Frame_Type : std_logic_vector(1 downto 0) := (others => '0');
signal Tx_Jack_Nember : std_logic_vector(2 downto 0) := (others => '0');
signal Tx_Parameter_Address : std_logic_vector(7 downto 0) := (others => '0');
signal Tx_Parameter_Value : std_logic_vector(15 downto 0) := (others => '0');
signal Tx_Busy : std_logic := '0';
signal RX_RS485_F : std_logic := '1';
signal Rx_Ready : std_logic := '0';
signal Rx_Frame_Type : std_logic_vector(1 downto 0) := (others => '0');
signal Rx_Jack_Nember : std_logic_vector(2 downto 0) := (others => '0');
signal Rx_Parameter_Address : std_logic_vector(7 downto 0) := (others => '0');
signal Rx_Parameter_Value : std_logic_vector(15 downto 0) := (others => '0');
begin
RS485_Frame_Transmitter : Frame_Transmitter
port map (
clk => clk,
TX_RS485 => TX_RS485,
Tx_Start => Tx_Start,
Tx_Frame_Type => Tx_Frame_Type,
Tx_Jack_Nember => Tx_Jack_Nember,
Tx_Parameter_Address => Tx_Parameter_Address,
Tx_Parameter_Value => Tx_Parameter_Value,
Tx_Busy => Tx_Busy
);
RX_RS485_Debounce_Filter : Debounce
generic map (
depth => 4
)
port map (
clk => clk,
original => RX_RS485,
filtered => RX_RS485_F
);
RS485_Frame_Receiver : Frame_Receiver
port map (
clk => clk,
RX_RS485 => RX_RS485_F,
Rx_Ready => Rx_Ready,
Rx_Frame_Type => Rx_Frame_Type,
Rx_Jack_Nember => Rx_Jack_Nember,
Rx_Parameter_Address => Rx_Parameter_Address,
Rx_Parameter_Value => Rx_Parameter_Value
);
Main_FSM : Jack_Controller_Main_State_Machine
port map (
clk => clk,
DIR_RS485 => DIR_RS485,
Tx_Start => Tx_Start,
Tx_Frame_Type => Tx_Frame_Type,
Tx_Jack_Nember => Tx_Jack_Nember,
Tx_Parameter_Address => Tx_Parameter_Address,
Tx_Parameter_Value => Tx_Parameter_Value,
Tx_Busy => Tx_Busy,
Rx_Ready => Rx_Ready,
Rx_Frame_Type => Rx_Frame_Type,
Rx_Jack_Nember => Rx_Jack_Nember,
Rx_Parameter_Address => Rx_Parameter_Address,
Rx_Parameter_Value => Rx_Parameter_Value,
Parameter_Bank_Jack_ID => Parameter_Bank_Jack_ID,
Parameter_Bank_Read_Request => Parameter_Bank_Read_Request,
Parameter_Bank_Read_Address => Parameter_Bank_Read_Address,
Parameter_Bank_Read_Response => Parameter_Bank_Read_Response,
Parameter_Bank_Read_Data => Parameter_Bank_Read_Data,
Parameter_Bank_Write_Request => Parameter_Bank_Write_Request,
Parameter_Bank_Write_Address => Parameter_Bank_Write_Address,
Parameter_Bank_Write_Data => Parameter_Bank_Write_Data,
Parameter_Bank_Write_Done => Parameter_Bank_Write_Done
);
end Behavioral;