ROD firmware
1.0.5
ATLAS l1-calo - ROD_eFEX and ROD_jFEX firmware for the L1Calo ROD board
Back to ROD documentation
ROD
packet_processor
hdl
controller_codes.vhd
1
----------------------------------------------------------------------------------
2
-- Company: University of Cambridge
3
-- Engineer: Ed Flaherty
4
--
5
-- Create Date: 15.02.2017 18:07:11
6
-- Design Name: packet_processor
7
-- Module Name: controller_codes - Behavioral
8
-- Project Name: L1Calo ROD
9
-- Target Devices: V7 550T
10
-- Tool Versions:
11
-- Description: This file describes the states and output codes of a Moore State Machine used to control the event builder
12
--
13
-- Dependencies:
14
--
15
-- Revision:
16
-- Revision 0.01 - File Created
17
-- revision 1.0 - added controls_type bit to mux in second header word
18
-- Additional Comments:
19
--
20
----------------------------------------------------------------------------------
21
22
23
library
IEEE
;
24
use
IEEE.STD_LOGIC_1164.
ALL
;
25
package
controller_codes
is
26
27
constant
StWIDTH
:
integer
:=
6
;
28
subtype
state_type
is
std_logic_vector
(
StWIDTH
-
1
downto
0
)
;
29
constant
wait_for_event
:
state_type
:=
6
x
"11"
;
30
constant
read_ttc
:
state_type
:=
6
x
"12"
;
31
constant
chan_timeout
:
state_type
:=
6
x
"13"
;
32
constant
check_enable
:
state_type
:=
6
x
"1C"
;
33
constant
discard_event
:
state_type
:=
6
x
"14"
;
34
constant
idle_state
:
state_type
:=
"000000"
;
--00
35
constant
load_header
:
state_type
:=
"000001"
;
--01
36
constant
start_reading
:
state_type
:=
"000010"
;
--02
37
constant
header_build
:
state_type
:=
"000011"
;
--03
38
constant
header_build_2
:
state_type
:=
"000100"
;
--04
39
constant
continue_reading
:
state_type
:=
"000101"
;
--05
40
constant
finish_reading
:
state_type
:=
"000110"
;
--06
41
constant
continue_polling
:
state_type
:=
"000111"
;
--07
42
constant
header_blocking
:
state_type
:=
"001000"
;
--08
43
constant
trailer_build
:
state_type
:=
"001001"
;
--09
44
constant
trailer_build_2
:
state_type
:=
"001010"
;
--0A
45
constant
trailer_mux
:
state_type
:=
"001011"
;
--0B
46
constant
wait_chan_in
:
state_type
:=
"001100"
;
--0C
47
constant
check_error
:
state_type
:=
"001101"
;
--0D
48
constant
poll_early
:
state_type
:=
"001110"
;
--0E
49
constant
wait_for_hdr
:
state_type
:=
"001111"
;
--0F
50
constant
trailer_build_3
:
state_type
:=
"010000"
;
--10
51
--inserting corrective trailer
52
constant
pr_corr_trailer
:
state_type
:=
6
x
"15"
;
53
constant
wait_corr_crc
:
state_type
:=
6
x
"16"
;
54
constant
add_corr_trailer
:
state_type
:=
6
x
"17"
;
55
56
--inserting corrective trailer for last channel
57
constant
eval_chan_crc20
:
state_type
:=
6
x
"18"
;
--
58
constant
pr_corr_trlr_lc
:
state_type
:=
6
x
"19"
;
59
constant
wait_corr_crc_lc
:
state_type
:=
6
x
"1A"
;
60
constant
add_corr_trlr_lc
:
state_type
:=
6
x
"1B"
;
61
62
--building empty packet when not TOBs arrive
63
constant
start_empty_pkt
:
state_type
:=
6
x
"31"
;
--31
64
--wait for another packet after multiple bad l1id events on all channels
65
constant
attempt_resync
:
state_type
:=
6
x
"32"
;
--32
66
constant
await_resync
:
state_type
:=
6
x
"33"
;
--33
67
68
--debug states ----
69
constant
dbg_header_build
:
state_type
:=
"100000"
;
--20
70
constant
dbg_header_load
:
state_type
:=
"100001"
;
--21
71
constant
dbg_packet_load
:
state_type
:=
"100010"
;
--22
72
constant
dbg_trailer_build
:
state_type
:=
"100011"
;
--23
73
constant
dbg_trail_build_2
:
state_type
:=
"100100"
;
--24
74
constant
dbg_trail_build_3
:
state_type
:=
"100101"
;
--25
75
constant
dbg_trailer_load
:
state_type
:=
"100110"
;
--26
76
constant
dbg_trlr_ld_last
:
state_type
:=
"100111"
;
--27
77
constant
dbg_pkt_load_1st
:
state_type
:=
"101000"
;
--28
78
79
constant
dbg_trlr_inc_chan
:
state_type
:=
6
x
"29"
;
--29
80
constant
dbg_bad_l1ID
:
state_type
:=
"110000"
;
--30
81
82
constant
dbg_wait_for_hdr
:
state_type
:=
6
x
"34"
;
--34
83
84
subtype
controls_type
is
std_logic_vector
(
35
downto
0
)
;
85
--
86
-- |<-----------------------------------34 chan_timeout (not currently used)
87
-- | |<----------------------21 chan_pointer_reset
88
-- | ||<---------------------20 sel_corr_trailer
89
-- | |||<--------------------19 inc_corr_counter
90
-- | ||||<-------------------18 clr_chan_len_cnt
91
-- | |||||<------------------17 clr_build_flag (not in use)
92
-- | ||||||<-----------------16 set_build_flag (not in use)
93
-- | |||||||<----------------15 FIFO_s_tvalid
94
-- | ||||||||<---------------14 FIFO_s_tlast
95
-- | |||||||||<------------- 13 load_hdr_reg/clr pkt length
96
-- | ||||||||||<------------ 12 hdr_reg_valid
97
-- | |||||||||||<----------- 11 poll
98
-- | ||||||||||||<---------- 10 increment_chan,
99
-- | |||||||||||||<----------9 load_last_chan_pointer
100
-- | ||||||||||||||<---------8 sel_packet_header 1
101
-- | |||||||||||||||<--------7 sel_packet_header 2
102
-- | ||||||||||||||||<-------6 sel_packet_trailer
103
-- | |||||||||||||||||<------5 event_trailer_crc20_calc
104
-- | ||||||||||||||||||<-----4 event_trailer_crc20_reset
105
-- | |||||||||||||||||||<----3 pet_timer
106
-- | ||||||||||||||||||||<---2 hdr_out_crc9_start
107
-- | |||||||||||||||||||||<--1 chan_trailer_crc_calc
108
-- | ||||||||||||||||||||||<-0 chan_trailer_crc_reset
109
-- | ||||||||||||||||||||||
110
constant
wait_for_event_o
:
controls_type
:=
"000000000000001000000000000000001000"
;
--11
111
constant
read_ttc_o
:
controls_type
:=
"000000000000000000000010001000000000"
;
--12
112
constant
chan_timeout_o
:
controls_type
:=
"010000000000000000000000010000001000"
;
--13
113
constant
check_enable_o
:
controls_type
:=
"000000000000000000000000000000001000"
;
--1C
114
constant
discard_event_o
:
controls_type
:=
"000000000000000000000000010000000000"
;
--14
115
constant
idle_o
:
controls_type
:=
"000000110000000000000000000000000100"
;
--00
116
constant
load_header_o
:
controls_type
:=
"000000000000000000000010001000000000"
;
--01
117
constant
start_reading_o
:
controls_type
:=
"000000000000000000000001100100000000"
;
--02
118
constant
header_build_o
:
controls_type
:=
"000000000000000000001001000100010001"
;
--03
119
constant
header_build_2_o
:
controls_type
:=
"000000000000000000001001000010000000"
;
--04
120
constant
continue_reading_o
:
controls_type
:=
"000000000000000000001001000000100010"
;
--05
121
constant
finish_reading_o
:
controls_type
:=
"000000000000000000000001010000000000"
;
--06
122
--insert calc_hdr_in_crc_o state here with hdr_in_crc9_start active : this allows time to reroute data to debug on crc error
123
constant
continue_polling_o
:
controls_type
:=
"000000000000000000000001000000000001"
;
--07
124
constant
header_blocking_o
:
controls_type
:=
"000000000000000000000001000000000000"
;
--08
125
constant
trailer_build_o
:
controls_type
:=
"000000000000000000000001000000000000"
;
--09
126
constant
trailer_build_2_o
:
controls_type
:=
"000000000000000000000001000001100000"
;
--0a
127
constant
trailer_build_3_o
:
controls_type
:=
"000000000000000000000001000001000000"
;
--10
128
constant
trailer_mux_o
:
controls_type
:=
"000000000000000000001101010001000000"
;
--0b
129
constant
wait_chan_in_o
:
controls_type
:=
"000000000000000000000001000000000000"
;
--0c
130
constant
check_error_o
:
controls_type
:=
"000000000000000001000001000000000000"
;
--0d
131
constant
poll_early_o
:
controls_type
:=
"000000000000000000000000100000000000"
;
--0e
132
constant
wait_for_hdr_o
:
controls_type
:=
"000000000000000000000000000000001000"
;
--0f
133
constant
pr_corr_trailer_o
:
controls_type
:=
"000000000000000000000000000000000010"
;
--15
134
constant
wait_corr_crc_o
:
controls_type
:=
"000000000000000010000000000000000000"
;
--16
135
constant
add_corr_trailer_o
:
controls_type
:=
"000000000000000100001000000000101000"
;
--17
136
137
constant
eval_chan_crc20_o
:
controls_type
:=
"000000000000000000000001000000000000"
;
--18
138
139
constant
pr_corr_trlr_lc_o
:
controls_type
:=
"000000000000000000000000000000000010"
;
--19
140
constant
wait_corr_crc_lc_o
:
controls_type
:=
"000000000000000010000000000000000000"
;
--1A
141
constant
add_corr_trlr_lc_o
:
controls_type
:=
"000000000000000101001000000000101000"
;
--1B
142
143
144
145
-- debug stream states |
146
constant
dbg_header_build_o
:
controls_type
:=
"000000110010010000000000100000000001"
;
--20
147
constant
dbg_header_load_o
:
controls_type
:=
"000110001000000000000000000000000000"
;
--21
148
constant
dbg_packet_load_o
:
controls_type
:=
"000010000001100000000000000000000010"
;
--22
149
constant
dbg_trailer_build_o
:
controls_type
:=
"000000000000000000000000000000000000"
;
--23
150
constant
dbg_trail_build_2_o
:
controls_type
:=
"000000000101000000000000000000001000"
;
--24
151
constant
dbg_trail_build_3_o
:
controls_type
:=
"000000000100000000000000000000000000"
;
--25
152
constant
dbg_trailer_load_o
:
controls_type
:=
"000011000100000000000000000000001000"
;
--26
153
constant
dbg_trlr_ld_last_o
:
controls_type
:=
"000011000100000000000000000000001000"
;
--27
154
constant
dbg_pkt_load_1st_o
:
controls_type
:=
"000010000001100000000000000000000000"
;
--28
155
156
constant
dbg_trlr_inc_chan_o
:
controls_type
:=
"000000000000000000000000010000001000"
;
--29
157
158
constant
dbg_bad_l1ID_o
:
controls_type
:=
"000000110010010000000000100000000001"
;
--30 same as dbg_header_build_o
159
constant
start_empty_pkt_o
:
controls_type
:=
"001000000000000000000001000100000100"
;
--31
160
constant
attempt_resync_o
:
controls_type
:=
"000000000000000000000000010000000000"
;
--32
161
constant
await_resync_o
:
controls_type
:=
"000000000000000000000000000000000000"
;
--33
162
constant
dbg_wait_for_hdr_o
:
controls_type
:=
"000000000000000000000000000000001000"
;
--34
163
-- ||||||||||||
164
-- ||||||||||||<------------------------22 Debug Length Count Reset
165
-- |||||||||||<-------------------------23 Debug Length Count Enable
166
-- ||||||||||<--------------------------24 Debug trailer CRC calc
167
-- |||||||||<---------------------------25 Debug trailer CRC reset
168
-- ||||||||<----------------------------26 sel_dbg_trailer
169
-- |||||||<-----------------------------27 sel_dbg_header
170
-- ||||||<------------------------------28 Debug header CRC calc
171
-- |||||<-------------------------------29 Debug header CRC reset
172
-- ||||<--------------------------------30 Debug_s_tlast
173
-- |||<---------------------------------31 Debug_s_tvalid
174
-- ||<----------------------------------32 set_bad_l1id_flag
175
-- |<-----------------------------------33 set_empty_packet_build
176
end
package
;
controller_codes
Definition:
controller_codes.vhd:25
Generated on Sat Dec 14 2024 13:33:14 for ROD firmware by
1.9.1