otsdaq_prepmodernization
v2_05_02_indev
Return to top level
Main Page
Classes
Files
File List
Sample_Manager.vhd
1
-------------------------------------------------------------------------------
2
--
3
-- Title : Sample_Manager
4
-- Design : PsiDecoder
5
-- Author : Desktop Support
6
-- Company : FNAL
7
--
8
-------------------------------------------------------------------------------
9
--
10
-- File : c:\My_Designs\PsiDecoder\PsiDecoder\src\Sample_Manager.vhd
11
-- Generated : Mon Feb 16 11:53:11 2009
12
-- From : interface description file
13
-- By : Itf2Vhdl ver. 1.20
14
--
15
-------------------------------------------------------------------------------
16
--
17
-- Description :
18
--
19
-------------------------------------------------------------------------------
20
21
use
PsiDecoderParameters.all
;
22
23
--{{ Section below this comment is automatically maintained
24
-- and may be overwritten
25
--{entity {Sample_Manager} architecture {Sample_Manager}}
26
27
library
IEEE
;
28
use
IEEE.STD_LOGIC_1164.
all
;
29
30
31
entity
Sample_Manager
is
32
port
(
33
ADC_DATA_IN
:
in
STD_LOGIC_VECTOR
(
adc_bits_P
-
1
downto
0
)
;
34
ADC_WR_EN
:
in
STD_LOGIC
;
35
EN_MAN_SAMPLE_SEL
:
in
STD_LOGIC
;
36
MAN_SAMPLE_SEL
:
in
STD_LOGIC
;
37
MASTER_CLOCK
:
in
STD_LOGIC
;
38
managed_data
:
out
STD_LOGIC_VECTOR
(
adc_bits_P
-
1
downto
0
)
;
39
wr_en
:
out
STD_LOGIC
40
)
;
41
end
Sample_Manager
;
42
43
--}} End of automatically maintained section
44
45
architecture
Sample_Manager
of
Sample_Manager
is
46
signal
data_label
:
std_logic
:=
'
0
'
;
47
signal
sample_sel
:
std_logic
:=
'
0
'
;
-- use first value after 500 samples lower than 470("0111010110") as selected sample.. (lowest sample wins)
48
signal
sample_cnt
:
integer
range
0
to
511
:=
0
;
49
signal
check_other_label
:
std_logic
:=
'
0
'
;
50
signal
save_val
:
STD_LOGIC_VECTOR
(
adc_bits_P
-
1
downto
0
)
;
51
begin
52
process
( MASTER_CLOCK )
53
begin
54
if
rising_edge
(
MASTER_CLOCK
)
then
55
56
wr_en
<=
'
0
'
;
57
58
if
ADC_WR_EN
=
'
1
'
then
59
60
data_label
<=
not
data_label
;
61
if
(
EN_MAN_SAMPLE_SEL
=
'
0
'
and
data_label
=
sample_sel
)
or
(
EN_MAN_SAMPLE_SEL
=
'
1
'
and
data_label
=
MAN_SAMPLE_SEL
)
then
62
managed_data
<=
ADC_DATA_IN
;
63
wr_en
<=
'
1
'
;
64
end
if
;
65
66
67
-- find correct sample to select
68
69
if
ADC_DATA_IN
>=
"0100101100"
and
sample_cnt
<
500
then
70
sample_cnt
<=
sample_cnt
+
1
;
71
end
if
;
72
73
if
sample_cnt
=
500
and
ADC_DATA_IN
<
"0110010000"
then
--CHANGED TO 400!! (Sept 2010)-- "0111010110" then -- found first potential UB
74
check_other_label
<=
'
1
'
;
75
save_val
<=
ADC_DATA_IN
;
76
end
if
;
77
78
if
check_other_label
=
'
1
'
then
-- check other potential UB
79
80
if
ADC_DATA_IN
<
save_val
then
-- DECIDE SAMPLE SELECT HERE!!!
81
sample_sel
<=
data_label
;
82
else
83
sample_sel
<=
not
data_label
;
84
end
if
;
85
86
check_other_label
<=
'
0
'
;
87
sample_cnt
<=
0
;
88
end
if
;
89
90
91
end
if
;
92
end
if
;
93
end
process
;
94
95
end
Sample_Manager
;
Sample_Manager
Definition:
Sample_Manager.vhd:31
otsdaq_prepmodernization
firmware
g-2
KickerControllerFirmware
GEL_CAPTAN
Sample_Manager.vhd
Generated on Wed Apr 29 2020 18:41:42 for otsdaq_prepmodernization by
1.8.5