eFEX firmware
1.7.3
ATLAS l1-calo - electron and tau feature extraction firmware for eFEX boards
Back to eFEX documentation
Readout
src
cntr_up_dn_generic.vhd
Go to the documentation of this file.
1
11
12
13
library
IEEE
;
14
use
IEEE.STD_LOGIC_1164.
ALL
;
15
USE
ieee.std_logic_arith.
all
;
16
18
entity
cntr_up_dn_generic
is
19
generic
(
20
width
:
integer
:=
16
21
)
;
22
Port
(
24
CE
:
in
STD_LOGIC
;
26
CLK
:
in
STD_LOGIC
;
28
RST
:
in
STD_LOGIC
;
30
UP
:
in
STD_LOGIC
;
32
DOWN
:
in
STD_LOGIC
;
34
Q
:
out
STD_LOGIC_VECTOR
(
width
-
1
downto
0
)
35
)
;
36
end
cntr_up_dn_generic
;
37
39
architecture
Behavioral
of
cntr_up_dn_generic
is
40
41
signal
temp
:
unsigned
(
width
-
1
downto
0
)
;
42
43
begin
44
process
(
CLK
)
45
begin
46
if
CLK
'
event
AND
CLK
=
'
1
'
then
47
if
RST
=
'
1
'
then
-- this is a synchronous reset
48
temp
<=
(
others
=
>
'
0
'
)
;
-- set counter to offset value given.
49
else
50
if
UP
=
'
1
'
AND
DOWN
=
'
0
'
then
51
temp
<=
temp
+
1
;
-- else increment the value by one
52
else
53
if
UP
=
'
0
'
AND
DOWN
=
'
1
'
then
54
if
temp
>
0
then
-- if count > 0
55
temp
<=
temp
-
1
;
-- else decrement the value by one
56
end
if
;
57
else
58
temp
<=
temp
;
-- do nothing
59
end
if
;
60
end
if
;
61
end
if
;
62
end
if
;
63
end
process
;
64
Q
<=
std_logic_vector
(
temp
)
;
-- push out new value
65
66
end
Behavioral;
cntr_up_dn_generic.Behavioral
Up/Down counter.
Definition:
cntr_up_dn_generic.vhd:39
cntr_up_dn_generic
Up/Down counter.
Definition:
cntr_up_dn_generic.vhd:18
cntr_up_dn_generic.CLK
in CLK STD_LOGIC
Clock signal input.
Definition:
cntr_up_dn_generic.vhd:26
cntr_up_dn_generic.DOWN
in DOWN STD_LOGIC
Count DOWN signal input.
Definition:
cntr_up_dn_generic.vhd:32
cntr_up_dn_generic.CE
in CE STD_LOGIC
Enable signal input.
Definition:
cntr_up_dn_generic.vhd:24
cntr_up_dn_generic.Q
out Q STD_LOGIC_VECTOR( width- 1 downto 0)
Counter Output signal.
Definition:
cntr_up_dn_generic.vhd:35
cntr_up_dn_generic.RST
in RST STD_LOGIC
Reset signal input.
Definition:
cntr_up_dn_generic.vhd:28
cntr_up_dn_generic.UP
in UP STD_LOGIC
Count UP signal input.
Definition:
cntr_up_dn_generic.vhd:30
Generated on Tue Nov 11 2025 09:44:32 for eFEX firmware by
1.9.1