AMC13
Firmwares for the different applications of the AMC13 uTCA board made at Boston University
 All Classes Variables
amc13_pack.vhd
1 -- Package File Template
2 --
3 -- Purpose: This package defines supplemental types, subtypes,
4 -- constants, and functions
5 
6 
7 library IEEE;
8 use IEEE.STD_LOGIC_1164.all;
9 use work.amc13_version_package.all;
10 
11 package amc13_pack is
12 -- constants (included from amc13_version_package
13  constant device_ID : std_logic_vector(15 downto 0) := device_ID;
14  constant T2_version : std_logic_vector(15 downto 0) := T2_version;
15  constant K7version : std_logic_vector(15 downto 0) := k7version;
16  constant V6version : std_logic_vector(15 downto 0) := V6version;
17  constant CTRversion : std_logic_vector(7 downto 0) := CTRversion;
18  constant key : std_logic_vector(31 downto 0) := key;
19  constant flavor : string := flavor;
20  constant lsc_speed : integer := lsc_speed;
21 -- use A24 to access VME chip data
22 -- registers on VME chip
23 constant ID_addr : std_logic_vector(15 downto 0) := x"0000";
24 constant CRC_vme_addr : std_logic_vector(15 downto 0) := x"0004";
25 constant CRC_DCC_addr : std_logic_vector(15 downto 0) := x"0008";
26 constant CRC_LRB_addr : std_logic_vector(15 downto 0) := x"000c";
27 constant VME_csr_addr : std_logic_vector(15 downto 0) := x"0010"; -- VME chip control and status register
28 constant F_cmd_addr : std_logic_vector(15 downto 0) := x"0100"; -- FLASH command register, write only
29 constant key_addr : std_logic_vector(15 downto 0) := x"0294"; -- FLASH operation protection key register, write only
30 -- block RAM buffer on VME chip
31 constant F_wbuf_addr : std_logic_vector(15 downto 0) := x"0800"; -- size 0x200 FLASH write buffer
32 constant F_rbuf_addr : std_logic_vector(15 downto 0) := x"0a00"; -- size 0x200 FLASH read buffer
33 -- use A32 to access legacy DCC registers
34 ---------------------------------------------------------------------------------------------------------------------------
35 constant CSR_addr : std_logic_vector(15 downto 0) := x"0000";
36 constant CFG_addr : std_logic_vector(15 downto 0) := x"0001";
37 constant MON_ctrl_addr : std_logic_vector(15 downto 0) := x"0002";
38 constant HTR_EN_addr : std_logic_vector(15 downto 0) := x"0003";
39 constant SFP_CSR_addr : std_logic_vector(15 downto 0) := x"0004";
40 constant HTR_test_addr : std_logic_vector(15 downto 0) := x"0005";
41 constant BC0_delay_addr : std_logic_vector(15 downto 0) := x"0006";
42 constant SRC_id_addr : std_logic_vector(15 downto 0) := x"0007";
43 constant TTC_bcnt_addr : std_logic_vector(15 downto 0) := x"0008";
44 constant TTC_cal_addr : std_logic_vector(15 downto 0) := x"0009";
45 constant mem_status_addr: std_logic_vector(15 downto 0) := x"000a";
46 constant test_ctrl_addr : std_logic_vector(15 downto 0) := x"000b";
47 constant PAGE_addr : std_logic_vector(15 downto 0) := x"000c";
48 constant MON_wc_addr : std_logic_vector(15 downto 0) := x"000d";
49 constant evn_pntr_addr : std_logic_vector(15 downto 0) := x"000e";
50 constant SL_pntr_addr : std_logic_vector(15 downto 0) := x"000f";
51 constant SRC_id1_addr : std_logic_vector(15 downto 0) := x"0011";
52 constant SRC_id2_addr : std_logic_vector(15 downto 0) := x"0011";
53 constant fake_length_addr : std_logic_vector(15 downto 0) := x"0018";
54 constant TTS_pattern_addr : std_logic_vector(15 downto 0) := x"0019";
55 --constant sta_ctrl_addr : std_logic_vector(15 downto 0) := x"0010"; -- size 0x10 -- was at 0xc00
56 constant status_cntr_addr: std_logic_vector(15 downto 0) := x"0020"; -- size 0x10 -- was at 0xbc0
57 constant sysmon_addr : std_logic_vector(15 downto 0) := x"0030"; -- size 0x10
58 constant misc_cntr_addr : std_logic_vector(15 downto 0) := x"0040"; -- size 0x40
59 constant LSC_addr : std_logic_vector(15 downto 0) := x"0080"; -- size 0x20
60 constant I2C_addr : std_logic_vector(15 downto 0) := x"0100"; -- size 0x100
61 constant L1A_buf_addr : std_logic_vector(15 downto 0) := x"0200"; -- size 0x200
62 constant AMC_reg_addr : std_logic_vector(15 downto 0) := x"0800";
63 constant SFP_reg_addr : std_logic_vector(15 downto 0) := x"1000";
64 --constant ll2_dbg_addr : std_logic_vector(15 downto 0) := x"0880";
65 --constant ll3_dbg_addr : std_logic_vector(15 downto 0) := x"08c0";
66 --constant ll4_dbg_addr : std_logic_vector(15 downto 0) := x"0900";
67 --constant edc_dbg_addr : std_logic_vector(15 downto 0) := x"0940";
68 --constant eb_dbg_addr : std_logic_vector(15 downto 0) := x"0980";
69 --constant mem_dbg_addr : std_logic_vector(15 downto 0) := x"09c0";
70 --constant ddr_dbg_addr : std_logic_vector(15 downto 0) := x"0a00";
71 --constant SL_buf_addr : std_logic_vector(15 downto 0) := x"0c00"; -- size 0x200
72 --constant mem_buf_addr : std_logic_vector(15 downto 0) := x"4000"; -- size 0x2000
73 -- HTR base address
74 constant HTR0_base_addr : std_logic_vector(15 downto 0) := x"1000"; -- size 0x80
75 constant HTR1_base_addr : std_logic_vector(15 downto 0) := x"1080"; -- size 0x80
76 constant HTR2_base_addr : std_logic_vector(15 downto 0) := x"1100"; -- size 0x80
77 constant HTR3_base_addr : std_logic_vector(15 downto 0) := x"1180"; -- size 0x80
78 constant HTR4_base_addr : std_logic_vector(15 downto 0) := x"1200"; -- size 0x80
79 constant HTR5_base_addr : std_logic_vector(15 downto 0) := x"1280"; -- size 0x80
80 constant HTR6_base_addr : std_logic_vector(15 downto 0) := x"1300"; -- size 0x80
81 constant HTR7_base_addr : std_logic_vector(15 downto 0) := x"1380"; -- size 0x80
82 constant HTR8_base_addr : std_logic_vector(15 downto 0) := x"1400"; -- size 0x80
83 constant HTR9_base_addr : std_logic_vector(15 downto 0) := x"1480"; -- size 0x80
84 constant HTR10_base_addr : std_logic_vector(15 downto 0) := x"1500"; -- size 0x80
85 constant HTR11_base_addr : std_logic_vector(15 downto 0) := x"1580"; -- size 0x80
86 -- LRB address offset
87 constant HTR_status : std_logic_vector(11 downto 0) := x"008";
88 -- HTR channel 0 counters
89 constant CH0_wc : std_logic_vector(11 downto 0) := x"400"; -- total word count 8 bytes
90 constant CH0_cerr : std_logic_vector(11 downto 0) := x"408"; -- total cerr count 8 bytes
91 constant CH0_uerr : std_logic_vector(11 downto 0) := x"410"; -- total uerr count 8 bytes
92 constant CH0_event_cnt : std_logic_vector(11 downto 0) := x"418"; -- total event count 8 bytes
93 constant CH0_evt_cerr : std_logic_vector(11 downto 0) := x"420"; -- total event count with CERR 8 bytes
94 constant CH0_evt_uerr : std_logic_vector(11 downto 0) := x"428"; -- total event count with UERR 8 bytes
95 constant CH0_evt_trunc : std_logic_vector(11 downto 0) := x"430"; -- total truncated event count 8 bytes
96 constant CH0_evt_badid : std_logic_vector(11 downto 0) := x"438"; -- total event count with BADID error 8 bytes
97 constant CH0_evt_crc : std_logic_vector(11 downto 0) := x"440"; -- total event count with CRC error 8 bytes
98 -- memeory window
99 type array2X2 is array(0 to 1) of std_logic_vector(1 downto 0);
100 type array2X3 is array(0 to 1) of std_logic_vector(2 downto 0);
101 type array2X4 is array(0 to 1) of std_logic_vector(3 downto 0);
102 type array2X7 is array(0 to 1) of std_logic_vector(6 downto 0);
103 type array2X8 is array(0 to 1) of std_logic_vector(7 downto 0);
104 type array2X9 is array(0 to 1) of std_logic_vector(8 downto 0);
105 type array2X16 is array(0 to 1) of std_logic_vector(15 downto 0);
106 type array2X32 is array(0 to 1) of std_logic_vector(31 downto 0);
107 type array2X64 is array(0 to 1) of std_logic_vector(63 downto 0);
108 type array2X65 is array(0 to 1) of std_logic_vector(64 downto 0);
109 type array3X2 is array(0 to 2) of std_logic_vector(1 downto 0);
110 type array3X3 is array(0 to 2) of std_logic_vector(2 downto 0);
111 type array3X4 is array(0 to 2) of std_logic_vector(3 downto 0);
112 type array3X5 is array(0 to 2) of std_logic_vector(4 downto 0);
113 type array3X7 is array(0 to 2) of std_logic_vector(6 downto 0);
114 type array3X8 is array(0 to 2) of std_logic_vector(7 downto 0);
115 type array3X9 is array(0 to 2) of std_logic_vector(8 downto 0);
116 type array3X10 is array(0 to 2) of std_logic_vector(9 downto 0);
117 type array3X11 is array(0 to 2) of std_logic_vector(10 downto 0);
118 type array3X12 is array(0 to 2) of std_logic_vector(11 downto 0);
119 type array3X13 is array(0 to 2) of std_logic_vector(12 downto 0);
120 type array3X14 is array(0 to 2) of std_logic_vector(13 downto 0);
121 type array3X16 is array(0 to 2) of std_logic_vector(15 downto 0);
122 type array3X17 is array(0 to 2) of std_logic_vector(16 downto 0);
123 type array3X18 is array(0 to 2) of std_logic_vector(17 downto 0);
124 type array3X19 is array(0 to 2) of std_logic_vector(18 downto 0);
125 type array3X20 is array(0 to 2) of std_logic_vector(19 downto 0);
126 type array3X21 is array(0 to 2) of std_logic_vector(20 downto 0);
127 type array3X24 is array(0 to 2) of std_logic_vector(23 downto 0);
128 type array3X26 is array(0 to 2) of std_logic_vector(25 downto 0);
129 type array3X28 is array(0 to 2) of std_logic_vector(27 downto 0);
130 type array3X32 is array(0 to 2) of std_logic_vector(31 downto 0);
131 type array3X48 is array(0 to 2) of std_logic_vector(47 downto 0);
132 type array3X56 is array(0 to 2) of std_logic_vector(55 downto 0);
133 type array3X64 is array(0 to 2) of std_logic_vector(63 downto 0);
134 type array3X65 is array(0 to 2) of std_logic_vector(64 downto 0);
135 type array3X66 is array(0 to 2) of std_logic_vector(65 downto 0);
136 type array3X67 is array(0 to 2) of std_logic_vector(66 downto 0);
137 type array4X9 is array(0 to 3) of std_logic_vector(8 downto 0);
138 type array4X10 is array(0 to 3) of std_logic_vector(9 downto 0);
139 type array4X11 is array(0 to 3) of std_logic_vector(10 downto 0);
140 type array4X12 is array(0 to 3) of std_logic_vector(11 downto 0);
141 type array4X13 is array(0 to 4) of std_logic_vector(12 downto 0);
142 type array4X64 is array(0 to 3) of std_logic_vector(63 downto 0);
143 type array5X11 is array(0 to 4) of std_logic_vector(10 downto 0);
144 type array5X13 is array(0 to 4) of std_logic_vector(12 downto 0);
145 type array6X64 is array(0 to 5) of std_logic_vector(63 downto 0);
146 type array8X4 is array(0 to 7) of std_logic_vector(3 downto 0);
147 type array8X12 is array(0 to 7) of std_logic_vector(11 downto 0);
148 type array12X2 is array(0 to 11) of std_logic_vector(1 downto 0);
149 type array12X3 is array(0 to 11) of std_logic_vector(2 downto 0);
150 type array12X4 is array(0 to 11) of std_logic_vector(3 downto 0);
151 type array12X6 is array(0 to 11) of std_logic_vector(5 downto 0);
152 type array12X8 is array(0 to 11) of std_logic_vector(7 downto 0);
153 type array12X13 is array(0 to 11) of std_logic_vector(12 downto 0);
154 type array12X16 is array(0 to 11) of std_logic_vector(15 downto 0);
155 type array12X20 is array(0 to 11) of std_logic_vector(19 downto 0);
156 type array12X21 is array(0 to 11) of std_logic_vector(20 downto 0);
157 type array12X32 is array(0 to 11) of std_logic_vector(31 downto 0);
158 type array12X64 is array(0 to 11) of std_logic_vector(63 downto 0);
159 type array32X32 is array(0 to 31) of std_logic_vector(31 downto 0);
160 type array16X4 is array(0 to 15) of std_logic_vector(3 downto 0);
161 type array24X32 is array(0 to 23) of std_logic_vector(31 downto 0);
162 type array2X3x5 is array(0 to 1) of array3x5;
163 type array2X3x12 is array(0 to 1) of array3x12;
164 type bitarray9x64 is array(0 to 8) of bit_vector(63 downto 0);
165 end amc13_pack;
166 package body amc13_pack is
167 end amc13_pack;