source: firmware/FAD/FACT_FAD_20MHz_VAR_PS/FACT_FAD_lib/hdl/fad_definitions.vhd@ 10500

Last change on this file since 10500 was 10500, checked in by neise, 10 years ago
- FAD internal trigger ID reset is possible - with 0x"2A" - runnumber will be written into EVent header (32bit) default is zero.
  • Property svn:keywords set to Revision
File size: 9.2 KB
Line 
1-- Package File Template
2--
3-- Purpose: This package defines supplemental types, subtypes,
4-- constants, and functions
5
6
7library IEEE;
8use IEEE.STD_LOGIC_1164.all;
9use IEEE.STD_LOGIC_ARITH.ALL;
10use IEEE.STD_LOGIC_UNSIGNED.ALL;
11use std.textio.all;
12use work.txt_util.all;
13-- use IEEE.NUMERIC_STD.ALL;
14
15package fad_definitions is
16
17
18-- Declare constants
19
20 type mac_type is array (0 to 2) of std_logic_vector (15 downto 0);
21 type ip_type is array (0 to 3) of integer;
22
23 type mac_list_type is array (0 to 2) of mac_type;
24 type ip_list_type is array (0 to 2) of ip_type;
25-- Network Settings
26
27 constant ETHZ_GATEWAY : ip_type := (192, 33, 96, 1);
28 constant CAM_GATEWAY : ip_type := (192, 33, 96, 1); --???????????????
29 constant TUDO_GATEWAY : ip_type := (129, 217, 160, 1);
30
31 constant ETHZ_NETMASK : ip_type := (255, 255, 248, 0);
32 constant CAM_NETMASK : ip_type := (255, 255, 248, 0); --???????????????
33 constant TUDO_NETMASK : ip_type := (255, 255, 255, 0);
34
35 --constant MAC_ZERO : mac_type := (X"0000", X"0000", X"0000");
36 constant MAC_FAD0 : mac_type := (X"0011", X"9561", X"97B4");
37 constant MAC_FAD1 : mac_type := (X"FAC7", X"0FAD", X"0001");
38 constant MAC_FAD2 : mac_type := (X"FAC7", X"0FAD", X"0002");
39
40 --constant IP_ZERO : ip_type := (0,0,0,0);
41 constant IP_TUDO : ip_type := (129, 217, 160, 119);
42 constant IP_ETHZ_FAD0 : ip_type := (192, 33, 99, 225);
43 constant IP_ETHZ_FAD1 : ip_type := (192, 33, 99, 226);
44 constant IP_ETHZ_FAD2 : ip_type := (192, 33, 99, 237);
45
46 -- IP lookup table used to convert CID,BID into IP, if not in camera.
47 constant IP_LIST : ip_list_type := (IP_ETHZ_FAD0, IP_ETHZ_FAD1, IP_ETHZ_FAD2);
48 constant MAC_LIST : mac_list_type := (MAC_FAD0,MAC_FAD1,MAC_FAD2);
49
50 constant FIRST_PORT : integer := 5000;
51 constant CAM_IP_PREFIX : ip_type := (10, 0, 0, 0);
52 constant IP_offset : integer := 128;
53 constant CAM_MAC_prefix : mac_type := (X"FAC7", X"0FAD", X"0000");
54-- Network Settings End
55 --constant SUBVERSION_LONGSTRING : string := "$Rev: 10500 $:: $";
56 --constant SUBVERSION_STRING : string := SUBVERSION_LONGSTRING(7 to 25); -- cut off starting "$Rev: 10500 $:: " and trailing "$"
57 --constant SUBVERSION_NUMBER : std_logic_vector (15 downto 0) := conv_std_logic_vector(str_to_int(SUBVERSION_STRING),16);
58 constant PACKAGE_VERSION : std_logic_vector(7 downto 0) := X"01";
59 constant PACKAGE_SUB_VERSION : std_logic_vector(7 downto 0) := X"03";
60 constant PACKAGE_HEADER_LENGTH : integer := 36;
61 constant PACKAGE_HEADER_ZEROS : integer := 0;
62 constant PACKAGE_END_LENGTH : integer := 2; -- CRC and END-Flag
63 constant PACKAGE_END_ZEROS : integer := 2;
64 constant CHANNEL_HEADER_SIZE : integer := 4;
65 constant NUMBER_OF_DRS : integer := 4;
66 constant POSITION_OF_ROI_IN_CHANNEL_HEADER : integer := 3;
67
68 constant W5300_S_INC : std_logic_vector(6 downto 0) := "1000000"; -- socket address offset
69
70-- W5300 Registers
71 constant W5300_BASE_ADR : std_logic_vector (9 downto 0) := (others => '0');
72 constant W5300_MR : std_logic_vector (9 downto 0) := W5300_BASE_ADR + X"0";
73 constant W5300_IR : std_logic_vector (9 downto 0) := W5300_BASE_ADR + X"2";
74 constant W5300_IMR : std_logic_vector (9 downto 0) := W5300_BASE_ADR + X"4";
75 constant W5300_SHAR : std_logic_vector (9 downto 0) := W5300_BASE_ADR + X"8";
76 constant W5300_GAR : std_logic_vector (9 downto 0) := W5300_BASE_ADR + X"10";
77 constant W5300_SUBR : std_logic_vector (9 downto 0) := W5300_BASE_ADR + X"14";
78 constant W5300_SIPR : std_logic_vector (9 downto 0) := W5300_BASE_ADR + X"18";
79 constant W5300_RTR : std_logic_vector (9 downto 0) := W5300_BASE_ADR + X"1C";
80 constant W5300_RCR : std_logic_vector (9 downto 0) := W5300_BASE_ADR + X"1E";
81 constant W5300_TMS01R : std_logic_vector (9 downto 0) := W5300_BASE_ADR + X"20";
82 constant W5300_TMS23R : std_logic_vector (9 downto 0) := W5300_BASE_ADR + X"22";
83 constant W5300_TMS45R : std_logic_vector (9 downto 0) := W5300_BASE_ADR + X"24";
84 constant W5300_TMS67R : std_logic_vector (9 downto 0) := W5300_BASE_ADR + X"26";
85 constant W5300_RMS01R : std_logic_vector (9 downto 0) := W5300_BASE_ADR + X"28";
86 constant W5300_RMS23R : std_logic_vector (9 downto 0) := W5300_BASE_ADR + X"2A";
87 constant W5300_RMS45R : std_logic_vector (9 downto 0) := W5300_BASE_ADR + X"2C";
88 constant W5300_RMS67R : std_logic_vector (9 downto 0) := W5300_BASE_ADR + X"2E";
89 constant W5300_MTYPER : std_logic_vector (9 downto 0) := W5300_BASE_ADR + X"30";
90
91 constant W5300_S0_MR : std_logic_vector (9 downto 0) := W5300_BASE_ADR + "1000000000" + X"0";
92 constant W5300_S0_CR : std_logic_vector (9 downto 0) := W5300_BASE_ADR + "1000000000" + X"2";
93 constant W5300_S0_IMR : std_logic_vector (9 downto 0) := W5300_BASE_ADR + "1000000000" + X"4";
94 constant W5300_S0_IR : std_logic_vector (9 downto 0) := W5300_BASE_ADR + "1000000000" + X"6";
95 constant W5300_S0_SSR : std_logic_vector (9 downto 0) := W5300_BASE_ADR + "1000000000" + X"8";
96 constant W5300_S0_PORTR : std_logic_vector (9 downto 0) := W5300_BASE_ADR + "1000000000" + X"A";
97 constant W5300_S0_DPORTR : std_logic_vector (9 downto 0) := W5300_BASE_ADR + "1000000000" + X"12";
98 constant W5300_S0_DIPR : std_logic_vector (9 downto 0) := W5300_BASE_ADR + "1000000000" + X"14";
99 constant W5300_S0_TX_WRSR : std_logic_vector (9 downto 0) := W5300_BASE_ADR + "1000000000" + X"20";
100 constant W5300_S0_TX_FSR : std_logic_vector (9 downto 0) := W5300_BASE_ADR + "1000000000" + X"24";
101 constant W5300_S0_RX_RSR : std_logic_vector (9 downto 0) := W5300_BASE_ADR + "1000000000" + X"28";
102 constant W5300_S0_TX_FIFOR : std_logic_vector (9 downto 0) := W5300_BASE_ADR + "1000000000" + X"2E";
103 constant W5300_S0_RX_FIFOR : std_logic_vector (9 downto 0) := W5300_BASE_ADR + "1000000000" + X"30";
104-- End W5300 registers
105
106--
107 constant W5300_TX_FIFO_SIZE_8B : integer := 15360; -- Socket TX FIFO-Size in Bytes
108 constant W5300_TX_FIFO_SIZE : integer := (W5300_TX_FIFO_SIZE_8B / 2); -- Socket TX FIFO-Size in 16 Bit Words
109
110 constant LOG2_OF_RAM_SIZE_64B : integer := 15;
111 --constant RAM_SIZE_64B : integer := 2**LOG2_OF_RAM_SIZE_64B;
112 constant RAM_SIZE_64B : integer := 24576;
113 constant RAM_SIZE_16B : integer := RAM_SIZE_64B * 4;
114
115-- TYPE definitions
116 type roi_max_type is array (0 to 8) of std_logic_vector (10 downto 0);
117 type roi_array_type is array (0 to 35) of integer range 0 to 1024;
118 type drs_s_cell_array_type is array (0 to 3) of std_logic_vector (9 downto 0);
119 type adc_data_array_type is array (0 to 3) of std_logic_vector (11 downto 0);
120
121 type dac_array_type is array (0 to 7) of integer range 0 to 2**16 - 1;
122 type sensor_array_type is array (0 to 3) of integer range 0 to 2**16 - 1;
123
124-- constant DEFAULT_ROI : roi_array_type := (115, 125, 100, 102, 155, 101, 0, 101, 106,
125-- 181, 121, 189, 101, 101, 187, 56, 187, 101,
126-- 2, 141, 101, 100, 10, 100, 178, 101, 174,
127-- 12, 181, 100, 102, 101, 102, 0, 101, 108);
128-- constant DEFAULT_ROI : roi_array_type := (others => 100);
129 constant DEFAULT_ROI : roi_array_type := (others => 1024);
130
131 constant DEFAULT_DAC : dac_array_type := (20972, 34079, 20526, 0, 28836, 28836, 28836, 28836);
132 --constant DEFAULT_DAC : dac_array_type := (others => 0);
133
134 constant DEFAULT_DRSADDR : std_logic_vector (3 downto 0):= "0000";
135 constant DEFAULT_DRSADDR_MODE : std_logic := '0';
136
137-- config RAM addresses
138constant BADDR_ROI : std_logic_vector := X"00"; -- Baseaddress ROI-Values
139constant BADDR_DAC : std_logic_vector := X"24"; -- Baseaddress DAC-Values
140
141
142
143-- Commands
144constant CMD_WRITE : std_logic_vector := X"05";
145constant CMD_DENABLE : std_logic_vector := X"06";
146constant CMD_DDISABLE : std_logic_vector := X"07";
147constant CMD_DWRITE_RUN : std_logic_vector := X"08";
148constant CMD_DWRITE_STOP : std_logic_vector := X"09";
149constant CMD_READ : std_logic_vector := X"0A";
150constant CMD_SCLK_ON : std_logic_vector := X"10";
151constant CMD_SCLK_OFF : std_logic_vector := X"11";
152constant CMD_PS_DIRINC : std_logic_vector := X"12";
153constant CMD_PS_DIRDEC : std_logic_vector := X"13";
154constant CMD_PS_DO : std_logic_vector := X"14";
155constant CMD_SRCLK_ON : std_logic_vector := X"15";
156constant CMD_SRCLK_OFF : std_logic_vector := X"16";
157constant CMD_PS_RESET : std_logic_vector := X"17";
158constant CMD_TRIGGERS_ON : std_logic_vector := X"18";
159constant CMD_TRIGGERS_OFF : std_logic_vector := X"19";
160constant CMD_TRIGGER_S : std_logic_vector := X"20";
161constant CMD_RESET_TRIGGER_ID : std_logic_vector := X"2A";
162
163constant CMD_START : std_logic_vector := X"22"; -- set data generator in RUN-mnode
164constant CMD_STOP : std_logic_vector := X"23"; -- set data generator in STOP-mode
165constant CMD_MODE_COMMAND : std_logic_vector := X"30";
166constant CMD_MODE_ALL_SOCKETS : std_logic_vector := X"31";
167constant CMD_TRIGGER : std_logic_vector := X"A0";
168constant CMD_TRIGGER_C : std_logic_vector := X"B0";
169
170
171
172
173-- DRS Registers
174 constant DRS_ADDR_IDLE : std_logic_vector := "1001";
175 constant DRS_CONFIG_REG : std_logic_vector := "1100";
176 constant DRS_WRITE_SHIFT_REG : std_logic_vector := "1101";
177 constant DRS_WRITE_CONFIG_REG : std_logic_vector := "1110";
178 constant DRS_DISABLE_ALL_OUTS : std_logic_vector := "1111";
179
180-- Declare functions and procedure
181
182
183end fad_definitions;
Note: See TracBrowser for help on using the repository browser.