-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVertical_Padding_Counter.vhd
More file actions
63 lines (48 loc) · 1.96 KB
/
Copy pathVertical_Padding_Counter.vhd
File metadata and controls
63 lines (48 loc) · 1.96 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
LIBRARY IEEE;
USE IEEE.std_logic_1164.ALL;
USE IEEE.numeric_std.ALL;
ENTITY Vertical_Padding_Counter IS
PORT( clk : IN std_logic;
reset : IN std_logic;
enb : IN std_logic;
frameEnd : IN std_logic;
unloading : IN std_logic;
running : IN std_logic;
lineStart : IN std_logic;
VCount : OUT std_logic_vector(10 DOWNTO 0) -- ufix11
);
END Vertical_Padding_Counter;
ARCHITECTURE rtl OF Vertical_Padding_Counter IS
-- Signals
SIGNAL runningStart : std_logic;
SIGNAL unloadingStart : std_logic;
SIGNAL VerticalPadCounter : unsigned(10 DOWNTO 0); -- ufix11
SIGNAL prePad : std_logic;
SIGNAL runCountEn : std_logic;
SIGNAL verCountEn : std_logic;
BEGIN
runningStart <= running AND lineStart;
unloadingStart <= unloading AND lineStart;
prePad <= '1' WHEN VerticalPadCounter < to_unsigned(16#007#, 11) ELSE
'0';
runCountEn <= runningStart AND prePad;
verCountEn <= runCountEn OR unloadingStart;
-- Free running, Unsigned Counter
-- initial value = 0
-- step value = 1
Vertical_Counter_process : PROCESS (clk)
BEGIN
IF clk'EVENT AND clk = '1' THEN
IF reset = '1' THEN
VerticalPadCounter <= to_unsigned(16#000#, 11);
ELSIF enb = '1' THEN
IF frameEnd = '1' THEN
VerticalPadCounter <= to_unsigned(16#000#, 11);
ELSIF verCountEn = '1' THEN
VerticalPadCounter <= VerticalPadCounter + to_unsigned(16#001#, 11);
END IF;
END IF;
END IF;
END PROCESS Vertical_Counter_process;
VCount <= std_logic_vector(VerticalPadCounter);
END rtl;