-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCarParkTop.vhd
148 lines (140 loc) · 5.98 KB
/
CarParkTop.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
---------------------------------------------------------------------------------------------------------------------------------
-- CODE VERSION v2
---------------------------------------------------------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.Numeric_std.all;
use work.Parking_Package.all;
entity CarParkTOP is
port( clk :in std_logic;
rst : in std_logic;
Car_Ent: in std_logic; -- Car Entry in the parking lot
Car_Ext: in std_logic; -- Car Exit from the parking lot
Status_Top: out std_logic -- vacancy status '0'-> Wait, '1'-> allow
);
end CarParkTOP;
architecture TOP of CarParkTOP is
component CarParkCntlr is
port( clk :in std_logic;
rst : in std_logic;
car_in : in std_logic;
Car_out : in std_logic;
GatePerm:in std_logic;
Admin_In : out std_logic;
Staff_In : out std_logic;
Visitor_In : out std_logic;
DisAbel_In : out std_logic;
Admin_Out : out std_logic;
Staff_Out : out std_logic;
Visitor_Out : out std_logic;
DisAbel_Out : out std_logic;
Status : out std_logic := '0';
Ent_car_type : car_type;
Ext_car_type : car_type
);
end component;
component counter is
port( clk : in std_logic;
rst : in std_logic;
Admin_In : in std_logic;
Staff_In : in std_logic;
Visitor_In : in std_logic;
DisAbel_In : in std_logic;
Admin_Out : in std_logic;
Staff_Out : in std_logic;
Visitor_Out : in std_logic;
DisAbel_Out : in std_logic;
GatePerm :out std_logic
);
end component;
signal GatePerm_Count_Ctrl : std_logic;
signal Admin_In_Count_Ctrl : std_logic;
signal Staff_In_Count_Ctrl : std_logic;
signal Visitor_In_Count_Ctrl : std_logic;
signal DisAbel_In_Count_Ctrl : std_logic;
signal Admin_Out_Ctrl_Count : std_logic;
signal Staff_Out_Ctrl_Count : std_logic;
signal Visitor_Out_Ctrl_Count : std_logic;
signal DisAbel_Out_Ctrl_Count : std_logic;
signal Top_Car_Ent : Car_type;
signal Top_Car_Ext : Car_type;
begin
Controller: entity work.CarParkCntlr port map(clk => clk, rst => rst, car_in => Car_Ent, Car_out =>Car_Ext,
GatePerm => GatePerm_Count_Ctrl, Admin_In => Admin_In_Count_Ctrl,
Staff_In => Staff_In_Count_Ctrl, Visitor_Out => Visitor_Out_Ctrl_Count,
DisAbel_Out => DisAbel_Out_Ctrl_Count, Status => Status_Top, Ent_car_type => Top_Car_Ent, Ext_car_type => Top_Car_Ext);
VacancyTracker: entity work.counter port map(clk => clk, rst => rst, Admin_In => Admin_In_Count_Ctrl,
Staff_In => Staff_In_Count_Ctrl, Visitor_In => Visitor_In_Count_Ctrl, DisAbel_In => DisAbel_In_Count_Ctrl,
Admin_Out => Admin_Out_Ctrl_Count, Staff_Out => Staff_Out_Ctrl_Count, Visitor_Out =>Visitor_Out_Ctrl_Count,
DisAbel_Out => DisAbel_Out_Ctrl_Count,GatePerm => GatePerm_Count_Ctrl);
end TOP;
------------------------------------------------------------------------------------------------------------------------------------
-- CODE v1.0
------------------------------------------------------------------------------------------------------------------------------------
-- library ieee;
-- use ieee.std_logic_1164.all;
-- use ieee.Numeric_std.all;
-- entity CarParkTOP is
-- port( clk :in std_logic;
-- rst : in std_logic;
-- Car_Ent: in std_logic; -- Car Entry in the parking lot
-- Car_Ext: in std_logic; -- Car Exit from the parking lot
-- Status_Top: out std_logic -- vacancy status '0'-> Wait, '1'-> allow
-- );
-- end CarParkTOP;
--
--architecture TOP of CarParkTOP is
-- component CarParkCntlr is
-- port( car_in : in std_logic;
-- Car_out : in std_logic;
-- GatePerm:in std_logic;
-- Admin_In : out std_logic;
-- Staff_In : out std_logic;
-- Visitor_In : out std_logic;
-- DisAbel_In : out std_logic;
-- Admin_Out : out std_logic;
-- Staff_Out : out std_logic;
-- Visitor_Out : out std_logic;
-- DisAbel_Out : out std_logic;
-- Status : out std_logic := '0'
-- );
-- end component;
--
-- component counter is
-- port( clk : in std_logic;
-- rst : in std_logic;
-- Admin_In : in std_logic;
-- Staff_In : in std_logic;
-- Visitor_In : in std_logic;
-- DisAbel_In : in std_logic;
-- Admin_Out : in std_logic;
-- Staff_Out : in std_logic;
-- Visitor_Out : in std_logic;
-- DisAbel_Out : in std_logic;
-- GatePerm:out std_logic
-- );
-- end component;
--
-- signal GatePerm_Count_Ctrl : std_logic;
-- signal Admin_In_Count_Ctrl : std_logic;
-- signal Staff_In_Count_Ctrl : std_logic;
-- signal Visitor_In_Count_Ctrl : std_logic;
-- signal DisAbel_In_Count_Ctrl : std_logic;
-- signal Admin_Out_Ctrl_Count : std_logic;
-- signal Staff_Out_Ctrl_Count : std_logic;
-- signal Visitor_Out_Ctrl_Count : std_logic;
-- signal DisAbel_Out_Ctrl_Count : std_logic;
-- begin
-- Controller: entity work.CarParkCntlr port map( car_in => Car_Ent, Car_out =>Car_Ext,
-- GatePerm => GatePerm_Count_Ctrl, Admin_In => Admin_In_Count_Ctrl,
-- Staff_In => Staff_In_Count_Ctrl, Visitor_Out => Visitor_Out_Ctrl_Count,
-- DisAbel_Out => DisAbel_Out_Ctrl_Count, Status => Status_Top);
--
-- VacancyTracker: entity work.counter port map(clk => clk, rst => rst, Admin_In => Admin_In_Count_Ctrl,
-- Staff_In => Staff_In_Count_Ctrl, Visitor_In => Visitor_In_Count_Ctrl, DisAbel_In => DisAbel_In_Count_Ctrl,
-- Admin_Out => Admin_Out_Ctrl_Count, Staff_Out => Staff_Out_Ctrl_Count, Visitor_Out =>Visitor_Out_Ctrl_Count,
-- DisAbel_Out => DisAbel_Out_Ctrl_Count,GatePerm => GatePerm_Count_Ctrl);
--
-- end TOP;
--
------------------------------------------------------------------------------------------------------------------------------------