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

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