diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml new file mode 100644 index 0000000..62e5707 --- /dev/null +++ b/.github/workflows/documentation.yml @@ -0,0 +1,29 @@ +name: documentation + +on: [push, pull_request, workflow_dispatch] + +permissions: + contents: write + +jobs: + docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + - name: Install dependencies + run: | + pip install -e . + pip install pydata-sphinx-theme + pip install sphinx sphinx_rtd_theme myst_parser sphinx_mdinclude + - name: Sphinx build + run: | + sphinx-build docs/source _build + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + if: ${{github.event_name == 'push' && github.ref == 'refs/heads/main'}} + with: + publish_branch: gh-pages + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: _build/ + force_orphan: true diff --git a/.gitignore b/.gitignore index b6e4761..7c22bbd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,10 @@ +#debugging and data files +test.ipynb +*.h5 +!/aidatlu/test/interpreted_data.h5 +!/aidatlu/test/raw_data_test.h5 +.vscode + # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] @@ -23,6 +30,7 @@ wheels/ pip-wheel-metadata/ share/python-wheels/ *.egg-info/ +*.egg-info .installed.cfg *.egg MANIFEST diff --git a/EUDETdummy/constraints/EUDET_dummy_constr.xdc b/EUDETdummy/constraints/EUDET_dummy_constr.xdc deleted file mode 100644 index 17c41b0..0000000 --- a/EUDETdummy/constraints/EUDET_dummy_constr.xdc +++ /dev/null @@ -1,140 +0,0 @@ -## Trigger inputs - -#set_property IOSTANDARD LVCMOS18 [get_ports {threshold_discr_p_i[*]}] -#set_property PACKAGE_PIN J4 [get_ports {threshold_discr_p_i[4]}] -#set_property PACKAGE_PIN H1 [get_ports {threshold_discr_p_i[5]}] - -#set_property IOSTANDARD LVCMOS33 [get_ports {threshold_discr_n_i[*]}] -#set property IOSTANDARD LVDS_25 [get_ports {threshold_discr_p_i[*]}] -#set_property PACKAGE_PIN B1 [get_ports {threshold_discr_p_i[0]}] -#set_property PACKAGE_PIN A1 [get_ports {threshold_discr_n_i[0]}] -#set_property PACKAGE_PIN C4 [get_ports {threshold_discr_p_i[1]}] -#set_property PACKAGE_PIN B4 [get_ports {threshold_discr_n_i[1]}] -#set_property PACKAGE_PIN K2 [get_ports {threshold_discr_p_i[2]}] -#set_property PACKAGE_PIN K1 [get_ports {threshold_discr_n_i[2]}] -#set_property PACKAGE_PIN C6 [get_ports {threshold_discr_p_i[3]}] -#set_property PACKAGE_PIN C5 [get_ports {threshold_discr_n_i[3]}] -#set_property PACKAGE_PIN J4 [get_ports {threshold_discr_p_i[4]}] -#set_property PACKAGE_PIN H4 [get_ports {threshold_discr_n_i[4]}] -#set_property PACKAGE_PIN H1 [get_ports {threshold_discr_p_i[5]}] -#set_property PACKAGE_PIN G1 [get_ports {threshold_discr_n_i[5]}] - -## Miscellaneous I/O -set_property IOSTANDARD LVCMOS33 [get_ports clk_gen_rst] -set_property PACKAGE_PIN C1 [get_ports clk_gen_rst] -set_property IOSTANDARD LVCMOS33 [get_ports gpio] -set_property PACKAGE_PIN F6 [get_ports gpio] - - -## Crystal clock -set_property IOSTANDARD LVDS_25 [get_ports sysclk_40_i_p] -set_property PACKAGE_PIN T5 [get_ports sysclk_40_i_p] -set_property PACKAGE_PIN T4 [get_ports sysclk_40_i_n] - -## Output clock (currently not working so set to 0) -set_property IOSTANDARD LVCMOS33 [get_ports sysclk_50_o_p] -set_property PACKAGE_PIN E3 [get_ports sysclk_50_o_p] -set_property IOSTANDARD LVCMOS33 [get_ports sysclk_50_o_n] -set_property PACKAGE_PIN D3 [get_ports sysclk_50_o_n] - -## Inputs/Outputs for DUTs -set_property IOSTANDARD LVCMOS33 [get_ports {busy_o[*]}] -set_property PACKAGE_PIN R7 [get_ports {busy_o[0]}] -set_property PACKAGE_PIN U4 [get_ports {busy_o[1]}] -set_property PACKAGE_PIN R8 [get_ports {busy_o[2]}] -set_property PACKAGE_PIN K5 [get_ports {busy_o[3]}] - -set_property IOSTANDARD LVCMOS33 [get_ports {triggers_o[*]}] -set_property PACKAGE_PIN R6 [get_ports {triggers_o[0]}] -set_property PACKAGE_PIN P2 [get_ports {triggers_o[1]}] -set_property PACKAGE_PIN R1 [get_ports {triggers_o[2]}] -set_property PACKAGE_PIN U1 [get_ports {triggers_o[3]}] - -set_property IOSTANDARD LVCMOS33 [get_ports {cont_o[*]}] -set_property PACKAGE_PIN N5 [get_ports {cont_o[0]}] -set_property PACKAGE_PIN P4 [get_ports {cont_o[1]}] -set_property PACKAGE_PIN M6 [get_ports {cont_o[2]}] -set_property PACKAGE_PIN L6 [get_ports {cont_o[3]}] - -set_property IOSTANDARD LVCMOS33 [get_ports {spare_o[*]}] -set_property PACKAGE_PIN L1 [get_ports {spare_o[0]}] -set_property PACKAGE_PIN M4 [get_ports {spare_o[1]}] -set_property PACKAGE_PIN N2 [get_ports {spare_o[2]}] -set_property PACKAGE_PIN M3 [get_ports {spare_o[3]}] - -set_property IOSTANDARD LVCMOS33 [get_ports {dut_clk_o[*]}] -set_property PACKAGE_PIN K3 [get_ports {dut_clk_o[0]}] -set_property PACKAGE_PIN F4 [get_ports {dut_clk_o[1]}] -set_property PACKAGE_PIN E2 [get_ports {dut_clk_o[2]}] -set_property PACKAGE_PIN G4 [get_ports {dut_clk_o[3]}] - -set_property IOSTANDARD LVCMOS33 [get_ports {cont_i[*]}] -set_property PACKAGE_PIN P5 [get_ports {cont_i[0]}] -set_property PACKAGE_PIN P3 [get_ports {cont_i[1]}] -set_property PACKAGE_PIN N6 [get_ports {cont_i[2]}] -set_property PACKAGE_PIN L5 [get_ports {cont_i[3]}] - -set_property IOSTANDARD LVCMOS33 [get_ports {spare_i[*]}] -set_property PACKAGE_PIN M1 [get_ports {spare_i[0]}] -set_property PACKAGE_PIN N4 [get_ports {spare_i[1]}] -set_property PACKAGE_PIN N1 [get_ports {spare_i[2]}] -set_property PACKAGE_PIN M2 [get_ports {spare_i[3]}] - -set_property IOSTANDARD LVCMOS33 [get_ports {triggers_i[*]}] -set_property PACKAGE_PIN R5 [get_ports {triggers_i[0]}] -set_property PACKAGE_PIN R2 [get_ports {triggers_i[1]}] -set_property PACKAGE_PIN T1 [get_ports {triggers_i[2]}] -set_property PACKAGE_PIN V1 [get_ports {triggers_i[3]}] - -set_property IOSTANDARD LVCMOS33 [get_ports {busy_i[*]}] -set_property PACKAGE_PIN T6 [get_ports {busy_i[0]}] -set_property PACKAGE_PIN U3 [get_ports {busy_i[1]}] -set_property PACKAGE_PIN T8 [get_ports {busy_i[2]}] -set_property PACKAGE_PIN L4 [get_ports {busy_i[3]}] - -set_property IOSTANDARD LVCMOS33 [get_ports {dut_clk_i[*]}] -set_property PACKAGE_PIN L3 [get_ports {dut_clk_i[0]}] -set_property PACKAGE_PIN F3 [get_ports {dut_clk_i[1]}] -set_property PACKAGE_PIN D2 [get_ports {dut_clk_i[2]}] -set_property PACKAGE_PIN G3 [get_ports {dut_clk_i[3]}] - -# ------------------------------------------------------------------------------------------------- - - - - - - -set_property BITSTREAM.CONFIG.SPI_BUSWIDTH 4 [current_design] - - -create_debug_core u_ila_0 ila -set_property ALL_PROBE_SAME_MU true [get_debug_cores u_ila_0] -set_property ALL_PROBE_SAME_MU_CNT 4 [get_debug_cores u_ila_0] -set_property C_ADV_TRIGGER true [get_debug_cores u_ila_0] -set_property C_DATA_DEPTH 8192 [get_debug_cores u_ila_0] -set_property C_EN_STRG_QUAL true [get_debug_cores u_ila_0] -set_property C_INPUT_PIPE_STAGES 0 [get_debug_cores u_ila_0] -set_property C_TRIGIN_EN false [get_debug_cores u_ila_0] -set_property C_TRIGOUT_EN false [get_debug_cores u_ila_0] -set_property port_width 1 [get_debug_ports u_ila_0/clk] -connect_debug_port u_ila_0/clk [get_nets [list sysclk_40_BUFG]] -set_property PROBE_TYPE DATA_AND_TRIGGER [get_debug_ports u_ila_0/probe0] -set_property port_width 32 [get_debug_ports u_ila_0/probe0] -connect_debug_port u_ila_0/probe0 [get_nets [list {TrigNArray[0][0]} {TrigNArray[0][1]} {TrigNArray[0][2]} {TrigNArray[0][3]} {TrigNArray[0][4]} {TrigNArray[0][5]} {TrigNArray[0][6]} {TrigNArray[0][7]} {TrigNArray[0][8]} {TrigNArray[0][9]} {TrigNArray[0][10]} {TrigNArray[0][11]} {TrigNArray[0][12]} {TrigNArray[0][13]} {TrigNArray[0][14]} {TrigNArray[0][15]} {TrigNArray[0][16]} {TrigNArray[0][17]} {TrigNArray[0][18]} {TrigNArray[0][19]} {TrigNArray[0][20]} {TrigNArray[0][21]} {TrigNArray[0][22]} {TrigNArray[0][23]} {TrigNArray[0][24]} {TrigNArray[0][25]} {TrigNArray[0][26]} {TrigNArray[0][27]} {TrigNArray[0][28]} {TrigNArray[0][29]} {TrigNArray[0][30]} {TrigNArray[0][31]}]] -create_debug_port u_ila_0 probe -set_property PROBE_TYPE DATA_AND_TRIGGER [get_debug_ports u_ila_0/probe1] -set_property port_width 1 [get_debug_ports u_ila_0/probe1] -connect_debug_port u_ila_0/probe1 [get_nets [list {busy_o_OBUF[0]}]] -create_debug_port u_ila_0 probe -set_property PROBE_TYPE DATA_AND_TRIGGER [get_debug_ports u_ila_0/probe2] -set_property port_width 1 [get_debug_ports u_ila_0/probe2] -connect_debug_port u_ila_0/probe2 [get_nets [list {dut_clk_o_OBUF[0]}]] -create_debug_port u_ila_0 probe -set_property PROBE_TYPE DATA_AND_TRIGGER [get_debug_ports u_ila_0/probe3] -set_property port_width 1 [get_debug_ports u_ila_0/probe3] -connect_debug_port u_ila_0/probe3 [get_nets [list TriggerNumberStrobe6_out]] -set_property C_CLK_INPUT_FREQ_HZ 300000000 [get_debug_cores dbg_hub] -set_property C_ENABLE_CLK_DIVIDER false [get_debug_cores dbg_hub] -set_property C_USER_SCAN_CHAIN 1 [get_debug_cores dbg_hub] -connect_debug_port dbg_hub/clk [get_nets sysclk_40_BUFG] diff --git a/EUDETdummy/constraints/I2C_constr.xdc b/EUDETdummy/constraints/I2C_constr.xdc deleted file mode 100644 index eb95fff..0000000 --- a/EUDETdummy/constraints/I2C_constr.xdc +++ /dev/null @@ -1,40 +0,0 @@ -set_property IOSTANDARD LVCMOS33 [get_ports i2c_reset] -set_property PACKAGE_PIN C2 [get_ports i2c_reset] - -set_property IOSTANDARD LVCMOS33 [get_ports i2c_scl_b] -set_property PACKAGE_PIN N17 [get_ports i2c_scl_b] - -set_property IOSTANDARD LVCMOS33 [get_ports i2c_sda_b] -set_property PACKAGE_PIN P18 [get_ports i2c_sda_b] - - - -create_clock -period 25.000 -name sysclk_40_i_p -waveform {0.000 12.500} [get_ports sysclk_40_i_p] -#set_property ASYNC_REG true [get_cells I1/sync_registers/s_ring_d4_reg] -#set_property ASYNC_REG true [get_cells I1/sync_registers/s_ring_d3_reg] -#set_property ASYNC_REG true [get_cells I1/sync_ipbus/s_ring_d0_reg] -#set_property ASYNC_REG true [get_cells I1/sync_ipbus/s_ring_d1_reg] - -#set_clock_groups -asynchronous -group [get_clocks pll_base_inst_n_2] -group [get_clocks mmcm_n_8] -#set_property ASYNC_REG true [get_cells I1/sync_ipbus/s_ring_d3_reg] -#set_property ASYNC_REG true [get_cells I1/sync_ipbus/s_ring_d4_reg] -#set_property ASYNC_REG true [get_cells I6/s_logic_reset_d1_reg] -#set_property ASYNC_REG true [get_cells I6/s_logic_reset_d2_reg] -#set_property ASYNC_REG true [get_cells I1/sync_registers/s_ring_d1_reg] -#set_property ASYNC_REG true [get_cells I1/sync_registers/s_ring_d0_reg] -#set_clock_groups -asynchronous -group [get_clocks mmcm_n_8] -group [get_clocks pll_base_inst_n_2] - - -#Define clock groups and make them asynchronous with each other -set_clock_groups -asynchronous -group {clk_enclustra I_1 mmcm_n_10 mmcm_n_6 mmcm_n_8 clk_ipb_i} -group {sysclk_40_i_p I pll_base_inst_n_2 s_clk160} - -# ------------------------------------------------------------------------------------------------- - - - -#DEBUG PROBES - - - - - diff --git a/EUDETdummy/constraints/enclustra_ax3_pm3.tcl b/EUDETdummy/constraints/enclustra_ax3_pm3.tcl deleted file mode 100644 index 7fd31b4..0000000 --- a/EUDETdummy/constraints/enclustra_ax3_pm3.tcl +++ /dev/null @@ -1,52 +0,0 @@ -set_property BITSTREAM.GENERAL.COMPRESS TRUE [current_design] - -proc false_path {patt clk} { - set p [get_ports -quiet $patt -filter {direction != out}] - if {[llength $p] != 0} { - set_input_delay 0 -clock [get_clocks $clk] [get_ports $patt -filter {direction != out}] - set_false_path -from [get_ports $patt -filter {direction != out}] - } - set p [get_ports -quiet $patt -filter {direction != in}] - if {[llength $p] != 0} { - set_output_delay 0 -clock [get_clocks $clk] [get_ports $patt -filter {direction != in}] - set_false_path -to [get_ports $patt -filter {direction != in}] - } -} - -# System clock (50MHz) -#create_clock -period 25.000 -name sysclk [get_ports sysclk] -create_clock -period 20.000 -name clk_enclustra [get_ports clk_enclustra] - -set_false_path -through [get_pins infra/clocks/rst_reg/Q] -set_false_path -through [get_nets infra/clocks/nuke_i] - -set_property IOSTANDARD LVCMOS33 [get_ports clk_enclustra] -set_property PACKAGE_PIN P17 [get_ports clk_enclustra] - -set_property IOSTANDARD LVCMOS33 [get_ports {leds[*]}] -set_property SLEW SLOW [get_ports {leds[*]}] -set_property PACKAGE_PIN M16 [get_ports {leds[0]}] -set_property PACKAGE_PIN M17 [get_ports {leds[1]}] -set_property PACKAGE_PIN L18 [get_ports {leds[2]}] -set_property PACKAGE_PIN M18 [get_ports {leds[3]}] -false_path {leds[*]} clk_enclustra - -set_property IOSTANDARD LVCMOS33 [get_ports {rgmii_* phy_rstn}] -set_property PACKAGE_PIN R18 [get_ports {rgmii_txd[0]}] -set_property PACKAGE_PIN T18 [get_ports {rgmii_txd[1]}] -set_property PACKAGE_PIN U17 [get_ports {rgmii_txd[2]}] -set_property PACKAGE_PIN U18 [get_ports {rgmii_txd[3]}] -set_property PACKAGE_PIN T16 [get_ports {rgmii_tx_ctl}] -set_property PACKAGE_PIN N16 [get_ports {rgmii_txc}] -set_property PACKAGE_PIN U16 [get_ports {rgmii_rxd[0]}] -set_property PACKAGE_PIN V17 [get_ports {rgmii_rxd[1]}] -set_property PACKAGE_PIN V15 [get_ports {rgmii_rxd[2]}] -set_property PACKAGE_PIN V16 [get_ports {rgmii_rxd[3]}] -set_property PACKAGE_PIN R16 [get_ports {rgmii_rx_ctl}] -set_property PACKAGE_PIN T14 [get_ports {rgmii_rxc}] -set_property PACKAGE_PIN M13 [get_ports {phy_rstn}] -false_path {phy_rstn} clk_enclustra - -# ------------------------------------------------------------------------------------------------- - - diff --git a/EUDETdummy/hdl/Dummy_DUT.vhd b/EUDETdummy/hdl/Dummy_DUT.vhd deleted file mode 100644 index 311e87a..0000000 --- a/EUDETdummy/hdl/Dummy_DUT.vhd +++ /dev/null @@ -1,284 +0,0 @@ ----------------------------------------------------------------------------------- ---! @file --- --- Company: University of Bristol --- Engineer: David Cussans --- --- Create Date: 16:28:09 07/07/2006 --- Design Name: --- Module Name: Dummy_DUT - RTL --- Project Name: --- Target Devices: --- Tool versions: ---! @brief Pretends to be a device under test --- --- --- Dependencies: --- --- Revision: --- Revision 0.01 - File Created --- Additional Comments: --- ----------------------------------------------------------------------------------- -library IEEE; -use IEEE.STD_LOGIC_1164.ALL; -use IEEE.NUMERIC_STD.ALL; - - --- constant definitions. - - - ----- Uncomment the following library declaration if instantiating ----- any Xilinx primitives in this code. ---library UNISIM; ---use UNISIM.VComponents.all; - -entity Dummy_DUT is - Port ( - CLK : in STD_LOGIC; --! this is the USB clock. - RST : in STD_LOGIC; --! Synchronous clock - Trigger : in STD_LOGIC; --! Trigger from TLU - stretchBusy: in STD_LOGIC; -- flag: if 1, then we want to extend the BUSY signal - Busy : out STD_LOGIC; --! Busy to TLU - DUTClk : out STD_LOGIC; --! clock from DUT - TriggerNumber : out STD_LOGIC_VECTOR(31 downto 0); - TriggerNumberStrobe : out STD_LOGIC; - FSM_Error : out STD_LOGIC - ); - -end entity Dummy_DUT; - -architecture RTL of Dummy_DUT is - - component delay is - generic ( - length : integer := 1); -- number of clock cycles to delay signal - port ( - clock : in std_logic; -- rising edge active - input : in std_logic; - output : out std_logic); - end component; - - ----------------------------------------------------------------------------- - - signal Registered_Trigger , Registered_RST : std_logic; -- trigger and reset signals after being registered to suppress meta-stability. - - signal TriggerShiftRegister : STD_LOGIC_VECTOR (31 downto 0); --! register - --to accept - --incoming - --trigger number - - type state_type is (IDLE , WAIT_FOR_TRIGGER_LOW , CLOCKING , OUTPUT_TRIGGER_NUMBER, BUSYDELAY); - signal state : state_type := IDLE; - signal next_state : state_type := IDLE; - - signal TriggerBitCounter : unsigned(4 downto 0) := ( others => '0'); --! stores bit being clocked - --in from TLU. - signal InternalDUTClk : std_logic := '0'; -- ! "can't read an output" bodge - - constant DUTClockDivider : unsigned(3 downto 0) := to_unsigned(14,4); - - constant TriggerBitCounterLimit : unsigned(4 downto 0) := to_unsigned(16,5); - - signal DUTClockCounter : unsigned(4 downto 0) := ( others => '0'); - - signal s_busySR : unsigned( 14 downto 0) := ( others => '0' ); -- --! Shift register to generate stretch - -begin - - trigger_register: delay - generic map ( - length => 2) - port map ( - clock => clk, - input => Trigger, - output => Registered_Trigger); - - reset_register: delay - generic map ( - length => 2) - port map ( - clock => clk, - input => RST, - output => Registered_RST); - - - busy_control: process (clk , state) - begin -- process busy_control - if rising_edge(clk) then - if state = IDLE then - busy <= '0'; - else - busy <= '1'; - end if; - end if; - end process busy_control; - --- busy_control: process (clk , state) --- begin -- process busy_control --- if rising_edge(clk) then --- if (stretchBusy ='1') then --- if ((state = IDLE) and (s_busySR=0)) then --- busy <= '0'; --- s_busySR <= ( others => '1' ); --- elsif ( (state = IDLE) and (s_busySR /= 0) ) then --- busy <= '1'; --- s_busySR <= s_busySR -1; --- else --- busy <= '1'; --- s_busySR <= s_busySR -1; --- end if; --- else --- if state = IDLE then --- busy <= '0'; --- else --- busy <= '1'; --- end if; --- end if; --- end if; --- end process busy_control; - - clock_control: process (clk , state , TriggerBitCounter ) - begin -- process busy_control - if rising_edge(clk) then - if state = CLOCKING then - if (InternalDUTClk = '0') and (DUTClockCounter = DUTClockDivider) then - TriggerBitCounter <= TriggerBitCounter +1; - else - TriggerBitCounter <= TriggerBitCounter; - end if; - else - TriggerBitCounter <= ( others => '0'); - end if; - end if; - end process clock_control; - - - InternalDUTClk_control: process (clk , state , InternalDUTClk) - begin -- process busy_control - if rising_edge(clk) then - if state = CLOCKING then - if DUTClockCounter = DUTClockDivider then - InternalDUTClk <= not InternalDUTClk ; - DUTClockCounter <= ( others => '0'); - else - DUTClockCounter <= DUTClockCounter + 1; - end if; - else - InternalDUTClk <= '0'; - DUTClockCounter <= ( others => '0'); - end if; - end if; - end process InternalDUTClk_control; - - shift_register_control: process (clk , state , TriggerShiftRegister) - begin -- process shift_register_control - if rising_edge(clk) then - if state = IDLE then - TriggerShiftRegister <= ( others => '0'); - elsif state = CLOCKING then - if (InternalDUTClk = '1') and (DUTClockCounter=to_unsigned(1,4 )) then - -- if (InternalDUTClk = '1') and (DUTClockCounter=to_unsigned(1,DUTClockCounter'length )) then - TriggerShiftRegister <= trigger & TriggerShiftRegister( 31 downto 1) ; - -- TriggerShiftRegister <= trigger & TriggerShiftRegister( TriggerShiftRegister'high downto 1) ; - else - TriggerShiftRegister <= TriggerShiftRegister; - end if; - end if; - end if; - end process shift_register_control; - - strobe_control: process (clk , state ) - begin -- process stobe_control - if rising_edge(clk) then - if state = OUTPUT_TRIGGER_NUMBER then - TriggerNumber <= TriggerShiftRegister; - TriggerNumberStrobe <= '1'; - else - TriggerNumberStrobe <= '0'; - end if; - end if; - end process strobe_control; - - busy_delay_control: process(clk, state) - begin - if rising_edge(clk) then - if state= BUSYDELAY then - s_busySR <= s_busySR -1; - elsif state= WAIT_FOR_TRIGGER_LOW then - s_busySR <= ( others => '1' ); - end if; - end if; - end process busy_delay_control; - ---! @brief controls the next state in the state machine --- type : combinational --- inputs : pattern_we, mask_we , beam_state_counter --- outputs: state , beam_state_counter - state_logic: process (state, TriggerBitCounter , registered_trigger ,InternalDUTClk, stretchBusy, s_busySR ) - begin -- process state_logic - case state is - - when IDLE => - if ( registered_trigger = '1') then - next_state <= WAIT_FOR_TRIGGER_LOW; - else - next_state <= IDLE; - end if; - - when WAIT_FOR_TRIGGER_LOW => - if ( registered_trigger = '0' ) then - next_state <= CLOCKING; - else - next_state <= WAIT_FOR_TRIGGER_LOW; - end if; - - when CLOCKING => - if (( TriggerBitCounter = TriggerBitCounterLimit ) and ( InternalDUTClk = '0')) then - next_state <= OUTPUT_TRIGGER_NUMBER; - else - next_state <= CLOCKING; - end if; - - when OUTPUT_TRIGGER_NUMBER => - if (stretchBusy ='1') then - next_state <= BUSYDELAY; - else - next_state <= IDLE; - end if; - - when BUSYDELAY => - if (s_busySR /= 0) then - next_state <= BUSYDELAY; - else - next_state <= IDLE; - end if; - - when others => - next_state <= IDLE; - - end case; - end process state_logic; - - --! @brief Register that holds the current state of the FSM - -- type : combinational - -- inputs : clk , next_state - -- outputs: state - state_register: process (clk ) - begin -- process state_register - if rising_edge(clk) then - if (registered_rst = '1') then - state <= IDLE; - else - state <= next_state; - end if; - end if; - end process state_register; - - DUTClk <= InternalDUTClk; - - fsm_error <= '0'; -- hardware to zero. - -end RTL; - diff --git a/EUDETdummy/hdl/Dummy_DUT_Toplevel.vhd b/EUDETdummy/hdl/Dummy_DUT_Toplevel.vhd deleted file mode 100755 index 9116dc5..0000000 --- a/EUDETdummy/hdl/Dummy_DUT_Toplevel.vhd +++ /dev/null @@ -1,627 +0,0 @@ -------------------------------------------------------------------------------- ---! @file ---! @brief Top level of firmware for dummy JRA1-TLU -------------------------------------------------------------------------------- --- File name: Dummy_DUT_Toplevel.vhd --- Version: 0.1 --- Date: 20/Oct/2009 --- David Cussans --- --- Changes --- -------------------------------------------------------------------------------- - -library IEEE; -use IEEE.STD_LOGIC_1164.all; - -use IEEE.NUMERIC_STD.all; - ---! Use library for instantiating Xilinx primitive components. ---library UNISIM; ---use UNISIM.vcomponents.all; - ---! include definition of TLU address map -use work.TLU_Address_Map_v02.all; - ---! Top level with all the hardware ports. -entity Dummy_DUT_Toplevel is - port ( - USB_StreamCLK : in std_logic; --! 48MHz clock from FX2 - USB_StreamFIFOADDR : out std_logic_vector(1 downto 0); - USB_StreamPKTEND_n : out std_logic; - USB_StreamFlags_n : in std_logic_vector(2 downto 0); - USB_StreamSLOE_n : out std_logic; - USB_StreamSLRD_n : out std_logic; - USB_StreamSLWR_n : out std_logic; - USB_StreamData : inout std_logic_vector(15 downto 0); - USB_StreamFX2Rdy : in std_logic; - - USB_RegCLK : in std_logic; --! 48MHz clock from FX2 - USB_RegAddr : in std_logic_vector(15 downto 0); - USB_RegData : inout std_logic_vector(7 downto 0); - USB_RegOE_n : in std_logic; - USB_RegRD_n : in std_logic; - USB_RegWR_n : in std_logic; - USB_RegCS_n : in std_logic; - - USB_Interrupt : out std_logic; - - User_Signals : inout std_logic_vector(7 downto 0); - - S_CLK : out std_logic; - S_A : out std_logic_vector(22 downto 0); - S_DA : inout std_logic_vector(8 downto 0); - S_DB : inout std_logic_vector(8 downto 0); - S_ADV_LD_N : out std_logic; - S_BWA_N : out std_logic; - S_BWB_N : out std_logic; - S_OE_N : out std_logic; - S_WE_N : out std_logic; - - IO_CLK_N : inout std_logic; --! Posive side of differential user clock - IO_CLK_P : inout std_logic; --! Posive side of differential user clock - IO : inout std_logic_vector(46 downto 0) --! The 47 I/O pins - ); -end Dummy_DUT_Toplevel; - -architecture arch of Dummy_DUT_Toplevel is - - --! Declare interfaces component - component ZestSC1_Interfaces - port ( - --! FPGA pin connections - USB_StreamCLK : in std_logic; - USB_StreamFIFOADDR : out std_logic_vector(1 downto 0); - USB_StreamPKTEND_n : out std_logic; - USB_StreamFlags_n : in std_logic_vector(2 downto 0); - USB_StreamSLOE_n : out std_logic; - USB_StreamSLRD_n : out std_logic; - USB_StreamSLWR_n : out std_logic; - USB_StreamData : inout std_logic_vector(15 downto 0); - USB_StreamFX2Rdy : in std_logic; - - USB_RegCLK : in std_logic; - USB_RegAddr : in std_logic_vector(15 downto 0); - USB_RegData : inout std_logic_vector(7 downto 0); - USB_RegOE_n : in std_logic; - USB_RegRD_n : in std_logic; - USB_RegWR_n : in std_logic; - USB_RegCS_n : in std_logic; - - USB_Interrupt : out std_logic; - - S_CLK : out std_logic; - S_A : out std_logic_vector(22 downto 0); - S_ADV_LD_N : out std_logic; - S_BWA_N : out std_logic; - S_BWB_N : out std_logic; - S_DA : inout std_logic_vector(8 downto 0); - S_DB : inout std_logic_vector(8 downto 0); - S_OE_N : out std_logic; - S_WE_N : out std_logic; - - --! User connections - --! Streaming interface - User_CLK : out std_logic; - User_RST : out std_logic; - - User_StreamBusGrantLength : in std_logic_vector(11 downto 0); - - User_StreamDataIn : out std_logic_vector(15 downto 0); - User_StreamDataInWE : out std_logic; - User_StreamDataInBusy : in std_logic; - - User_StreamDataOut : in std_logic_vector(15 downto 0); - User_StreamDataOutWE : in std_logic; - User_StreamDataOutBusy : out std_logic; - - --! Register interface - User_RegAddr : out std_logic_vector(15 downto 0); - User_RegDataIn : out std_logic_vector(7 downto 0); - User_RegDataOut : in std_logic_vector(7 downto 0); - User_RegWE : out std_logic; - User_RegRE : out std_logic; - - --! Signals and interrupts - User_Interrupt : in std_logic; - - --! SRAM interface - User_SRAM_A : in std_logic_vector(22 downto 0); - User_SRAM_W : in std_logic; - User_SRAM_R : in std_logic; - User_SRAM_DR_VALID : out std_logic; - User_SRAM_DW : in std_logic_vector(17 downto 0); - User_SRAM_DR : out std_logic_vector(17 downto 0) - ); - end component; - - component Register_Controller is - - port ( - - --! Take clock from Zest interface block - User_CLK : in std_logic; - - --! Register interface to USB - User_RegAddr : in std_logic_vector(15 downto 0); - User_RegDataIn : in std_logic_vector(7 downto 0); - User_RegDataOut : out std_logic_vector(7 downto 0); - User_RegWE : in std_logic; - User_RegRE : in std_logic; - - Logic_CLK : in std_logic; - - --! Signals to trigger logic - DUT_Reset : out std_logic_vector(NUMBER_OF_DUT-1 downto 0); --separate bits for each DUT - - DUT_Trigger : out std_logic_vector(NUMBER_OF_DUT-1 downto 0); - DUT_Debug_Trigger : out std_logic_vector(NUMBER_OF_DUT-1 downto 0); - DUT_Busy : in std_logic_vector(NUMBER_OF_DUT-1 downto 0); -- actual state of DUT - DUT_Clock_Debug : in std_logic_vector(NUMBER_OF_DUT-1 downto 0); -- actual state of - -- DUT_CLOCK - - I2C_Select : out std_logic_vector(WIDTH_OF_I2C_SELECT_PORT-1 downto 0); -- output to mux/demux that selects I2C ports - - I2C_SCL_OUT : out std_logic; -- drives SCL - I2C_SCL_IN : in std_logic; -- state of SCL - - I2C_SDA_OUT : out std_logic; -- drives SDA - I2C_SDA_IN : in std_logic; -- state of SDA - - -- Mask for beam trigger inputs. - Beam_Trigger_AMask : out std_logic_vector(NUMBER_OF_BEAM_TRIGGERS-1 downto 0); - Beam_Trigger_OMask : out std_logic_vector(NUMBER_OF_BEAM_TRIGGERS-1 downto 0); - Beam_Trigger_VMask : out std_logic_vector(NUMBER_OF_BEAM_TRIGGERS-1 downto 0); - - Trigger_pattern : out std_logic_vector (15 downto 0); - Aux_pattern : out std_logic_vector (15 downto 0); - - Beam_Trigger_Mask_WE : out std_logic; - Beam_Trigger_Pattern_WE : out std_logic; - - --Beam trigger input for debugging. - beam_trigger_in : in std_logic_vector(NUMBER_OF_BEAM_TRIGGERS-1 downto 0); - calibration_trigger_interval : out std_logic_vector(7 downto 0); - -- send trigger to, and receive busy from only certain DUT.... - DUT_Mask : out std_logic_vector(NUMBER_OF_DUT-1 downto 0); - enable_DUT_veto : out std_logic_vector(NUMBER_OF_DUT-1 downto 0); -- - --! controls if a DUT can halt triggers by - --! raising DUT_CLK line. - DUT_Mask_WE : out std_logic; - - -- because of 8-bit interface trigger a read of whole timestamp and then - -- read each byte separately - Timestamp : in std_logic_vector(TIMESTAMP_WIDTH-1 downto 0); - - Trigger_Counter : in std_logic_vector(TRIGGER_COUNTER_WIDTH-1 downto 0); - Particle_Counter : in std_logic_vector(TRIGGER_COUNTER_WIDTH-1 downto 0); -- fsv - Auxiliary_Counter : in std_logic_vector(TRIGGER_COUNTER_WIDTH-1 downto 0); - Trigger_Scalers : in TRIGGER_SCALER_ARRAY; - Buffer_Pointer : in std_logic_vector(BUFFER_COUNTER_WIDTH-1 downto 0); - - Trigger_Output_FSM_Status : in std_logic_vector(NUMBER_OF_DUT-1 downto 0); - Trigger_FSM_State_Value : in std_logic_vector(( (NUMBER_OF_DUT*4)-1) downto 0); - beam_trigger_fsm_status : in std_logic_vector(2 downto 0); - DMA_Status : in std_logic; - Host_Trig_Inhibit : out std_logic; - Trig_Enable_Status : in std_logic; -- this is the overall status of the TLU ( incl. vetos from DUT) - Clock_Source_Select : out std_logic; - Clock_DCM_Locked : in std_logic; - Reset_Timestamp : out std_logic; - Reset_Buffer_Pointer : out std_logic; - Reset_DMA_Controller : out std_logic; - Reset_ClockGen : out std_logic; - Initiate_Readout : out std_logic; - Reset_Trigger_Counter : out std_logic; - Reset_Trigger_Scalers : out std_logic; - Reset_Trigger_Output_FSM : out std_logic; - Reset_Beam_Trigger_FSM : out std_logic; - Stop_if_Timestamp_Buffer_Full : out std_logic; - strobe_width : out std_logic_vector(STROBE_COUNTER_WIDTH-1 downto 0); - strobe_period : out std_logic_vector(STROBE_COUNTER_WIDTH-1 downto 0); - write_strobe_data : out std_logic; - enable_strobe : out std_logic; - strobe_running : in std_logic; - Write_Trigger_Bits_Mode : out std_logic; - Trigger_Handshake_Mode : out std_logic_vector(NUMBER_OF_DUT-1 downto 0) - ); - end component; - - ----------------------------------------------------------------------------- - - component Dummy_DUT - Port ( - CLK : in STD_LOGIC; --! this is the USB clock. - RST : in STD_LOGIC; --! Synchronous clock - Trigger : in STD_LOGIC; --! Trigger from TLU - Busy : out STD_LOGIC; --! Busy to TLU - DUTClk : out STD_LOGIC; --! clock from DUT - TriggerNumber : out STD_LOGIC_VECTOR(15 downto 0); - TriggerNumberStrobe : out STD_LOGIC; - FSM_Error : out STD_LOGIC - ); - end component; - - ----------------------------------------------------------------------------- - - component Trigger_Number_Error_Checker is - Port ( - CLK : in STD_LOGIC; --! this is the USB clock. - RST : in STD_LOGIC; --! Synchronous with clock - TriggerNumber : in STD_LOGIC_VECTOR(15 downto 0); --! should - --incremeent from - --0 - TriggerNumberStrobe : in STD_LOGIC; --! Active high - TriggerCounter : out STD_LOGIC_VECTOR(15 downto 0); --!internal counter - ErrorFlag : out STD_LOGIC --! goes high if internal number - --doesn't match - ); -end component; - - ----------------------------------------------------------------------------- - - -- declaration of chipscope core .... - - component dummy_dut_chipscope_ila - PORT ( - CONTROL : INOUT STD_LOGIC_VECTOR(35 DOWNTO 0); - CLK : IN STD_LOGIC; - TRIG0 : IN STD_LOGIC_VECTOR(15 DOWNTO 0); - TRIG1 : IN STD_LOGIC_VECTOR(15 DOWNTO 0); - TRIG2 : IN STD_LOGIC_VECTOR(3 DOWNTO 0)); - end component; - - component dummy_dut_chipscope_icon - PORT ( - CONTROL0 : INOUT STD_LOGIC_VECTOR(35 DOWNTO 0)); - end component; - - -- Chipscope signals - signal CONTROL : STD_LOGIC_VECTOR(35 DOWNTO 0); - signal TRIG0 : STD_LOGIC_VECTOR(15 DOWNTO 0); - signal TRIG1 : STD_LOGIC_VECTOR(15 DOWNTO 0); - signal TRIG2 : STD_LOGIC_VECTOR(3 DOWNTO 0); - - - ----------------------------------------------------------------------------- - - - -- Declare signals - signal CLK : std_logic; - signal RST : std_logic; - - -- Register interface - signal Addr : std_logic_vector(15 downto 0); - signal DataIn : std_logic_vector(7 downto 0); - signal DataOut : std_logic_vector(7 downto 0); - signal WE : std_logic; - signal RE : std_logic; - - -- signals associated with streaming interface. - signal Host_Data : std_logic_vector(15 downto 0); - signal Host_Data_WE : std_logic; - signal Host_Busy : std_logic; - - -- Interrupt signal - -- not used in this design - signal Interrupt : std_logic; - - - -- Signals associated with DUT - signal DUT_Reset : std_logic_vector(NUMBER_OF_DUT-1 downto 0); --separate bits for each DUT - signal DUT_Busy : std_logic_vector(NUMBER_OF_DUT-1 downto 0); -- actual state of DUT - signal DUT_Clock : std_logic_vector(NUMBER_OF_DUT-1 downto 0); -- actual state of DUT_CLK - signal DUT_Trigger : std_logic_vector(NUMBER_OF_DUT-1 downto 0); -- - - subtype TriggerNumberType is std_logic_vector(15 downto 0); - type TriggerNumberArray is array (NUMBER_OF_DUT-1 downto 0) of TriggerNumberType; - signal TriggerNumber : TriggerNumberArray; -- trigger number clocked out from TLU - - signal TriggerCounter : TriggerNumberArray; -- trigger number inside - -- error checker - - signal TriggerNumberStrobe : std_logic_vector(NUMBER_OF_DUT-1 downto 0); -- strobes high - - signal ErrorFlag : std_logic_vector(NUMBER_OF_DUT-1 downto 0); -- strobes high - - -- I2C signals - signal I2C_Select : std_logic_vector(WIDTH_OF_I2C_SELECT_PORT-1 downto 0); - signal I2C_SDA_OUT :std_logic; - signal I2C_SCL_OUT :std_logic; - signal I2C_SDA_IN :std_logic; - signal I2C_SCL_IN :std_logic; - - signal trigger_scalers : TRIGGER_SCALER_ARRAY; -- array of 16 bit registers - --- a bodge, since I can't figure out how to make it work with aggregates. - -- declare a constant for the unused IO => . - constant unused_io : std_logic_vector(7 downto 0) := "ZZZZZZZZ" ; - - for all : zestsc1_interfaces use entity work.zestsc1_interfaces(arch); - ------------------------------------------------------------------------ --- end of declarations start of instantiation ------------------------------------------------------------------------ - -begin - - - - -- let unused IO float for now - ( IO(7) , IO(10) , IO(19) , IO(24) , - IO(33) , IO(39) , IO(40) , IO(45) ) <= unused_io; - - -- Instantiate interfaces component - Interfaces : ZestSC1_Interfaces - port map ( - USB_StreamCLK => USB_StreamCLK, - USB_StreamFIFOADDR => USB_StreamFIFOADDR, - USB_StreamPKTEND_n => USB_StreamPKTEND_n, - USB_StreamFlags_n => USB_StreamFlags_n, - USB_StreamSLOE_n => USB_StreamSLOE_n, - USB_StreamSLRD_n => USB_StreamSLRD_n, - USB_StreamSLWR_n => USB_StreamSLWR_n, - USB_StreamData => USB_StreamData, - USB_StreamFX2Rdy => USB_StreamFX2Rdy, - - USB_RegCLK => USB_RegCLK, - USB_RegAddr => USB_RegAddr, - USB_RegData => USB_RegData, - USB_RegOE_n => USB_RegOE_n, - USB_RegRD_n => USB_RegRD_n, - USB_RegWR_n => USB_RegWR_n, - USB_RegCS_n => USB_RegCS_n, - - USB_Interrupt => USB_Interrupt, - - S_CLK => S_CLK, - S_A => S_A, - S_ADV_LD_N => S_ADV_LD_N, - S_BWA_N => S_BWA_N, - S_BWB_N => S_BWB_N, - S_DA => S_DA, - S_DB => S_DB, - S_OE_N => S_OE_N, - S_WE_N => S_WE_N, - - -- User connections - -- Streaming interface - User_CLK => CLK, - -- bodge for simulation - -- User_CLK => open, - User_RST => RST, - - User_StreamBusGrantLength => "100000000000", --! In clock cycles. --- User_StreamBusGrantLength => X"100", -- In clock cycles. Clutching at --- --straws, make this the same as --- --Example2.vhd ( i.e. 256 cycles not --- --2048 ) --- - User_StreamDataIn => open, - User_StreamDataInWE => open, - User_StreamDataInBusy => '1', - - User_StreamDataOut => Host_Data, - User_StreamDataOutWE => Host_Data_WE, - User_StreamDataOutBusy => Host_Busy, - - -- Register interface - User_RegAddr => Addr, - User_RegDataIn => DataIn, - User_RegDataOut => DataOut, - User_RegWE => WE, - User_RegRE => RE, - - -- Interrupts - User_Interrupt => Interrupt, - - -- SRAM interface - User_SRAM_A => "00000000000000000000000", - User_SRAM_W => '0', - User_SRAM_R => '0', - User_SRAM_DR_VALID => open, - User_SRAM_DW => "000000000000000000", - User_SRAM_DR => open - ); - - - reg_ctrl : Register_Controller - port map ( - - -- Take clock from Zest interface block - User_CLK => clk, - - -- Register interface - User_RegAddr => Addr, - User_RegDataIn => DataIn, - User_RegDataOut => DataOut, - User_RegWE => WE, - User_RegRE => RE, - - Logic_CLK => clk, - - -- Signals to trigger logic --- DUT_Reset => , --separate bits for each DUT - --- DUT_Trigger => Host_DUT_Trigger, - --- DUT_Debug_Trigger => Host_DUT_Debug_Trigger , - DUT_Busy => DUT_Busy, -- actual state of DUT - DUT_Clock_Debug => DUT_Clock, - - I2C_Select => I2C_Select , - I2C_SCL_OUT => I2C_SCL_OUT , - I2C_SCL_IN => I2C_SCL_IN , - I2C_SDA_OUT => I2C_SDA_OUT, - I2C_SDA_IN => I2C_SDA_IN , - - -- Mask for beam trigger inputs. --- Beam_Trigger_AMask => open, --- Beam_Trigger_OMask => open, --- Beam_Trigger_VMask => open, --- Beam_Trigger_Mask_WE => open, - - --- Trigger_pattern => open, --- Aux_pattern => open, --- Beam_Trigger_Pattern_WE => beam_trigger_pattern_we, - - - --Beam trigger input for debugging. - beam_trigger_in => ( others => '0'), - --- calibration_trigger_interval => Calibration_Trigger_Interval, - - -- send trigger to, and receive busy from only certain DUT.... --- DUT_Mask => DUT_Mask, --- DUT_Mask_WE => DUT_MAsk_WE, - - -- because of 8-bit interface trigger a read of whole timestamp and then - -- read each byte separately - Timestamp => ( others => '0'), - - Trigger_Counter => ( others => '0'), - Particle_Counter => ( others => '0'), -- fsv - Auxiliary_Counter => ( others => '0'), - Trigger_Scalers => trigger_scalers, - - Buffer_Pointer => ( others => '0'), - - Trigger_Output_FSM_Status => ( others => '0'), - Trigger_FSM_State_Value => ( others => '0'), - beam_trigger_fsm_status => ( others => '0'), - DMA_Status => '0', --- Host_Trig_Inhibit => host_veto, - Trig_Enable_Status => '0', - --- Clock_Source_Select => Clock_Source_Select, - Clock_DCM_Locked => '0' , ---- Reset_Timestamp => Reset_Timestamp, --- Reset_Buffer_Pointer => Reset_Buffer_Pointer, --- Reset_DMA_Controller => Reset_DMA_Controller, --- Reset_ClockGen => Reset_ClockGen , --- Initiate_Readout => Initiate_Readout, --- Reset_Trigger_Counter => Reset_Trigger_Counter, --- Reset_Trigger_Scalers => Reset_Trigger_Scalers, --- Reset_Trigger_Output_FSM => trigger_fsm_reset, --- Reset_Beam_Trigger_FSM => beam_trigger_fsm_reset, --- Stop_if_Timestamp_Buffer_Full => stop_if_buffer_full, --- strobe_width => strobe_width , --- strobe_period => strobe_period , --- write_strobe_data => write_strobe_data , --- enable_strobe => enable_strobe , - strobe_running => '0' --- Write_Trigger_Bits_Mode => write_trigger_bits_mode, --- Trigger_Handshake_Mode => dut_trigger_handshake_mode - ); - --- bodge for simulation: --- clk <= usb_streamclk ; - ----------------------------------------------- --- Use a generate statement to generate the required number of --- trigger outputs. - Trigger_Outputs : - for DUT in 0 to NUMBER_OF_DUT-1 generate - begin - - -- connect up the input pins to the internal signals. - -- odd numbered inputs are inverted to reduce ground bounce in LVDS-->TTL converters - -- the odd-numbered outputs are inverted to reduce ground bounce. - - -- Cross the TRIGGER-->BUSY and DUT_CLK-->Reset lines to allow connection - -- to TLU - - -- Trigger and Reset are inputs to the Dummy DUT, but wired to BUSY and - -- CLOCK lines. - inverted_inputs: if ( (DUT=1) or (DUT=3) or (DUT=5) ) generate - DUT_Trigger(DUT) <= not IO(DUT_BUSY_BIT(DUT)); - DUT_Reset(DUT) <= not IO(DUT_CLOCK_BIT(DUT)); - end generate inverted_inputs; - - noninverted_inputs: if ( (DUT=0) or (DUT=2) or (DUT=4) ) generate - DUT_Trigger(DUT) <= IO(DUT_BUSY_BIT(DUT)); - DUT_Reset(DUT) <= IO(DUT_CLOCK_BIT(DUT)); - end generate noninverted_inputs; - - --------------------------------------------------------------------------- - -- Busy and DUT_Clock are *outputs* from the Dummy DUT, but wired to - -- TRIGGER and RESET outputs. - inverted_outputs: if ( (DUT=1) or (DUT=3) or (DUT=5) ) generate - IO(TRIGGER_OUTPUT_BIT(DUT)) <= not DUT_Busy(DUT); - IO(DUT_RESET_BIT(DUT)) <= not DUT_Clock(DUT); - end generate inverted_outputs; - - noninverted_outputs: if ( (DUT=0) or (DUT=2) or (DUT=4) ) generate - IO(TRIGGER_OUTPUT_BIT(DUT)) <= DUT_Busy(DUT); - IO(DUT_RESET_BIT(DUT)) <= DUT_Clock(DUT); - end generate noninverted_outputs; - - -- generate an instance of the Dummy DUT behind each connector - DUT_Instance: Dummy_DUT - Port map ( - CLK => CLK, - RST => DUT_Reset(DUT), - Trigger => DUT_Trigger(DUT), - Busy => DUT_Busy(DUT), - DUTClk => DUT_Clock(DUT), - TriggerNumber => TriggerNumber(DUT), - TriggerNumberStrobe => TriggerNumberStrobe(DUT), - FSM_Error => open - ); - - -- generate an instance of an error checker for each DUT - error_checker_instance : Trigger_Number_Error_Checker - Port map ( - CLK => CLK, - RST => DUT_Reset(DUT), - TriggerNumber => TriggerNumber(DUT), - TriggerNumberStrobe => TriggerNumberStrobe(DUT), - TriggerCounter => TriggerCounter(DUT), - ErrorFlag => ErrorFlag(DUT) - ); - - end generate; - - -- chipscope instrumentation - icon0 : dummy_dut_chipscope_icon - port map ( - CONTROL0 => CONTROL ); - - ila0 : dummy_dut_chipscope_ila - port map ( - CONTROL => CONTROL, - CLK => CLK, - TRIG0 => TRIG0, - TRIG1 => TRIG1, - TRIG2 => TRIG2); - - -- copy signals to the Chipscope core ports... - TRIG0 <= TriggerNumber(0); - TRIG1 <= TriggerCounter(0); - TRIG2(0) <= ErrorFlag(0); - TRIG2(1) <= TriggerNumberStrobe(0); - TRIG2(2) <= DUT_Reset(0); - TRIG2(3) <= DUT_Trigger(0); - ---------------------------------------------------------------- - --- connect up I2C bus-select lines. - i2c_bus_select: for BUS_ID in 0 to WIDTH_OF_I2C_SELECT_PORT-1 generate - begin - IO(I2C_BUS_SELECT_IO_BITS(BUS_ID)) <= I2C_Select(BUS_ID); - end generate; - - -- conenct up I2C data lines - IO(I2C_SCL_OUT_IO_BIT) <= I2C_SCL_OUT; - IO(I2C_SDA_OUT_IO_BIT) <= I2C_SDA_OUT; - I2C_SCL_IN <= IO(I2C_SCL_IN_IO_BIT); - I2C_SDA_IN <= IO(I2C_SDA_IN_IO_BIT); - - -- connect up BEAM_TRIGGER and CLK to GPIO for debugging... - IO(GPIO_BIT(0)) <= DUT_Trigger(0); - IO(GPIO_BIT(1)) <= DUT_Reset(0); - IO(GPIO_BIT(2)) <= DUT_Busy(0); - IO(GPIO_BIT(3)) <= ErrorFlag(0); -- DUT_Clock(0); - -end arch; diff --git a/EUDETdummy/hdl/Register_Controller.vhd b/EUDETdummy/hdl/Register_Controller.vhd deleted file mode 100644 index d0def0d..0000000 --- a/EUDETdummy/hdl/Register_Controller.vhd +++ /dev/null @@ -1,601 +0,0 @@ -library IEEE; -use IEEE.STD_LOGIC_1164.all; -use IEEE.STD_LOGIC_ARITH.all; -use IEEE.STD_LOGIC_UNSIGNED.all; - --- include address map declarations -use work.TLU_Address_Map.all; - -entity Register_Controller is - - port ( - - -- Take clock from Zest interface block - User_CLK : in std_logic; - - -- Register interface to USB - User_RegAddr : in std_logic_vector(15 downto 0); - User_RegDataIn : in std_logic_vector(7 downto 0); - User_RegDataOut : out std_logic_vector(7 downto 0); - User_RegWE : in std_logic; - User_RegRE : in std_logic; - - -- Take clock from trigger logic. - Logic_CLK : in std_logic; - - -- Signals to trigger logic - DUT_Reset : out std_logic_vector(NUMBER_OF_DUT-1 downto 0); --separate bits for each DUT - - DUT_Trigger : out std_logic_vector(NUMBER_OF_DUT-1 downto 0); - --separate bits for each DUT. Fed via trigger controller, - -- so vetoed if DUT does not respond. - - DUT_Debug_Trigger : out std_logic_vector(NUMBER_OF_DUT-1 downto 0); - --separate bits for each DUT. Fed straight to output pins - - DUT_Busy : in std_logic_vector(NUMBER_OF_DUT-1 downto 0); -- actual state of DUT - DUT_Clock_Debug : in std_logic_vector(NUMBER_OF_DUT-1 downto 0); -- actual state - -- of dut_clk - DUT_Leds : out std_logic_vector(NUMBER_OF_DUT-1 downto 0); -- LED on each - -- RJ45 - - -- Mask for beam trigger inputs. - Beam_Trigger_AMask : out std_logic_vector(NUMBER_OF_BEAM_TRIGGERS-1 downto 0) := ( others => '1' ) ; - Beam_Trigger_OMask : out std_logic_vector(NUMBER_OF_BEAM_TRIGGERS-1 downto 0) := ( others => '0' ) ; - Beam_Trigger_VMask : out std_logic_vector(NUMBER_OF_BEAM_TRIGGERS-1 downto 0); - Beam_Trigger_Mask_WE : out std_logic; - - --Beam trigger input for debugging. - beam_trigger_in : in std_logic_vector(NUMBER_OF_BEAM_TRIGGERS-1 downto 0); - - calibration_trigger_interval : out std_logic_vector(7 downto 0); - - -- send trigger to, and receive busy from only certain DUT.... - DUT_Mask : out std_logic_vector(NUMBER_OF_DUT-1 downto 0); - DUT_Mask_WE : out std_logic; - - -- because of 8-bit interface trigger a read of whole timestamp and then - -- read each byte separately - -- this is the current value of the timestamp - Timestamp : in std_logic_vector(TIMESTAMP_WIDTH-1 downto 0); - - Trigger_Counter : in std_logic_vector(TRIGGER_COUNTER_WIDTH-1 downto 0); - Particle_Counter : in std_logic_vector(TRIGGER_COUNTER_WIDTH-1 downto 0); -- fsv - - Trigger_Scalers : in TRIGGER_SCALER_ARRAY; - - Buffer_Pointer : in std_logic_vector(BUFFER_COUNTER_WIDTH-1 downto 0); - - Trigger_Output_FSM_Status : in std_logic_vector(NUMBER_OF_DUT-1 downto 0); - beam_trigger_fsm_status : in std_logic_vector(2 downto 0); - DMA_Status : in std_logic; - Host_Trig_Inhibit : out std_logic; -- this is the trigger inhibit controlled by the host - Trig_Enable_Status : in std_logic; -- this is the overall status of the TLU ( incl. vetos from DUT) - Clock_Source_Select : out std_logic; - Reset_Timestamp : out std_logic; - Reset_Buffer_Pointer : out std_logic; - Reset_DMA_Controller : out std_logic; - Initiate_Readout : out std_logic; - Reset_Trigger_Counter : out std_logic; - Reset_Trigger_Scalers : out std_logic; - Reset_Trigger_Output_FSM : out std_logic; - Reset_Beam_Trigger_FSM : out std_logic - ); - -end Register_Controller; - - -architecture rtl of Register_Controller is - - component Select_Scaler - port ( - trigger_scaler : in TRIGGER_SCALER; - -- 16-bit register holding scintillator counts - low_byte_out : out std_logic_vector(7 downto 0); -- output to USB i/face - high_byte_out : out std_logic_vector(7 downto 0) -- output to USB i/face - ); - end component; - - signal Output_Data : std_logic_vector(7 downto 0); - -- output data after Mux, before output reg - - -- signal Internal_Trig_Inhibit : std_logic; - -- -- can't read an output port, so declare a dummy signal - - signal Buffer_Pointer_Register : - std_logic_vector(BUFFER_POINTER_WIDTH-1 downto 0); - -- stores the buffer pointer after capture - signal Timestamp_Register : - std_logic_vector(TIMESTAMP_WIDTH-1 downto 0); - -- stores timestamp after capture - signal Trigger_Counter_Register : - std_logic_vector(TRIGGER_COUNTER_WIDTH-1 downto 0); - -- stores the trigger counter after capture - - signal Particle_Counter_Register : - std_logic_vector(TRIGGER_COUNTER_WIDTH-1 downto 0); - -- fsv -- stores the Particle counter after capture - - signal Internal_DUT_Mask : std_logic_vector(NUMBER_OF_DUT-1 downto 0); - -- can't read output port, so declare a dummy signal.... - - signal Internal_DUT_Leds : std_logic_vector(NUMBER_OF_DUT-1 downto 0); - -- can't read output port, so declare a dummy signal.... - - signal Internal_Debug_Trigger : std_logic_vector(NUMBER_OF_DUT-1 downto 0); - -- can't read output port, so declare a dummy signal.... - - signal Internal_DUT_Reset : std_logic_vector(NUMBER_OF_DUT-1 downto 0); - -- can't read output port, so declare a dummy signal.... - - signal Internal_Calibration_Trigger_Interval : std_logic_vector(CALIBRATION_TRIGGER_COUNTER_WIDTH-1 downto 0) := "00000000"; - -- interval between calibration triggers, in units of milli-seconds. Zero turns off triggers - - signal Internal_Host_Trig_Inhibit : std_logic :='1'; - - signal Internal_Clock_Source_Select : std_logic :='1'; - - signal Internal_Beam_Trigger_AMask : std_logic_vector(NUMBER_OF_BEAM_TRIGGERS-1 downto 0); - signal Internal_Beam_Trigger_OMask : std_logic_vector(NUMBER_OF_BEAM_TRIGGERS-1 downto 0); - signal Internal_Beam_Trigger_VMask : std_logic_vector(NUMBER_OF_BEAM_TRIGGERS-1 downto 0); - - signal Registered_Trigger_Scalers : TRIGGER_SCALER_ARRAY; - -- register the scalers... - signal registered_scaler0 : TRIGGER_SCALER; - signal registered_scaler1 : TRIGGER_SCALER; - signal registered_scaler2 : TRIGGER_SCALER; - signal registered_scaler3 : TRIGGER_SCALER; - - signal Trigger_Scaler0_low : std_logic_vector(7 downto 0); - signal Trigger_Scaler0_high : std_logic_vector(7 downto 0); - signal Trigger_Scaler1_low : std_logic_vector(7 downto 0); - signal Trigger_Scaler1_high : std_logic_vector(7 downto 0); - signal Trigger_Scaler2_low : std_logic_vector(7 downto 0); - signal Trigger_Scaler2_high : std_logic_vector(7 downto 0); - signal Trigger_Scaler3_low : std_logic_vector(7 downto 0); - signal Trigger_Scaler3_high : std_logic_vector(7 downto 0); - -begin -- architecture rtl - - - -- purpose: selects which of inputs gets multiplexed to readout bus - -- type : combinational - -- inputs : clk,addr,rw - -- outputs: User_RegDataOut - -- fsv add Particle_Counter_Register - read_mux : process (User_RegAddr, User_CLK , DUT_Busy, DUT_Clock_Debug, Internal_Host_Trig_Inhibit, - Trig_Enable_Status, Buffer_Pointer_Register, Timestamp_Register, - Trigger_Counter_Register, Particle_Counter_Register, Timestamp, Trigger_Counter, Internal_DUT_Mask, - Internal_DUT_Leds, Trigger_Output_FSM_Status, DMA_Status) is - begin -- process read_mux - - if ( - -- don't clock in data - it doesn't seem to work! - -- User_CLK'event and User_CLK = '1' - -- and User_RegRE = '1' - -- and - User_RegAddr(15 downto 6) = BASE_ADDRESS(15 downto 6)) then - - case User_RegAddr(5 downto 0) is - - -- read firmware ID - when FIRMWARE_ID_ADDRESS => - Output_Data <= FIRMWARE_ID; - - -- read staus of DUT_BUSY lines. - when DUT_BUSY_ADDRESS => - Output_Data(NUMBER_OF_DUT-1 downto 0) <= DUT_Busy; - Output_Data(7 downto NUMBER_OF_DUT) <= (others => '0'); - - -- read DUT_CLOCK ( aka DUT_TRIGGER_DATA ) lines - when DUT_CLOCK_DEBUG_ADDRESS => - Output_Data(NUMBER_OF_DUT-1 downto 0) <= DUT_Clock_Debug; - Output_Data(7 downto NUMBER_OF_DUT) <= (others => '0'); - - - -- read state of trigger inhibit line - when TRIG_INHIBIT_ADDRESS => - Output_Data(0) <= Internal_Host_Trig_Inhibit; - Output_Data(1) <= Trig_Enable_Status; - Output_Data(7 downto 2) <= (others => '0'); - - when CLOCK_SOURCE_SELECT_ADDRESS => - Output_Data(0) <= Internal_Clock_Source_Select; - Output_Data(7 downto 1) <= (others => '0'); - - -- interval between internal triggersa - when INTERNAL_TRIGGER_INTERVAL => - Output_Data(7 downto 0) <= Internal_Calibration_Trigger_Interval; - - -- read buffer pointer - -- for now assume a 16-bit buffer pointer - when REGISTERED_BUFFER_POINTER_ADDRESS_0 => - Output_Data <= Buffer_Pointer_Register(7 downto 0); - when REGISTERED_BUFFER_POINTER_ADDRESS_1 => - Output_Data <= Buffer_Pointer_Register(15 downto 8); - - -- read buffer pointer - -- for now assume a 16-bit buffer pointer - when BUFFER_POINTER_ADDRESS_0 => - Output_Data <= Buffer_Pointer(7 downto 0); - when BUFFER_POINTER_ADDRESS_1 => - Output_Data(BUFFER_COUNTER_WIDTH-9 downto 0) <= Buffer_Pointer(BUFFER_COUNTER_WIDTH-1 downto 8); - Output_Data(7 downto BUFFER_COUNTER_WIDTH-8) <= (others => '0'); - - -- read timestamp - -- assume a 64-bit timestamp - when REGISTERED_TIMESTAMP_ADDRESS_0 => - Output_Data <= Timestamp_Register(7 downto 0); - when REGISTERED_TIMESTAMP_ADDRESS_1 => - Output_Data <= Timestamp_Register(15 downto 8); - when REGISTERED_TIMESTAMP_ADDRESS_2 => - Output_Data <= Timestamp_Register(23 downto 16); - when REGISTERED_TIMESTAMP_ADDRESS_3 => - Output_Data <= Timestamp_Register(31 downto 24); - when REGISTERED_TIMESTAMP_ADDRESS_4 => - Output_Data <= Timestamp_Register(39 downto 32); - when REGISTERED_TIMESTAMP_ADDRESS_5 => - Output_Data <= Timestamp_Register(47 downto 40); - when REGISTERED_TIMESTAMP_ADDRESS_6 => - Output_Data <= Timestamp_Register(55 downto 48); - when REGISTERED_TIMESTAMP_ADDRESS_7 => - Output_Data <= Timestamp_Register(63 downto 56); - - -- read registered trigger counter. - -- assume a 32-bit trigger counter - when REGISTERED_TRIGGER_COUNTER_ADDRESS_0 => - Output_Data <= Trigger_Counter_Register(7 downto 0); - when REGISTERED_TRIGGER_COUNTER_ADDRESS_1 => - Output_Data <= Trigger_Counter_Register(15 downto 8); - when REGISTERED_TRIGGER_COUNTER_ADDRESS_2 => - Output_Data <= Trigger_Counter_Register(23 downto 16); - when REGISTERED_TRIGGER_COUNTER_ADDRESS_3 => - Output_Data <= Trigger_Counter_Register(31 downto 24); - - -- read registered Particle counter. -- fsv -- - -- assume a 32-bit trigger counter - when REGISTERED_PARTICLE_COUNTER_ADDRESS_0 => - Output_Data <= Particle_Counter_Register(7 downto 0); - when REGISTERED_PARTICLE_COUNTER_ADDRESS_1 => - Output_Data <= Particle_Counter_Register(15 downto 8); - when REGISTERED_PARTICLE_COUNTER_ADDRESS_2 => - Output_Data <= Particle_Counter_Register(23 downto 16); - when REGISTERED_PARTICLE_COUNTER_ADDRESS_3 => - Output_Data <= Particle_Counter_Register(31 downto 24); - - -- read unregistered timestamp - -- assume a 64-bit timestamp - when TIMESTAMP_ADDRESS_0 => - Output_Data <= Timestamp(7 downto 0); - when TIMESTAMP_ADDRESS_1 => - Output_Data <= Timestamp(15 downto 8); - when TIMESTAMP_ADDRESS_2 => - Output_Data <= Timestamp(23 downto 16); - when TIMESTAMP_ADDRESS_3 => - Output_Data <= Timestamp(31 downto 24); - when TIMESTAMP_ADDRESS_4 => - Output_Data <= Timestamp(39 downto 32); - when TIMESTAMP_ADDRESS_5 => - Output_Data <= Timestamp(47 downto 40); - when TIMESTAMP_ADDRESS_6 => - Output_Data <= Timestamp(55 downto 48); - when TIMESTAMP_ADDRESS_7 => - Output_Data <= Timestamp(63 downto 56); - - -- read unregisteredtrigger counter. - -- assume a 32-bit trigger counter - when TRIGGER_COUNTER_ADDRESS_0 => - Output_Data <= Trigger_Counter(7 downto 0); - when TRIGGER_COUNTER_ADDRESS_1 => - Output_Data <= Trigger_Counter(15 downto 8); - when TRIGGER_COUNTER_ADDRESS_2 => - Output_Data <= Trigger_Counter(23 downto 16); - when TRIGGER_COUNTER_ADDRESS_3 => - Output_Data <= Trigger_Counter(31 downto 24); - - -- read status of DUT mask - when DUT_MASK_ADDRESS => - Output_Data(NUMBER_OF_DUT-1 downto 0) <= Internal_DUT_Mask; - Output_Data(7 downto NUMBER_OF_DUT) <= (others => '0'); - - -- read status of LEDs - when DUT_LED_ADDRESS => - Output_Data(NUMBER_OF_DUT-1 downto 0) <= Internal_DUT_Leds; - Output_Data(7 downto NUMBER_OF_DUT) <= (others => '0'); - - -- read status of debugging trigger (connected to dut trigger - -- outputs without trigger/busy handshake. - when DUT_DEBUG_TRIGGER_ADDRESS => - Output_Data(NUMBER_OF_DUT-1 downto 0) <= Internal_Debug_Trigger; - Output_Data(7 downto NUMBER_OF_DUT) <= (others => '0'); - - -- read status of beam trigger inputs - -- (useful for debugging) - when BEAM_TRIGGER_IN_ADDRESS => - Output_Data(NUMBER_OF_BEAM_TRIGGERS-1 downto 0) <= beam_trigger_in; - Output_Data(7 downto NUMBER_OF_BEAM_TRIGGERS) <= (others => '0'); - - - -- read status of beam_trigger_omask, amask , vmask - when BEAM_TRIGGER_OMASK_ADDRESS => - Output_Data(NUMBER_OF_BEAM_TRIGGERS-1 downto 0) <= Internal_Beam_Trigger_OMask; - Output_Data(7 downto NUMBER_OF_BEAM_TRIGGERS) <= (others => '0'); - - when BEAM_TRIGGER_AMASK_ADDRESS => - Output_Data(NUMBER_OF_BEAM_TRIGGERS-1 downto 0) <= Internal_Beam_Trigger_AMask; - Output_Data(7 downto NUMBER_OF_BEAM_TRIGGERS) <= (others => '0'); - - when BEAM_TRIGGER_VMASK_ADDRESS => - Output_Data(NUMBER_OF_BEAM_TRIGGERS-1 downto 0) <= Internal_Beam_Trigger_VMask; - Output_Data(7 downto NUMBER_OF_BEAM_TRIGGERS) <= (others => '0'); - - -- read status of reset lines - when DUT_RESET_ADDRESS => - Output_Data(NUMBER_OF_DUT-1 downto 0) <= Internal_DUT_Reset; - Output_Data(7 downto NUMBER_OF_DUT) <= (others => '0'); - - when TRIGGER_FSM_STATUS_ADDRESS => - Output_Data(NUMBER_OF_DUT-1 downto 0) <= Trigger_Output_FSM_Status; - Output_Data(7 downto NUMBER_OF_DUT) <= (others => '0'); - - when BEAM_TRIGGER_FSM_STATUS_ADDRESS => - Output_Data(2 downto 0) <= beam_trigger_fsm_status; - Output_Data(7 downto 3) <= (others => '0'); - - when DMA_STATUS_ADDRESS => - Output_Data(0) <= DMA_Status; - Output_Data(7 downto 1) <= (others => '0'); - --- trigger_scaler_read_mux: --- for BEAM_TRIGGER_IDX in 0 to NUMBER_OF_BEAM_TRIGGERS-1 generate --- high_low: --- for HIGH_LOW_BYTE in 0 to 1 generate --- when (TRIGGER_IN0_COUNTER_0 + BEAM_TRIGGER_IDX*2 + HIGH_LOW_BYTE) => --- register_scaler: Select_Scaler --- port map ( --- trigger_scaler => Trigger_Scalers(BEAM_TRIGGER_IDX1), --- byte_select => HIGH_LOW_BYTE1, --- byte_out => Output_Data --- ); --- end generate; -- HIGH_LOW --- end generate; -- BEAM_TRIGGER_IDX --- Output_Data <= Registered_Trigger_Scaler_Byte(BEAM_TRIGGER_IDX*2 + HIGH_LOW_BYTE); - - when TRIGGER_IN0_COUNTER_0 => - Output_Data <= Trigger_Scaler0_low; - - when TRIGGER_IN0_COUNTER_1 => - Output_Data <= Trigger_Scaler0_high; - - when TRIGGER_IN1_COUNTER_0 => - Output_Data <= Trigger_Scaler1_low; - - when TRIGGER_IN1_COUNTER_1 => - Output_Data <= Trigger_Scaler1_high; - - when TRIGGER_IN2_COUNTER_0 => - Output_Data <= Trigger_Scaler2_low; - - when TRIGGER_IN2_COUNTER_1 => - Output_Data <= Trigger_Scaler2_high; - - when TRIGGER_IN3_COUNTER_0 => - Output_Data <= Trigger_Scaler3_low; - - when TRIGGER_IN3_COUNTER_1 => - Output_Data <= Trigger_Scaler3_high; - - - when others => - -- if the address is out of range return zero - --Output_Data(7 downto 0) <= (others => '0'); - null; - - end case; - - --else - -- -- if the address is out of range return zero - -- Output_Data(7 downto 0) <= (others => '0'); - end if; - - end process read_mux; - --- trigger_scaler_register_mux: --- for BEAM_TRIGGER_IDX1 in 0 to NUMBER_OF_BEAM_TRIGGERS-1 generate --- high_low1: --- for HIGH_LOW_BYTE1 in 0 to 1 generate --- register_scaler: Select_Scaler --- port map ( --- trigger_scaler => Trigger_Scalers(BEAM_TRIGGER_IDX1), --- byte_select => HIGH_LOW_BYTE1, --- byte_out => Registered_Scaler_Byte(BEAM_TRIGGER_IDX1*2 + HIGH_LOW_BYTE1) --- ); --- end generate; -- HIGH_LOW --- end generate; -- BEAM_TRIGGER_IDX - --- Registered_Scaler <= Registered_Trigger_Scalers(BEAM_TRIGGER_IDX); --- Registered_Trigger_Scaler(8*(HIGH_LOW_BYTE+1)-1 downto 7*HIGH_LOW_BYTE); - - - -- purpose: Writing to STATE_CAPTURE_ADDRESS registers - -- Timestamp, Trigger_Counter, Buffer_Pointer - -- type : combinational - -- inputs : User_CLK - -- outputs: Timestamp_Register, Trigger_Counter_Register, - -- Buffer_Pointer_Register - - write_mux : process (User_CLK, Timestamp, - Trigger_Counter, Buffer_Pointer) is - begin -- process capture_state - -- clock the data to be written on the *falling* edge of user clock. - if (User_CLK'event and User_CLK = '0') then - if ( User_RegWE = '1' and User_RegAddr(15 downto 6) = BASE_ADDRESS(15 downto 6)) then - - -- Capture timestamp, trigger_counter and buffer_pointer - -- into registers. - if (User_RegAddr(5 downto 0) = STATE_CAPTURE_ADDRESS) then - Timestamp_Register <= Timestamp; - Trigger_Counter_Register <= Trigger_Counter; - Particle_Counter_Register <= Particle_Counter; -- fsv - Buffer_Pointer_Register(BUFFER_COUNTER_WIDTH-1 downto 0) <= Buffer_Pointer; - Buffer_Pointer_Register(BUFFER_POINTER_WIDTH-1 downto BUFFER_COUNTER_WIDTH) <= (others => '0'); - - Registered_Trigger_Scalers <= Trigger_Scalers; - - end if; - - -- output DUT reset signals. - if (User_RegAddr(5 downto 0) = DUT_RESET_ADDRESS ) then - Internal_DUT_Reset <= User_RegDataIn(NUMBER_OF_DUT-1 downto 0); - end if; - - -- output DUT trigger signals for one clock cycle... - if (User_RegAddr(5 downto 0) = DUT_TRIGGER_ADDRESS - ) then - DUT_Trigger <= User_RegDataIn(NUMBER_OF_DUT-1 downto 0); - end if; - - -- output trigger inhibit signal - if (User_RegAddr(5 downto 0) = TRIG_INHIBIT_ADDRESS ) then - Internal_Host_Trig_Inhibit <= User_RegDataIn(0); - end if; - - -- set the frequency of the internal (calibration) triggers - if (User_RegAddr(5 downto 0) = INTERNAL_TRIGGER_INTERVAL ) then - Internal_Calibration_Trigger_Interval <= User_RegDataIn; - end if; - - -- output DUT_mask - if ( User_RegAddr(5 downto 0) = DUT_MASK_ADDRESS ) then - Internal_DUT_Mask <= User_RegDataIn(NUMBER_OF_DUT-1 downto 0); - DUT_Mask_WE <= '1'; - end if; - - -- write to LEDs - if ( User_RegAddr(5 downto 0) = DUT_LED_ADDRESS ) then - Internal_DUT_Leds <= User_RegDataIn(NUMBER_OF_DUT-1 downto 0); - end if; - - - -- Select which clock source drives the trigger logic - -- 0 = external clock - -- 1 = USB ( 48MHz ) clock - if (User_RegAddr(5 downto 0) = CLOCK_SOURCE_SELECT_ADDRESS ) then - Internal_Clock_Source_Select <= User_RegDataIn(0); - end if; - - -- Write to the trigger output. - if ( User_RegAddr(5 downto 0) = DUT_DEBUG_TRIGGER_ADDRESS ) then - Internal_Debug_Trigger <= User_RegDataIn(NUMBER_OF_DUT-1 downto 0); - end if; - - -- output pointer/counter reset signals for one clock cycle. - if (User_RegAddr(5 downto 0) = RESET_REGISTER_ADDRESS - ) then - Reset_Timestamp <= - User_RegDataIn(TIMESTAMP_RESET_BIT); - Reset_Trigger_Counter <= - User_RegDataIn(TRIGGER_COUNTER_RESET_BIT); - Reset_Buffer_Pointer <= - User_RegDataIn(BUFFER_POINTER_RESET_BIT); - Reset_DMA_Controller <= - User_RegDataIn(DMA_CONTROLLER_RESET_BIT); - Reset_Trigger_Output_FSM <= User_RegDataIn(TRIGGER_FSM_RESET_BIT); - --Reset_Beam_Trigger_FSM <= User_RegDataIn(BEAM_TRIGGER_FSM_RESET_BIT); - Reset_Trigger_Scalers <= User_RegDataIn(TRIGGER_SCALERS_RESET_BIT); - end if; - - - - -- Initiate readout block readout of trigger info - if (User_RegAddr(5 downto 0) = INITIATE_READOUT_ADDRESS - ) then - Initiate_Readout <= '1'; - end if; - - -- set beam trigger output masks. - if (User_RegAddr(5 downto 0) = BEAM_TRIGGER_AMASK_ADDRESS or - User_RegAddr(5 downto 0) = BEAM_TRIGGER_OMASK_ADDRESS or - User_RegAddr(5 downto 0) = BEAM_TRIGGER_VMASK_ADDRESS - ) then - Beam_Trigger_Mask_WE <= '1'; - if (User_RegAddr(5 downto 0) = BEAM_TRIGGER_AMASK_ADDRESS) then - Internal_Beam_Trigger_AMask <= User_RegDataIn(NUMBER_OF_BEAM_TRIGGERS-1 downto 0); - elsif (User_RegAddr(5 downto 0) = BEAM_TRIGGER_OMASK_ADDRESS) then - Internal_Beam_Trigger_OMask <= User_RegDataIn(NUMBER_OF_BEAM_TRIGGERS-1 downto 0); - else - Internal_Beam_Trigger_VMask <= User_RegDataIn(NUMBER_OF_BEAM_TRIGGERS-1 downto 0); - end if; - end if; - - - else - initiate_readout <= '0'; - DUT_Mask_WE <= '0'; - Beam_Trigger_Mask_WE <= '0'; - Reset_Timestamp <= '0'; - Reset_Trigger_Counter <= '0'; - Reset_Buffer_Pointer <= '0'; - Reset_DMA_Controller <= '0'; - Reset_Trigger_Output_FSM <= '0'; - Reset_Beam_Trigger_FSM <= '0'; - - end if; - - end if; -- end of clk'falling - end process write_mux; - - - registered_scaler0 <= Registered_Trigger_Scalers(0); - Trigger_Scaler0_low <= registered_scaler0(7 downto 0); - Trigger_Scaler0_high <= registered_scaler0(15 downto 8); - - registered_scaler1 <= Registered_Trigger_Scalers(1); - Trigger_Scaler1_low <= registered_scaler1(7 downto 0); - Trigger_Scaler1_high <= registered_scaler1(15 downto 8); - - registered_scaler2 <= Registered_Trigger_Scalers(2); - Trigger_Scaler2_low <= registered_scaler2(7 downto 0); - Trigger_Scaler2_high <= registered_scaler2(15 downto 8); - - registered_scaler3 <= Registered_Trigger_Scalers(3); - Trigger_Scaler3_low <= registered_scaler3(7 downto 0); - Trigger_Scaler3_high <= registered_scaler3(15 downto 8); - - - -- purpose: output register for data output to USB - -- type : combinational - -- inputs : clk, User_RegDataOut - -- outputs: User_RegDataOut --- output_register: process (User_CLK, Output_Data) is --- begin -- process output_register --- if (User_CLK'event and User_CLK='1') then --- User_RegDataOut <= Output_Data; --- end if; --- end process output_register; - - User_RegDataOut <= Output_Data; - - DUT_Mask <= Internal_DUT_Mask; - - DUT_Leds <= Internal_DUT_Leds; - - DUT_Debug_Trigger <= Internal_Debug_Trigger; - - DUT_Reset <= Internal_DUT_Reset; - - Clock_Source_Select <= Internal_Clock_Source_Select; - - Host_Trig_Inhibit <= Internal_Host_Trig_Inhibit; - - calibration_trigger_interval <= Internal_Calibration_Trigger_Interval; - - Beam_Trigger_OMask <= Internal_Beam_Trigger_OMask; - Beam_Trigger_AMask <= Internal_Beam_Trigger_AMask; - Beam_Trigger_VMask <= Internal_Beam_Trigger_VMask; - - -end architecture rtl; - - - diff --git a/EUDETdummy/hdl/TLU_Address_Map.vhd b/EUDETdummy/hdl/TLU_Address_Map.vhd deleted file mode 100644 index c3b75a3..0000000 --- a/EUDETdummy/hdl/TLU_Address_Map.vhd +++ /dev/null @@ -1,144 +0,0 @@ --- --- TLU_address_map.vhdl --- --- package containg address map and type definitions for JRA1 TLU --- --- Generated by script make_tlu_address_map.pl --- --- Do not edit by hand! --- Edit TLU_address_map.dat instead --- --- Generated on Sun Aug 31 21:05:20 2008 --- -library IEEE; -use IEEE.STD_LOGIC_1164.ALL; - -package TLU_Address_Map is - - constant FIRMWARE_ID : std_logic_vector(7 downto 0) := "11111010" ; - constant NUMBER_OF_DUT : integer := 6; -- how many devices - -- (including telescope devices) - -- in system - - constant BEAM_TRIGGER_MASK_WIDTH : integer := 12; -- should be three times the # trigger - constant NUMBER_OF_BEAM_TRIGGERS : integer := 4; - - constant TIMESTAMP_WIDTH : integer := 64; - constant NUMBER_WORDS_IN_TIMESTAMP : integer := 4; - constant TRIGGER_COUNTER_WIDTH : integer := 32; - constant TRIGGER_DATA_WIDTH : integer := 32; - constant BUFFER_POINTER_WIDTH : integer := 16; -- width of pointer - constant BUFFER_COUNTER_WIDTH : integer := 12; -- this is the width of - -- the counter, - -- *NOT* the pointer - -- ( which has to be - -- an integer number - -- of bytes ) - constant BUFFER_DEPTH : integer := 4096; -- 2^BUFFER_COUNTER_WIDTH - constant BUFFER_HEADROOM : integer := 8; -- leave this many entries in - -- buffer when siganlling full - ----------------------------------------------------------------------------- - -- define which bits in RESET_REGISTER reset which counters/pointers... - constant TIMESTAMP_RESET_BIT : integer := 0; - constant TRIGGER_COUNTER_RESET_BIT : integer := 1; - constant BUFFER_POINTER_RESET_BIT : integer := 2; - constant TRIGGER_FSM_RESET_BIT : integer := 3; - constant BEAM_TRIGGER_FSM_RESET_BIT : integer := 4; - constant DMA_CONTROLLER_RESET_BIT : integer := 5; - constant TRIGGER_SCALERS_RESET_BIT : integer := 6; - - ----------------------------------------------------------------------------- - -- Constants for internal trigger generation - constant CALIBRATION_TRIGGER_COUNTER_WIDTH : integer := 8; - constant SLOW_CLOCK_COUNTER_WIDTH : integer := 16; -- needs to store 48000 - constant SLOW_CLOCK_RATIO : std_logic_vector (SLOW_CLOCK_COUNTER_WIDTH-1 downto 0) := "1011101110000000"; -- ratio between 48MHz and 1kHz - - ----------------------------------------------------------------------------- - constant SCALER_NUMBER_OF_BYTES : integer := 2; - subtype TRIGGER_SCALER is std_logic_vector(8*SCALER_NUMBER_OF_BYTES - 1 downto 0); - type TRIGGER_SCALER_ARRAY is array ( NUMBER_OF_BEAM_TRIGGERS-1 downto 0) of TRIGGER_SCALER; - - ----------------------------------------------------------------------------- - -- mapping of IO pins onto signals in design. - ----------------------------------------------------------------------------- - type beam_trigger_inputs is array ( 0 to 3 ) of integer; - -- this beam trigger mapping assumes use of Bonn discriminator board. - -- i.e. 1,0,3,2 - constant BEAM_TRIG_IN_BIT : beam_trigger_inputs := (9,6,11,8); - - type dut_io is array ( 0 to NUMBER_OF_DUT-1 ) of integer; - constant TRIGGER_OUTPUT_BIT : dut_io := (1,0,3,2,5,4); - constant DUT_RESET_BIT : dut_io := (13,12,15,14,17,16); - constant DUT_BUSY_BIT : dut_io := (27,26,29,28,31,30); - constant DUT_CLOCK_BIT : dut_io := (38,41,43,42,44,46); - constant DUT_LED_BIT : dut_io := (18,21,20,23,22,25); - - type gpio is array (0 to 4) of integer; -- mapping for gpio bits - constant GPIO_BIT : gpio := (37,36,35,34,32); - ----------------------------------------------------------------------------- - - constant BASE_ADDRESS : std_logic_vector(15 downto 0) := "0010000000000000" ; - - constant FIRMWARE_ID_ADDRESS : std_logic_vector(5 downto 0) := "000001" ; - constant DUT_BUSY_ADDRESS : std_logic_vector(5 downto 0) := "000010" ; - constant DUT_RESET_ADDRESS : std_logic_vector(5 downto 0) := "000011" ; - constant DUT_TRIGGER_ADDRESS : std_logic_vector(5 downto 0) := "000100" ; - constant DUT_MASK_ADDRESS : std_logic_vector(5 downto 0) := "000101" ; - constant TRIG_INHIBIT_ADDRESS : std_logic_vector(5 downto 0) := "000110" ; - constant RESET_REGISTER_ADDRESS : std_logic_vector(5 downto 0) := "000111" ; - constant INITIATE_READOUT_ADDRESS : std_logic_vector(5 downto 0) := "001000" ; - constant STATE_CAPTURE_ADDRESS : std_logic_vector(5 downto 0) := "001001" ; - constant TRIGGER_FSM_STATUS_ADDRESS : std_logic_vector(5 downto 0) := "001010" ; - constant BEAM_TRIGGER_FSM_STATUS_ADDRESS : std_logic_vector(5 downto 0) := "001011" ; - constant DMA_STATUS_ADDRESS : std_logic_vector(5 downto 0) := "001100" ; - constant REGISTERED_BUFFER_POINTER_ADDRESS_0 : std_logic_vector(5 downto 0) := "001101" ; - constant REGISTERED_BUFFER_POINTER_ADDRESS_1 : std_logic_vector(5 downto 0) := "001110" ; - constant REGISTERED_TIMESTAMP_ADDRESS_0 : std_logic_vector(5 downto 0) := "001111" ; - constant REGISTERED_TIMESTAMP_ADDRESS_1 : std_logic_vector(5 downto 0) := "010000" ; - constant REGISTERED_TIMESTAMP_ADDRESS_2 : std_logic_vector(5 downto 0) := "010001" ; - constant REGISTERED_TIMESTAMP_ADDRESS_3 : std_logic_vector(5 downto 0) := "010010" ; - constant REGISTERED_TIMESTAMP_ADDRESS_4 : std_logic_vector(5 downto 0) := "010011" ; - constant REGISTERED_TIMESTAMP_ADDRESS_5 : std_logic_vector(5 downto 0) := "010100" ; - constant REGISTERED_TIMESTAMP_ADDRESS_6 : std_logic_vector(5 downto 0) := "010101" ; - constant REGISTERED_TIMESTAMP_ADDRESS_7 : std_logic_vector(5 downto 0) := "010110" ; - constant REGISTERED_TRIGGER_COUNTER_ADDRESS_0 : std_logic_vector(5 downto 0) := "010111" ; - constant REGISTERED_TRIGGER_COUNTER_ADDRESS_1 : std_logic_vector(5 downto 0) := "011000" ; - constant REGISTERED_TRIGGER_COUNTER_ADDRESS_2 : std_logic_vector(5 downto 0) := "011001" ; - constant REGISTERED_TRIGGER_COUNTER_ADDRESS_3 : std_logic_vector(5 downto 0) := "011010" ; - constant BUFFER_POINTER_ADDRESS_0 : std_logic_vector(5 downto 0) := "011011" ; - constant BUFFER_POINTER_ADDRESS_1 : std_logic_vector(5 downto 0) := "011100" ; - constant TIMESTAMP_ADDRESS_0 : std_logic_vector(5 downto 0) := "011101" ; - constant TIMESTAMP_ADDRESS_1 : std_logic_vector(5 downto 0) := "011110" ; - constant TIMESTAMP_ADDRESS_2 : std_logic_vector(5 downto 0) := "011111" ; - constant TIMESTAMP_ADDRESS_3 : std_logic_vector(5 downto 0) := "100000" ; - constant TIMESTAMP_ADDRESS_4 : std_logic_vector(5 downto 0) := "100001" ; - constant TIMESTAMP_ADDRESS_5 : std_logic_vector(5 downto 0) := "100010" ; - constant TIMESTAMP_ADDRESS_6 : std_logic_vector(5 downto 0) := "100011" ; - constant TIMESTAMP_ADDRESS_7 : std_logic_vector(5 downto 0) := "100100" ; - constant TRIGGER_COUNTER_ADDRESS_0 : std_logic_vector(5 downto 0) := "100101" ; - constant TRIGGER_COUNTER_ADDRESS_1 : std_logic_vector(5 downto 0) := "100110" ; - constant TRIGGER_COUNTER_ADDRESS_2 : std_logic_vector(5 downto 0) := "100111" ; - constant TRIGGER_COUNTER_ADDRESS_3 : std_logic_vector(5 downto 0) := "101000" ; - constant BEAM_TRIGGER_AMASK_ADDRESS : std_logic_vector(5 downto 0) := "101001" ; - constant BEAM_TRIGGER_OMASK_ADDRESS : std_logic_vector(5 downto 0) := "101010" ; - constant BEAM_TRIGGER_VMASK_ADDRESS : std_logic_vector(5 downto 0) := "101011" ; - constant INTERNAL_TRIGGER_INTERVAL : std_logic_vector(5 downto 0) := "101100" ; - constant BEAM_TRIGGER_IN_ADDRESS : std_logic_vector(5 downto 0) := "101101" ; - constant DUT_RESET_DEBUG_ADDRESS : std_logic_vector(5 downto 0) := "101110" ; - constant DUT_DEBUG_TRIGGER_ADDRESS : std_logic_vector(5 downto 0) := "101111" ; - constant DUT_CLOCK_DEBUG_ADDRESS : std_logic_vector(5 downto 0) := "110000" ; - constant DUT_LED_ADDRESS : std_logic_vector(5 downto 0) := "110001" ; - constant CLOCK_SOURCE_SELECT_ADDRESS : std_logic_vector(5 downto 0) := "110010" ; - constant TRIGGER_IN0_COUNTER_0 : std_logic_vector(5 downto 0) := "110011" ; - constant TRIGGER_IN0_COUNTER_1 : std_logic_vector(5 downto 0) := "110100" ; - constant TRIGGER_IN1_COUNTER_0 : std_logic_vector(5 downto 0) := "110101" ; - constant TRIGGER_IN1_COUNTER_1 : std_logic_vector(5 downto 0) := "110110" ; - constant TRIGGER_IN2_COUNTER_0 : std_logic_vector(5 downto 0) := "110111" ; - constant TRIGGER_IN2_COUNTER_1 : std_logic_vector(5 downto 0) := "111000" ; - constant TRIGGER_IN3_COUNTER_0 : std_logic_vector(5 downto 0) := "111001" ; - constant TRIGGER_IN3_COUNTER_1 : std_logic_vector(5 downto 0) := "111010" ; - constant REGISTERED_PARTICLE_COUNTER_ADDRESS_0 : std_logic_vector(5 downto 0) := "111011" ; - constant REGISTERED_PARTICLE_COUNTER_ADDRESS_1 : std_logic_vector(5 downto 0) := "111100" ; - constant REGISTERED_PARTICLE_COUNTER_ADDRESS_2 : std_logic_vector(5 downto 0) := "111101" ; - constant REGISTERED_PARTICLE_COUNTER_ADDRESS_3 : std_logic_vector(5 downto 0) := "111110" ; -end package TLU_Address_Map; diff --git a/EUDETdummy/hdl/TLU_address_map_v0-2.vhdl b/EUDETdummy/hdl/TLU_address_map_v0-2.vhdl deleted file mode 100644 index 1d2515d..0000000 --- a/EUDETdummy/hdl/TLU_address_map_v0-2.vhdl +++ /dev/null @@ -1,263 +0,0 @@ --- --- TLU_address_map_v0-2.vhdl --- --- --- Generated on Mon Feb 8 18:18:05 2010 --- --- --- package containg address map and type definitions for JRA1 TLU --- --- Generated by script make_tlu_address_map.pl --- --- Do not edit by hand! --- -library IEEE; -use IEEE.STD_LOGIC_1164.ALL; - -package TLU_Address_Map_v02 is - - constant NUMBER_OF_DUT : integer := 6; -- how many devices - -- (including telescope devices) - -- in system - - constant BEAM_TRIGGER_MASK_WIDTH : integer := 12; -- should be three times the # trigger - constant NUMBER_OF_BEAM_TRIGGERS : integer := 4; - - constant TIMESTAMP_WIDTH : integer := 64; - constant TIMESTAMP_OUTPUT_WIDTH : integer := 16; - constant NUMBER_WORDS_IN_TIMESTAMP : integer := 4; - constant TRIGGER_COUNTER_WIDTH : integer := 32; - constant TRIGGER_DATA_WIDTH : integer := 32; - constant STROBE_COUNTER_WIDTH : integer := 32; -- width for recurring strobe pulses. - constant BUFFER_POINTER_WIDTH : integer := 16; -- width of pointer - constant BUFFER_COUNTER_WIDTH : integer := 12; -- this is the width of - -- the counter, - -- *NOT* the pointer - -- ( which has to be - -- an integer number - -- of bytes ) - constant OUTPUT_BUFFER_COUNTER_WIDTH : integer := BUFFER_COUNTER_WIDTH+2; -- pointer into 16-bit output of DPR - constant BUFFER_DEPTH : integer := 4096; -- 2^BUFFER_COUNTER_WIDTH - constant BUFFER_HEADROOM : integer := 16; -- leave this many entries in - -- buffer when siganlling full - constant NUM_WORDS_IN_LONGLONG : integer := 4; -- Number of 16-bit words in a 64-bit word - - ----------------------------------------------------------------------------- - -- define which bits in RESET_REGISTER reset which counters/pointers... - ----------------------------------------------------------------------------- - constant TIMESTAMP_RESET_BIT : integer := 0; - constant TRIGGER_COUNTER_RESET_BIT : integer := 1; - constant BUFFER_POINTER_RESET_BIT : integer := 2; - constant TRIGGER_FSM_RESET_BIT : integer := 3; - constant BEAM_TRIGGER_FSM_RESET_BIT : integer := 4; - constant DMA_CONTROLLER_RESET_BIT : integer := 5; - constant TRIGGER_SCALERS_RESET_BIT : integer := 6; - constant CLOCK_GEN_RESET_BIT : integer := 7; - - constant ENABLE_DMA_BIT : integer := 0; - constant RESET_DMA_COUNTER_BIT : integer := 1; - - ----------------------------------------------------------------------------- - -- Constants for internal trigger generation - ----------------------------------------------------------------------------- - constant CALIBRATION_TRIGGER_COUNTER_WIDTH : integer := 8; - constant SLOW_CLOCK_COUNTER_WIDTH : integer := 16; -- needs to store 48000 - --constant SLOW_CLOCK_RATIO : std_logic_vector (SLOW_CLOCK_COUNTER_WIDTH-1 downto 0) := "1011101110000000"; -- ratio between 48MHz and 1kHz - -- hack for Santos... - constant SLOW_CLOCK_RATIO : std_logic_vector (SLOW_CLOCK_COUNTER_WIDTH-1 downto 0) := "0000000111100000"; -- ratio between 48MHz and 100kHz - - ----------------------------------------------------------------------------- - -- define sub-types for internal trigger scalers. - ----------------------------------------------------------------------------- - constant SCALER_NUMBER_OF_BYTES : integer := 2; - subtype TRIGGER_SCALER is std_logic_vector(8*SCALER_NUMBER_OF_BYTES - 1 downto 0); - type TRIGGER_SCALER_ARRAY is array ( NUMBER_OF_BEAM_TRIGGERS-1 downto 0) of TRIGGER_SCALER; - - ----------------------------------------------------------------------------- - -- define which bits for I2C lines - ----------------------------------------------------------------------------- - constant I2C_SDA_OUT_BIT : integer := 0; - constant I2C_SDA_IN_BIT : integer := 1; - constant I2C_SCL_OUT_BIT : integer := 2; - constant I2C_SCL_IN_BIT : integer := 3; - constant WIDTH_OF_I2C_SELECT_PORT : integer := 2; - - -- I2C bus numbers ( write to register to select ) - constant I2C_BUS_MOTHERBOARD : integer := 3; - constant I2C_BUS_HDMI : integer := 2; - constant I2C_BUS_LEMO : integer := 1; - constant I2C_BUS_DISPLAY : integer := 0; - - -- List I2C PCA9555 devices. - constant I2C_BUS_MOTHERBOARD_LED_IO : integer := 0; - constant I2C_BUS_MOTHERBOARD_TRIGGER_ENABLE_IPSEL_IO : integer := 1; - constant I2C_BUS_MOTHERBOARD_RESET_ENABLE_IO : integer := 2; - constant I2C_BUS_MOTHERBOARD_FRONT_PANEL_IO : integer := 3; - constant I2C_BUS_MOTHERBOARD_LCD_IO : integer := 4; - - constant I2C_BUS_LEMO_RELAY_IO : integer := 0; - - -- This is a bit of a cock-up. The PCA9555 attached to the LEDs changed address between version "b" ( = 1 ) and version "c" (= 0) - constant I2C_BUS_LEMO_LED_IO_VB : integer := 1; - - constant I2C_BUS_LEMO_LED_IO : integer := 0; - constant I2C_BUS_LEMO_ADC : integer := 2; - - ----------------------------------------------------------------------------- - -- mapping of IO pins onto signals in design. - ----------------------------------------------------------------------------- - type beam_trigger_inputs is array ( 0 to 3 ) of integer; - -- Assumes Bonn discriminator board ( ie 1,0,3,2) - constant BEAM_TRIG_IN_BIT : beam_trigger_inputs := (9,6,11,8); - - type dut_io is array ( 0 to NUMBER_OF_DUT-1 ) of integer; - constant TRIGGER_OUTPUT_BIT : dut_io := (1,0,3,2,5,4); - constant DUT_RESET_BIT : dut_io := (13,12,15,14,17,16); - constant DUT_BUSY_BIT : dut_io := (27,26,29,28,31,30); - constant DUT_CLOCK_BIT : dut_io := (38,41,43,42,44,46); - - -- constant DUT_LED_BIT : dut_io := (18,21,20,23,22,25); - type i2c_select_array is array ( 0 to WIDTH_OF_I2C_SELECT_PORT-1)of integer ; - constant I2C_BUS_SELECT_IO_BITS : i2c_select_array := ( 25 , 22 ); - constant I2C_SCL_OUT_IO_BIT : integer := 18; - constant I2C_SDA_OUT_IO_BIT : integer := 21; - constant I2C_SCL_IN_IO_BIT : integer := 20; - constant I2C_SDA_IN_IO_BIT : integer := 23; - - constant I2C_FRONT_PANEL_INTERRUPT : integer := 32; - - type gpio is array (0 to 3) of integer; -- mapping for gpio bits - constant GPIO_BIT : gpio := (37,36,35,34); - ----------------------------------------------------------------------------- - constant FIRMWARE_ID : std_logic_vector(7 downto 0) := "01000100" ; --- FIRMWARE_ID = 68 - - constant BASE_ADDRESS : std_logic_vector(15 downto 0) := "0010000000000000" ; --- BASE_ADDRESS = 8192 - - constant NUMBER_OF_BITS_TO_DECODE : integer := 7 ; -- how many bits of the address should be decoded? - constant FIRMWARE_ID_ADDRESS : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0000000" ; - constant DUT_BUSY_ADDRESS : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0000001" ; - constant DUT_RESET_ADDRESS : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0000010" ; - constant DUT_TRIGGER_ADDRESS : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0000011" ; - constant DUT_MASK_ADDRESS : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0000100" ; - constant TRIG_INHIBIT_ADDRESS : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0000101" ; - constant RESET_REGISTER_ADDRESS : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0000110" ; - constant INITIATE_READOUT_ADDRESS : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0000111" ; - constant STATE_CAPTURE_ADDRESS : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0001000" ; - constant TRIGGER_FSM_STATUS_ADDRESS : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0001001" ; - constant BEAM_TRIGGER_FSM_STATUS_ADDRESS : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0001010" ; - constant DMA_STATUS_ADDRESS : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0001011" ; - constant REGISTERED_BUFFER_POINTER_ADDRESS_BASE : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0001100" ; - constant REGISTERED_BUFFER_POINTER_ADDRESS_BYTES : integer := 2 ; - constant REGISTERED_BUFFER_POINTER_ADDRESS_0 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0001100" ; - constant REGISTERED_BUFFER_POINTER_ADDRESS_1 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0001101" ; - constant REGISTERED_TIMESTAMP_ADDRESS_BASE : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0001110" ; - constant REGISTERED_TIMESTAMP_ADDRESS_BYTES : integer := 8 ; - constant REGISTERED_TIMESTAMP_ADDRESS_0 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0001110" ; - constant REGISTERED_TIMESTAMP_ADDRESS_1 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0001111" ; - constant REGISTERED_TIMESTAMP_ADDRESS_2 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0010000" ; - constant REGISTERED_TIMESTAMP_ADDRESS_3 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0010001" ; - constant REGISTERED_TIMESTAMP_ADDRESS_4 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0010010" ; - constant REGISTERED_TIMESTAMP_ADDRESS_5 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0010011" ; - constant REGISTERED_TIMESTAMP_ADDRESS_6 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0010100" ; - constant REGISTERED_TIMESTAMP_ADDRESS_7 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0010101" ; - constant REGISTERED_TRIGGER_COUNTER_ADDRESS_BASE : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0010110" ; - constant REGISTERED_TRIGGER_COUNTER_ADDRESS_BYTES : integer := 4 ; - constant REGISTERED_TRIGGER_COUNTER_ADDRESS_0 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0010110" ; - constant REGISTERED_TRIGGER_COUNTER_ADDRESS_1 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0010111" ; - constant REGISTERED_TRIGGER_COUNTER_ADDRESS_2 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0011000" ; - constant REGISTERED_TRIGGER_COUNTER_ADDRESS_3 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0011001" ; - constant BUFFER_POINTER_ADDRESS_BASE : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0011010" ; - constant BUFFER_POINTER_ADDRESS_BYTES : integer := 2 ; - constant BUFFER_POINTER_ADDRESS_0 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0011010" ; - constant BUFFER_POINTER_ADDRESS_1 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0011011" ; - constant TIMESTAMP_ADDRESS_BASE : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0011100" ; - constant TIMESTAMP_ADDRESS_BYTES : integer := 8 ; - constant TIMESTAMP_ADDRESS_0 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0011100" ; - constant TIMESTAMP_ADDRESS_1 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0011101" ; - constant TIMESTAMP_ADDRESS_2 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0011110" ; - constant TIMESTAMP_ADDRESS_3 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0011111" ; - constant TIMESTAMP_ADDRESS_4 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0100000" ; - constant TIMESTAMP_ADDRESS_5 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0100001" ; - constant TIMESTAMP_ADDRESS_6 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0100010" ; - constant TIMESTAMP_ADDRESS_7 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0100011" ; - constant TRIGGER_COUNTER_ADDRESS_BASE : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0100100" ; - constant TRIGGER_COUNTER_ADDRESS_BYTES : integer := 4 ; - constant TRIGGER_COUNTER_ADDRESS_0 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0100100" ; - constant TRIGGER_COUNTER_ADDRESS_1 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0100101" ; - constant TRIGGER_COUNTER_ADDRESS_2 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0100110" ; - constant TRIGGER_COUNTER_ADDRESS_3 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0100111" ; - constant BEAM_TRIGGER_AMASK_ADDRESS : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0101000" ; - constant BEAM_TRIGGER_OMASK_ADDRESS : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0101001" ; - constant BEAM_TRIGGER_VMASK_ADDRESS : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0101010" ; - constant INTERNAL_TRIGGER_INTERVAL : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0101011" ; - constant BEAM_TRIGGER_IN_ADDRESS : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0101100" ; - constant DUT_RESET_DEBUG_ADDRESS : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0101101" ; - constant DUT_DEBUG_TRIGGER_ADDRESS : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0101110" ; - constant DUT_CLOCK_DEBUG_ADDRESS : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0101111" ; - constant DUT_I2C_BUS_SELECT_ADDRESS : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0110000" ; - constant DUT_I2C_BUS_DATA_ADDRESS : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0110001" ; - constant CLOCK_SOURCE_SELECT_ADDRESS : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0110010" ; - constant TRIGGER_IN0_COUNTER_BASE : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0110011" ; - constant TRIGGER_IN0_COUNTER_BYTES : integer := 2 ; - constant TRIGGER_IN0_COUNTER_0 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0110011" ; - constant TRIGGER_IN0_COUNTER_1 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0110100" ; - constant TRIGGER_IN1_COUNTER_BASE : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0110101" ; - constant TRIGGER_IN1_COUNTER_BYTES : integer := 2 ; - constant TRIGGER_IN1_COUNTER_0 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0110101" ; - constant TRIGGER_IN1_COUNTER_1 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0110110" ; - constant TRIGGER_IN2_COUNTER_BASE : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0110111" ; - constant TRIGGER_IN2_COUNTER_BYTES : integer := 2 ; - constant TRIGGER_IN2_COUNTER_0 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0110111" ; - constant TRIGGER_IN2_COUNTER_1 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0111000" ; - constant TRIGGER_IN3_COUNTER_BASE : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0111001" ; - constant TRIGGER_IN3_COUNTER_BYTES : integer := 2 ; - constant TRIGGER_IN3_COUNTER_0 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0111001" ; - constant TRIGGER_IN3_COUNTER_1 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0111010" ; - constant REGISTERED_PARTICLE_COUNTER_ADDRESS_BASE : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0111011" ; - constant REGISTERED_PARTICLE_COUNTER_ADDRESS_BYTES : integer := 4 ; - constant REGISTERED_PARTICLE_COUNTER_ADDRESS_0 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0111011" ; - constant REGISTERED_PARTICLE_COUNTER_ADDRESS_1 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0111100" ; - constant REGISTERED_PARTICLE_COUNTER_ADDRESS_2 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0111101" ; - constant REGISTERED_PARTICLE_COUNTER_ADDRESS_3 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0111110" ; - constant REGISTERED_AUX_COUNTER_ADDRESS_BASE : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0111111" ; - constant REGISTERED_AUX_COUNTER_ADDRESS_BYTES : integer := 4 ; - constant REGISTERED_AUX_COUNTER_ADDRESS_0 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "0111111" ; - constant REGISTERED_AUX_COUNTER_ADDRESS_1 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "1000000" ; - constant REGISTERED_AUX_COUNTER_ADDRESS_2 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "1000001" ; - constant REGISTERED_AUX_COUNTER_ADDRESS_3 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "1000010" ; - constant HANDSHAKE_MODE_ADDRESS : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "1000011" ; - constant BUFFER_STOP_MODE_ADDRESS : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "1000100" ; - constant WRITE_TRIGGER_BITS_MODE_ADDRESS : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "1000101" ; - constant TRIGGER_PATTERN_ADDRESS_BASE : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "1000110" ; - constant TRIGGER_PATTERN_ADDRESS_BYTES : integer := 2 ; - constant TRIGGER_PATTERN_ADDRESS_0 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "1000110" ; - constant TRIGGER_PATTERN_ADDRESS_1 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "1000111" ; - constant AUX_PATTERN_ADDRESS_BASE : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "1001000" ; - constant AUX_PATTERN_ADDRESS_BYTES : integer := 2 ; - constant AUX_PATTERN_ADDRESS_0 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "1001000" ; - constant AUX_PATTERN_ADDRESS_1 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "1001001" ; - constant STROBE_WIDTH_ADDRESS_BASE : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "1001010" ; - constant STROBE_WIDTH_ADDRESS_BYTES : integer := 4 ; - constant STROBE_WIDTH_ADDRESS_0 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "1001010" ; - constant STROBE_WIDTH_ADDRESS_1 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "1001011" ; - constant STROBE_WIDTH_ADDRESS_2 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "1001100" ; - constant STROBE_WIDTH_ADDRESS_3 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "1001101" ; - constant STROBE_PERIOD_ADDRESS_BASE : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "1001110" ; - constant STROBE_PERIOD_ADDRESS_BYTES : integer := 4 ; - constant STROBE_PERIOD_ADDRESS_0 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "1001110" ; - constant STROBE_PERIOD_ADDRESS_1 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "1001111" ; - constant STROBE_PERIOD_ADDRESS_2 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "1010000" ; - constant STROBE_PERIOD_ADDRESS_3 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "1010001" ; - constant STROBE_ENABLE_ADDRESS : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "1010010" ; - constant TRIGGER_FSM_STATUS_VALUE_ADDRESS_BASE : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "1010011" ; - constant TRIGGER_FSM_STATUS_VALUE_ADDRESS_BYTES : integer := 3 ; - constant TRIGGER_FSM_STATUS_VALUE_ADDRESS_0 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "1010011" ; - constant TRIGGER_FSM_STATUS_VALUE_ADDRESS_1 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "1010100" ; - constant TRIGGER_FSM_STATUS_VALUE_ADDRESS_2 : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "1010101" ; - constant ENABLE_DUT_VETO_ADDRESS : std_logic_vector(NUMBER_OF_BITS_TO_DECODE-1 downto 0) := "1010110" ; - - constant ADDRESS_MAP_SIZE : integer := 87 ; - -end package TLU_Address_Map_v02 ; diff --git a/EUDETdummy/hdl/Trigger_Number_Error_Checker.vhd b/EUDETdummy/hdl/Trigger_Number_Error_Checker.vhd deleted file mode 100755 index 8c361f4..0000000 --- a/EUDETdummy/hdl/Trigger_Number_Error_Checker.vhd +++ /dev/null @@ -1,116 +0,0 @@ ----------------------------------------------------------------------------------- ---! @file --- --- Company: University of Bristol --- Engineer: David Cussans --- --- Create Date: 11/11/09 --- Design Name: --- Module Name: Trigger_Number_Error_Checker - RTL --- Project Name: --- Target Devices: --- Tool versions: ---! @brief Checks the trigger numbers being returned by the dummy dut. --- --- --- Dependencies: --- --- Revision: --- Revision 0.01 - File Created --- Additional Comments: --- ----------------------------------------------------------------------------------- -library IEEE; -use IEEE.STD_LOGIC_1164.ALL; -use IEEE.NUMERIC_STD.ALL; - - --- constant definitions. - - - ----- Uncomment the following library declaration if instantiating ----- any Xilinx primitives in this code. ---library UNISIM; ---use UNISIM.VComponents.all; - -entity Trigger_Number_Error_Checker is - Port ( - CLK : in STD_LOGIC; --! this is the USB clock. - RST : in STD_LOGIC; --! Synchronous with clock - TriggerNumber : in STD_LOGIC_VECTOR(15 downto 0); --! should - --incremeent from - --0 - TriggerNumberStrobe : in STD_LOGIC; --! Active high - TriggerCounter : out STD_LOGIC_VECTOR(15 downto 0); --!internal counter - ErrorFlag : out STD_LOGIC --! goes high if internal number - --doesn't match - ); - -end entity Trigger_Number_Error_Checker; - -architecture RTL of Trigger_Number_Error_Checker is - - - - signal InternalTriggerCounter : std_logic_vector(TriggerNumber'high downto 0); -- internal - -- store - -- to compare with output from TLU - - signal InternalErrorFlag : std_logic := '0'; -- VHDL can't read an out-port bodge - - signal Registered_TriggerNumberStrobe0 ,Registered_TriggerNumberStrobe1 ,Registered_TriggerNumberStrobe2 : std_logic := '0'; - -- bodge 'cos I don't understand RTL... - signal Registered_TriggerNumber : std_logic_vector(15 downto 0); - -begin - - delay_triggerstrobe: process (clk , TriggerNumberStrobe ,Registered_TriggerNumberStrobe0 ,Registered_TriggerNumberStrobe1 , Registered_TriggerNumberStrobe2 ) - begin -- process delay_triggerstrobe - if rising_edge(clk) then - Registered_TriggerNumberStrobe0 <= TriggerNumberStrobe; - Registered_TriggerNumberStrobe1 <= Registered_TriggerNumberStrobe0; - Registered_TriggerNumberStrobe2 <= Registered_TriggerNumberStrobe1; - end if; - end process delay_triggerstrobe; - - register_trigger_number: process (clk , TriggerNumber ) - begin -- process register_trigger_number - if rising_edge(clk) then - Registered_TriggerNumber <= TriggerNumber; - end if; - end process register_trigger_number; - - - check_error: process (clk ,Registered_TriggerNumberStrobe0 , Registered_TriggerNumber , InternalTriggerCounter) - begin -- process busy_control - if (rising_edge(clk) and (Registered_TriggerNumberStrobe0 = '1')) then - if ( unsigned(Registered_TriggerNumber) /= (unsigned(InternalTriggerCounter)+2) )then -- - -- temporary fix to check that checker is working. --- if ( unsigned(Registered_TriggerNumber) /= (unsigned(InternalTriggerCounter)+1) )then - InternalErrorFlag <= '1'; - else - InternalErrorFlag <= '0'; - end if; - end if; - end process check_error; - - output_error: process (clk , Registered_TriggerNumberStrobe1 , InternalErrorFlag) - begin -- process output_error - if (rising_edge(clk)and (Registered_TriggerNumberStrobe1 = '1')) then - ErrorFlag <= InternalErrorFlag; - end if; - end process output_error; - - - register_trigger_number: process (clk , Registered_TriggerNumberStrobe2 , TriggerNumber ) - begin -- process output_error - if (rising_edge(clk)and (Registered_TriggerNumberStrobe2 = '1')) then - InternalTriggerCounter <= TriggerNumber; - end if; - end process output_error; - - TriggerCounter <= InternalTriggerCounter; - -end RTL; - diff --git a/EUDETdummy/hdl/ZestSC1_Host.vhd b/EUDETdummy/hdl/ZestSC1_Host.vhd deleted file mode 100644 index f7b1bf9..0000000 --- a/EUDETdummy/hdl/ZestSC1_Host.vhd +++ /dev/null @@ -1,652 +0,0 @@ --- ZestSC1 Host Interface Code --- File name: ZestSC1_Host.vhd --- Version: 1.10 --- Date: 14/3/2006 - --- Copyright (C) 2005 Orange Tree Technologies Ltd. All rights reserved. --- Orange Tree Technologies grants the purchaser of a ZestSC1 the right to use and --- modify this logic core in any form including but not limited to VHDL source code or --- EDIF netlist in FPGA designs that target the ZestSC1. --- Orange Tree Technologies prohibits the use of this logic core or any modification of --- it in any form including but not limited to VHDL source code or EDIF netlist in --- FPGA or ASIC designs that target any other hardware unless the purchaser of the --- ZestSC1 has purchased the appropriate licence from Orange Tree Technologies. --- Contact Orange Tree Technologies if you want to purchase such a licence. - ---***************************************************************************************** ---** ---** Disclaimer: LIMITED WARRANTY AND DISCLAIMER. These designs are ---** provided to you "as is". Orange Tree Technologies and its licensors ---** make and you receive no warranties or conditions, express, implied, ---** statutory or otherwise, and Orange Tree Technologies specifically ---** disclaims any implied warranties of merchantability, non-infringement, ---** or fitness for a particular purpose. Orange Tree Technologies does not ---** warrant that the functions contained in these designs will meet your ---** requirements, or that the operation of these designs will be ---** uninterrupted or error free, or that defects in the Designs will be ---** corrected. Furthermore, Orange Tree Technologies does not warrant or ---** make any representations regarding use or the results of the use of the ---** designs in terms of correctness, accuracy, reliability, or otherwise. ---** ---** LIMITATION OF LIABILITY. In no event will Orange Tree Technologies ---** or its licensors be liable for any loss of data, lost profits, cost or ---** procurement of substitute goods or services, or for any special, ---** incidental, consequential, or indirect damages arising from the use or ---** operation of the designs or accompanying documentation, however caused ---** and on any theory of liability. This limitation will apply even if ---** Orange Tree Technologies has been advised of the possibility of such ---** damage. This limitation shall apply notwithstanding the failure of the ---** essential purpose of any limited remedies herein. ---** ---***************************************************************************************** - -library IEEE; -use IEEE.STD_LOGIC_1164.ALL; -use IEEE.STD_LOGIC_ARITH.ALL; -use IEEE.STD_LOGIC_UNSIGNED.ALL; - -library UNISIM; -use UNISIM.VComponents.all; - -entity ZestSC1_Host is - port ( - -- FPGA pin connections - USB_StreamCLK : in std_logic; - USB_StreamFIFOADDR : out std_logic_vector(1 downto 0); - USB_StreamPKTEND_n : out std_logic; - USB_StreamFlags_n : in std_logic_vector(2 downto 0); - USB_StreamSLOE_n : out std_logic; - USB_StreamSLRD_n : out std_logic; - USB_StreamSLWR_n : out std_logic; - USB_StreamFX2Rdy : in std_logic; --- USB_StreamData : inout std_logic_vector(15 downto 0); - USB_StreamData : out std_logic_vector(15 downto 0); - - USB_RegCLK : in std_logic; - USB_RegAddr : in std_logic_vector(15 downto 0); - USB_RegData : inout std_logic_vector(7 downto 0); - USB_RegOE_n : in std_logic; - USB_RegRD_n : in std_logic; - USB_RegWR_n : in std_logic; - USB_RegCS_n : in std_logic; - - USB_Interrupt : out std_logic; - - -- User connections - -- Streaming interface - User_CLK : out std_logic; - User_RST : out std_logic; - DCMLocked : out std_logic; - - User_StreamBusGrantLength : in std_logic_vector(11 downto 0); - - User_StreamDataIn : out std_logic_vector(15 downto 0); - User_StreamDataInWE : out std_logic; - User_StreamDataInBusy : in std_logic; - - User_StreamDataOut : in std_logic_vector(15 downto 0); - User_StreamDataOutWE : in std_logic; - User_StreamDataOutBusy : out std_logic; - - -- Register interface - User_RegAddr : out std_logic_vector(15 downto 0); - User_RegDataIn : out std_logic_vector(7 downto 0); - User_RegDataOut : in std_logic_vector(7 downto 0); - User_RegWE : out std_logic; - User_RegRE : out std_logic; - - -- Interrupts - User_Interrupt : in std_logic - ); -end ZestSC1_Host; - -architecture arch of ZestSC1_Host is - - -- Reset block - component ROC - port - ( - O : out std_logic - ); - end component; - attribute box_type : string; - attribute box_type of ROC: component is "black_box"; - - -- DCMs - component DCM - -- synthesis translate_off - generic (CLK_FEEDBACK : string := "1X"; - CLKDV_DIVIDE : real := 2.0; - CLKFX_DIVIDE : integer := 1; - CLKFX_MULTIPLY : integer := 4; - CLKIN_DIVIDE_BY_2 : boolean := FALSE; - CLKIN_PERIOD : real := 20.0; - CLKOUT_PHASE_SHIFT : string := "NONE"; - DESKEW_ADJUST : string := "SYSTEM_SYNCHRONOUS"; - DFS_FREQUENCY_MODE : string := "LOW"; - DLL_FREQUENCY_MODE : string := "LOW"; - DSS_MODE : string := "NONE"; - DUTY_CYCLE_CORRECTION : boolean := TRUE; - PHASE_SHIFT : integer := 0; - STARTUP_WAIT : boolean := FALSE); - -- synthesis translate_on - port (CLK0 : out std_ulogic; - CLK180 : out std_ulogic; - CLK270 : out std_ulogic; - CLK2X : out std_ulogic; - CLK2X180 : out std_ulogic; - CLK90 : out std_ulogic; - CLKDV : out std_ulogic; - CLKFX : out std_ulogic; - CLKFX180 : out std_ulogic; - LOCKED : out std_ulogic; - PSDONE : out std_ulogic; - STATUS : out std_logic_vector(7 downto 0); - CLKFB : in std_ulogic; - CLKIN : in std_ulogic; - DSSEN : in std_ulogic; - PSCLK : in std_ulogic; - PSEN : in std_ulogic; - PSINCDEC : in std_ulogic; - RST : in std_ulogic); - end component; - attribute box_type of DCM: component is "black_box"; - - attribute CLK_FEEDBACK : string; - attribute CLKDV_DIVIDE : real; - attribute CLKFX_DIVIDE : integer; - attribute CLKFX_MULTIPLY : integer; - attribute CLKIN_DIVIDE_BY_2 : boolean; - attribute CLKOUT_PHASE_SHIFT : string; - attribute DESKEW_ADJUST : string; - attribute DFS_FREQUENCY_MODE : string; - attribute DLL_FREQUENCY_MODE : string; - attribute DSS_MODE : string; - attribute DUTY_CYCLE_CORRECTION : boolean; - attribute PHASE_SHIFT : integer; - attribute STARTUP_WAIT : boolean; --- attribute FACTORY_JF : integer; - - -- Component Attribute specification for Stream clock DCM - attribute CLK_FEEDBACK of StreamDCM: label is "1X"; - attribute CLKDV_DIVIDE of StreamDCM: label is 2.0; - attribute CLKFX_DIVIDE of StreamDCM: label is 1; - attribute CLKFX_MULTIPLY of StreamDCM: label is 2; - attribute CLKIN_DIVIDE_BY_2 of StreamDCM: label is FALSE; - attribute CLKOUT_PHASE_SHIFT of StreamDCM: label is "NONE"; --- attribute CLKOUT_PHASE_SHIFT of StreamDCM: label is "FIXED"; - attribute DESKEW_ADJUST of StreamDCM : label is "SYSTEM_SYNCHRONOUS"; - attribute DFS_FREQUENCY_MODE of StreamDCM: label is "LOW"; - attribute DLL_FREQUENCY_MODE of StreamDCM: label is "LOW"; - attribute DSS_MODE of StreamDCM: label is "NONE"; - attribute DUTY_CYCLE_CORRECTION of StreamDCM: label is TRUE; - attribute PHASE_SHIFT of StreamDCM: label is 0; --- attribute PHASE_SHIFT of StreamDCM: label is -13; - attribute STARTUP_WAIT of StreamDCM: label is FALSE; --- attribute FACTORY_JF of StreamDCM: label is x"8080"; - - -- Component Attribute specification for Register clock DCM - attribute CLK_FEEDBACK of RegDCM: label is "1X"; - attribute CLKDV_DIVIDE of RegDCM: label is 2.0; - attribute CLKFX_DIVIDE of RegDCM: label is 1; - attribute CLKFX_MULTIPLY of RegDCM: label is 2; - attribute CLKIN_DIVIDE_BY_2 of RegDCM: label is FALSE; - attribute CLKOUT_PHASE_SHIFT of RegDCM: label is "NONE"; - attribute DESKEW_ADJUST of RegDCM : label is "SYSTEM_SYNCHRONOUS"; - attribute DFS_FREQUENCY_MODE of RegDCM: label is "LOW"; - attribute DLL_FREQUENCY_MODE of RegDCM: label is "LOW"; - attribute DSS_MODE of RegDCM: label is "NONE"; - attribute DUTY_CYCLE_CORRECTION of RegDCM: label is TRUE; - attribute PHASE_SHIFT of RegDCM: label is 0; - attribute STARTUP_WAIT of RegDCM: label is FALSE; - - -- Declare global clock buffer - component BUFG - port (I : in std_logic; - O : out std_logic - ); - end component; - attribute box_type of BUFG: component is "black_box"; - - -- General signals - signal RST : std_logic; - signal StreamCLK : std_logic; - signal StreamCLKFB : std_logic; - signal RegCLK : std_logic; - signal RegCLKFB : std_logic; - - -- Streaming interface --- signal StreamRead : std_logic; - signal StreamWrite : std_logic; - signal StreamDataIn : std_logic_vector(15 downto 0); - signal StreamDataOut : std_logic_vector(15 downto 0); - signal DataOutRegFull : std_logic; - signal StreamBusy : std_logic; - signal StreamDataAvailable : std_logic; - signal StreamReadStrobe : std_logic; - signal WriteToFIFOIn : std_logic; - signal StreamWriteStrobe : std_logic; - signal ReadFromFIFOOut : std_logic; - signal ReadOK : std_logic; - signal WriteOK : std_logic; --- signal ReadCycle : std_logic; - signal WriteCycle : std_logic; - signal User_DataInStrobe : std_logic; - signal GrantPeriod : std_logic_vector(11 downto 0); - signal Granted : std_logic; - signal LastDir : std_logic; - - signal FX2FIFOFull : std_logic; - signal FX2FIFOEmpty : std_logic; - - type FIFO_ARRAY_TYPE is array(15 downto 0) of std_logic_vector(15 downto 0); - signal FIFOOut : FIFO_ARRAY_TYPE; - signal FIFOIn : FIFO_ARRAY_TYPE; - signal FIFOInEmpty : std_logic; - - signal FIFOOutWriteCount : std_logic_vector(3 downto 0); - signal FIFOOutWriteCountG : std_logic_vector(3 downto 0); - signal RegFIFOOutWriteCountG : std_logic_vector(3 downto 0); - signal FIFOOutWriteCountInUSB : std_logic_vector(3 downto 0); - - signal FIFOOutReadCount : std_logic_vector(3 downto 0); - signal FIFOOutReadCountG : std_logic_vector(3 downto 0); - signal RegFIFOOutReadCountG : std_logic_vector(3 downto 0); - signal FIFOOutReadCountInUser : std_logic_vector(3 downto 0); - - signal FIFOInWriteCount : std_logic_vector(3 downto 0); - signal FIFOInWriteCountG : std_logic_vector(3 downto 0); - signal RegFIFOInWriteCountG : std_logic_vector(3 downto 0); - signal FIFOInWriteCountInUser : std_logic_vector(3 downto 0); - - signal FIFOInReadCount : std_logic_vector(3 downto 0); - signal FIFOInReadCountG : std_logic_vector(3 downto 0); - signal RegFIFOInReadCountG : std_logic_vector(3 downto 0); - signal FIFOInReadCountInUSB : std_logic_vector(3 downto 0); - - signal FIFOOutDataCount : std_logic_vector(3 downto 0); - signal FIFOInDataCount : std_logic_vector(3 downto 0); - - -- Memory mapped interface - signal RegCS : std_logic; - signal RegLastCS : std_logic; - signal RegOE : std_logic; - signal RegLastOE : std_logic; - signal RegWR : std_logic; - signal RegLastWR : std_logic; - signal RegRD : std_logic; - signal RegLastRD : std_logic; - signal RegOutput : std_logic_vector(7 downto 0); - - -- Counter for interrupt generation - signal IntCounter : std_logic_vector(2 downto 0); - -begin - - -- Generate resets and clocks - ROC_1 : ROC port map ( O => RST ); - User_RST <= RST; - User_CLK <= RegCLK; - - ------------------------- - -- Streaming interface -- - ------------------------- - - -- Control signals - USB_StreamPKTEND_n <= '1'; - USB_StreamSLRD_n <= not StreamReadStrobe; - USB_StreamSLWR_n <= not StreamWriteStrobe; - USB_StreamSLOE_n <= '1'; -- modify for write stream data only - - USB_StreamData <= StreamDataOut; -- modify for output only - --- USB_StreamFIFOADDR <= "00" when (ReadCycle='1' or StreamRead='1') else "10"; - USB_StreamFIFOADDR <= "10"; - - - -- Generate FIFO full and empty flags for the FX2 - -- This must be done internally because the timing of the FX2 flags - -- and read/write strobes is such that we cannot respond to the flags - -- in one clock cycle. The flags from the FX2 are therefore set to - -- one empty place (full flag) and one available word (empty flag). - process (RST, StreamCLK) - begin - if (RST='1') then - FX2FIFOFull <= '1'; - FX2FIFOEmpty <= '1'; - elsif (StreamCLK'event and StreamCLK='1') then - if (USB_StreamFlags_n(0)='1' and USB_StreamFX2Rdy='1') then - FX2FIFOEmpty <= '0'; - elsif (StreamReadStrobe='1') then - FX2FIFOEmpty <= '1'; - end if; - - if (USB_StreamFlags_n(1)='1' and USB_StreamFX2Rdy='1') then - FX2FIFOFull <= '0'; - elsif (StreamWriteStrobe='1') then - FX2FIFOFull <= '1'; - end if; - end if; - end process; - - -- Read and write strobe generation and registering of input and output data - StreamReadStrobe <= '0'; -- modify for write only - - WriteToFIFOIn <= '0'; -- modify for write only - - StreamWriteStrobe <= '1' when (WriteCycle='1') else '0'; - ReadFromFIFOOut <= '1' when (WriteCycle='0' and DataOutRegFull='0' and - StreamDataAvailable='1') else '0'; - WriteOK <= '1' when FX2FIFOFull='0' and (StreamDataAvailable='1' or DataOutRegFull='1') and - USB_StreamFX2Rdy='1' and StreamWrite='1' else '0'; - process (RST, StreamCLK) - begin - if (RST='1') then - DataOutRegFull <= '0'; - elsif (StreamCLK'event and StreamCLK='1') then - if (ReadFromFIFOOut='1') then - StreamDataOut <= FIFOOut(conv_integer(FIFOOutReadCount)); - DataOutRegFull <= '1'; - elsif (StreamWriteStrobe='1') then - DataOutRegFull <= '0'; - end if; - end if; - end process; - - -- Control individual reads and writes from/to the FX2 - process (RST, StreamCLK) - begin - if (RST='1') then --- ReadCycle <= '0'; - WriteCycle <= '0'; - elsif (StreamCLK'event and StreamCLK='1') then - --- ReadCycle <= '0'; -- modify for write only. - - if (WriteCycle='0') then - WriteCycle <= WriteOK; - else - WriteCycle <= '0'; - end if; - - end if; - end process; - - -- Manage transfers - -- Checks whether a transfer is needed and possible - -- Use round robin to alternate between reads and writes - -- - -- GrantLength limits the length of time the streaming bus is granted to - -- reads or writes. Set it low for rapid bus turn arounds at the expense - -- of overall bandwidth. Set high for larger maximum bandwidth at the - -- expense of slower bus turnarounds - -- DGC, Dec 09. - process (RST, StreamCLK) - begin - if (RST='1') then --- StreamRead <= '0'; - StreamWrite <= '0'; - GrantPeriod <= X"000"; - Granted <= '0'; - FIFOInWriteCount <= X"0"; - FIFOOutReadCount <= X"0"; - LastDir <= '0'; - - elsif (StreamCLK'event and StreamCLK='1') then - --- StreamRead <= '0'; - - if (Granted='0') then - - -- modify for output data only - if (FX2FIFOFull='0' and (StreamDataAvailable='1' or DataOutRegFull='1')) then - -- EP6 full flag is clear and we have data - StreamWrite <= '1'; --- GrantPeriod <= User_StreamBusGrantLength; -- no point in --- loading grant period - since don't do anything with it. - LastDir <= '1'; - Granted <= '1'; - end if; - - end if; - - if (WriteToFIFOIn='1') then - FIFOInWriteCount <= FIFOInWriteCount + 1; - end if; - if (ReadFromFIFOOut='1') then - FIFOOutReadCount <= FIFOOutReadCount + 1; - end if; - - end if; - end process; - - -- Short FIFOs for crossing clock domains - -- User domain -> USB - process (RST, RegCLK) - begin - if (RST='1') then - FIFOOutWriteCount <= "0000"; - elsif (RegCLK'event and RegCLK='1') then - if (User_StreamDataOutWE='1') then - FIFOOutWriteCount <= FIFOOutWriteCount + 1; - end if; - end if; - end process; - process (RegCLK) - begin - if (RegCLK'event and RegCLK='1') then - if (User_StreamDataOutWE='1') then - FIFOOut(conv_integer(FIFOOutWriteCount)) <= User_StreamDataOut; - end if; - end if; - end process; - - -- Note fixup for behavioural simulation - holds the data during write strobe - User_StreamDataIn <= ( others => '0' ); - User_StreamDataInWE <= User_DataInStrobe; - User_DataInStrobe <= not FIFOInEmpty and not User_StreamDataInBusy; - - -- Generate busy flag to User - -- Grey code the DataOut read counter, cross clock domain and decode - FIFOOutReadCountG <= FIFOOutReadCount(3) & - (FIFOOutReadCount(3) xor FIFOOutReadCount(2)) & - (FIFOOutReadCount(2) xor FIFOOutReadCount(1)) & - (FIFOOutReadCount(1) xor FIFOOutReadCount(0)); - process (RST, RegCLK) - begin - if (RST='1') then - RegFIFOOutReadCountG <= "0000"; - elsif (RegCLK'event and RegClk='1') then - RegFIFOOutReadCountG <= FIFOOutReadCountG; - end if; - end process; - FIFOOutReadCountInUser <= RegFIFOOutReadCountG(3) & - (RegFIFOOutReadCountG(3) xor RegFIFOOutReadCountG(2)) & - (RegFIFOOutReadCountG(3) xor RegFIFOOutReadCountG(2) xor RegFIFOOutReadCountG(1)) & - (RegFIFOOutReadCountG(3) xor RegFIFOOutReadCountG(2) xor RegFIFOOutReadCountG(1) xor RegFIFOOutReadCountG(0)); - FIFOOutDataCount <= FIFOOutWriteCount-FIFOOutReadCountInUser; - User_StreamDataOutBusy <= '1' when (FIFOOutDataCount(3)='1') else '0'; - - -- Generate write enable strobe to the User - -- Grey code the DataIn write counter, cross clock domain and decode - FIFOInWriteCountG <= FIFOInWriteCount(3) & - (FIFOInWriteCount(3) xor FIFOInWriteCount(2)) & - (FIFOInWriteCount(2) xor FIFOInWriteCount(1)) & - (FIFOInWriteCount(1) xor FIFOInWriteCount(0)); - process (RST, RegCLK) - begin - if (RST='1') then - RegFIFOInWriteCountG <= "0000"; - elsif (RegCLK'event and RegClk='1') then - RegFIFOInWriteCountG <= FIFOInWriteCountG; - end if; - end process; - FIFOInWriteCountInUser <= RegFIFOInWriteCountG(3) & - (RegFIFOInWriteCountG(3) xor RegFIFOInWriteCountG(2)) & - (RegFIFOInWriteCountG(3) xor RegFIFOInWriteCountG(2) xor RegFIFOInWriteCountG(1)) & - (RegFIFOInWriteCountG(3) xor RegFIFOInWriteCountG(2) xor RegFIFOInWriteCountG(1) xor RegFIFOInWriteCountG(0)); - FIFOInEmpty <= '1' when FIFOInWriteCountInUser=FIFOInReadCount else '0'; - - -- Generate 'data available' flag to the USB chip - FIFOOutWriteCountG <= FIFOOutWriteCount(3) & - (FIFOOutWriteCount(3) xor FIFOOutWriteCount(2)) & - (FIFOOutWriteCount(2) xor FIFOOutWriteCount(1)) & - (FIFOOutWriteCount(1) xor FIFOOutWriteCount(0)); - process (RST, StreamCLK) - begin - if (RST='1') then - RegFIFOOutWriteCountG <= "0000"; - elsif (StreamCLK'event and StreamCLK='1') then - RegFIFOOutWriteCountG <= FIFOOutWriteCountG; - end if; - end process; - FIFOOutWriteCountInUSB <= RegFIFOOutWriteCountG(3) & - (RegFIFOOutWriteCountG(3) xor RegFIFOOutWriteCountG(2)) & - (RegFIFOOutWriteCountG(3) xor RegFIFOOutWriteCountG(2) xor RegFIFOOutWriteCountG(1)) & - (RegFIFOOutWriteCountG(3) xor RegFIFOOutWriteCountG(2) xor RegFIFOOutWriteCountG(1) xor RegFIFOOutWriteCountG(0)); - StreamDataAvailable <= '1' when (FIFOOutWriteCountInUSB/=FIFOOutReadCount) else '0'; - - -- Generate 'space available' flag to the USB chip - FIFOInReadCountG <= FIFOInReadCount(3) & - (FIFOInReadCount(3) xor FIFOInReadCount(2)) & - (FIFOInReadCount(2) xor FIFOInReadCount(1)) & - (FIFOInReadCount(1) xor FIFOInReadCount(0)); - process (RST, StreamCLK) - begin - if (RST='1') then - RegFIFOInReadCountG <= "0000"; - elsif (StreamCLK'event and StreamCLK='1') then - RegFIFOInReadCountG <= FIFOInReadCountG; - end if; - end process; - FIFOInReadCountInUSB <= RegFIFOInReadCountG(3) & - (RegFIFOInReadCountG(3) xor RegFIFOInReadCountG(2)) & - (RegFIFOInReadCountG(3) xor RegFIFOInReadCountG(2) xor RegFIFOInReadCountG(1)) & - (RegFIFOInReadCountG(3) xor RegFIFOInReadCountG(2) xor RegFIFOInReadCountG(1) xor RegFIFOInReadCountG(0)); - FIFOInDataCount <= FIFOInWriteCount-FIFOInReadCountInUSB; - StreamBusy <= '1' when (FIFOInDataCount(3)='1') else '0'; - - - ----------------------------- - -- Memory mapped interface -- - ----------------------------- - User_RegAddr <= USB_RegAddr - X"2000"; -- 8051 external memory starts at 0x2000 - User_RegWE <= RegCS and RegLastCS and RegWR and RegLastWR; - User_RegRE <= RegCS and not RegLastCS and RegRD and not RegLastRD; - User_RegDataIn <= USB_RegData; - - RegCS <= not USB_RegCS_n; - RegOE <= not USB_RegOE_n; - RegWR <= not USB_RegWR_n; - RegRD <= not USB_RegRD_n; - process (RegCLK) - begin - if (RegCLK'event and RegCLK='1') then - RegLastCS <= RegCS; - RegLastRD <= RegRD; - RegLastWR <= RegWR; - RegLastOE <= RegOE; - end if; - end process; - - -- Register read interface - process (RegCLK) - begin - if (RegCLK'event and RegCLK='1') then - RegOutput <= User_RegDataOut; - end if; - end process; - - USB_RegData <= RegOutput when (RegRD='1' and RegCS='1' and RegOE='1') else (others=>'Z'); - - - --------------------------- - -- Generate an interrupt -- - --------------------------- - -- Interrupt is active low, edge triggered and must be held for - -- 4 cycles of the register interface clock - process (RST, RegCLK) - begin - if (RST='1') then - IntCounter <= "000"; - elsif (RegCLK'event and RegCLK='1') then - if (User_Interrupt='1') then - IntCounter <= "100"; - elsif (IntCounter/="000") then - IntCounter <= IntCounter + 1; - end if; - end if; - end process; - USB_Interrupt <= not IntCounter(2); - - - ------------------------------- - -- Instatiate DCMs on clocks -- - ------------------------------- - StreamDCM : DCM - -- synthesis translate_off - generic map(CLK_FEEDBACK => "1X", - CLKDV_DIVIDE => 2.0, - CLKFX_DIVIDE => 1, - CLKFX_MULTIPLY => 2, - CLKIN_DIVIDE_BY_2 => false, - CLKOUT_PHASE_SHIFT => "NONE", --- CLKOUT_PHASE_SHIFT => "NONE", - CLKIN_PERIOD => 20.833, - CLKOUT_PHASE_SHIFT => "FIXED", - DESKEW_ADJUST => "SYSTEM_SYNCHRONOUS", - DFS_FREQUENCY_MODE => "LOW", - DLL_FREQUENCY_MODE => "LOW", - DSS_MODE => "NONE", - DUTY_CYCLE_CORRECTION => true, --- PHASE_SHIFT => -13, - PHASE_SHIFT => 0, --- FACTORY_JF => x"8080", - STARTUP_WAIT => false) - -- synthesis translate_on - port map (CLK0 => StreamCLKFB, - CLKFB => StreamCLK, - CLKIN => USB_StreamCLK, - DSSEN => '0', - PSCLK => '0', - PSEN => '0', - PSINCDEC => '0', - RST => RST); - StreamCLK_BUFG: BUFG - port map ( - I => StreamCLKFB, - O => StreamCLK - ); - - RegDCM : DCM - -- synthesis translate_off - generic map(CLK_FEEDBACK => "1X", - CLKDV_DIVIDE => 2.0, - CLKFX_DIVIDE => 1, - CLKFX_MULTIPLY => 2, - CLKIN_DIVIDE_BY_2 => false, - CLKOUT_PHASE_SHIFT => "NONE", - DESKEW_ADJUST => "SYSTEM_SYNCHRONOUS", - DFS_FREQUENCY_MODE => "LOW", - DLL_FREQUENCY_MODE => "LOW", - DSS_MODE => "NONE", - DUTY_CYCLE_CORRECTION => true, - PHASE_SHIFT => 0, - STARTUP_WAIT => false) - -- synthesis translate_on - port map (CLK0 => RegCLKFB, - CLKFB => RegCLK, - CLKIN => USB_RegCLK, - DSSEN => '0', - PSCLK => '0', - PSEN => '0', - PSINCDEC => '0', - RST => RST, - LOCKED => DCMLocked); - RegCLK_BUFG: BUFG - port map ( - I => RegCLKFB, - O => RegCLK - ); - -end arch; diff --git a/EUDETdummy/hdl/ZestSC1_Interfaces.vhd b/EUDETdummy/hdl/ZestSC1_Interfaces.vhd deleted file mode 100644 index 6f9909e..0000000 --- a/EUDETdummy/hdl/ZestSC1_Interfaces.vhd +++ /dev/null @@ -1,329 +0,0 @@ --- ZestSC1 Top Level Code --- File name: ZestSC1_Interfaces.vhd --- Version: 1.00 --- Date: 9/2/2005 - --- Copyright (C) 2005 Orange Tree Technologies Ltd. All rights reserved. --- Orange Tree Technologies grants the purchaser of a ZestSC1 the right to use and --- modify this logic core in any form including but not limited to VHDL source code or --- EDIF netlist in FPGA designs that target the ZestSC1. --- Orange Tree Technologies prohibits the use of this logic core or any modification of --- it in any form including but not limited to VHDL source code or EDIF netlist in --- FPGA or ASIC designs that target any other hardware unless the purchaser of the --- ZestSC1 has purchased the appropriate licence from Orange Tree Technologies. --- Contact Orange Tree Technologies if you want to purchase such a licence. - ---***************************************************************************************** ---** ---** Disclaimer: LIMITED WARRANTY AND DISCLAIMER. These designs are ---** provided to you "as is". Orange Tree Technologies and its licensors ---** make and you receive no warranties or conditions, express, implied, ---** statutory or otherwise, and Orange Tree Technologies specifically ---** disclaims any implied warranties of merchantability, non-infringement, ---** or fitness for a particular purpose. Orange Tree Technologies does not ---** warrant that the functions contained in these designs will meet your ---** requirements, or that the operation of these designs will be ---** uninterrupted or error free, or that defects in the Designs will be ---** corrected. Furthermore, Orange Tree Technologies does not warrant or ---** make any representations regarding use or the results of the use of the ---** designs in terms of correctness, accuracy, reliability, or otherwise. ---** ---** LIMITATION OF LIABILITY. In no event will Orange Tree Technologies ---** or its licensors be liable for any loss of data, lost profits, cost or ---** procurement of substitute goods or services, or for any special, ---** incidental, consequential, or indirect damages arising from the use or ---** operation of the designs or accompanying documentation, however caused ---** and on any theory of liability. This limitation will apply even if ---** Orange Tree Technologies has been advised of the possibility of such ---** damage. This limitation shall apply notwithstanding the failure of the ---** essential purpose of any limited remedies herein. ---** ---***************************************************************************************** - -library IEEE; -use IEEE.STD_LOGIC_1164.ALL; -use IEEE.STD_LOGIC_ARITH.ALL; -use IEEE.STD_LOGIC_UNSIGNED.ALL; - --- Uncomment the following lines to use the declarations that are --- provided for instantiating Xilinx primitive components. ---library UNISIM; ---use UNISIM.VComponents.all; - -entity ZestSC1_Interfaces is - port ( - -- User connections - -- General connections - User_CLK : out std_logic; -- User logic clock - User_RST : out std_logic; -- User logic reset - - -- USB Streaming interface - User_StreamBusGrantLength : in std_logic_vector(11 downto 0); -- Round robin grant length - -- Controls read and write grant times - -- on the streaming bus - - User_StreamDataIn : out std_logic_vector(15 downto 0); -- Stream data from host - User_StreamDataInWE : out std_logic; -- Stream write strobe from host - User_StreamDataInBusy : in std_logic; -- Busy for stream from host - - User_StreamDataOut : in std_logic_vector(15 downto 0); -- Stream data to host - User_StreamDataOutWE : in std_logic; -- Stream write strobe to host - User_StreamDataOutBusy : out std_logic; -- Busy for stream to host - - -- USB Register interface - User_RegAddr : out std_logic_vector(15 downto 0); -- Register interface address - User_RegDataIn : out std_logic_vector(7 downto 0); -- Register write data - User_RegDataOut : in std_logic_vector(7 downto 0); -- Register read data - User_RegWE : out std_logic; -- Write strobe for register - User_RegRE : out std_logic; -- Read strobe for register - - -- USB Interrupts - User_Interrupt : in std_logic; -- Interrupt to host PC - - -- SRAM interface - User_SRAM_A: in std_logic_vector(22 downto 0); -- 23-bit address - User_SRAM_W: in std_logic; -- write strobe active high - User_SRAM_R: in std_logic; -- read strobe active high - User_SRAM_DR_VALID: out std_logic; -- read data valid strobe active high - User_SRAM_DW: in std_logic_vector(17 downto 0); -- 18-bit data bus for writing to SRAM - User_SRAM_DR: out std_logic_vector(17 downto 0); -- 18-bit data bus for reading from SRAM - - -- FPGA pin connections - -- External USB Controller interface - USB_StreamCLK : in std_logic; - USB_StreamFIFOADDR : out std_logic_vector(1 downto 0); - USB_StreamPKTEND_n : out std_logic; - USB_StreamFlags_n : in std_logic_vector(2 downto 0); - USB_StreamSLOE_n : out std_logic; - USB_StreamSLRD_n : out std_logic; - USB_StreamSLWR_n : out std_logic; - USB_StreamFX2Rdy : in std_logic; - USB_StreamData : inout std_logic_vector(15 downto 0); - - USB_RegCLK : in std_logic; - USB_RegAddr : in std_logic_vector(15 downto 0); - USB_RegData : inout std_logic_vector(7 downto 0); - USB_RegOE_n : in std_logic; - USB_RegRD_n : in std_logic; - USB_RegWR_n : in std_logic; - USB_RegCS_n : in std_logic; - - USB_Interrupt : out std_logic; - - -- External SRAM interface - S_CLK: out std_logic; - S_A: out std_logic_vector(22 downto 0); - S_ADV_LD_N: out std_logic; - S_BWA_N: out std_logic; - S_BWB_N: out std_logic; - S_DA: inout std_logic_vector(8 downto 0); - S_DB: inout std_logic_vector(8 downto 0); - S_OE_N: out std_logic; - S_WE_N: out std_logic - ); - -end ZestSC1_Interfaces; - -architecture arch of ZestSC1_Interfaces is - -component ZestSC1_Host is - port ( - -- FPGA pin connections - USB_StreamCLK : in std_logic; - USB_StreamFIFOADDR : out std_logic_vector(1 downto 0); - USB_StreamPKTEND_n : out std_logic; - USB_StreamFlags_n : in std_logic_vector(2 downto 0); - USB_StreamSLOE_n : out std_logic; - USB_StreamSLRD_n : out std_logic; - USB_StreamSLWR_n : out std_logic; - USB_StreamFX2Rdy : in std_logic; - USB_StreamData : inout std_logic_vector(15 downto 0); - - USB_RegCLK : in std_logic; - USB_RegAddr : in std_logic_vector(15 downto 0); - USB_RegData : inout std_logic_vector(7 downto 0); - USB_RegOE_n : in std_logic; - USB_RegRD_n : in std_logic; - USB_RegWR_n : in std_logic; - USB_RegCS_n : in std_logic; - - USB_Interrupt : out std_logic; - - -- User connections - -- General connections - User_CLK : out std_logic; - User_RST : out std_logic; - DCMLocked : out std_logic; - - -- Streaming interface - User_StreamBusGrantLength : in std_logic_vector(11 downto 0); - - User_StreamDataIn : out std_logic_vector(15 downto 0); - User_StreamDataInWE : out std_logic; - User_StreamDataInBusy : in std_logic; - - User_StreamDataOut : in std_logic_vector(15 downto 0); - User_StreamDataOutWE : in std_logic; - User_StreamDataOutBusy : out std_logic; - - -- Register interface - User_RegAddr : out std_logic_vector(15 downto 0); - User_RegDataIn : out std_logic_vector(7 downto 0); - User_RegDataOut : in std_logic_vector(7 downto 0); - User_RegWE : out std_logic; - User_RegRE : out std_logic; - - -- Interrupts - User_Interrupt : in std_logic - ); -end component; - - --- comment out unused SRAM ---component ZestSC1_SRAM is --- port ( --- -- User interface --- USER_CLK: in std_logic; -- clock from user logic --- USER_RESET: in std_logic; -- reset --- USER_A: in std_logic_vector(22 downto 0); -- 23-bit address --- USER_W: in std_logic; -- write strobe active high --- USER_R: in std_logic; -- read strobe active high --- USER_DR_VALID: out std_logic; -- read data valid strobe active high --- USER_DW: in std_logic_vector(17 downto 0); -- 18-bit data bus for writing to SRAM --- USER_DR: out std_logic_vector(17 downto 0); -- 18-bit data bus for reading from SRAM --- --- -- ZBT SRAM interface --- CLK_SRAM: out std_logic; --- S_A: out std_logic_vector(22 downto 0); --- S_ADV_LD_N: out std_logic; --- S_BWA_N: out std_logic; --- S_BWB_N: out std_logic; --- S_DA: inout std_logic_vector(8 downto 0); --- S_DB: inout std_logic_vector(8 downto 0); --- S_OE_N: out std_logic; --- S_WE_N: out std_logic --- ); ---end component; - -signal Clk: std_logic; -signal Reset: std_logic; -signal SRAMReset : std_logic; -signal DCMLocked : std_logic; - --- Preserve IO signals to prevent errors from the UCF file --- Comment out all keep attributes in an attempt to see if it --- screws ISE 9.1 ---attribute keep : string; ---attribute keep of USB_StreamCLK: signal is "true"; ---attribute keep of USB_StreamSLRD_n: signal is "true"; ---attribute keep of USB_StreamSLWR_n: signal is "true"; ---attribute keep of USB_StreamSLOE_n: signal is "true"; ---attribute keep of USB_StreamFX2Rdy: signal is "true"; ---attribute keep of USB_StreamFIFOADDR: signal is "true"; ---attribute keep of USB_StreamPKTEND_n: signal is "true"; ---attribute keep of USB_StreamData: signal is "true"; ---attribute keep of USB_StreamFlags_n: signal is "true"; --- ---attribute keep of USB_RegCLK: signal is "true"; ---attribute keep of USB_RegAddr: signal is "true"; ---attribute keep of USB_RegOE_n: signal is "true"; ---attribute keep of USB_RegRD_n: signal is "true"; ---attribute keep of USB_RegWR_n: signal is "true"; ---attribute keep of USB_RegCS_n: signal is "true"; ---attribute keep of USB_RegData: signal is "true"; --- ---attribute keep of USB_Interrupt: signal is "true"; --- ---attribute keep of S_CLK: signal is "true"; ---attribute keep of S_A: signal is "true"; ---attribute keep of S_BWA_N: signal is "true"; ---attribute keep of S_BWB_N: signal is "true"; ---attribute keep of S_DA: signal is "true"; ---attribute keep of S_DB: signal is "true"; ---attribute keep of S_OE_N: signal is "true"; ---attribute keep of S_WE_N: signal is "true"; ---attribute keep of S_ADV_LD_N: signal is "true"; - -begin - -User_CLK <= Clk; -User_RST <= Reset; -SRAMReset <= Reset or not DCMLocked; - -INST_ZestSC1_Host: ZestSC1_Host - port map ( - -- FPGA pin connections - USB_StreamCLK => USB_StreamCLK, - USB_StreamFIFOADDR => USB_StreamFIFOADDR, - USB_StreamPKTEND_n => USB_StreamPKTEND_n, - USB_StreamFlags_n => USB_StreamFlags_n, - USB_StreamSLOE_n => USB_StreamSLOE_n, - USB_StreamSLRD_n => USB_StreamSLRD_n, - USB_StreamSLWR_n => USB_StreamSLWR_n, - USB_StreamFX2Rdy => USB_StreamFX2Rdy, - USB_StreamData => USB_StreamData, - - USB_RegCLK => USB_RegCLK, - USB_RegAddr => USB_RegAddr, - USB_RegData => USB_RegData, - USB_RegOE_n => USB_RegOE_n, - USB_RegRD_n => USB_RegRD_n, - USB_RegWR_n => USB_RegWR_n, - USB_RegCS_n => USB_RegCS_n, - - USB_Interrupt => USB_Interrupt, - - -- User connections - -- General connections - User_CLK => Clk, - User_RST => Reset, - DCMLocked => DCMLocked, - - -- Streaming interface - User_StreamBusGrantLength => User_StreamBusGrantLength, - - User_StreamDataIn => User_StreamDataIn, - User_StreamDataInWE => User_StreamDataInWE, - User_StreamDataInBusy => User_StreamDataInBusy, - - User_StreamDataOut => User_StreamDataOut, - User_StreamDataOutWE => User_StreamDataOutWE, - User_StreamDataOutBusy => User_StreamDataOutBusy, - - -- Register interface - User_RegAddr => User_RegAddr, - User_RegDataIn => User_RegDataIn, - User_RegDataOut => User_RegDataOut, - User_RegWE => User_RegWE, - User_RegRE => User_RegRE, - - -- Interrupts - User_Interrupt => User_Interrupt - ); - --- Comment out SRAM since it isn't needed. ---INST_SRAM: ZestSC1_SRAM --- port map( --- -- User interface --- USER_CLK => Clk, --- USER_RESET => SRAMReset, --- USER_A => USER_SRAM_A, --- USER_W => USER_SRAM_W, --- USER_R => USER_SRAM_R, --- USER_DR_VALID => USER_SRAM_DR_VALID, --- USER_DW => USER_SRAM_DW, --- USER_DR => USER_SRAM_DR, --- --- -- ZBT SRAM interface --- CLK_SRAM => S_CLK, --- S_A => S_A, --- S_ADV_LD_N => S_ADV_LD_N, --- S_BWA_N => S_BWA_N, --- S_BWB_N => S_BWB_N, --- S_DA => S_DA, --- S_DB => S_DB, --- S_OE_N => S_OE_N, --- S_WE_N => S_WE_N --- ); - -end arch; diff --git a/EUDETdummy/hdl/clocks_7s_extphy_se.vhd b/EUDETdummy/hdl/clocks_7s_extphy_se.vhd deleted file mode 100644 index 90c77ff..0000000 --- a/EUDETdummy/hdl/clocks_7s_extphy_se.vhd +++ /dev/null @@ -1,151 +0,0 @@ --- clocks_7s_extphy_se --- --- Generates a 125MHz ethernet clock and 31MHz ipbus clock from the 50MHz reference --- Also an unbuffered 200MHz clock for IO delay calibration block --- Includes reset logic for ipbus --- --- Dave Newbold, April 2011 --- --- $Id$ - -library ieee; -use ieee.std_logic_1164.all; -use ieee.numeric_std.all; - -library unisim; -use unisim.VComponents.all; - -entity clocks_7s_extphy_Se is - port( - sysclk: in std_logic; - clko_125: out std_logic; - clko_125_90: out std_logic; - clko_200: out std_logic; - clko_ipb: out std_logic; - locked: out std_logic; - nuke: in std_logic; - soft_rst: in std_logic; - rsto_125: out std_logic; - rsto_ipb: out std_logic; - rsto_ipb_ctrl: out std_logic; - onehz: out std_logic - ); - -end clocks_7s_extphy_se; - -architecture rtl of clocks_7s_extphy_se is - - signal dcm_locked, sysclk_i, clk_ipb_i, clk_125_i, clk_125_90_i, clkfb, clk_ipb_b, clk_125_b, clk_200_i: std_logic; - signal d17, d17_d: std_logic; - signal nuke_i, nuke_d, nuke_d2: std_logic := '0'; - signal rst, srst, rst_ipb, rst_125, rst_ipb_ctrl: std_logic := '1'; - signal rctr: unsigned(3 downto 0) := "0000"; - -begin - - ibufgds0: IBUFG port map( - i => sysclk, - o => sysclk_i - ); - - bufg125: BUFG port map( - i => clk_125_i, - o => clk_125_b - ); - - clko_125 <= clk_125_b; - - bufg125_90: BUFG port map( - i => clk_125_90_i, - o => clko_125_90 - ); - - bufgipb: BUFG port map( - i => clk_ipb_i, - o => clk_ipb_b - ); - - clko_ipb <= clk_ipb_b; - - bufg200: BUFG port map( - i => clk_200_i, - o => clko_200 - ); - - mmcm: MMCME2_BASE - generic map( - clkfbout_mult_f => 20.0, - clkout1_divide => 8, - clkout2_divide => 8, - clkout2_phase => 90.0, - clkout3_divide => 32, - clkout4_divide => 5, - clkin1_period => 20.0 - ) - port map( - clkin1 => sysclk_i, - clkfbin => clkfb, - clkfbout => clkfb, - clkout1 => clk_125_i, - clkout2 => clk_125_90_i, - clkout3 => clk_ipb_i, - clkout4 => clk_200_i, - locked => dcm_locked, - rst => '0', - pwrdwn => '0' - ); - - clkdiv: entity work.ipbus_clock_div - port map( - clk => sysclk_i, - d17 => d17, - d28 => onehz - ); - - process(sysclk_i) - begin - if rising_edge(sysclk_i) then - d17_d <= d17; - if d17='1' and d17_d='0' then - rst <= nuke_d2 or not dcm_locked; - nuke_d <= nuke_i; -- Time bomb (allows return packet to be sent) - nuke_d2 <= nuke_d; - end if; - end if; - end process; - - locked <= dcm_locked; - srst <= '1' when rctr /= "0000" else '0'; - - process(clk_ipb_b) - begin - if rising_edge(clk_ipb_b) then - rst_ipb <= rst or srst; - nuke_i <= nuke; - if srst = '1' or soft_rst = '1' then - rctr <= rctr + 1; - end if; - end if; - end process; - - rsto_ipb <= rst_ipb; - - process(clk_ipb_b) - begin - if rising_edge(clk_ipb_b) then - rst_ipb_ctrl <= rst; - end if; - end process; - - rsto_ipb_ctrl <= rst_ipb_ctrl; - - process(clk_125_b) - begin - if rising_edge(clk_125_b) then - rst_125 <= rst; - end if; - end process; - - rsto_125 <= rst_125; - -end rtl; diff --git a/EUDETdummy/hdl/delay.vhd b/EUDETdummy/hdl/delay.vhd deleted file mode 100644 index d819105..0000000 --- a/EUDETdummy/hdl/delay.vhd +++ /dev/null @@ -1,52 +0,0 @@ -LIBRARY ieee; -USE ieee.std_logic_1164.ALL; -use IEEE.std_logic_arith.all; -USE ieee.std_logic_unsigned.all; - -entity delay is - - generic ( - length : integer := 1); -- number of clock cycles to delay signal - port ( - clock : in std_logic; -- rising edge active - input : in std_logic; - output : out std_logic); - -end delay; - -architecture rtl of delay is - - component dtype - port ( - Q : out std_logic; - C : in std_logic; - CLR : in std_logic; - D : in std_logic; - CE : in std_logic; - PRE : in std_logic - ); - end component; - - signal internal_signal : std_logic_vector( length downto 0); -- signals along the pipe-line - -begin -- rtl - - internal_signal(0) <= input; - - pipeline: for N in 1 to length generate - - pipelinestage: dtype - port map ( - q => internal_signal(N), - c => clock , - clr => '0' , - d => internal_signal(N-1), - ce => '1' , - pre => '0' - ); - - end generate pipeline; - - output <= internal_signal(length); - -end rtl; diff --git a/EUDETdummy/hdl/delay_word.vhd b/EUDETdummy/hdl/delay_word.vhd deleted file mode 100644 index e520714..0000000 --- a/EUDETdummy/hdl/delay_word.vhd +++ /dev/null @@ -1,43 +0,0 @@ -LIBRARY ieee; -USE ieee.std_logic_1164.ALL; -use IEEE.std_logic_arith.all; -USE ieee.std_logic_unsigned.all; - -entity delay_word is - - generic ( - length : integer := 1 ; -- number of clock cycles to delay signal - width : integer := 1 ); -- width of bus - port ( - clock : in std_logic; -- rising edge active - input : in std_logic_vector(width-1 downto 0); - output : out std_logic_vector(width-1 downto 0) - ); - -end delay_word; - -architecture rtl of delay_word is - - - subtype DataWord is std_logic_vector( width-1 downto 0 ); - type WordArray is array (length downto 0) of DataWord; - signal InternalSignal : WordArray; -- signals along the pipe-line - -begin -- rtl - - InternalSignal(0) <= input; - - pipeline: for N in 1 to length generate - - pipelinestage: process (clock , InternalSignal(N-1)) - begin -- process pipelinestage - if rising_edge(clock) then - InternalSignal(N) <= InternalSignal(N-1); - end if; - end process pipelinestage; - - end generate pipeline; - - output <= InternalSignal(length); - -end rtl; diff --git a/EUDETdummy/hdl/dtype.vhdl b/EUDETdummy/hdl/dtype.vhdl deleted file mode 100644 index d2dd171..0000000 --- a/EUDETdummy/hdl/dtype.vhdl +++ /dev/null @@ -1,34 +0,0 @@ ------ CELL dtype ----- -library IEEE; -use IEEE.STD_LOGIC_1164.all; --- use IEEE.VITAL_Timing.all; - -entity dtype is - - port( - Q : out std_logic; - C : in std_logic; - CLR : in std_logic; - D : in std_logic; - CE : in std_logic; - PRE : in std_logic - ); - -end dtype; - -architecture dtype_V of dtype is -begin - - VITALBehavior : process(C, CLR, PRE) - begin - - if (CLR = '1') then - Q <= '0'; - elsif (PRE = '1') then - Q <= '1'; - elsif (rising_edge(C) and CE='1') then - Q <= D ; - end if; - end process; -end dtype_V; - diff --git a/EUDETdummy/hdl/dummyEventBuffer_rtl.vhd b/EUDETdummy/hdl/dummyEventBuffer_rtl.vhd deleted file mode 100644 index 4c0e8fa..0000000 --- a/EUDETdummy/hdl/dummyEventBuffer_rtl.vhd +++ /dev/null @@ -1,168 +0,0 @@ ---============================================================================= ---! @file eventBuffer_rtl.vhd ---============================================================================= --- -------------------------------------------------------------------------------- --- -- --- University of Bristol, High Energy Physics Group. --- -- -------------------------------------------------------------------------------- -- --- VHDL Architecture fmc_mTLU_lib.eventBuffer.rtl --- --- --- Created using using Mentor Graphics HDL Designer(TM) 2010.3 (Build 21) --- -LIBRARY ieee; -USE ieee.std_logic_1164.all; -USE ieee.numeric_std.all; - -USE work.ipbus.all; - ---! @brief Stores input words (64bits) for readout over IPBus. ---! Uses a FIFO ( 64bits at input, 32 bits at output ) --- --- ---! @author David Cussans , David.Cussans@bristol.ac.uk --- ---! @date 15:24:50 11/13/12 --- ---! @version v0.1 --- ---! @details ---! \n\nIPBus Address map: ---! \li 0x0000 - FIFO data ---! \li 0x0001 - FIFO fill level ---! \li 0x0010 - FIFO status/control: (Writing Bit-0 resets pointers, Reading bit-1 returns "prog_full" flag) ---! ---! Modified by: Alvaro Dosil , alvaro.dosil@usc.es \n --------------------------------------------------------------------------------- - -ENTITY eventBuffer IS - GENERIC( - g_EVENT_DATA_WIDTH : positive := 32; - g_IPBUS_WIDTH : positive := 32; - g_READ_COUNTER_WIDTH : positive := 13 - ); - PORT( - clk_4x_logic_i : IN std_logic; - data_strobe_i : IN std_logic; -- Indicates data to transfer - event_data_i : IN std_logic_vector (g_EVENT_DATA_WIDTH-1 DOWNTO 0); - ipbus_clk_i : IN std_logic; - ipbus_i : IN ipb_wbus; - ipbus_reset_i : IN std_logic; - strobe_4x_logic_i : IN std_logic; - --trigger_count_i : IN std_logic_vector (g_IPBUS_WIDTH-1 DOWNTO 0); --! Not used yet. - rst_fifo_o : OUT std_logic; --! rst signal to first level fifos - buffer_full_o : OUT std_logic; --! Goes high when event buffer almost full - ipbus_o : OUT ipb_rbus; - logic_reset_i : IN std_logic -- reset buffers when high. Synch withclk_4x_logic - ); - --- Declarations - -END ENTITY eventBuffer ; - --- -ARCHITECTURE rtl OF eventBuffer IS - signal s_rd_data_count : std_logic_vector(g_READ_COUNTER_WIDTH-1 downto 0) := (others =>'0'); - signal s_fifo_fill_level : std_logic_vector(g_IPBUS_WIDTH-1 downto 0) := (others =>'0'); -- read-counter - 2*write_count - signal s_write_strobe : std_logic := '0'; - signal s_rst_fifo, s_rst_fifo_ipb : std_logic := '0'; -- ! Take high to reset FIFO pointers. - signal s_fifo_prog_full : std_logic := '0'; -- ! Controlled by programmable-full flag of FIFO core - signal s_fifo_rd_en : std_logic := '0'; -- ! Take high to clock data out of FIFO - signal s_fifo_dout : std_logic_vector(g_IPBUS_WIDTH-1 downto 0); -- ! Output from FIFO ( fall-through mode) - signal s_fifo_valid : std_logic := '1'; -- ! High when data in FIFO - signal s_fifo_full, s_fifo_almost_full, s_fifo_empty, s_fifo_almost_empty : std_logic := '0'; -- ! full and empty FIFO flags - signal s_fifo_status_ipb , s_fifo_fill_level_d1 : std_logic_vector(ipbus_o.ipb_rdata'range) := (others => '0'); -- data registered onto IPBus clock - signal s_ack : std_logic := '0'; -- -- IPBus ACK signal - COMPONENT dummy_event_fifo - PORT ( - rst : IN STD_LOGIC; - wr_clk : IN STD_LOGIC; - rd_clk : IN STD_LOGIC; - din : IN STD_LOGIC_VECTOR(g_EVENT_DATA_WIDTH-1 DOWNTO 0); - wr_en : IN STD_LOGIC; - rd_en : IN STD_LOGIC; - dout : OUT STD_LOGIC_VECTOR(g_EVENT_DATA_WIDTH-1 DOWNTO 0); - full : OUT STD_LOGIC; - almost_full : OUT STD_LOGIC; - empty : OUT STD_LOGIC; - almost_empty : OUT STD_LOGIC; - rd_data_count : OUT STD_LOGIC_VECTOR(12 DOWNTO 0); - prog_full : OUT STD_LOGIC - ); - END COMPONENT; - -BEGIN - - ----------------------------------------------------------------------------- - -- IPBus IO - ----------------------------------------------------------------------------- - - --! Generate IPBus ACK - ipbus_ack: process(ipbus_clk_i) - begin - if rising_edge(ipbus_clk_i) then - s_ack <= ipbus_i.ipb_strobe and not s_ack; - end if; - end process ipbus_ack; - ipbus_o.ipb_ack <= s_ack; - - --! Generate FIFO read enable - --! take high for one cycle ( when ipb_strobe goes high but before ACK goes - --high to follow it - s_fifo_rd_en <= '1' when - ipbus_i.ipb_strobe = '1' and ipbus_i.ipb_write = '0' and ipbus_i.ipb_addr(1 downto 0) = "00" and s_ack = '0' - else '0'; - ipbus_o.ipb_err <= '0'; - - --! Multiplex output data. - with ipbus_i.ipb_addr(1 downto 0) select ipbus_o.ipb_rdata <= - s_fifo_dout when "00", - s_fifo_fill_level when "01", - s_fifo_status_ipb when "10", - (others => '1') when others; - - ipbus_write: process (ipbus_clk_i) - begin -- process ipbus_write - if rising_edge(ipbus_clk_i) then - s_rst_fifo_ipb <= '0'; - if ipbus_i.ipb_strobe = '1' and ipbus_i.ipb_addr(1 downto 0) = "10" and ipbus_i.ipb_write = '1' then - s_rst_fifo_ipb <= '1'; - end if; - -- Register data onto IPBus clock domain to ease timing closure. - s_fifo_status_ipb <= X"000000" & "000" & s_fifo_prog_full & s_fifo_full & s_fifo_almost_full & s_fifo_almost_empty & s_fifo_empty; - s_fifo_fill_level <= X"0000" & "000" & s_rd_data_count; - end if; - end process ipbus_write; - - rst_fifo_o <= s_rst_fifo_ipb; - s_rst_fifo <= s_rst_fifo_ipb or logic_reset_i; - - ----------------------------------------------------------------------------- - -- FIFO and fill-level calculation - ----------------------------------------------------------------------------- - - -- Instantiate a buffer to store the data. 64-bit on input, 32-bit on output. - --event_fifo : entity work.tlu_event_fifo - event_fifo : dummy_event_fifo - PORT MAP ( - rst => s_rst_fifo, - wr_clk => clk_4x_logic_i, - rd_clk => ipbus_clk_i, - --din => event_data_i, - din => event_data_i, - wr_en => data_strobe_i, - rd_en => s_fifo_rd_en, - dout => s_fifo_dout, - full => s_fifo_full, - almost_full => s_fifo_almost_full, - empty => s_fifo_empty, - almost_empty => s_fifo_almost_empty, - rd_data_count => s_rd_data_count, - prog_full => s_fifo_prog_full - ); - buffer_full_o <= s_fifo_prog_full; - -END ARCHITECTURE rtl; - diff --git a/EUDETdummy/hdl/enclustra_ax3_pm3_infra.vhd b/EUDETdummy/hdl/enclustra_ax3_pm3_infra.vhd deleted file mode 100644 index df07ba1..0000000 --- a/EUDETdummy/hdl/enclustra_ax3_pm3_infra.vhd +++ /dev/null @@ -1,131 +0,0 @@ --- enclustra_ax3_pm3_infra --- --- All board-specific stuff goes here --- --- Dave Newbold, June 2013--- - -library IEEE; -use IEEE.STD_LOGIC_1164.ALL; - -use work.ipbus.all; - -entity enclustra_ax3_pm3_infra is - port( - sysclk: in std_logic; -- ??? board crystal clock - clk_ipb_o: out std_logic; -- IPbus clock - rst_ipb_o: out std_logic; - rst_125_o: out std_logic; - clk_200_o: out std_logic; - --clk_aux_o: out std_logic; -- 40MHz generated clock - --rst_aux_o: out std_logic; - nuke: in std_logic; -- The signal of doom - soft_rst: in std_logic; -- The signal of lesser doom - leds: out std_logic_vector(1 downto 0); -- status LEDs - rgmii_txd: out std_logic_vector(3 downto 0); - rgmii_tx_ctl: out std_logic; - rgmii_txc: out std_logic; - rgmii_rxd: in std_logic_vector(3 downto 0); - rgmii_rx_ctl: in std_logic; - rgmii_rxc: in std_logic; - mac_addr: in std_logic_vector(47 downto 0); -- MAC address - ip_addr: in std_logic_vector(31 downto 0); -- IP address - ipb_in: in ipb_rbus; -- ipbus - ipb_out: out ipb_wbus - ); - -end enclustra_ax3_pm3_infra; - -architecture rtl of enclustra_ax3_pm3_infra is - - signal clk125_fr, clk125, clk125_90, clk200, clk_ipb, clk_ipb_i, locked, rst125, rst_ipb, rst_ipb_ctrl, rst_eth, onehz, pkt: std_logic; - signal mac_tx_data, mac_rx_data: std_logic_vector(7 downto 0); - signal mac_tx_valid, mac_tx_last, mac_tx_error, mac_tx_ready, mac_rx_valid, mac_rx_last, mac_rx_error: std_logic; - signal led_p: std_logic_vector(0 downto 0); - -begin - --- DCM clock generation for internal bus, ethernet - - clocks: entity work.clocks_7s_extphy_se - port map( - sysclk => sysclk, - clko_125 => clk125, - clko_125_90 => clk125_90, - clko_200 => clk200, - clko_ipb => clk_ipb_i, - locked => locked, - nuke => nuke, - soft_rst => soft_rst, - rsto_125 => rst125, - rsto_ipb => rst_ipb, - rsto_ipb_ctrl => rst_ipb_ctrl, - onehz => onehz - ); - - clk_ipb <= clk_ipb_i; -- Best to align delta delays on all clocks for simulation - clk_ipb_o <= clk_ipb_i; - rst_ipb_o <= rst_ipb; - rst_125_o <= rst125; - clk_200_o <= clk200; - - stretch: entity work.led_stretcher - generic map( - WIDTH => 1 - ) - port map( - clk => clk125, - d(0) => pkt, - q => led_p - ); - leds <= (led_p(0), locked and onehz); - --- Ethernet MAC core and PHY interface - - eth: entity work.eth_7s_rgmii - port map( - clk125 => clk125, - clk125_90 => clk125_90, - clk200 => clk200, - rst => rst125, - rgmii_txd => rgmii_txd, - rgmii_tx_ctl => rgmii_tx_ctl, - rgmii_txc => rgmii_txc, - rgmii_rxd => rgmii_rxd, - rgmii_rx_ctl => rgmii_rx_ctl, - rgmii_rxc => rgmii_rxc, - tx_data => mac_tx_data, - tx_valid => mac_tx_valid, - tx_last => mac_tx_last, - tx_error => mac_tx_error, - tx_ready => mac_tx_ready, - rx_data => mac_rx_data, - rx_valid => mac_rx_valid, - rx_last => mac_rx_last, - rx_error => mac_rx_error - ); - --- ipbus control logic - - ipbus: entity work.ipbus_ctrl - port map( - mac_clk => clk125, - rst_macclk => rst125, - ipb_clk => clk_ipb, - rst_ipb => rst_ipb_ctrl, - mac_rx_data => mac_rx_data, - mac_rx_valid => mac_rx_valid, - mac_rx_last => mac_rx_last, - mac_rx_error => mac_rx_error, - mac_tx_data => mac_tx_data, - mac_tx_valid => mac_tx_valid, - mac_tx_last => mac_tx_last, - mac_tx_error => mac_tx_error, - mac_tx_ready => mac_tx_ready, - ipb_out => ipb_out, - ipb_in => ipb_in, - mac_addr => mac_addr, - ip_addr => ip_addr, - pkt => pkt - ); - -end rtl; diff --git a/EUDETdummy/hdl/eth_7s_rgmii.vhd b/EUDETdummy/hdl/eth_7s_rgmii.vhd deleted file mode 100644 index 3e2e167..0000000 --- a/EUDETdummy/hdl/eth_7s_rgmii.vhd +++ /dev/null @@ -1,184 +0,0 @@ --- Contains the instantiation of the Xilinx MAC & PHY interface for RGMII --- --- Do not change signal names in here without corresponding alteration to the timing contraints file --- --- Dave Newbold, October 2016 - -library ieee; -use ieee.std_logic_1164.all; - -library unisim; -use unisim.VComponents.all; -use work.emac_hostbus_decl.all; - -entity eth_7s_rgmii is - port( - clk125: in std_logic; - clk125_90: in std_logic; - clk200: in std_logic; - rst: in std_logic; - rgmii_txd: out std_logic_vector(3 downto 0); - rgmii_tx_ctl: out std_logic; - rgmii_txc: out std_logic; - rgmii_rxd: in std_logic_vector(3 downto 0); - rgmii_rx_ctl: in std_logic; - rgmii_rxc: in std_logic; - tx_data: in std_logic_vector(7 downto 0); - tx_valid: in std_logic; - tx_last: in std_logic; - tx_error: in std_logic; - tx_ready: out std_logic; - rx_data: out std_logic_vector(7 downto 0); - rx_valid: out std_logic; - rx_last: out std_logic; - rx_error: out std_logic; - hostbus_in: in emac_hostbus_in := ('0', "00", "0000000000", X"00000000", '0', '0', '0'); - hostbus_out: out emac_hostbus_out; - status: out std_logic_vector(3 downto 0) - ); - -end eth_7s_rgmii; - -architecture rtl of eth_7s_rgmii is - - COMPONENT temac_gbe_v9_rgmii - PORT ( - gtx_clk : IN STD_LOGIC; - gtx_clk90 : IN STD_LOGIC; - glbl_rstn : IN STD_LOGIC; - rx_axi_rstn : IN STD_LOGIC; - tx_axi_rstn : IN STD_LOGIC; - rx_statistics_vector : OUT STD_LOGIC_VECTOR(27 DOWNTO 0); - rx_statistics_valid : OUT STD_LOGIC; - rx_mac_aclk : OUT STD_LOGIC; - rx_reset : OUT STD_LOGIC; - rx_axis_mac_tdata : OUT STD_LOGIC_VECTOR(7 DOWNTO 0); - rx_axis_mac_tvalid : OUT STD_LOGIC; - rx_axis_mac_tlast : OUT STD_LOGIC; - rx_axis_mac_tuser : OUT STD_LOGIC; - tx_ifg_delay : IN STD_LOGIC_VECTOR(7 DOWNTO 0); - tx_statistics_vector : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); - tx_statistics_valid : OUT STD_LOGIC; - tx_mac_aclk : OUT STD_LOGIC; - tx_reset : OUT STD_LOGIC; - tx_axis_mac_tdata : IN STD_LOGIC_VECTOR(7 DOWNTO 0); - tx_axis_mac_tvalid : IN STD_LOGIC; - tx_axis_mac_tlast : IN STD_LOGIC; - tx_axis_mac_tuser : IN STD_LOGIC_VECTOR(0 DOWNTO 0); - tx_axis_mac_tready : OUT STD_LOGIC; - pause_req : IN STD_LOGIC; - pause_val : IN STD_LOGIC_VECTOR(15 DOWNTO 0); - speedis100 : OUT STD_LOGIC; - speedis10100 : OUT STD_LOGIC; - rgmii_txd : OUT STD_LOGIC_VECTOR(3 DOWNTO 0); - rgmii_tx_ctl : OUT STD_LOGIC; - rgmii_txc : OUT STD_LOGIC; - rgmii_rxd : IN STD_LOGIC_VECTOR(3 DOWNTO 0); - rgmii_rx_ctl : IN STD_LOGIC; - rgmii_rxc : IN STD_LOGIC; - inband_link_status : OUT STD_LOGIC; - inband_clock_speed : OUT STD_LOGIC_VECTOR(1 DOWNTO 0); - inband_duplex_status : OUT STD_LOGIC; - rx_configuration_vector : IN STD_LOGIC_VECTOR(79 DOWNTO 0); - tx_configuration_vector : IN STD_LOGIC_VECTOR(79 DOWNTO 0) - ); - END COMPONENT; - - COMPONENT mac_fifo_axi4 - PORT ( - m_aclk : IN STD_LOGIC; - s_aclk : IN STD_LOGIC; - s_aresetn : IN STD_LOGIC; - s_axis_tvalid : IN STD_LOGIC; - s_axis_tready : OUT STD_LOGIC; - s_axis_tdata : IN STD_LOGIC_VECTOR(7 DOWNTO 0); - s_axis_tlast : IN STD_LOGIC; - s_axis_tuser : IN STD_LOGIC_VECTOR(0 DOWNTO 0); - m_axis_tvalid : OUT STD_LOGIC; - m_axis_tready : IN STD_LOGIC; - m_axis_tdata : OUT STD_LOGIC_VECTOR(7 DOWNTO 0); - m_axis_tlast : OUT STD_LOGIC; - m_axis_tuser : OUT STD_LOGIC_VECTOR(0 DOWNTO 0) - ); - END COMPONENT; - - signal rx_data_e: std_logic_vector(7 downto 0); - signal rx_clk_e, rx_valid_e, rx_last_e, rx_user_e, rx_rst_e, rx_rst_en, rstn: std_logic; - signal rx_user_f, rx_user_ef: std_logic_vector(0 downto 0); - -begin - - idelayctrl0: idelayctrl port map( - refclk => clk200, - rst => rst - ); - - rstn <= not rst; - - emac0: temac_gbe_v9_rgmii - port map( - gtx_clk => clk125, - gtx_clk90 => clk125_90, - glbl_rstn => rstn, - rx_axi_rstn => '1', - tx_axi_rstn => '1', - rx_statistics_vector => open, - rx_statistics_valid => open, - rx_mac_aclk => rx_clk_e, - rx_reset => rx_rst_e, - rx_axis_mac_tdata => rx_data_e, - rx_axis_mac_tvalid => rx_valid_e, - rx_axis_mac_tlast => rx_last_e, - rx_axis_mac_tuser => rx_user_e, - tx_ifg_delay => X"00", - tx_statistics_vector => open, - tx_statistics_valid => open, - tx_mac_aclk => open, -- Internally connected to gtx_clk inside core - tx_reset => open, - tx_axis_mac_tdata => tx_data, - tx_axis_mac_tvalid => tx_valid, - tx_axis_mac_tlast => tx_last, - tx_axis_mac_tuser(0) => tx_error, - tx_axis_mac_tready => tx_ready, - pause_req => '0', - pause_val => X"0000", - speedis100 => open, - speedis10100 => open, - rgmii_txd => rgmii_txd, - rgmii_tx_ctl => rgmii_tx_ctl, - rgmii_txc => rgmii_txc, - rgmii_rxd => rgmii_rxd, - rgmii_rx_ctl => rgmii_rx_ctl, - rgmii_rxc => rgmii_rxc, - inband_link_status => status(0), - inband_clock_speed => status(3 downto 2), - inband_duplex_status => status(1), - rx_configuration_vector => X"0000_0000_0000_0000_0812", - tx_configuration_vector => X"0000_0000_0000_0000_0012" - ); - - rx_user_ef(0) <= rx_user_e; - rx_error <= rx_user_f(0); - rx_rst_en <= not rx_rst_e; - - fifo: mac_fifo_axi4 - port map( - m_aclk => clk125, - s_aclk => rx_clk_e, - s_aresetn => rx_rst_en, - s_axis_tvalid => rx_valid_e, - s_axis_tready => open, - s_axis_tdata => rx_data_e, - s_axis_tlast => rx_last_e, - s_axis_tuser => rx_user_ef, - m_axis_tvalid => rx_valid, - m_axis_tready => '1', - m_axis_tdata => rx_data, - m_axis_tlast => rx_last, - m_axis_tuser => rx_user_f - ); -- Clock domain crossing FIFO - - hostbus_out.hostrddata <= (others => '0'); - hostbus_out.hostmiimrdy <= '0'; - -end rtl; diff --git a/EUDETdummy/hdl/fmcTLU_pkg.vhd b/EUDETdummy/hdl/fmcTLU_pkg.vhd deleted file mode 100644 index cb6b101..0000000 --- a/EUDETdummy/hdl/fmcTLU_pkg.vhd +++ /dev/null @@ -1,27 +0,0 @@ ---============================================================================= ---! @file fmcTLU_pkg.vhd ---============================================================================= ---- ---! @brief VHDL Package Header fmc_mTLU_lib.fmcTLU --- ---! @author phdgc ---! @date 16:44:31 11/08/12 --- --- using Mentor Graphics HDL Designer(TM) 2010.3 (Build 21) --- -LIBRARY ieee; -USE ieee.std_logic_1164.all; -PACKAGE fmcTLU IS - - constant c_NUM_TIME_BITS : natural := 5; - constant c_NUM_TRIG_INPUTS : natural := 4; - constant c_EVENT_DATA_WIDTH : natural := 32; - constant c_DATA_WIDTH : natural := 32; - - subtype t_triggerTime is std_logic_vector(c_NUM_TIME_BITS-1 downto 0); - --type t_triggerTimeArray is array(natural range <>) of t_triggerTime; - type t_triggerTimeArray is array(natural range <>) of std_logic_vector(c_NUM_TIME_BITS-1 downto 0) ; - - type t_registerArray is array(natural range <>) of std_logic_vector(c_DATA_WIDTH-1 downto 0) ; - -END fmcTLU; diff --git a/EUDETdummy/hdl/fmcTLU_pkg_body.vhd b/EUDETdummy/hdl/fmcTLU_pkg_body.vhd deleted file mode 100644 index 9437776..0000000 --- a/EUDETdummy/hdl/fmcTLU_pkg_body.vhd +++ /dev/null @@ -1,13 +0,0 @@ ---============================================================================= ---! @file fmcTLU_pkg_body.vhd ---============================================================================= ---- ---! @brief VHDL Package Body fmc_mTLU_lib.fmcTLU --- ---! @author phdgc ---! @date 16:45:08 11/08/12 --- --- using Mentor Graphics HDL Designer(TM) 2010.3 (Build 21) --- -PACKAGE BODY fmcTLU IS -END fmcTLU; diff --git a/EUDETdummy/hdl/i2c/i2c_master_bit_ctrl.vhd b/EUDETdummy/hdl/i2c/i2c_master_bit_ctrl.vhd deleted file mode 100644 index d0dc4e9..0000000 --- a/EUDETdummy/hdl/i2c/i2c_master_bit_ctrl.vhd +++ /dev/null @@ -1,492 +0,0 @@ ----------------------------------------------------------------------- --- >>>>>>>>>>>>>>>>>>>>>> COPYRIGHT NOTICE <<<<<<<<<<<<<<<<<<<<<<<<<<< ----------------------------------------------------------------------- ---/////////////////////////////////////////////////////////////////// ---// //// ---// WISHBONE rev.B2 compliant I2C Master bit-controller //// ---// //// ---// //// ---// Author: Richard Herveille //// ---// richard@asics.ws //// ---// www.asics.ws //// ---// //// ---// Downloaded from: http://www.opencores.org/projects/i2c/ //// ---// //// ---/////////////////////////////////////////////////////////////////// ---// //// ---// Copyright (C) 2001 Richard Herveille //// ---// richard@asics.ws //// ---// //// ---// This source file may be used and distributed without //// ---// restriction provided that this copyright statement is not //// ---// removed from the file and that any derivative work contains //// ---// the original copyright notice and the associated disclaimer.//// ---// //// ---// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY //// ---// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED //// ---// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS //// ---// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR //// ---// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, //// ---// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES //// ---// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE //// ---// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR //// ---// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF //// ---// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT //// ---// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT //// ---// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE //// ---// POSSIBILITY OF SUCH DAMAGE. //// ---// //// ---/////////////////////////////////////////////////////////////////// --- -------------------------------------------------------------------- --- >>>>>>>>>>>>>>>>>>>>>>>>> COPYRIGHT NOTICE <<<<<<<<<<<<<<<<<<<<<<<<< --- -------------------------------------------------------------------- --- Copyright (c) 2008 - 2010 by Lattice Semiconductor Corporation --- -------------------------------------------------------------------- --- --- Disclaimer: --- --- This VHDL or Verilog source code is intended as a design reference --- which illustrates how these types of functions can be implemented. --- It is the user's responsibility to verify their design for --- consistency and functionality through the use of formal --- verification methods. Lattice Semiconductor provides no warranty --- regarding the use or functionality of this code. --- --- -------------------------------------------------------------------- --- --- Lattice Semiconductor Corporation --- 5555 NE Moore Court --- Hillsboro, OR 97214 --- U.S.A --- --- TEL: 1-800-Lattice (USA and Canada) --- 503-268-8001 (other locations) --- --- web: http://www.latticesemi.com/ --- email: techsupport@latticesemi.com --- --- -------------------------------------------------------------------- --- Code Revision History : --- -------------------------------------------------------------------- --- Ver: | Author |Mod. Date |Changes Made: --- V1.0 |K.P. | 7/09 | Initial ver for VHDL --- | converted from LSC ref design RD1046 --- -------------------------------------------------------------------- - - ---///////////////////////////////////// ---// Bit controller section ---///////////////////////////////////// ---// ---// Translate simple commands into SCL/SDA transitions ---// Each command has 5 states, A/B/C/D/idle ---// ---// start: SCL ~~~~~~~~~~\____ ---// SDA ~~~~~~~~\______ ---// x | A | B | C | D | i ---// ---// repstart SCL ____/~~~~\___ ---// SDA __/~~~\______ ---// x | A | B | C | D | i ---// ---// stop SCL ____/~~~~~~~~ ---// SDA ==\____/~~~~~ ---// x | A | B | C | D | i ---// ---//- write SCL ____/~~~~\____ ---// SDA ==X=========X= ---// x | A | B | C | D | i ---// ---//- read SCL ____/~~~~\____ ---// SDA XXXX=====XXXX ---// x | A | B | C | D | i ---// --- ---// Timing: Normal mode Fast mode ---/////////////////////////////////////////////////////////////////////// ---// Fscl 100KHz 400KHz ---// Th_scl 4.0us 0.6us High period of SCL ---// Tl_scl 4.7us 1.3us Low period of SCL ---// Tsu:sta 4.7us 0.6us setup time for a repeated start condition ---// Tsu:sto 4.0us 0.6us setup time for a stop conditon ---// Tbuf 4.7us 1.3us Bus free time between a stop and start condition ---// --- --- -------------------------------------------------------------------- - -library ieee; -use ieee.std_logic_1164.all; -use ieee.std_logic_arith.all; -use ieee.std_logic_unsigned.all; - -entity i2c_master_bit_ctrl is - port ( - clk : in std_logic; - rst : in std_logic; - nReset : in std_logic; - clk_cnt : in std_logic_vector(15 downto 0); -- clock prescale value - ena : in std_logic; -- core enable signal - cmd : in std_logic_vector(3 downto 0); - cmd_ack : out std_logic; -- command complete acknowledge - busy : out std_logic; -- i2c bus busy - al : out std_logic; -- i2c bus arbitration lost - din : in std_logic; - dout : out std_logic; - scl_i : in std_logic; -- i2c clock line input - scl_o : out std_logic; -- i2c clock line output - scl_oen : out std_logic; -- i2c clock line output enable (active low) - sda_i : in std_logic; -- i2c data line input - sda_o : out std_logic; -- i2c data line output - sda_oen : out std_logic -- i2c data line output enable (active low) - ); - - -end; - -architecture arch of i2c_master_bit_ctrl is - ---attribute UGROUP:string; ---attribute UGROUP of arch : label is "bit_group"; - - -signal sSCL, sSDA : std_logic; -- synchronized SCL and SDA inputs -signal dscl_oen : std_logic; -- delayed scl_oen -signal sda_chk : std_logic; -- check SDA output (Multi-master arbitration) -signal clk_en : std_logic; -- clock generation signals -signal slave_wait : std_logic; - --- bus status controller signals -signal dSCL,dSDA : std_logic; -signal sta_condition : std_logic; -signal sto_condition : std_logic; -signal cmd_stop : std_logic; - -signal cnt : std_logic_vector(15 downto 0); -- clock divider counter - -signal scl_oen_int : std_logic; -signal sda_oen_int : std_logic; -signal busy_int : std_logic; -signal al_int : std_logic; - --- state machine variable -signal c_state : std_logic_vector(16 downto 0); - -constant idle : std_logic_vector(16 downto 0) := "00000000000000000"; -constant start_a : std_logic_vector(16 downto 0) := "00000000000000001"; -constant start_b : std_logic_vector(16 downto 0) := "00000000000000010"; -constant start_c : std_logic_vector(16 downto 0) := "00000000000000100"; -constant start_d : std_logic_vector(16 downto 0) := "00000000000001000"; -constant start_e : std_logic_vector(16 downto 0) := "00000000000010000"; -constant stop_a : std_logic_vector(16 downto 0) := "00000000000100000"; -constant stop_b : std_logic_vector(16 downto 0) := "00000000001000000"; -constant stop_c : std_logic_vector(16 downto 0) := "00000000010000000"; -constant stop_d : std_logic_vector(16 downto 0) := "00000000100000000"; -constant rd_a : std_logic_vector(16 downto 0) := "00000001000000000"; -constant rd_b : std_logic_vector(16 downto 0) := "00000010000000000"; -constant rd_c : std_logic_vector(16 downto 0) := "00000100000000000"; -constant rd_d : std_logic_vector(16 downto 0) := "00001000000000000"; -constant wr_a : std_logic_vector(16 downto 0) := "00010000000000000"; -constant wr_b : std_logic_vector(16 downto 0) := "00100000000000000"; -constant wr_c : std_logic_vector(16 downto 0) := "01000000000000000"; -constant wr_d : std_logic_vector(16 downto 0) := "10000000000000000"; - -constant I2C_CMD_NOP : std_logic_vector(3 downto 0) := "0000"; -constant I2C_CMD_START : std_logic_vector(3 downto 0) := "0001"; -constant I2C_CMD_STOP : std_logic_vector(3 downto 0) := "0010"; -constant I2C_CMD_WRITE : std_logic_vector(3 downto 0) := "0100"; -constant I2C_CMD_READ : std_logic_vector(3 downto 0) := "1000"; - -begin - -scl_oen <= scl_oen_int; -sda_oen <= sda_oen_int; - --- whenever the slave is not ready it can delay the cycle by pulling SCL low --- delay scl_oen -process(clk) -begin - if rising_edge(clk) then - dscl_oen <= scl_oen_int; - end if; -end process; - -slave_wait <= '1' when ((dscl_oen = '1') AND (sSCL = '0')) else '0'; - --- generate clk enable signal -process(clk,nReset) -begin - if (nReset = '0') then - cnt <= (others => '0'); - clk_en <= '1'; - elsif rising_edge(clk) then - if (rst = '1') then - cnt <= (others => '0'); - clk_en <= '1'; - elsif ((cnt = "0000000000000000") OR (ena = '0')) then - cnt <= clk_cnt; - clk_en <= '1'; - elsif (slave_wait = '1') then - cnt <= cnt; - clk_en <= '0'; - else - cnt <= cnt - '1'; - clk_en <= '0'; - end if; - end if; -end process; - --- synchronize SCL and SDA inputs --- reduce metastability risc -process(clk,nReset) -begin - if (nReset = '0') then - sSCL <= '1'; - sSDA <= '1'; - dSCL <= '1'; - dSDA <= '1'; - elsif rising_edge(clk) then - if (rst = '1') then - sSCL <= '1'; - sSDA <= '1'; - dSCL <= '1'; - dSDA <= '1'; - else - dSCL <= sSCL; - dSDA <= sSDA; - -- Don't need to treat 'H' if separate I and O - -- if ((scl_i = '1') OR (scl_i = 'H')) then - if (scl_i = '1') then - sSCL <= '1'; - else - sSCL <= '0'; - end if; - -- if ((sda_i = '1') OR (sda_i = 'H')) then - if (sda_i = '1') then - sSDA <= '1'; - else - sSDA <= '0'; - end if; - end if; - end if; -end process; - --- detect start condition => detect falling edge on SDA while SCL is high --- detect stop condition => detect rising edge on SDA while SCL is high -process(clk,nReset) -begin - if (nReset = '0') then - sta_condition <= '0'; - sto_condition <= '0'; - elsif rising_edge(clk) then - if (rst = '1') then - sta_condition <= '0'; - sto_condition <= '0'; - else - sta_condition <= NOT(sSDA) AND dSDA AND sSCL; - sto_condition <= sSDA AND NOT(dSDA) AND sSCL; - end if; - end if; -end process; - --- generate i2c bus busy signal -process(clk,nReset) -begin - if (nReset = '0') then - busy_int <= '0'; - elsif rising_edge(clk) then - if (rst = '1') then - busy_int <= '0'; - else - busy_int <= (sta_condition OR busy_int) AND NOT(sto_condition); - end if; - end if; -end process; - -busy <= busy_int; - --- generate arbitration lost signal --- aribitration lost when: --- 1) master drives SDA high, but the i2c bus is low --- 2) stop detected while not requested -process(clk,nReset) -begin - if (nReset = '0') then - cmd_stop <= '0'; - elsif rising_edge(clk) then - if (rst = '1') then - cmd_stop <= '0'; - elsif (clk_en = '1') then - if (cmd = I2C_CMD_STOP) then - cmd_stop <= '1'; - else - cmd_stop <= '0'; - end if; - end if; - end if; -end process; - -process(clk,nReset) -begin - if (nReset = '0') then - al_int <= '0'; - elsif rising_edge(clk) then - if (rst = '1') then - al_int <= '0'; - else - if (((sda_chk = '1') AND (sSDA = '0') AND (sda_oen_int = '1')) OR ((c_state /= idle) AND (sto_condition = '1') AND (cmd_stop = '0'))) then - al_int <= '1'; - else - al_int <= '0'; - end if; - end if; - end if; -end process; - -al <= al_int; - - --- generate dout signal (store SDA on rising edge of SCL) -process(clk) -begin - if rising_edge(clk) then - if ((sSCL = '1') AND (dSCL = '0')) then - dout <= sSDA; - end if; - end if; -end process; - - ---generate state machine -process(clk,nReset) -begin - if (nReset = '0') then - c_state <= idle; - cmd_ack <= '0'; - scl_oen_int <= '1'; - sda_oen_int <= '1'; - sda_chk <= '0'; - elsif rising_edge(clk) then - if ((rst = '1') OR (al_int = '1')) then - c_state <= idle; - cmd_ack <= '0'; - scl_oen_int <= '1'; - sda_oen_int <= '1'; - sda_chk <= '0'; - else - cmd_ack <= '0'; --default no command acknowledge + assert cmd_ack only 1clk cycle - if (clk_en = '1') then - case (c_state) is - when idle => - case (cmd) is - when I2C_CMD_START => c_state <= start_a; - when I2C_CMD_STOP => c_state <= stop_a; - when I2C_CMD_WRITE => c_state <= wr_a; - when I2C_CMD_READ => c_state <= rd_a; - when others => c_state <= idle; - end case; - - scl_oen_int <= scl_oen_int; -- keep SCL in same state - sda_oen_int <= sda_oen_int; -- keep SDA in same state - sda_chk <= '0'; -- don't check SDA output - when start_a => -- start - c_state <= start_b; - scl_oen_int <= scl_oen_int; -- keep SCL in same state - sda_oen_int <= '1'; -- set SDA high - sda_chk <= '0'; -- don't check SDA output - when start_b => - c_state <= start_c; - scl_oen_int <= '1'; -- set SCL high - sda_oen_int <= '1'; -- keep SDA high - sda_chk <= '0'; -- don't check SDA output - when start_c => - c_state <= start_d; - scl_oen_int <= '1'; -- keep SCL high - sda_oen_int <= '0'; -- set SDA low - sda_chk <= '0'; -- don't check SDA output - when start_d => - c_state <= start_e; - scl_oen_int <= '1'; -- keep SCL high - sda_oen_int <= '0'; -- keep SDA low - sda_chk <= '0'; -- don't check SDA output - when start_e => - c_state <= idle; - cmd_ack <= '1'; - scl_oen_int <= '0'; -- set SCL low - sda_oen_int <= '0'; -- keep SDA low - sda_chk <= '0'; -- don't check SDA output - when stop_a => -- stop - c_state <= stop_b; - scl_oen_int <= '0'; -- keep SCL low - sda_oen_int <= '0'; -- set SDA low - sda_chk <= '0'; -- don't check SDA output - when stop_b => - c_state <= stop_c; - scl_oen_int <= '1'; -- set SCL high - sda_oen_int <= '0'; -- keep SDA low - sda_chk <= '0'; -- don't check SDA output - when stop_c => - c_state <= stop_d; - scl_oen_int <= '1'; -- keep SCL high - sda_oen_int <= '0'; -- keep SDA low - sda_chk <= '0'; -- don't check SDA output - when stop_d => - c_state <= idle; - cmd_ack <= '1'; - scl_oen_int <= '1'; -- keep SCL high - sda_oen_int <= '1'; -- set SDA high - sda_chk <= '0'; -- don't check SDA output - when rd_a => -- read - c_state <= rd_b; - scl_oen_int <= '0'; -- keep SCL low - sda_oen_int <= '1'; -- tri-state SDA - sda_chk <= '0'; -- don't check SDA output - when rd_b => - c_state <= rd_c; - scl_oen_int <= '1'; -- set SCL high - sda_oen_int <= '1'; -- keep SDA tri-stated - sda_chk <= '0'; -- don't check SDA output - when rd_c => - c_state <= rd_d; - scl_oen_int <= '1'; -- keep SCL high - sda_oen_int <= '1'; -- keep SDA tri-stated - sda_chk <= '0'; -- don't check SDA output - when rd_d => - c_state <= idle; - cmd_ack <= '1'; - scl_oen_int <= '0'; -- set SCL low - sda_oen_int <= '1'; -- keep SDA tri-stated - sda_chk <= '0'; -- don't check SDA output - when wr_a => -- write - c_state <= wr_b; - scl_oen_int <= '0'; -- keep SCL low - sda_oen_int <= din; -- set SDA - sda_chk <= '0'; -- don't check SDA output (SCL low) - when wr_b => - c_state <= wr_c; - scl_oen_int <= '1'; -- set SCL high - sda_oen_int <= din; -- keep SDA - sda_chk <= '1'; -- check SDA output - when wr_c => - c_state <= wr_d; - scl_oen_int <= '1'; -- keep SCL high - sda_oen_int <= din; - sda_chk <= '1'; -- check SDA output - when wr_d => - c_state <= idle; - cmd_ack <= '1'; - scl_oen_int <= '0'; -- set SCL low - sda_oen_int <= din; - sda_chk <= '0'; -- don't check SDA output (SCL low) - when others => NULL; - end case; - end if; - end if; - end if; -end process; - - --- assign scl and sda output (always gnd) -scl_o <= '0'; -sda_o <= '0'; - -end arch; diff --git a/EUDETdummy/hdl/i2c/i2c_master_byte_ctrl.vhd b/EUDETdummy/hdl/i2c/i2c_master_byte_ctrl.vhd deleted file mode 100644 index f521957..0000000 --- a/EUDETdummy/hdl/i2c/i2c_master_byte_ctrl.vhd +++ /dev/null @@ -1,286 +0,0 @@ ----------------------------------------------------------------------- --- >>>>>>>>>>>>>>>>>>>>>> COPYRIGHT NOTICE <<<<<<<<<<<<<<<<<<<<<<<<<<< ----------------------------------------------------------------------- ---/////////////////////////////////////////////////////////////////// ---// //// ---// WISHBONE rev.B2 compliant I2C Master byte-controller //// ---// //// ---// //// ---// Author: Richard Herveille //// ---// richard@asics.ws //// ---// www.asics.ws //// ---// //// ---// Downloaded from: http://www.opencores.org/projects/i2c/ //// ---// //// ---/////////////////////////////////////////////////////////////////// ---// //// ---// Copyright (C) 2001 Richard Herveille //// ---// richard@asics.ws //// ---// //// ---// This source file may be used and distributed without //// ---// restriction provided that this copyright statement is not //// ---// removed from the file and that any derivative work contains //// ---// the original copyright notice and the associated disclaimer.//// ---// //// ---// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY //// ---// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED //// ---// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS //// ---// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR //// ---// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, //// ---// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES //// ---// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE //// ---// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR //// ---// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF //// ---// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT //// ---// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT //// ---// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE //// ---// POSSIBILITY OF SUCH DAMAGE. //// ---// //// ---/////////////////////////////////////////////////////////////////// ------------------------------------------------------------------------ --- Copyright (c) 2008 - 2010 by Lattice Semiconductor Corporation --- -------------------------------------------------------------------- --- --- Disclaimer: --- --- This VHDL or Verilog source code is intended as a design reference --- which illustrates how these types of functions can be implemented. --- It is the user's responsibility to verify their design for --- consistency and functionality through the use of formal --- verification methods. Lattice Semiconductor provides no warranty --- regarding the use or functionality of this code. --- --- -------------------------------------------------------------------- --- --- Lattice Semiconductor Corporation --- 5555 NE Moore Court --- Hillsboro, OR 97214 --- U.S.A --- --- TEL: 1-800-Lattice (USA and Canada) --- 503-268-8001 (other locations) --- --- web: http://www.latticesemi.com/ --- email: techsupport@latticesemi.com --- --- -------------------------------------------------------------------- --- Code Revision History : --- -------------------------------------------------------------------- --- Ver: | Author |Mod. Date |Changes Made: --- V1.0 |K.P. | 7/09 | Initial ver for VHDL --- | converted from LSC ref design RD1046 --- -------------------------------------------------------------------- - - -library ieee; -use ieee.std_logic_1164.all; -use ieee.std_logic_arith.all; -use ieee.std_logic_unsigned.all; - -entity i2c_master_byte_ctrl is - port ( - clk : in std_logic; -- master clock - rst : in std_logic; -- synchronous active high reset - nReset : in std_logic; -- asynchronous active low reset - clk_cnt : in std_logic_vector(15 downto 0); -- 4x SCL - -- control inputs - start : in std_logic; - stop : in std_logic; - read : in std_logic; - write : in std_logic; - ack_in : in std_logic; - din : in std_logic_vector(7 downto 0); - -- status outputs - cmd_ack : out std_logic; - ack_out : out std_logic; -- i2c clock line input - dout : out std_logic_vector(7 downto 0); - i2c_al : in std_logic; - -- signals for bit_controller - core_cmd : out std_logic_vector(3 downto 0); - core_txd : out std_logic; - core_rxd : in std_logic; - core_ack : in std_logic - ); -end; - -architecture arch of i2c_master_byte_ctrl is - -constant I2C_CMD_NOP : std_logic_vector(3 downto 0) := "0000"; -constant I2C_CMD_START : std_logic_vector(3 downto 0) := "0001"; -constant I2C_CMD_STOP : std_logic_vector(3 downto 0) := "0010"; -constant I2C_CMD_WRITE : std_logic_vector(3 downto 0) := "0100"; -constant I2C_CMD_READ : std_logic_vector(3 downto 0) := "1000"; - - -constant ST_IDLE : std_logic_vector(4 downto 0) := "00000"; -constant ST_START : std_logic_vector(4 downto 0) := "00001"; -constant ST_READ : std_logic_vector(4 downto 0) := "00010"; -constant ST_WRITE : std_logic_vector(4 downto 0) := "00100"; -constant ST_ACK : std_logic_vector(4 downto 0) := "01000"; -constant ST_STOP : std_logic_vector(4 downto 0) := "10000"; - -signal c_state : std_logic_vector(4 downto 0); - - -signal go : std_logic; -signal dcnt : std_logic_vector(2 downto 0); -signal cnt_done : std_logic; - -signal sr : std_logic_vector(7 downto 0); --8bit shift register -signal shift, ld : std_logic; - -signal cmd_ack_int : std_logic; - - -begin - -go <= '1' when (((read = '1') OR (write = '1') OR (stop = '1')) AND (cmd_ack_int = '0')) else '0'; -dout <= sr; - --- generate shift register -process(clk,nReset) -begin - if (nReset = '0') then - sr <= (others => '0'); - elsif rising_edge(clk) then - if (rst = '1') then - sr <= (others => '0'); - elsif (ld = '1') then - sr <= din; - elsif (shift = '1') then - sr <= sr(6 downto 0) & core_rxd; - end if; - end if; -end process; - --- generate counter -process(clk,nReset) -begin - if (nReset = '0') then - dcnt <= (others => '0'); - elsif rising_edge(clk) then - if (rst = '1') then - dcnt <= (others => '0'); - elsif (ld = '1') then - dcnt <= "111"; - elsif (shift = '1') then - dcnt <= dcnt - '1'; - end if; - end if; -end process; - -cnt_done <= '1' when (dcnt = "000") else '0'; - --- state machine -process(clk,nReset) -begin - if (nReset = '0') then - core_cmd <= I2C_CMD_NOP; - core_txd <= '0'; - shift <= '0'; - ld <= '0'; - cmd_ack_int <= '0'; - c_state <= ST_IDLE; - ack_out <= '0'; - elsif rising_edge(clk) then - if ((rst = '1') OR (i2c_al = '1')) then - core_cmd <= I2C_CMD_NOP; - core_txd <= '0'; - shift <= '0'; - ld <= '0'; - cmd_ack_int <= '0'; - c_state <= ST_IDLE; - ack_out <= '0'; - else - -- initially reset all signals - core_txd <= sr(7); - shift <= '0'; - ld <= '0'; - cmd_ack_int <= '0'; - - case (c_state) is - when ST_IDLE => - if (go = '1') then - if (start = '1') then - c_state <= ST_START; - core_cmd <= I2C_CMD_START; - elsif (read = '1') then - c_state <= ST_READ; - core_cmd <= I2C_CMD_READ; - elsif (write = '1') then - c_state <= ST_WRITE; - core_cmd <= I2C_CMD_WRITE; - else - c_state <= ST_STOP; - core_cmd <= I2C_CMD_STOP; - end if; - ld <= '1'; - end if; - when ST_START => - if (core_ack = '1') then - if (read = '1') then - c_state <= ST_READ; - core_cmd <= I2C_CMD_READ; - else - c_state <= ST_WRITE; - core_cmd <= I2C_CMD_WRITE; - end if; - ld <= '1'; - end if; - when ST_WRITE => - if (core_ack = '1') then - if (cnt_done = '1') then - c_state <= ST_ACK; - core_cmd <= I2C_CMD_READ; - else - c_state <= ST_WRITE; -- stay in same state - core_cmd <= I2C_CMD_WRITE; -- write next bit - shift <= '1'; - end if; - end if; - when ST_READ => - if (core_ack = '1') then - if (cnt_done = '1') then - c_state <= ST_ACK; - core_cmd <= I2C_CMD_WRITE; - else - c_state <= ST_READ; -- stay in same state - core_cmd <= I2C_CMD_READ; -- read next bit - shift <= '1'; - end if; - shift <= '1'; - core_txd <= ack_in; - end if; - when ST_ACK => - if (core_ack = '1') then - if (stop = '1') then - c_state <= ST_STOP; - core_cmd <= I2C_CMD_STOP; - else - c_state <= ST_IDLE; - core_cmd <= I2C_CMD_NOP; - -- generate command acknowledge signal - cmd_ack_int <= '1'; - end if; - -- assign ack_out output to bit_controller_rxd (contains last received bit) - ack_out <= core_rxd; - core_txd <= '1'; - else - core_txd <= ack_in; - end if; - when ST_STOP => - if (core_ack = '1') then - c_state <= ST_IDLE; - core_cmd <= I2C_CMD_NOP; - -- generate command acknowledge signal - cmd_ack_int <= '1'; - end if; - when others => NULL; - end case; - end if; - end if; -end process; - -cmd_ack <= cmd_ack_int; - -end arch; diff --git a/EUDETdummy/hdl/i2c/i2c_master_registers.vhd b/EUDETdummy/hdl/i2c/i2c_master_registers.vhd deleted file mode 100644 index 620e226..0000000 --- a/EUDETdummy/hdl/i2c/i2c_master_registers.vhd +++ /dev/null @@ -1,196 +0,0 @@ ----------------------------------------------------------------------- --- >>>>>>>>>>>>>>>>>>>>>> COPYRIGHT NOTICE <<<<<<<<<<<<<<<<<<<<<<<<<<< ----------------------------------------------------------------------- ---/////////////////////////////////////////////////////////////////// ---// //// ---// WISHBONE rev.B2 compliant I2C Master registers //// ---// //// ---// //// ---// Author: Richard Herveille //// ---// richard@asics.ws //// ---// www.asics.ws //// ---// //// ---// Downloaded from: http://www.opencores.org/projects/i2c/ //// ---// //// ---/////////////////////////////////////////////////////////////////// ---// //// ---// Copyright (C) 2001 Richard Herveille //// ---// richard@asics.ws //// ---// //// ---// This source file may be used and distributed without //// ---// restriction provided that this copyright statement is not //// ---// removed from the file and that any derivative work contains //// ---// the original copyright notice and the associated disclaimer.//// ---// //// ---// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY //// ---// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED //// ---// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS //// ---// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR //// ---// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, //// ---// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES //// ---// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE //// ---// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR //// ---// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF //// ---// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT //// ---// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT //// ---// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE //// ---// POSSIBILITY OF SUCH DAMAGE. //// ---// //// ---/////////////////////////////////////////////////////////////////// --- -------------------------------------------------------------------- --- >>>>>>>>>>>>>>>>>>>>>>>>> COPYRIGHT NOTICE <<<<<<<<<<<<<<<<<<<<<<<<< --- -------------------------------------------------------------------- --- Copyright (c) 2008 - 2010 by Lattice Semiconductor Corporation --- -------------------------------------------------------------------- --- --- Disclaimer: --- --- This VHDL or Verilog source code is intended as a design reference --- which illustrates how these types of functions can be implemented. --- It is the user's responsibility to verify their design for --- consistency and functionality through the use of formal --- verification methods. Lattice Semiconductor provides no warranty --- regarding the use or functionality of this code. --- --- -------------------------------------------------------------------- --- --- Lattice Semiconductor Corporation --- 5555 NE Moore Court --- Hillsboro, OR 97214 --- U.S.A --- --- TEL: 1-800-Lattice (USA and Canada) --- 503-268-8001 (other locations) --- --- web: http://www.latticesemi.com/ --- email: techsupport@latticesemi.com --- --- -------------------------------------------------------------------- --- Code Revision History : --- -------------------------------------------------------------------- --- Ver: | Author |Mod. Date |Changes Made: --- V1.0 |K.P. | 7/09 | Initial ver for VHDL --- | converted from LSC ref design RD1046 --- -------------------------------------------------------------------- --- -------------------------------------------------------------------- -library ieee; -use ieee.std_logic_1164.all; -use ieee.std_logic_arith.all; -use ieee.std_logic_unsigned.all; - -entity i2c_master_registers is - port ( - wb_clk_i : in std_logic; - rst_i : in std_logic; - wb_rst_i : in std_logic; - wb_dat_i : in std_logic_vector(7 downto 0); - wb_adr_i : in std_logic_vector(2 downto 0); - wb_wacc : in std_logic; - i2c_al : in std_logic; - i2c_busy : in std_logic; - done : in std_logic; - irxack : in std_logic; - prer : out std_logic_vector(15 downto 0); -- clock prescale register - ctr : out std_logic_vector(7 downto 0); -- control register - txr : out std_logic_vector(7 downto 0); -- transmit register - cr : out std_logic_vector(7 downto 0); -- command register - sr : out std_logic_vector(7 downto 0) -- status register - ); -end; - -architecture arch of i2c_master_registers is - - -signal ctr_int : std_logic_vector(7 downto 0); -signal cr_int : std_logic_vector(7 downto 0); - -signal al : std_logic; -- status register arbitration lost bit -signal rxack : std_logic; -- received aknowledge from slave -signal tip : std_logic; -- transfer in progress -signal irq_flag : std_logic; -- interrupt pending flag - -begin - --- generate prescale regisres, control registers, and transmit register -process(wb_clk_i,rst_i) -begin - if (rst_i = '0') then - prer <= (others => '1'); - ctr_int <= (others => '0'); - txr <= (others => '0'); - elsif rising_edge(wb_clk_i) then - if (wb_rst_i = '1') then - prer <= (others => '1'); - ctr_int <= (others => '0'); - txr <= (others => '0'); - elsif (wb_wacc = '1') then - case (wb_adr_i) is - when "000" => prer(7 downto 0) <= wb_dat_i; - when "001" => prer(15 downto 8) <= wb_dat_i; - when "010" => ctr_int <= wb_dat_i; - when "011" => txr <= wb_dat_i; - when others => NULL; - end case; - end if; - end if; -end process; - -ctr <= ctr_int; - --- generate command register (special case) -process(wb_clk_i,rst_i) -begin - if (rst_i = '0') then - cr_int <= (others => '0'); - elsif rising_edge(wb_clk_i) then - if (wb_rst_i = '1') then - cr_int <= (others => '0'); - elsif (wb_wacc = '1') then - if ((ctr_int(7) = '1') AND (wb_adr_i = "100")) then - cr_int <= wb_dat_i; - end if; - else - if ((done = '1') OR (i2c_al = '1')) then - cr_int(7 downto 4) <= "0000"; -- clear command b - end if; -- or when aribitr - cr_int(2 downto 1) <= "00"; -- reserved bits - cr_int(0) <= '0'; -- clear IRQ_ACK b - end if; - end if; -end process; - -cr <= cr_int; - --- generate status register block + interrupt request signal --- each output will be assigned to corresponding sr register locations on top level -process(wb_clk_i,rst_i) -begin - if (rst_i = '0') then - al <= '0'; - rxack <= '0'; - tip <= '0'; - irq_flag <= '0'; - elsif rising_edge(wb_clk_i) then - if (wb_rst_i = '1') then - al <= '0'; - rxack <= '0'; - tip <= '0'; - irq_flag <= '0'; - else - al <= i2c_al OR (al AND NOT(cr_int(7))); - rxack <= irxack; - tip <= (cr_int(5) OR cr_int(4)); - irq_flag <= (done OR i2c_al OR irq_flag) AND NOT(cr_int(0)); -- interrupt request flag is always generated - end if; - end if; -end process; - -sr(7) <= rxack; -sr(6) <= i2c_busy; -sr(5) <= al; -sr(4 downto 2) <= "000"; -- reserved -sr(1) <= tip; -sr(0) <= irq_flag; - - -end arch; diff --git a/EUDETdummy/hdl/i2c/i2c_master_rtl.vhd b/EUDETdummy/hdl/i2c/i2c_master_rtl.vhd deleted file mode 100644 index 6d0bb97..0000000 --- a/EUDETdummy/hdl/i2c/i2c_master_rtl.vhd +++ /dev/null @@ -1,97 +0,0 @@ ---============================================================================= ---! @file i2c_master_rtl.vhd ---============================================================================= --- -------------------------------------------------------------------------------- --- -- --- University of Bristol, High Energy Physics Group. --- -- -------------------------------------------------------------------------------- -- --- VHDL Architecture work.i2c_master.rtl --- ---! @brief Wraps the Wishbone I2C master in a wrapper where the IPBus signals\n ---! are bundled together in a record\n --- ---! @author David Cussans , David.Cussans@bristol.ac.uk --- ---! @date 17:22:12 11/30/12 --- ---! @version v0.1 --- ---! @details ---! ---! ---! Dependencies:\n ---! ---! References:\n ---! ---! Modified by:\n ---! Author: -------------------------------------------------------------------------------- ---! \n\nLast changes:\n -------------------------------------------------------------------------------- ---! @todo \n ---! \n --- --------------------------------------------------------------------------------- --- --- Created using using Mentor Graphics HDL Designer(TM) 2010.3 (Build 21) --- -LIBRARY ieee; -USE ieee.std_logic_1164.all; -USE ieee.numeric_std.all; - -USE work.ipbus.all; - -ENTITY i2c_master IS - PORT( - i2c_scl_i : IN std_logic; - i2c_sda_i : IN std_logic; - ipbus_clk_i : IN std_logic; - ipbus_i : IN ipb_wbus; -- Signals from IPBus core to slave - ipbus_reset_i : IN std_logic; - i2c_scl_enb_o : OUT std_logic; - i2c_sda_enb_o : OUT std_logic; - ipbus_o : OUT ipb_rbus -- signals from slave to IPBus core - ); - --- Declarations - -END ENTITY i2c_master ; - --- -ARCHITECTURE rtl OF i2c_master IS - - --signal s_i2c_scl, s_i2c_scl_o, s_i2c_scl_enb, s_i2c_sda, s_i2c_sda_enb : std_logic ; - -BEGIN - - --i2c_scl_b <= s_i2c_scl when (s_i2c_scl_enb = '0') else 'Z'; - --i2c_sda_b <= s_i2c_sda when (s_i2c_sda_enb = '0') else 'Z'; - - i2c_interface: entity work.i2c_master_top port map( - wb_clk_i => ipbus_clk_i, - wb_rst_i => ipbus_reset_i, - arst_i => '1', - wb_adr_i => ipbus_i.ipb_addr(2 downto 0), - wb_dat_i => ipbus_i.ipb_wdata(7 downto 0), - wb_dat_o => ipbus_o.ipb_rdata(7 downto 0), - wb_we_i => ipbus_i.ipb_write, - wb_stb_i => ipbus_i.ipb_strobe, - wb_cyc_i => '1', - wb_ack_o => ipbus_o.ipb_ack, - wb_inta_o => open, - scl_pad_i => i2c_scl_i, - scl_pad_o => open, - scl_padoen_o => i2c_scl_enb_o, - sda_pad_i => i2c_sda_i, - sda_pad_o => open, - sda_padoen_o => i2c_sda_enb_o - ); - - - ipbus_o.ipb_rdata(31 downto 8) <= ( others => '0'); - ipbus_o.ipb_err <= '0'; -- never return an error. - -END ARCHITECTURE rtl; - diff --git a/EUDETdummy/hdl/i2c/i2c_master_top.vhd b/EUDETdummy/hdl/i2c/i2c_master_top.vhd deleted file mode 100644 index a6f0aab..0000000 --- a/EUDETdummy/hdl/i2c/i2c_master_top.vhd +++ /dev/null @@ -1,344 +0,0 @@ ----------------------------------------------------------------------- --- >>>>>>>>>>>>>>>>>>>>>> COPYRIGHT NOTICE <<<<<<<<<<<<<<<<<<<<<<<<<<< ----------------------------------------------------------------------- ---/////////////////////////////////////////////////////////////////// ---// //// ---// WISHBONE rev.B2 compliant I2C Master bit-controller //// ---// //// ---// //// ---// Author: Richard Herveille //// ---// richard@asics.ws //// ---// www.asics.ws //// ---// //// ---// Downloaded from: http://www.opencores.org/projects/i2c/ //// ---// //// ---/////////////////////////////////////////////////////////////////// ---// //// ---// Copyright (C) 2001 Richard Herveille //// ---// richard@asics.ws //// ---// //// ---// This source file may be used and distributed without //// ---// restriction provided that this copyright statement is not //// ---// removed from the file and that any derivative work contains //// ---// the original copyright notice and the associated disclaimer.//// ---// //// ---// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY //// ---// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED //// ---// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS //// ---// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR //// ---// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, //// ---// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES //// ---// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE //// ---// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR //// ---// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF //// ---// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT //// ---// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT //// ---// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE //// ---// POSSIBILITY OF SUCH DAMAGE. //// ---// //// ---/////////////////////////////////////////////////////////////////// --- -------------------------------------------------------------------- --- >>>>>>>>>>>>>>>>>>>>>>>>> COPYRIGHT NOTICE <<<<<<<<<<<<<<<<<<<<<<<<< --- -------------------------------------------------------------------- --- Copyright (c) 2008 - 2010 by Lattice Semiconductor Corporation --- -------------------------------------------------------------------- --- --- Disclaimer: --- --- This VHDL or Verilog source code is intended as a design reference --- which illustrates how these types of functions can be implemented. --- It is the user's responsibility to verify their design for --- consistency and functionality through the use of formal --- verification methods. Lattice Semiconductor provides no warranty --- regarding the use or functionality of this code. --- --- -------------------------------------------------------------------- --- --- Lattice Semiconductor Corporation --- 5555 NE Moore Court --- Hillsboro, OR 97214 --- U.S.A --- --- TEL: 1-800-Lattice (USA and Canada) --- 503-268-8001 (other locations) --- --- web: http://www.latticesemi.com/ --- email: techsupport@latticesemi.com --- --- -------------------------------------------------------------------- --- Code Revision History : --- -------------------------------------------------------------------- --- Ver: | Author |Mod. Date |Changes Made: --- V1.0 |K.P. | 7/09 | Initial ver for VHDL --- | converted from LSC ref design RD1046 -------------------------------------------------------------------------------- --- Changes at University of bristol: --- V1.0A|D.G.C | 5/11 | Changed name and ports to fit OC original --- -------------------------------------------------------------------- - -library ieee; -use ieee.std_logic_1164.all; -use ieee.std_logic_arith.all; -use ieee.std_logic_unsigned.all; - -entity i2c_master_top is - generic ( - ARST_LVL : integer := 0 - ); - port ( - wb_clk_i : in std_logic; - wb_rst_i : in std_logic; - arst_i : in std_logic; - wb_adr_i : in std_logic_vector(2 downto 0); - wb_dat_i : in std_logic_vector(7 downto 0); - wb_dat_o : out std_logic_vector(7 downto 0); - wb_we_i : in std_logic; - wb_stb_i : in std_logic; - wb_cyc_i : in std_logic; - wb_ack_o : out std_logic; - wb_inta_o: out std_logic; - scl_pad_i: in std_logic; - scl_pad_o: out std_logic; - scl_padoen_o: out std_logic; - sda_pad_i: in std_logic; - sda_pad_o: out std_logic; - sda_padoen_o: out std_logic --- scl : inout std_logic; --- sda : inout std_logic - ); -end; - -architecture arch of i2c_master_top is - -component i2c_master_bit_ctrl - port ( - clk : in std_logic; - rst : in std_logic; - nReset : in std_logic; - clk_cnt : in std_logic_vector(15 downto 0); -- clock prescale value - ena : in std_logic; -- core enable signal - cmd : in std_logic_vector(3 downto 0); - cmd_ack : out std_logic; -- command complete acknowledge - busy : out std_logic; -- i2c bus busy - al : out std_logic; -- i2c bus arbitration lost - din : in std_logic; - dout : out std_logic; - scl_i : in std_logic; -- i2c clock line input - scl_o : out std_logic; -- i2c clock line output - scl_oen : out std_logic; -- i2c clock line output enable (active low) - sda_i : in std_logic; -- i2c data line input - sda_o : out std_logic; -- i2c data line output - sda_oen : out std_logic -- i2c data line output enable (active low) - ); -end component; - -component i2c_master_byte_ctrl - port ( - clk : in std_logic; -- master clock - rst : in std_logic; -- synchronous active high reset - nReset : in std_logic; -- asynchronous active low reset - clk_cnt : in std_logic_vector(15 downto 0); -- 4x SCL - -- control inputs - start : in std_logic; - stop : in std_logic; - read : in std_logic; - write : in std_logic; - ack_in : in std_logic; - din : in std_logic_vector(7 downto 0); - -- status outputs - cmd_ack : out std_logic; - ack_out : out std_logic; -- i2c clock line input - dout : out std_logic_vector(7 downto 0); - i2c_al : in std_logic; - -- signals for bit_controller - core_cmd : out std_logic_vector(3 downto 0); - core_txd : out std_logic; - core_rxd : in std_logic; - core_ack : in std_logic - ); -end component; - -component i2c_master_registers - port ( - wb_clk_i : in std_logic; - rst_i : in std_logic; - wb_rst_i : in std_logic; - wb_dat_i : in std_logic_vector(7 downto 0); - wb_adr_i : in std_logic_vector(2 downto 0); - wb_wacc : in std_logic; - i2c_al : in std_logic; - i2c_busy : in std_logic; - done : in std_logic; - irxack : in std_logic; - prer : out std_logic_vector(15 downto 0); -- clock prescale register - ctr : out std_logic_vector(7 downto 0); -- control register - txr : out std_logic_vector(7 downto 0); -- transmit register - cr : out std_logic_vector(7 downto 0); -- command register - sr : out std_logic_vector(7 downto 0) -- status register - ); -end component; - - -signal prer : std_logic_vector(15 downto 0); -signal ctr : std_logic_vector(7 downto 0); -signal txr : std_logic_vector(7 downto 0); -signal rxr : std_logic_vector(7 downto 0); -signal cr : std_logic_vector(7 downto 0); -signal sr : std_logic_vector(7 downto 0); - -signal done : std_logic; -signal core_en : std_logic; -signal ien : std_logic; -signal irxack : std_logic; -signal irq_flag : std_logic; -signal i2c_busy : std_logic; -signal i2c_al : std_logic; - -signal core_cmd : std_logic_vector(3 downto 0); -signal core_txd : std_logic; -signal core_ack, core_rxd : std_logic; - --- Don't need these signals, since passing them through --- component interface ---signal scl_pad_i : std_logic; ---signal scl_pad_o : std_logic; ---signal scl_padoen_o : std_logic; --- ---signal sda_pad_i : std_logic; ---signal sda_pad_o : std_logic; ---signal sda_padoen_o : std_logic; - -signal rst_i : std_logic; - -signal sta : std_logic; -signal sto : std_logic; -signal rd : std_logic; -signal wr : std_logic; -signal ack : std_logic; -signal iack : std_logic; - -signal wb_ack_o_int : std_logic; - -signal wb_wacc : std_logic; -signal acki : std_logic; - -begin - - -- Don't need to copy these signal - passing through - -- component interface ---scl_pad_i <= scl; ---sda_pad_i <= sda; - -rst_i <= arst_i when (ARST_LVL = 0) else NOT(arst_i); - -wb_wacc <= wb_cyc_i AND wb_stb_i AND wb_we_i; - -sta <= cr(7); -sto <= cr(6); -rd <= cr(5); -wr <= cr(4); -ack <= cr(3); -acki <= cr(0); - -core_en <= ctr(7); -ien <= ctr(6); - -process(wb_clk_i) -begin - if rising_edge(wb_clk_i) then - wb_ack_o_int <= wb_cyc_i AND wb_stb_i AND NOT(wb_ack_o_int); - end if; -end process; - -wb_ack_o <= wb_ack_o_int; - -process(wb_clk_i) -begin - if rising_edge(wb_clk_i) then - case (wb_adr_i) is - when "000" => wb_dat_o <= prer(7 downto 0); - when "001" => wb_dat_o <= prer(15 downto 8); - when "010" => wb_dat_o <= ctr; - when "011" => wb_dat_o <= rxr; - when "100" => wb_dat_o <= sr; - when "101" => wb_dat_o <= txr; - when "110" => wb_dat_o <= cr; - when "111" => wb_dat_o <= "00000000"; - when others => NULL; - end case; - end if; -end process; - -process(wb_clk_i,rst_i) -begin - if (rst_i = '0') then - wb_inta_o <= '0'; - elsif rising_edge(wb_clk_i) then - wb_inta_o <= sr(0) AND ien; - end if; -end process; - - - -byte_controller: i2c_master_byte_ctrl port map( - clk => wb_clk_i, - rst => wb_rst_i, - nReset => rst_i, - clk_cnt => prer, - start => sta, - stop => sto, - read => rd, - write => wr, - ack_in => ack, - din => txr, - cmd_ack => done, - ack_out => irxack, - dout => rxr, - i2c_al => i2c_al, - core_cmd => core_cmd, - core_ack => core_ack, - core_txd => core_txd, - core_rxd => core_rxd); - -bit_controller: i2c_master_bit_ctrl port map( - clk => wb_clk_i, - rst => wb_rst_i, - nReset => rst_i, - ena => core_en, - clk_cnt => prer, - cmd => core_cmd, - cmd_ack => core_ack, - busy => i2c_busy, - al => i2c_al, - din => core_txd, - dout => core_rxd, - scl_i => scl_pad_i, - scl_o => scl_pad_o, - scl_oen => scl_padoen_o, - sda_i => sda_pad_i, - sda_o => sda_pad_o, - sda_oen => sda_padoen_o); - -registers: i2c_master_registers port map( - wb_clk_i => wb_clk_i, - rst_i => rst_i, - wb_rst_i => wb_rst_i, - wb_dat_i => wb_dat_i, - wb_wacc => wb_wacc, - wb_adr_i => wb_adr_i, - i2c_al => i2c_al, - i2c_busy => i2c_busy, - done => done, - irxack => irxack, - prer => prer, - ctr => ctr, - txr => txr, - cr => cr, - sr => sr); - - --- edited from Lattice original to pass uni-directional signals ---scl <= scl_pad_o when (scl_padoen_o = '0') else 'Z'; ---sda <= sda_pad_o when (sda_padoen_o = '0') else 'Z'; - -end arch; diff --git a/EUDETdummy/hdl/ipbus_addr_decode.vhd b/EUDETdummy/hdl/ipbus_addr_decode.vhd deleted file mode 100644 index dc630e8..0000000 --- a/EUDETdummy/hdl/ipbus_addr_decode.vhd +++ /dev/null @@ -1,50 +0,0 @@ --- Address decode logic for ipbus fabric --- --- This file has been AUTOGENERATED from the address table - do not hand edit --- --- We assume the synthesis tool is clever enough to recognise exclusive conditions --- in the if statement. --- --- Dave Newbold, February 2011 - -library IEEE; -use IEEE.STD_LOGIC_1164.all; -use ieee.numeric_std.all; -use work.ipbus.all; - -package ipbus_addr_decode is - - function ipbus_addr_sel(signal addr : in std_logic_vector(31 downto 0)) return integer; - -end ipbus_addr_decode; - -package body ipbus_addr_decode is - - function ipbus_addr_sel(signal addr : in std_logic_vector(31 downto 0)) return integer is - variable sel : integer; - begin - if std_match(addr, "-----------------------0001-----") then - sel := 0; -- DUTInterfaces / base 00000020 / mask 0000001f - elsif std_match(addr, "-----------------------0010-----") then - sel := 1; -- triggerInputs / base 00000040 / mask 0000001f - elsif std_match(addr, "-----------------------0011-----") then - sel := 2; -- triggerLogic / base 00000060 / mask 0000001f - elsif std_match(addr, "-----------------------0100-----") then - sel := 3; -- eventBuffer / base 00000080 / mask 0000001f - elsif std_match(addr, "-----------------------0101-----") then - sel := 4; -- logic_clocks / base 000000a0 / mask 0000001f - elsif std_match(addr, "-----------------------0110-----") then - sel := 5; -- i2c_master / base 000000c0 / mask 00000007 - elsif std_match(addr, "-----------------------1010-----") then - sel := 6; -- Event_Formatter / base 00000140 / mask 0000001f - elsif std_match(addr, "-----------------------1011-----") then - sel := 7; -- TPix3_iface / base 00000160 / mask 0000001f - elsif std_match(addr, "-----------------------0000-----") then - sel := 8; -- version / base 00000000 / mask 00000000 - else - sel := 99; - end if; - return sel; - end ipbus_addr_sel; - -end ipbus_addr_decode; diff --git a/EUDETdummy/hdl/ipbus_decode_ipbus_example.vhd b/EUDETdummy/hdl/ipbus_decode_ipbus_example.vhd deleted file mode 100644 index a315ed0..0000000 --- a/EUDETdummy/hdl/ipbus_decode_ipbus_example.vhd +++ /dev/null @@ -1,69 +0,0 @@ --- Address decode logic for ipbus fabric --- --- --- We assume the synthesis tool is clever enough to recognise exclusive conditions --- in the if statement. --- --- Dave Newbold, February 2011 - -library IEEE; -use IEEE.STD_LOGIC_1164.all; -use ieee.numeric_std.all; - -package ipbus_decode_ipbus_example is - - constant IPBUS_SEL_WIDTH: positive := 5; -- Should be enough for now? - subtype ipbus_sel_t is std_logic_vector(IPBUS_SEL_WIDTH - 1 downto 0); - function ipbus_sel_ipbus_example(addr : in std_logic_vector(31 downto 0)) return ipbus_sel_t; - --- START automatically generated VHDL the Fri Oct 7 12:10:31 2016 - constant N_SLV_CTRL_REG: integer := 0; --for tests - constant N_SLV_REG: integer := 1; -- for tests - constant N_SLV_I2C_0: integer := 2; --I2C core for the TLU - constant N_SLV_DUT: integer :=3; - constant N_SLV_SHUT: integer :=4; - constant N_SLV_EVBUF: integer :=5; - constant N_SLV_EVFMT: integer :=6; - constant N_SLV_TRGIN: integer :=7; - constant N_SLV_TRGLGC: integer :=8; - constant N_SLV_LGCCLK: integer :=9; - - constant N_SLAVES: integer := 10; --Total number of slaves --- END automatically generated VHDL - --constant N_I2C_CORES: integer := 3; --How many I2C cores - -end ipbus_decode_ipbus_example; - -package body ipbus_decode_ipbus_example is - - function ipbus_sel_ipbus_example(addr : in std_logic_vector(31 downto 0)) return ipbus_sel_t is - variable sel: ipbus_sel_t; - begin - --- START automatically generated VHDL the Fri Oct 7 12:10:31 2016 - if std_match(addr, "-----------------000----------0-") then - sel := ipbus_sel_t(to_unsigned(N_SLV_CTRL_REG, IPBUS_SEL_WIDTH)); -- ctrl_reg / base 0x00000000 / mask 0x00003002 - elsif std_match(addr, "-----------------000----------1-") then - sel := ipbus_sel_t(to_unsigned(N_SLV_REG, IPBUS_SEL_WIDTH)); -- reg / base 0x00000002 / mask 0x00003002 - --elsif std_match(addr, "-----------------001------------") then - --sel := ipbus_sel_t(to_unsigned(N_SLV_RAM, IPBUS_SEL_WIDTH)); -- ram / base 0x00001000 / mask 0x00003000 - --elsif std_match(addr, "-----------------010----------0-") then - -- sel := ipbus_sel_t(to_unsigned(N_SLV_PRAM, IPBUS_SEL_WIDTH)); -- pram / base 0x00002000 / mask 0x00003002 - elsif std_match(addr, "-----------------011------------") then - sel := ipbus_sel_t(to_unsigned(N_SLV_I2C_0, IPBUS_SEL_WIDTH)); -- i2c / base 0x00003000 / mask 0x00003002 - elsif std_match(addr, "-----------------100------------") then - sel := ipbus_sel_t(to_unsigned(N_SLV_DUT, IPBUS_SEL_WIDTH)); -- i2c / base 0x00004000 / mask 0x00003002 - elsif std_match(addr, "-----------------101------------") then - sel := ipbus_sel_t(to_unsigned(N_SLV_TRGIN, IPBUS_SEL_WIDTH)); -- i2c / base 0x00005000 / mask 0x00003002 --- END automatically generated VHDL - - else - sel := ipbus_sel_t(to_unsigned(N_SLAVES, IPBUS_SEL_WIDTH)); - end if; - - return sel; - - end function ipbus_sel_ipbus_example; - -end ipbus_decode_ipbus_example; - diff --git a/EUDETdummy/hdl/ipbus_decode_tlu.vhd b/EUDETdummy/hdl/ipbus_decode_tlu.vhd deleted file mode 100644 index 114da40..0000000 --- a/EUDETdummy/hdl/ipbus_decode_tlu.vhd +++ /dev/null @@ -1,73 +0,0 @@ --- Address decode logic for ipbus fabric --- --- --- --- Paolo Baesso, February 2017 - -library IEEE; -use IEEE.STD_LOGIC_1164.all; -use ieee.numeric_std.all; - -package ipbus_decode_tlu is - - constant IPBUS_SEL_WIDTH: positive := 5; -- Should be enough for now? - subtype ipbus_sel_t is std_logic_vector(IPBUS_SEL_WIDTH - 1 downto 0); - function ipbus_sel_ipbus_example(addr : in std_logic_vector(31 downto 0)) return ipbus_sel_t; - --- START automatically generated VHDL the Fri Oct 7 12:10:31 2016 - constant N_SLV_CTRL_REG: integer := 0; --for tests - constant N_SLV_REG: integer := 1; -- for tests - constant N_SLV_I2C_0: integer := 2; --I2C core for the TLU - constant N_SLV_DUT: integer :=3; - constant N_SLV_SHUT: integer :=4; - constant N_SLV_EVBUF: integer :=5; - constant N_SLV_EVFMT: integer :=6; - constant N_SLV_TRGIN: integer :=7; - constant N_SLV_TRGLGC: integer :=8; - constant N_SLV_LGCCLK: integer :=9; - - constant N_SLAVES: integer := 10; --Total number of IPBus slaves --- END automatically generated VHDL - --constant N_I2C_CORES: integer := 3; --How many I2C cores - -end ipbus_decode_tlu; - -package body ipbus_decode_tlu is - - function ipbus_sel_ipbus_example(addr : in std_logic_vector(31 downto 0)) return ipbus_sel_t is - variable sel: ipbus_sel_t; - begin - --- START automatically generated VHDL the Fri Oct 7 12:10:31 2016 - if std_match(addr, "----------------0000----------0-") then - sel := ipbus_sel_t(to_unsigned(N_SLV_CTRL_REG, IPBUS_SEL_WIDTH)); -- ctrl_reg / base 0x00000000 / mask 0x00003002 - elsif std_match(addr, "----------------0000----------1-") then - sel := ipbus_sel_t(to_unsigned(N_SLV_REG, IPBUS_SEL_WIDTH)); -- reg / base 0x00000002 / mask 0x00003002 - elsif std_match(addr, "----------------0001------------") then - sel := ipbus_sel_t(to_unsigned(N_SLV_DUT, IPBUS_SEL_WIDTH)); -- ram / base 0x00001000 / mask 0x00003000 - elsif std_match(addr, "----------------0010----------0-") then - sel := ipbus_sel_t(to_unsigned(N_SLV_SHUT, IPBUS_SEL_WIDTH)); -- shutter / base 0x00002000 / mask 0x00003002 - elsif std_match(addr, "----------------0011------------") then - sel := ipbus_sel_t(to_unsigned(N_SLV_I2C_0, IPBUS_SEL_WIDTH)); -- i2c / base 0x00003000 / mask 0x00003002 - elsif std_match(addr, "----------------0100------------") then - sel := ipbus_sel_t(to_unsigned(N_SLV_EVBUF, IPBUS_SEL_WIDTH)); -- event buffer / base 0x00004000 / mask 0x00003002 - elsif std_match(addr, "----------------0101------------") then - sel := ipbus_sel_t(to_unsigned(N_SLV_EVFMT, IPBUS_SEL_WIDTH)); -- event formatter / base 0x00005000 / mask 0x00003002 - elsif std_match(addr, "----------------0110------------") then - sel := ipbus_sel_t(to_unsigned(N_SLV_TRGIN, IPBUS_SEL_WIDTH)); -- trigger inputs / base 0x00006000 / mask 0x00003002 - elsif std_match(addr, "----------------0111------------") then - sel := ipbus_sel_t(to_unsigned(N_SLV_TRGLGC, IPBUS_SEL_WIDTH)); -- trigger logic / base 0x00007000 / mask 0x00003002 - elsif std_match(addr, "----------------1000------------") then - sel := ipbus_sel_t(to_unsigned(N_SLV_LGCCLK, IPBUS_SEL_WIDTH)); -- logic clocks / base 0x00008000 / mask 0x00003002 --- END automatically generated VHDL - - else - sel := ipbus_sel_t(to_unsigned(N_SLAVES, IPBUS_SEL_WIDTH)); - end if; - - return sel; - - end function ipbus_sel_ipbus_example; - -end ipbus_decode_tlu; - diff --git a/EUDETdummy/hdl/ipbus_example.vhd b/EUDETdummy/hdl/ipbus_example.vhd deleted file mode 100644 index 5cc5f12..0000000 --- a/EUDETdummy/hdl/ipbus_example.vhd +++ /dev/null @@ -1,174 +0,0 @@ --- ipbus_example --- --- selection of different IPBus slaves without actual function, --- just for performance evaluation of the IPbus/uhal system --- --- Kristian Harder, March 2014 --- based on code by Dave Newbold, February 2011 - -library IEEE; -use IEEE.STD_LOGIC_1164.ALL; -use work.ipbus.all; -use work.ipbus_reg_types.all; -use work.ipbus_decode_ipbus_example.all; - -entity ipbus_example is - port( - ipb_clk: in std_logic; - ipb_rst: in std_logic; - ipb_in: in ipb_wbus; - ipb_out: out ipb_rbus; - nuke: out std_logic; - soft_rst: out std_logic; - --i2c_scl_b: INOUT std_logic; - --i2c_sda_b: INOUT std_logic; - - --i2c_sda_i: IN std_logic; - --i2c_scl_i: IN std_logic; - --i2c_scl_enb_o: OUT std_logic; - --i2c_sda_enb_o: OUT std_logic; - - i2c_sda_i: IN std_logic_vector(N_I2C_CORES - 1 downto 0); - i2c_scl_i: IN std_logic_vector(N_I2C_CORES - 1 downto 0); - i2c_scl_enb_o: OUT std_logic_vector(N_I2C_CORES - 1 downto 0); - i2c_sda_enb_o: OUT std_logic_vector(N_I2C_CORES - 1 downto 0); - userled: out std_logic - ); - -end ipbus_example; - -architecture rtl of ipbus_example is - - signal ipbw: ipb_wbus_array(N_SLAVES - 1 downto 0); - signal ipbr: ipb_rbus_array(N_SLAVES - 1 downto 0); - signal ctrl, stat: ipb_reg_v(0 downto 0); - --SIGNAL s_i2c_scl_enb : std_logic; - --SIGNAL s_i2c_sda_enb : std_logic; - - -->P - COMPONENT i2c_master - PORT ( - i2c_scl_i : IN std_logic; - i2c_sda_i : IN std_logic; - ipbus_clk_i : IN std_logic; - ipbus_i : IN ipb_wbus; - ipbus_reset_i : IN std_logic; - i2c_scl_enb_o : OUT std_logic; - i2c_sda_enb_o : OUT std_logic; - ipbus_o : OUT ipb_rbus - ); - END COMPONENT i2c_master; - FOR ALL : i2c_master USE ENTITY work.i2c_master;--

N_SLAVES, - SEL_WIDTH => IPBUS_SEL_WIDTH) - port map( - ipb_in => ipb_in, - ipb_out => ipb_out, - sel => ipbus_sel_ipbus_example(ipb_in.ipb_addr), - ipb_to_slaves => ipbw, - ipb_from_slaves => ipbr - ); - --- Slave 0: id / rst reg - - slave0: entity work.ipbus_ctrlreg_v - port map( - clk => ipb_clk, - reset => ipb_rst, - ipbus_in => ipbw(N_SLV_CTRL_REG), - ipbus_out => ipbr(N_SLV_CTRL_REG), - d => stat, - q => ctrl - ); - - stat(0) <= X"abcdfedc"; - soft_rst <= ctrl(0)(0); - nuke <= ctrl(0)(1); - --- Slave 1: register - - slave1: entity work.ipbus_reg_v - port map( - clk => ipb_clk, - reset => ipb_rst, - ipbus_in => ipbw(N_SLV_REG), - ipbus_out => ipbr(N_SLV_REG), - q => open - ); - --- Slave 2: 1kword RAM - - slave4: entity work.ipbus_ram - generic map(ADDR_WIDTH => 10) - port map( - clk => ipb_clk, - reset => ipb_rst, - ipbus_in => ipbw(N_SLV_RAM), - ipbus_out => ipbr(N_SLV_RAM) - ); - --- Slave 3: peephole RAM - - slave5: entity work.ipbus_peephole_ram - generic map(ADDR_WIDTH => 10) - port map( - clk => ipb_clk, - reset => ipb_rst, - ipbus_in => ipbw(N_SLV_PRAM), - ipbus_out => ipbr(N_SLV_PRAM) - ); --- slave6 : i2c_master --- PORT MAP ( --- i2c_scl_i => i2c_scl_b, --- i2c_sda_i => i2c_sda_b, --- ipbus_clk_i => ipb_clk, --- ipbus_i => ipbw(N_SLV_I2C), --- ipbus_reset_i => ipb_rst, --- i2c_scl_enb_o => s_i2c_scl_enb, --- i2c_sda_enb_o => s_i2c_sda_enb, --- ipbus_o => ipbr(N_SLV_I2C) --- ); - - -- Instantiate a I2C core for the EEPROM - slave6 : i2c_master - PORT MAP ( - i2c_scl_i => i2c_scl_i(0), - i2c_sda_i => i2c_sda_i(0), - ipbus_clk_i => ipb_clk, - ipbus_i => ipbw(N_SLV_I2C_0), - ipbus_reset_i => ipb_rst, - i2c_scl_enb_o => i2c_scl_enb_o(0), - i2c_sda_enb_o => i2c_sda_enb_o(0), - ipbus_o => ipbr(N_SLV_I2C_0) - ); - slave7 : i2c_master - PORT MAP ( - i2c_scl_i => i2c_scl_i(1), - i2c_sda_i => i2c_sda_i(1), - ipbus_clk_i => ipb_clk, - ipbus_i => ipbw(N_SLV_I2C_1), - ipbus_reset_i => ipb_rst, - i2c_scl_enb_o => i2c_scl_enb_o(1), - i2c_sda_enb_o => i2c_sda_enb_o(1), - ipbus_o => ipbr(N_SLV_I2C_1) - ); - slave8 : i2c_master - PORT MAP ( - i2c_scl_i => i2c_scl_i(2), - i2c_sda_i => i2c_sda_i(2), - ipbus_clk_i => ipb_clk, - ipbus_i => ipbw(N_SLV_I2C_2), - ipbus_reset_i => ipb_rst, - i2c_scl_enb_o => i2c_scl_enb_o(2), - i2c_sda_enb_o => i2c_sda_enb_o(2), - ipbus_o => ipbr(N_SLV_I2C_2) - ); -end rtl; diff --git a/EUDETdummy/hdl/ipbus_fabric_sel.vhd b/EUDETdummy/hdl/ipbus_fabric_sel.vhd deleted file mode 100644 index 86d2fa7..0000000 --- a/EUDETdummy/hdl/ipbus_fabric_sel.vhd +++ /dev/null @@ -1,61 +0,0 @@ --- The ipbus bus fabric, address select logic, data multiplexers --- --- This version selects the addressed slave depending on the state --- of incoming control lines --- --- Dave Newbold, February 2011 - -library IEEE; -use IEEE.STD_LOGIC_1164.ALL; -use ieee.numeric_std.all; -use work.ipbus.ALL; - -entity ipbus_fabric_sel is - generic( - NSLV: positive; - STROBE_GAP: boolean := false; - SEL_WIDTH: positive - ); - port( - sel: in std_logic_vector(SEL_WIDTH - 1 downto 0); - ipb_in: in ipb_wbus; - ipb_out: out ipb_rbus; - ipb_to_slaves: out ipb_wbus_array(NSLV - 1 downto 0); - ipb_from_slaves: in ipb_rbus_array(NSLV - 1 downto 0) := (others => IPB_RBUS_NULL) - ); - -end ipbus_fabric_sel; - -architecture rtl of ipbus_fabric_sel is - - signal sel_i: integer range 0 to NSLV := 0; - signal ored_ack, ored_err: std_logic_vector(NSLV downto 0); - signal qstrobe: std_logic; - -begin - - sel_i <= to_integer(unsigned(sel)); - - ored_ack(NSLV) <= '0'; - ored_err(NSLV) <= '0'; - - qstrobe <= ipb_in.ipb_strobe when STROBE_GAP = false else - ipb_in.ipb_strobe and not (ored_ack(0) or ored_err(0)); - - busgen: for i in NSLV-1 downto 0 generate - begin - - ipb_to_slaves(i).ipb_addr <= ipb_in.ipb_addr; - ipb_to_slaves(i).ipb_wdata <= ipb_in.ipb_wdata; - ipb_to_slaves(i).ipb_strobe <= qstrobe when sel_i = i else '0'; - ipb_to_slaves(i).ipb_write <= ipb_in.ipb_write; - ored_ack(i) <= ored_ack(i+1) or ipb_from_slaves(i).ipb_ack; - ored_err(i) <= ored_err(i+1) or ipb_from_slaves(i).ipb_err; - - end generate; - - ipb_out.ipb_rdata <= ipb_from_slaves(sel_i).ipb_rdata when sel_i /= NSLV else (others => '0'); - ipb_out.ipb_ack <= ored_ack(0); - ipb_out.ipb_err <= ored_err(0); - -end rtl; diff --git a/EUDETdummy/hdl/ipbus_slaves.vhd b/EUDETdummy/hdl/ipbus_slaves.vhd deleted file mode 100644 index e0ee08f..0000000 --- a/EUDETdummy/hdl/ipbus_slaves.vhd +++ /dev/null @@ -1,170 +0,0 @@ --- ipbus_example --- --- selection of different IPBus slaves without actual function, --- just for performance evaluation of the IPbus/uhal system --- --- Kristian Harder, March 2014 --- based on code by Dave Newbold, February 2011 - -library IEEE; -use IEEE.STD_LOGIC_1164.ALL; -use work.ipbus.all; -use work.ipbus_reg_types.all; -use work.ipbus_decode_ipbus_example.all; - -entity ipbus_slaves is - port( - ipb_clk: in std_logic; - ipb_rst: in std_logic; - ipb_in: in ipb_wbus; - ipb_out: out ipb_rbus; - nuke: out std_logic; - soft_rst: out std_logic; - --i2c_scl_b: INOUT std_logic; - --i2c_sda_b: INOUT std_logic; - - --i2c_sda_i: IN std_logic; - --i2c_scl_i: IN std_logic; - --i2c_scl_enb_o: OUT std_logic; - --i2c_sda_enb_o: OUT std_logic; - - i2c_sda_i: IN std_logic_vector(N_I2C_CORES - 1 downto 0); - i2c_scl_i: IN std_logic_vector(N_I2C_CORES - 1 downto 0); - i2c_scl_enb_o: OUT std_logic_vector(N_I2C_CORES - 1 downto 0); - i2c_sda_enb_o: OUT std_logic_vector(N_I2C_CORES - 1 downto 0); - userled: out std_logic - ); - -end ipbus_slaves; - -architecture rtl of ipbus_slaves is - - signal ipbw: ipb_wbus_array(N_SLAVES - 1 downto 0); - signal ipbr: ipb_rbus_array(N_SLAVES - 1 downto 0); - signal ctrl, stat: ipb_reg_v(0 downto 0); - --SIGNAL s_i2c_scl_enb : std_logic; - --SIGNAL s_i2c_sda_enb : std_logic; - - -->P - COMPONENT i2c_master - PORT ( - i2c_scl_i : IN std_logic; - i2c_sda_i : IN std_logic; - ipbus_clk_i : IN std_logic; - ipbus_i : IN ipb_wbus; - ipbus_reset_i : IN std_logic; - i2c_scl_enb_o : OUT std_logic; - i2c_sda_enb_o : OUT std_logic; - ipbus_o : OUT ipb_rbus - ); - END COMPONENT i2c_master; - FOR ALL : i2c_master USE ENTITY work.i2c_master;--

N_SLAVES, - SEL_WIDTH => IPBUS_SEL_WIDTH) - port map( - ipb_in => ipb_in, - ipb_out => ipb_out, - sel => ipbus_sel_ipbus_example(ipb_in.ipb_addr), - ipb_to_slaves => ipbw, - ipb_from_slaves => ipbr - ); - --- Slave 0: id / rst reg - - slave0: entity work.ipbus_ctrlreg_v - port map( - clk => ipb_clk, - reset => ipb_rst, - ipbus_in => ipbw(N_SLV_CTRL_REG), - ipbus_out => ipbr(N_SLV_CTRL_REG), - d => stat, - q => ctrl - ); - stat(0) <= X"abcdfedc"; - soft_rst <= ctrl(0)(0); - nuke <= ctrl(0)(1); - --- Slave 1: register - slave1: entity work.ipbus_reg_v - port map( - clk => ipb_clk, - reset => ipb_rst, - ipbus_in => ipbw(N_SLV_REG), - ipbus_out => ipbr(N_SLV_REG), - q => open - ); - --- Slave 2: 1kword RAM --- slave4: entity work.ipbus_ram --- generic map(ADDR_WIDTH => 10) --- port map( --- clk => ipb_clk, --- reset => ipb_rst, --- ipbus_in => ipbw(N_SLV_RAM), --- ipbus_out => ipbr(N_SLV_RAM) --- ); - --- Slave 3: peephole RAM --- slave5: entity work.ipbus_peephole_ram --- generic map(ADDR_WIDTH => 10) --- port map( --- clk => ipb_clk, --- reset => ipb_rst, --- ipbus_in => ipbw(N_SLV_PRAM), --- ipbus_out => ipbr(N_SLV_PRAM) --- ); --- slave6 : i2c_master --- PORT MAP ( --- i2c_scl_i => i2c_scl_b, --- i2c_sda_i => i2c_sda_b, --- ipbus_clk_i => ipb_clk, --- ipbus_i => ipbw(N_SLV_I2C), --- ipbus_reset_i => ipb_rst, --- i2c_scl_enb_o => s_i2c_scl_enb, --- i2c_sda_enb_o => s_i2c_sda_enb, --- ipbus_o => ipbr(N_SLV_I2C) --- ); - - -- Instantiate a I2C core for the EEPROM - slave6 : i2c_master - PORT MAP ( - i2c_scl_i => i2c_scl_i(0), - i2c_sda_i => i2c_sda_i(0), - ipbus_clk_i => ipb_clk, - ipbus_i => ipbw(N_SLV_I2C_0), - ipbus_reset_i => ipb_rst, - i2c_scl_enb_o => i2c_scl_enb_o(0), - i2c_sda_enb_o => i2c_sda_enb_o(0), - ipbus_o => ipbr(N_SLV_I2C_0) - ); - slave7 : i2c_master - PORT MAP ( - i2c_scl_i => i2c_scl_i(1), - i2c_sda_i => i2c_sda_i(1), - ipbus_clk_i => ipb_clk, - ipbus_i => ipbw(N_SLV_I2C_1), - ipbus_reset_i => ipb_rst, - i2c_scl_enb_o => i2c_scl_enb_o(1), - i2c_sda_enb_o => i2c_sda_enb_o(1), - ipbus_o => ipbr(N_SLV_I2C_1) - ); - slave8 : i2c_master - PORT MAP ( - i2c_scl_i => i2c_scl_i(2), - i2c_sda_i => i2c_sda_i(2), - ipbus_clk_i => ipb_clk, - ipbus_i => ipbw(N_SLV_I2C_2), - ipbus_reset_i => ipb_rst, - i2c_scl_enb_o => i2c_scl_enb_o(2), - i2c_sda_enb_o => i2c_sda_enb_o(2), - ipbus_o => ipbr(N_SLV_I2C_2) - ); -end rtl; diff --git a/EUDETdummy/hdl/ipbus_ver.vhd b/EUDETdummy/hdl/ipbus_ver.vhd deleted file mode 100644 index 068f126..0000000 --- a/EUDETdummy/hdl/ipbus_ver.vhd +++ /dev/null @@ -1,46 +0,0 @@ ---============================================================================= ---! @file ipbus_ver.vhd ---============================================================================= - --- Version register, returns a fixed value --- --- To be replaced by a more coherent versioning mechanism later --- --- Dave Newbold, August 2011 - -library IEEE; -use IEEE.STD_LOGIC_1164.ALL; -use work.ipbus.all; - ---! @brief IPBus fixed register returning Firmware version number -entity ipbus_ver is - port( - ipbus_in: in ipb_wbus; - ipbus_out: out ipb_rbus - ); - -end ipbus_ver; - -architecture rtl of ipbus_ver is - -begin - - ipbus_out.ipb_rdata <= X"a622" & X"1008"; -- Lower 16b are ipbus firmware build ID (temporary arrangement). - ipbus_out.ipb_ack <= ipbus_in.ipb_strobe; - ipbus_out.ipb_err <= '0'; - -end rtl; - --- Build log --- --- build 0x1000 : 22/08/11 : Starting build ID --- build 0x1001 : 29/08/11 : Version for SPI testing --- build 0x1002 : 27/09/11 : Bug fixes, new transactor code; v1.3 candidate --- build 0x1003 : buggy --- build 0x1004 : 18/10/11 : New mini-t top level, bug fixes, 1.3 codebase --- build 0x1005 : 20/10/11 : ipbus address config testing in mini-t --- build 0x1006 : 26/10/11 : trying with jumbo frames --- build 0x1007 : 27/10/11 : new slaves / address map + rhino frames --- build 0x1008 : 31/10/11 : rhino frames + multibus demo - - diff --git a/EUDETdummy/hdl/led_stretcher.vhd b/EUDETdummy/hdl/led_stretcher.vhd deleted file mode 100644 index c8af6c6..0000000 --- a/EUDETdummy/hdl/led_stretcher.vhd +++ /dev/null @@ -1,74 +0,0 @@ --- stretcher --- --- Stretches a single clock pulse so it's visible on an LED --- --- Dave Newbold, January 2013 --- --- $Id$ - -library ieee; -use ieee.std_logic_1164.all; -use ieee.numeric_std.all; - -entity led_stretcher is - generic( - WIDTH: positive := 1 - ); - port( - clk: in std_logic; -- Assumed to be 125MHz ipbus clock - d: in std_logic_vector(WIDTH - 1 downto 0); -- Input (edge detected) - q: out std_logic_vector(WIDTH - 1 downto 0) -- LED output, ~250ms pulse - ); - -end led_stretcher; - -architecture rtl of led_stretcher is - - signal d17, d17_d: std_logic; - -begin - - clkdiv: entity work.ipbus_clock_div - port map( - clk => clk, - d17 => d17 - ); - - process(clk) - begin - if rising_edge(clk) then - d17_d <= d17; - end if; - end process; - - lgen: for i in WIDTH - 1 downto 0 generate - - signal s, sd, e, e_d, sl: std_logic; - signal scnt: unsigned(6 downto 0); - - begin - - process(clk) - begin - if rising_edge(clk) then - s <= d(i); -- Possible clock domain crossing from slower clock (sync not important) - sd <= s; - e <= (e or (s and not sd)) and not e_d; - if d17 = '1' and d17_d = '0' then - e_d <= e; - if e = '1' then - scnt <= "0000001"; - elsif sl = '0' then - scnt <= scnt + 1; - end if; - end if; - end if; - end process; - - sl <= '1' when scnt = "0000000" else '0'; - - q(i) <= not sl; - - end generate; - -end rtl; diff --git a/EUDETdummy/hdl/logic_clocks_rtl.vhd b/EUDETdummy/hdl/logic_clocks_rtl.vhd deleted file mode 100644 index 631007a..0000000 --- a/EUDETdummy/hdl/logic_clocks_rtl.vhd +++ /dev/null @@ -1,344 +0,0 @@ ---============================================================================= ---! @file logic_clocks_rtl.vhd ---============================================================================= --- -------------------------------------------------------------------------------- --- -- --- University of Bristol, High Energy Physics Group. --- -- -------------------------------------------------------------------------------- -- --- VHDL Architecture fmc_mTLU_lib.logic_clocks.rtl --- --------------------------------------------------------------------------------- --- --- Created using using Mentor Graphics HDL Designer(TM) 2010.3 (Build 21) --- --- Based on output of Xilinx Coregen and Alvro Dosil TLU code. ------------------------------------------------------------------------------- --- "Output Output Phase Duty Pk-to-Pk Phase" --- "Clock Freq (MHz) (degrees) Cycle (%) Jitter (ps) Error (ps)" ------------------------------------------------------------------------------- --- CLK_OUT1___640.000______0.000______50.0______175.916____213.982 --- CLK_OUT2___160.000______0.000______50.0______223.480____213.982 --- CLK_OUT3____40.000______0.000______50.0______306.416____213.982 --- ------------------------------------------------------------------------------- --- "Input Clock Freq (MHz) Input Jitter (UI)" ------------------------------------------------------------------------------- --- __primary__________40.000____________0.010 - -LIBRARY ieee; -USE ieee.std_logic_1164.all; -USE ieee.numeric_std.all; - -USE work.ipbus.all; - -library unisim; -use unisim.vcomponents.all; - ---! @brief Generates 160MHz , 640MHz clocks from an incoming 40MHz clock. ---! Can switch between clock generated from on-board Xtal ( clk_logic_xtal ) and external clock. ---! Can also output clock to external clock pins. ---! ---! @author David Cussans , David.Cussans@bristol.ac.uk --- ---! @date 14:20:26 11/14/12 --- ---! @version v0.1 --- ---! @details ---! \br IPBus Address map: ---! \br (decode 2 bits) ---! \li 0x00000000 - control/status register: ---! \li bit-0 - PLL locked ( 1 = locked ) ---! \li bit-1 - buff-PLL locked ( 1 = locked ) ---! \li bit-2 - use xtal for logic ( 1 = xtal , 0= external) ---! \li bit-3 - clock connector is an input ( 1=input , 0 = output) ---! \li 0x00000001 - reset logic. Write to bit-zero to send reset. ---! ---! -ENTITY logic_clocks IS - GENERIC( - g_USE_EXTERNAL_CLK : integer := 1 - ); - PORT( - ipbus_clk_i : IN std_logic; - ipbus_i : IN ipb_wbus; - ipbus_reset_i : IN std_logic; - Reset_i : IN std_logic; - clk_logic_xtal_i : IN std_logic; --! 40MHz clock derived from onboard xtal - clk_8x_logic_o : OUT std_logic; --! 640MHz clock - clk_4x_logic_o : OUT std_logic; --! 160MHz clock - ipbus_o : OUT ipb_rbus; - strobe_8x_logic_o : OUT std_logic; --! strobes once every 4 cycles of clk_16x - strobe_4x_logic_o : OUT std_logic; --! one pulse every 4 cycles of clk_4x - DUT_clk_o : OUT std_logic; --! 40MHz to DUTs - logic_clocks_locked_o : OUT std_logic; --! Goes high if clocks locked. - logic_reset_o : OUT std_logic --! Goes high to reset counters etc. Sync with clk_4x_logic - ); - --- Declarations -END ENTITY logic_clocks ; - --- -ARCHITECTURE rtl OF logic_clocks IS - signal s_clk40 , s_clk40_internal : std_logic; - signal s_clk160 ,s_clk160_internal : std_logic; - signal ryanclock : std_logic; - signal s_clk320 , s_clk320_internal : std_logic; - signal s_clk40_out : std_logic; -- Clock generated by DDR register to feed out of chip. - signal s_clk_is_xtal, s_clk_is_ext_buf : std_logic := '0'; -- default to - -- input from ext - -- signal s_logic_clk_rst : std_logic := '0'; - signal s_locked_pll, s_locked_bufpll : std_logic; - - signal s_clk : std_logic; - signal s_DUT_Clk, s_DUT_Clk_o, s_DUT_ClkG : std_logic; - signal s_extclk, s_extclkG : std_logic; - -- signal s_clk_d1 , s_strobe_4x_p1 , s_strobe_4x_logic : std_logic; - signal s_clkfbout_buf , s_clkfbout : std_logic; - - signal s_strobe_generator : std_logic_vector(3 downto 0) := "1000"; -- ! Store state of ring buffer to generate strobe - signal s_logic_clk_generator : std_logic_vector(3 downto 0) := "1100"; --! Stores state of 40MHz "clock" - --signal s_strobe_generator : std_logic_vector(15 downto 0) := "1111000000000000"; -- ! Store state of ring buffer to generate strobe - --signal s_logic_clk_generator : std_logic_vector(15 downto 0) := "1111111100000000"; --! Stores state of 40MHz "clock" - signal s_strobe160 :std_logic_vector(15 downto 0) := "1000000000000000"; -- 160 strobe ring - signal s_strobe_fb : std_logic := '0'; - - signal s_logic_reset_ipb, s_logic_reset_ipb_d1 : std_logic := '0'; - -- ! Reset signal in IPBus clock domain - signal s_logic_reset , s_logic_reset_d1 , s_logic_reset_d2 , s_logic_reset_d3 , s_logic_reset_d4 : std_logic := '0'; - -- ! reset signal clocked onto logic-clock domain. - attribute SHREG_EXTRACT: string; - attribute SHREG_EXTRACT of s_logic_reset_d1: signal is "no"; -- Synchroniser not to be optimised into shre - attribute SHREG_EXTRACT of s_logic_reset_d2: signal is "no"; -- Synchroniser not to be optimised into shreg - attribute SHREG_EXTRACT of s_logic_reset_d3: signal is "no"; -- Synchroniser not to be optimised into shreg - attribute SHREG_EXTRACT of s_logic_reset_d4: signal is "no"; -- Synchroniser not to be optimised into shreg - signal s_ipbus_ack : std_logic := '0'; - signal s_reset_pll : std_logic := '0'; - - - -- ! Global Reset signal - signal s_extclk_internal : std_logic := '0'; - signal s_clock_status_ipb : std_logic_vector( ipbus_o.ipb_rdata'range ); --! Hold status of clocks - -BEGIN - ----------------------------------------------------------------------------- - -- IPBus write - ----------------------------------------------------------------------------- - ipbus_write: process (ipbus_clk_i) - begin -- process ipb_clk_i - if rising_edge(ipbus_clk_i) then - s_logic_reset_ipb <= '0'; - if (ipbus_i.ipb_strobe = '1' and ipbus_i.ipb_write = '1') then - case ipbus_i.ipb_addr(1 downto 0) is - when "00" => - s_clk_is_xtal <= ipbus_i.ipb_wdata(2) ; -- select clock source - - when "01" => - s_logic_reset_ipb <= ipbus_i.ipb_wdata(0) ; -- write to reset - when others => null; - end case; - end if; - - -- register reset signal to aid timing. - s_logic_reset_ipb_d1 <= s_logic_reset_ipb; - s_ipbus_ack <= ipbus_i.ipb_strobe and not s_ipbus_ack; - -- register the clock status signals onto IPBus domain. - --s_clock_status_ipb <= x"0000000" & '0' & s_clk_is_xtal & s_locked_bufpll & s_locked_pll; - s_clock_status_ipb <= x"0000000" & '0' & '0' & '0' & s_locked_pll; -- The only useful bit is not the PLL lock status. - end if; - end process ipbus_write; - - ipbus_o.ipb_ack <= s_ipbus_ack; - ipbus_o.ipb_err <= '0'; - - ----------------------------------------------------------------------------- - -- IPBUS read - ----------------------------------------------------------------------------- - with ipbus_i.ipb_addr(1 downto 0) select - ipbus_o.ipb_rdata <= - s_clock_status_ipb when "00", - (others => '1') when others; - - - ----------------------------------------------------------------------------- - -- Generate reset signal on logic-clock domain - -- This relies on the IPBus clock being much slower than the 4x logic clock. - ----------------------------------------------------------------------------- - p_reset: process (s_clk160_internal) - begin -- process p_reset - if rising_edge(s_clk160_internal) then - s_logic_reset_d1 <= s_logic_reset_ipb_d1; - s_logic_reset_d2 <= s_logic_reset_d1; - s_logic_reset_d3 <= s_logic_reset_d2; - s_logic_reset_d4 <= s_logic_reset_d2 and ( not s_logic_reset_d3); - s_logic_reset <= s_logic_reset_d4; - end if; - end process p_reset; - - logic_reset_o <= s_logic_reset; - logic_clocks_locked_o <= s_locked_bufpll and s_locked_pll; - - - -- Use Generate, since can't figure out how BUFGMUX works - -- gen_extclk_input: if ( g_USE_EXTERNAL_CLK = 1) generate - -- s_DUT_Clk <= s_extclkG; -- Hard wire for now. - -- end generate gen_extclk_input; - -- gen_intclk_input: if ( g_USE_EXTERNAL_CLK = 0) generate - s_DUT_Clk <= clk_logic_xtal_i; - -- end generate gen_intclk_input; - - - - --! Clocking primitive - ------------------------------------- - --! Instantiation of the PLL primitive - pll_base_inst : PLL_BASE - generic map - (BANDWIDTH => "OPTIMIZED", - --CLK_FEEDBACK => "CLKOUT0", --"CLKFBOUT", - CLK_FEEDBACK => "CLKFBOUT", - COMPENSATION => "SYSTEM_SYNCHRONOUS", - DIVCLK_DIVIDE => 1, - CLKFBOUT_MULT => 16, - CLKFBOUT_PHASE => 0.000, - CLKOUT0_DIVIDE => 2, -- 1-->2 move from 640 to 320 - CLKOUT0_PHASE => 0.000, - CLKOUT0_DUTY_CYCLE => 0.500, - CLKOUT1_DIVIDE => 4, -- 4-->8 move from 160 to 80 - CLKOUT1_PHASE => 0.000, - CLKOUT1_DUTY_CYCLE => 0.500, - CLKOUT2_DIVIDE => 16, -- 16--> 32 move from 40 to 20 - CLKOUT2_PHASE => 0.000, - CLKOUT2_DUTY_CYCLE => 0.500, - CLKIN_PERIOD => 25.000, - REF_JITTER => 0.010) - port map( - -- Output clocks - CLKFBOUT => s_clkfbout, - CLKOUT0 => s_clk320, - CLKOUT1 => s_clk160, - CLKOUT2 => s_clk40, - CLKOUT3 => open, - CLKOUT4 => open, - CLKOUT5 => open, - -- Status and control signals - LOCKED => s_locked_pll, - -- RST => s_logic_clk_rst, - RST => s_reset_pll, - -- Input clock control - -- CLKFBIN => s_clkfbout_buf, - CLKFBIN => s_clkfbout, - CLKIN => s_DUT_clk); - -- CLKIN => clk_logic_xtal_i); - - s_reset_pll <= Reset_i or s_logic_reset; - ------------------------------------------------ ---BUFPLL not supported by 7 Series. We need to replace it with BUFIO+BUFR - -- Buffer the 16x clock and generate the ISERDES strobe signal --- BUFPLL_inst : BUFPLL --- generic map ( --- DIVIDE => 4) --- port map ( --- IOCLK => s_clk640_internal, -- 1-bit output: Output I/O clock --- LOCK => s_locked_bufpll, -- 1-bit output: Synchronized LOCK output --- SERDESSTROBE => strobe_16x_logic_O, -- 1-bit output: Output SERDES strobe (connect to ISERDES2/OSERDES2) --- GCLK => s_clk160_internal, -- 1-bit input: BUFG clock input --- LOCKED => s_locked_pll, -- 1-bit input: LOCKED input from PLL --- PLLIN => s_clk640 -- 1-bit input: Clock input from PLL --- ); - - BUFG_inst: BUFG - port map ( - I => s_clk320, - O => s_clk320_internal - ); - --- BUFR_inst: BUFR --- generic map ( --- BUFR_DIVIDE => "4" --- ) --- port map ( --- I => s_clk160_internal, --- CE => '1', --- CLR => '0', --- O => ryanclock --- ); - --- BUFG_inst2: BUFG --- port map ( --- I => ryanclock, --- O => strobe_16x_logic_O -- Not sure this is actually a strobe... Check --- ); ------------------------------------------------ - - clk_8x_logic_o <= s_clk320_internal; - DUT_clk_o <= s_DUT_clk; - - - - -- Generate a strobe signal every 4 clocks. - -- Can't use a clock signal as a combinatorial signal. Hence the baroque - -- method of generating a strobe. Add a mechanism to restart if the '1' gets - -- lost .... - - ------------------ - generate_4x_strobe: process (s_clk160_internal)-- , s_clk40_out) - begin -- process generate_4x_strobe - if rising_edge(s_clk160_internal) then - if s_logic_reset = '1' then - s_strobe_generator <= "1000"; - s_logic_clk_generator <= "1100"; - --s_strobe160 <= "1000000000000000"; - elsif (s_locked_pll ='1') then - s_strobe_generator <= s_strobe_generator(2 downto 0) & s_strobe_generator(3); -- <- bit shift left - s_logic_clk_generator <= s_logic_clk_generator(2 downto 0) & s_logic_clk_generator(3); -- <- bit shift left - --s_strobe160 <= s_strobe160(14 downto 0) & s_strobe160(15); - end if; - end if; - end process generate_4x_strobe; - strobe_4x_logic_o <= s_strobe_generator(3); -- Every 4 clocks this gets to 1 for one pulse - s_clk40_out <= s_logic_clk_generator(3); -- Every 4 clocks this gets to 1 for two pulses (so half F of the original clock? But then it is a clk80 not clk40.) Not used it seems. - --------------- - - generate_8x_strobe: process (s_clk320_internal) - begin - if rising_edge(s_clk320_internal) then - if s_logic_reset = '1' then - s_strobe160 <= "1000000000000000"; - --s_strobe_generator <= "1111000000000000";-- - --s_logic_clk_generator <= "1111111100000000";-- - elsif (s_locked_pll ='1') then - s_strobe160 <= s_strobe160(14 downto 0) & s_strobe160(15); - --s_strobe_generator <= s_strobe_generator(14 downto 0) & s_strobe_generator(15); -- - --s_logic_clk_generator <= s_logic_clk_generator(14 downto 0) & s_logic_clk_generator(15); -- <- bit shift left - end if; - end if; - end process generate_8x_strobe; - strobe_8x_logic_O <= s_strobe160(15); - --strobe_4x_logic_o <= s_strobe_generator(15); -- - --s_clk40_out <= s_logic_clk_generator(15); -- - - - -- buffer 160MHz (4x) clock - -------------------------------------- - clk160_o_buf : BUFG - port map( - O => s_clk160_internal, - I => s_clk160); - - clk_4x_logic_o <= s_clk160_internal; - --- -- buffer 40MHz (1x) clock --- -------------------------------------- --- clk40_o_buf : BUFG --- port map( --- O => s_clk40_internal, --- I => s_clk40); - --- clk_logic_o <= s_clk40_out; - -END ARCHITECTURE rtl; - diff --git a/EUDETdummy/hdl/top_EUDET_dummy.vhd b/EUDETdummy/hdl/top_EUDET_dummy.vhd deleted file mode 100644 index 66b0ab9..0000000 --- a/EUDETdummy/hdl/top_EUDET_dummy.vhd +++ /dev/null @@ -1,646 +0,0 @@ --- Top-level design for TLU v1E --- --- This version is for Enclustra AX3 module, using the RGMII PHY on the PM3 baseboard --- --- You must edit this file to set the IP and MAC addresses --- --- Dave Newbold, 4/10/16-- - -library IEEE; -library UNISIM; -use IEEE.STD_LOGIC_1164.ALL; -use ieee.numeric_std.all; -use work.fmcTLU.all; -use work.ipbus_decode_tlu.all; -use work.ipbus.all; -use work.ipbus_reg_types.all; -use UNISIM.vcomponents.all; - ---Library UNISIM; ---use UNISIM.vcomponents.all; - -use work.ipbus.ALL; - -entity top_EUDET_dummy is - generic( - constant FW_VERSION : unsigned(31 downto 0):= X"ffff0006"; -- Firmware revision. Remember to change this as needed. - g_NUM_DUTS : positive := 4; -- <- was 3 - g_NUM_TRIG_INPUTS :positive := 6;-- <- was 4 - g_NUM_EDGE_INPUTS :positive := 6;-- <-- was 4 - g_NUM_EXT_SLAVES :positive :=8;-- <-- ?? - g_EVENT_DATA_WIDTH :positive := 32;-- <-- ?? - g_IPBUS_WIDTH :positive := 32;-- <-- was 32 - g_SPILL_COUNTER_WIDTH :positive := 12;-- <-- ?? - g_BUILD_SIMULATED_MAC :integer := 0 - ); - port( - --Clock - --sysclk: in std_logic; --50 MHz clock input from FPGA - clk_enclustra: in std_logic; --Enclustra onboard oscillator 40 MHz. Used for the IPBus block - sysclk_50_o_p : out std_logic; --50 MHz clock output to FMC pins - sysclk_50_o_n : out std_logic; --50 MHz clock output to FMC pins - sysclk_40_i_p: in std_logic; - sysclk_40_i_n: in std_logic; - --Misc - leds: out std_logic_vector(3 downto 0); -- status LEDs - dip_sw: in std_logic_vector(3 downto 0); -- switches - gpio: out std_logic; -- gpio pin on J1 (eventually make it inout) - --RGMII interface signals - rgmii_txd: out std_logic_vector(3 downto 0); - rgmii_tx_ctl: out std_logic; - rgmii_txc: out std_logic; - rgmii_rxd: in std_logic_vector(3 downto 0); - rgmii_rx_ctl: in std_logic; - rgmii_rxc: in std_logic; - phy_rstn: out std_logic; - --I2C bus - i2c_scl_b: inout std_logic; - i2c_sda_b: inout std_logic; - i2c_reset: out std_logic; --Reset line for the expander serial lines - --Clock generator controls - clk_gen_rst: out std_logic; --Reset line for the Si5345 clock generator (active low) - --clk_gen_lol: in std_logic; --LOL signal. Do not use for now as it is connected to CONT_FROM_FPGA<0> - --TLU signals for DUTs - busy_i: in std_logic_vector(g_NUM_DUTS-1 downto 0);-- Busy lines from DUTs (active high) (busy to FPGA) - busy_o: out std_logic_vector(g_NUM_DUTS-1 downto 0);-- Busy lines to DUTs (active high) (busy from FPGA) - cont_i: in std_logic_vector(g_NUM_DUTS-1 downto 0); --Control lines from DUTs - cont_o: out std_logic_vector(g_NUM_DUTS-1 downto 0); --Control lines to DUTs - spare_i: in std_logic_vector(g_NUM_DUTS-1 downto 0); --Spare lines from DUTs - spare_o: out std_logic_vector(g_NUM_DUTS-1 downto 0); --Spare lines to DUTs - triggers_i: in std_logic_vector(g_NUM_DUTS-1 downto 0); --Trigger lines from DUTs - triggers_o: out std_logic_vector(g_NUM_DUTS-1 downto 0); --Trigger lines to DUTs - dut_clk_i: in std_logic_vector(g_NUM_DUTS-1 downto 0); --Clock from DUTs - dut_clk_o: out std_logic_vector(g_NUM_DUTS-1 downto 0) --Clock to DUTs - - - --reset_or_clk_n_o: out std_logic_vector(g_NUM_DUTS-1 downto 0); --T0 synchronization signal - --reset_or_clk_p_o: out std_logic_vector(g_NUM_DUTS-1 downto 0); - --shutter_to_dut_n_o: out std_logic_vector(g_NUM_DUTS-1 downto 0); --Shutter output - --shutter_to_dut_p_o: out std_logic_vector(g_NUM_DUTS-1 downto 0); - - ); - -end top_EUDET_dummy; - -architecture rtl of top_EUDET_dummy is - - signal clk_ipb, rst_ipb, nuke, soft_rst, phy_rst_e, clk_200, sysclk_40, clk_encl_buf, userled: std_logic; - signal mac_addr: std_logic_vector(47 downto 0); - signal ip_addr: std_logic_vector(31 downto 0); - signal ipb_out: ipb_wbus; - signal ipb_in: ipb_rbus; - signal inf_leds: std_logic_vector(1 downto 0); - signal s_i2c_scl_enb : std_logic; - signal s_i2c_sda_enb : std_logic; - signal encl_clock50: std_logic; -- This is a 50 MHz clock generated from the Enclustra onboard oscillator (rather than the clock input) - - --signal s_i2c_sda_i : std_logic; - --signal s_i2c_scl_i : std_logic; - ------------------------------------------ - -- Internal signal declarations - SIGNAL T0_o : std_logic; - SIGNAL buffer_full_o : std_logic; --! Goes high when event buffer almost full - SIGNAL clk_8x_logic : std_logic; -- 320MHz clock - SIGNAL clk_4x_logic : std_logic; --! normally 160MHz - SIGNAL clk_logic_xtal : std_logic; -- ! 40MHz clock from onboard xtal - SIGNAL data_strobe : std_logic; -- goes high when data ready to load into event buffer - SIGNAL dout : std_logic; - SIGNAL dout1 : std_logic; - SIGNAL event_data : std_logic_vector(g_EVENT_DATA_WIDTH-1 DOWNTO 0); - signal ipbww: ipb_wbus_array(N_SLAVES - 1 downto 0); - signal ipbrr: ipb_rbus_array(N_SLAVES - 1 downto 0); - SIGNAL logic_clocks_reset : std_logic; -- Goes high to reset counters etc. Sync with clk_4x_logic - SIGNAL logic_reset : std_logic; - SIGNAL overall_trigger : std_logic; --! goes high to load trigger data - SIGNAL overall_veto : std_logic; --! Halts triggers when high - SIGNAL postVetoTrigger_times : t_triggerTimeArray(g_NUM_TRIG_INPUTS-1 DOWNTO 0); -- ! trigger arrival time ( w.r.t. logic_strobe) - SIGNAL postVetotrigger : std_logic_vector(g_NUM_TRIG_INPUTS-1 DOWNTO 0); -- ! High when trigger from input connector active and enabled - --trigger_count_i : IN std_logic_vector (g_IPBUS_WIDTH-1 DOWNTO 0); --! Not used yet. - SIGNAL rst_fifo_o : std_logic; --! rst signal to first level fifos - SIGNAL s_edge_fall_times : t_triggerTimeArray(g_NUM_EDGE_INPUTS-1 DOWNTO 0); -- Array of edge times ( w.r.t. logic_strobe) - SIGNAL s_edge_falling : std_logic_vector(g_NUM_EDGE_INPUTS-1 DOWNTO 0); -- ! High when falling edge - SIGNAL s_edge_rise_times : t_triggerTimeArray(g_NUM_EDGE_INPUTS-1 DOWNTO 0); -- Array of edge times ( w.r.t. logic_strobe) - SIGNAL s_edge_rising : std_logic_vector(g_NUM_EDGE_INPUTS-1 DOWNTO 0); -- ! High when rising edge - --SIGNAL s_i2c_scl_enb : std_logic; - --SIGNAL s_i2c_sda_enb : std_logic; - SIGNAL s_shutter : std_logic; --! shutter signal from TimePix, retimed onto local clock - SIGNAL s_triggerLogic_reset : std_logic; - SIGNAL shutter_cnt_i : std_logic_vector(g_SPILL_COUNTER_WIDTH-1 DOWNTO 0); - SIGNAL shutter_i : std_logic; - SIGNAL spill_cnt_i : std_logic_vector(g_SPILL_COUNTER_WIDTH-1 DOWNTO 0); - SIGNAL spill_i : std_logic; - SIGNAL strobe_8x_logic : std_logic; --! Pulses one cycle every 4 of 16x clock. - SIGNAL strobe_4x_logic : std_logic; -- one pulse every 4 cycles of clk_4x - SIGNAL trigger_count : std_logic_vector(g_IPBUS_WIDTH-1 DOWNTO 0); - type myTrigArray is array (g_NUM_DUTS-1 downto 0) of std_logic_vector(g_IPBUS_WIDTH-1 DOWNTO 0); - signal TrigNArray : myTrigArray; - SIGNAL TriggerNumber : std_logic_vector(g_EVENT_DATA_WIDTH-1 DOWNTO 0); - SIGNAL TriggerNumberStrobe : std_logic_vector(g_NUM_DUTS-1 downto 0); - SIGNAL stretchFlags : std_logic_vector(g_NUM_DUTS-1 downto 0) := "0011"; -- ! define which dummyDUT have their busy line stretched - - SIGNAL trigger_times : t_triggerTimeArray(g_NUM_TRIG_INPUTS-1 DOWNTO 0); -- ! trigger arrival time ( w.r.t. logic_strobe) - SIGNAL triggers : std_logic_vector(g_NUM_TRIG_INPUTS-1 DOWNTO 0); - SIGNAL veto_o : std_logic; --! goes high when one or more DUT are busy - signal ctrl, stat: ipb_reg_v(0 downto 0); - --My signals - --SIGNAL busy_toggle_o : std_logic_vector(g_NUM_DUTS-1 downto 0); - ----------------------------------------------- ----------------------------------------------- - component DUTInterfaces - generic( - g_NUM_DUTS : positive := 4;-- <- was 3 - g_IPBUS_WIDTH : positive := 32 - ); - port ( - clk_4x_logic_i : IN std_logic ; - strobe_4x_logic_i : IN std_logic ; --! goes high every 4th clock cycle - trigger_counter_i : IN std_logic_vector (g_EVENT_DATA_WIDTH-1 DOWNTO 0); --! Number of trigger events since last reset - trigger_i : IN std_logic ; --! goes high when trigger logic issues a trigger - reset_or_clk_to_dut_i : IN std_logic ; --! Synchronization signal. Passed TO DUT pins - shutter_to_dut_i : IN std_logic ; --! Goes high TO indicate data-taking active. DUTs report busy unless ignoreShutterVeto IPBus flag is set high - -- IPBus signals. - ipbus_clk_i : IN std_logic ; - ipbus_i : IN ipb_wbus ; --! Signals from IPBus core TO slave - ipbus_reset_i : IN std_logic ; - ipbus_o : OUT ipb_rbus ; --! signals from slave TO IPBus core - -- Signals to/from DUT - busy_from_dut : IN std_logic_vector (g_NUM_DUTS-1 DOWNTO 0); --! BUSY input from DUTs - busy_to_dut : OUT std_logic_vector (g_NUM_DUTS-1 DOWNTO 0); --! BUSY input to DUTs (single ended) - clk_from_dut : IN std_logic_vector(g_NUM_DUTS-1 DOWNTO 0); --new signal for TLU, replace differential I/O - clk_to_dut : OUT std_logic_vector(g_NUM_DUTS-1 DOWNTO 0); --new signal for TLU, replace differential I/O - reset_to_dut: OUT std_logic_vector (g_NUM_DUTS-1 DOWNTO 0); --! Replaces reset_or_clk_to_dut - trigger_to_dut : OUT std_logic_vector (g_NUM_DUTS-1 DOWNTO 0); --! Trigger output - shutter_to_dut : OUT std_logic_vector (g_NUM_DUTS-1 DOWNTO 0); --! Shutter output - veto_o : OUT std_logic - ); - end component DUTInterfaces; ----------------------------------------------- ----------------------------------------------- - component Dummy_DUT - Port ( - CLK : in STD_LOGIC; --! this is the USB clock. - RST : in STD_LOGIC; --! Synchronous clock - Trigger : in STD_LOGIC; --! Trigger from TLU - stretchBusy: in STD_LOGIC; --! flag: if 1 extend the BUSY signal - Busy : out STD_LOGIC; --! Busy to TLU - DUTClk : out STD_LOGIC; --! clock from DUT - TriggerNumber : out STD_LOGIC_VECTOR(31 downto 0); - TriggerNumberStrobe : out STD_LOGIC; - FSM_Error : out STD_LOGIC - ); -end component; ----------------------------------------------- ----------------------------------------------- - - COMPONENT eventBuffer - GENERIC ( - g_EVENT_DATA_WIDTH : positive := 32; - g_IPBUS_WIDTH : positive := 32; - g_READ_COUNTER_WIDTH : positive := 16 - ); - PORT ( - clk_4x_logic_i : IN std_logic ; - data_strobe_i : IN std_logic ; -- Indicates data TO transfer - event_data_i : IN std_logic_vector (g_EVENT_DATA_WIDTH-1 DOWNTO 0); - ipbus_clk_i : IN std_logic ; - ipbus_i : IN ipb_wbus ; - ipbus_reset_i : IN std_logic ; - strobe_4x_logic_i : IN std_logic ; - --trigger_count_i : IN std_logic_vector (g_IPBUS_WIDTH-1 DOWNTO 0); --! Not used yet. - rst_fifo_o : OUT std_logic ; --! rst signal TO first level fifos - buffer_full_o : OUT std_logic ; --! Goes high when event buffer almost full - ipbus_o : OUT ipb_rbus ; - logic_reset_i : IN std_logic -- reset buffers when high. Synch withclk_4x_logic - ); - END COMPONENT eventBuffer; ----------------------------------------------- ----------------------------------------------- --- COMPONENT eventFormatter --- GENERIC ( --- g_EVENT_DATA_WIDTH : positive := 64; --- g_IPBUS_WIDTH : positive := 32; --- g_COUNTER_TRIG_WIDTH : positive := 32; --- g_COUNTER_WIDTH : positive := 12; --- g_EVTTYPE_WIDTH : positive := 4; --! Width of the event type word --- --g_NUM_INPUT_TYPES : positive := 4; -- Number of different input types (trigger, shutter, edge...) --- g_NUM_EDGE_INPUTS : positive := 4; --! Number of edge inputs --- g_NUM_TRIG_INPUTS : positive := 6 --! Number of trigger inputs (POSSIBLY WRONG!) --- ); --- PORT ( --- clk_4x_logic_i : IN std_logic ; --! Rising edge active --- ipbus_clk_i : IN std_logic ; --- logic_strobe_i : IN std_logic ; --! Pulses high once every 4 cycles of clk_4x_logic --- logic_reset_i : IN std_logic ; --! goes high TO reset counters. Synchronous with clk_4x_logic --- rst_fifo_i : IN std_logic ; --! Goes high TO reset FIFOs --- buffer_full_i : IN std_logic ; --! Goes high when output fifo full --- trigger_i : IN std_logic ; --! goes high TO load trigger data. One cycle of clk_4x_logic --- trigger_times_i : IN t_triggerTimeArray (g_NUM_TRIG_INPUTS-1 DOWNTO 0); --! Array of trigger times ( w.r.t. logic_strobe) --- trigger_inputs_fired_i : IN std_logic_vector (g_NUM_TRIG_INPUTS-1 DOWNTO 0); --! high for each input that "fired" --- trigger_cnt_i : IN std_logic_vector (g_COUNTER_TRIG_WIDTH-1 DOWNTO 0); --! Trigger count --- shutter_i : IN std_logic ; --- shutter_cnt_i : IN std_logic_vector (g_COUNTER_WIDTH-1 DOWNTO 0); --- spill_i : IN std_logic ; --- spill_cnt_i : IN std_logic_vector (g_COUNTER_WIDTH-1 DOWNTO 0); --- edge_rise_i : IN std_logic_vector (g_NUM_EDGE_INPUTS-1 DOWNTO 0); --! High when rising edge --- edge_fall_i : IN std_logic_vector (g_NUM_EDGE_INPUTS-1 DOWNTO 0); --! High when falling edge --- edge_rise_time_i : IN t_triggerTimeArray (g_NUM_EDGE_INPUTS-1 DOWNTO 0); --! Array of edge times ( w.r.t. logic_strobe) --- edge_fall_time_i : IN t_triggerTimeArray (g_NUM_EDGE_INPUTS-1 DOWNTO 0); --! Array of edge times ( w.r.t. logic_strobe) --- ipbus_i : IN ipb_wbus ; --- ipbus_o : OUT ipb_rbus ; --- data_strobe_o : OUT std_logic ; --! goes high when data ready TO load into event buffer --- event_data_o : OUT std_logic_vector (g_EVENT_DATA_WIDTH-1 DOWNTO 0); --- reset_timestamp_i : IN std_logic ; --! Taking high causes timestamp TO be reset. Combined with internal timestmap reset and written to reset_timestamp_o --- reset_timestamp_o : OUT std_logic --! Goes high for one clock cycle of clk_4x_logic when timestamp reset --- ); --- END COMPONENT eventFormatter; ----------------------------------------------- ----------------------------------------------- - COMPONENT logic_clocks - GENERIC ( - g_USE_EXTERNAL_CLK : integer := 1 - ); - PORT ( - ipbus_clk_i : IN std_logic ; - ipbus_i : IN ipb_wbus ; - ipbus_reset_i : IN std_logic ; - Reset_i : IN std_logic ; - clk_logic_xtal_i : IN std_logic ; -- ! 40MHz clock from onboard xtal - clk_8x_logic_o : OUT std_logic ; -- 640MHz clock - clk_4x_logic_o : OUT std_logic ; -- 160MHz clock - ipbus_o : OUT ipb_rbus ; - strobe_8x_logic_o : OUT std_logic ; -- strobes once every 4 cycles of clk_16x - strobe_4x_logic_o : OUT std_logic ; -- one pulse every 4 cycles of clk_4x - --extclk_p_b : INOUT std_logic ; -- either external clock in, or a clock being driven out - --extclk_n_b : INOUT std_logic ; - DUT_clk_o : OUT std_logic ; - logic_clocks_locked_o : OUT std_logic ; - logic_reset_o : OUT std_logic -- Goes high TO reset counters etc. Sync with clk_4x_logic - ); - END COMPONENT logic_clocks; ----------------------------------------------- - - - COMPONENT i2c_master - PORT ( - i2c_scl_i : IN std_logic; - i2c_sda_i : IN std_logic; - ipbus_clk_i : IN std_logic; - ipbus_i : IN ipb_wbus; - ipbus_reset_i : IN std_logic; - i2c_scl_enb_o : OUT std_logic; - i2c_sda_enb_o : OUT std_logic; - ipbus_o : OUT ipb_rbus - ); - END COMPONENT i2c_master; - --- component clk_wiz_0 --- port --- (-- Clock in ports --- clk_in1 : in std_logic; --- -- Clock out ports --- clk_out1 : out std_logic; --- -- Status and control signals --- reset : in std_logic; --- locked : out std_logic --- ); --- end component; - - - -- Optional embedded configurations - -- pragma synthesis_off - FOR ALL : DUTInterfaces USE ENTITY work.DUTInterfaces; - --FOR ALL : IPBusInterface USE ENTITY work.IPBusInterface; - FOR ALL : T0_Shutter_Iface USE ENTITY work.T0_Shutter_Iface; - FOR ALL : eventBuffer USE ENTITY work.eventBuffer; - FOR ALL : eventFormatter USE ENTITY work.eventFormatter; - FOR ALL : i2c_master USE ENTITY work.i2c_master;--

'0'); - -- ModuleWare code(v1.12) for instance 'I13' of 'gnd' - shutter_i <= '0'; - -- ModuleWare code(v1.12) for instance 'I14' of 'gnd' - shutter_cnt_i <= (OTHERS => '0'); - -- ModuleWare code(v1.12) for instance 'I17' of 'gnd' - dout1 <= '0'; - -- ModuleWare code(v1.12) for instance 'I18' of 'gnd' - dout <= '0'; - -- ModuleWare code(v1.12) for instance 'I19' of 'merge' - --gpio_hdr <= dout1 & dout & s_shutter & T0_o; - -- ModuleWare code(v1.12) for instance 'I8' of 'sor' - overall_veto <= buffer_full_o OR veto_o; - -- ModuleWare code(v1.12) for instance 'I16' of 'sor' - s_triggerLogic_reset <= logic_reset OR T0_o; - - i2c_reset <= '1'; - clk_gen_rst <= '1'; - gpio <= strobe_8x_logic; - sysclk_50_o_p <= '0'; - sysclk_50_o_n <= '0'; - --busy_o <= std_logic_vector(to_unsigned(0, busy_o'length)); - --busy_o <= '000000'; - --sysclk_40_o_p <= sysclk; - ------------------------------------------- - infra: entity work.enclustra_ax3_pm3_infra - port map( - sysclk => clk_encl_buf, - clk_ipb_o => clk_ipb, - rst_ipb_o => rst_ipb, - rst_125_o => phy_rst_e, - clk_200_o => clk_200, - nuke => nuke, - soft_rst => soft_rst, - leds => inf_leds, - rgmii_txd => rgmii_txd, - rgmii_tx_ctl => rgmii_tx_ctl, - rgmii_txc => rgmii_txc, - rgmii_rxd => rgmii_rxd, - rgmii_rx_ctl => rgmii_rx_ctl, - rgmii_rxc => rgmii_rxc, - mac_addr => mac_addr, - ip_addr => ip_addr, - ipb_in => ipb_in, - ipb_out => ipb_out - ); - - --leds <= not ('0' & userled & inf_leds); -- Check this. - phy_rstn <= not phy_rst_e; - --- mac_addr <= X"020ddba1151" & dip_sw; -- Careful here, arbitrary addresses do not always work --- ip_addr <= X"c0a8c81" & dip_sw; -- 192.168.200.16+n - mac_addr <= X"020ddba1151d"; -- Careful here, arbitrary addresses do not always work - ip_addr <= X"c0a8c81d"; -- 192.168.200.29 - ------------------------------------------- - I1 : entity work.ipbus_ctrlreg_v - port map( - clk => clk_ipb, - reset => rst_ipb, - ipbus_in => ipbww(N_SLV_CTRL_REG), - ipbus_out => ipbrr(N_SLV_CTRL_REG), - d => stat, - q => ctrl - ); - stat(0) <= std_logic_vector(FW_VERSION);-- <-Let's use this as firmware revision number - soft_rst <= ctrl(0)(0); - nuke <= ctrl(0)(1); - ------------------------------------------- - I2 : entity work.ipbus_fabric_sel - generic map( - NSLV => N_SLAVES, - SEL_WIDTH => IPBUS_SEL_WIDTH) - port map( - ipb_in => ipb_out, - ipb_out => ipb_in, - sel => ipbus_sel_ipbus_example(ipb_out.ipb_addr), - ipb_to_slaves => ipbww, - ipb_from_slaves => ipbrr - ); - ------------------------------------------- - I3 : i2c_master - PORT MAP ( - i2c_scl_i => i2c_scl_b, - i2c_sda_i => i2c_sda_b, - ipbus_clk_i => clk_ipb, - ipbus_i => ipbww(N_SLV_I2C_0), - ipbus_reset_i => rst_ipb, - i2c_scl_enb_o => s_i2c_scl_enb, - i2c_sda_enb_o => s_i2c_sda_enb, - ipbus_o => ipbrr(N_SLV_I2C_0) - ); - ----------------------------------------------- - I4 : logic_clocks - GENERIC MAP ( - g_USE_EXTERNAL_CLK => 0 - ) - PORT MAP ( - ipbus_clk_i => clk_ipb, - ipbus_i => ipbww(N_SLV_LGCCLK), - ipbus_reset_i => rst_ipb, - Reset_i => logic_clocks_reset, - clk_logic_xtal_i => sysclk_40, -- Not sure this is correct - clk_8x_logic_o => clk_8x_logic, - clk_4x_logic_o => clk_4x_logic, - ipbus_o => ipbrr(N_SLV_LGCCLK), - strobe_8x_logic_o => strobe_8x_logic, - strobe_4x_logic_o => strobe_4x_logic, - DUT_clk_o => open, - logic_clocks_locked_o => leds(3), - logic_reset_o => logic_reset - ); - - - ------------------------------------------- --- I6 : eventFormatter --- GENERIC MAP ( --- g_EVENT_DATA_WIDTH => g_EVENT_DATA_WIDTH, --- g_IPBUS_WIDTH => g_IPBUS_WIDTH, --- g_COUNTER_TRIG_WIDTH => g_IPBUS_WIDTH, --- g_COUNTER_WIDTH => 12, --- g_EVTTYPE_WIDTH => 4, --! Width of the event type word --- --g_NUM_INPUT_TYPES : positive := 4; -- Number of different input types (trigger, shutter, edge...) --- g_NUM_EDGE_INPUTS => g_NUM_EDGE_INPUTS, --! Number of edge inputs --- g_NUM_TRIG_INPUTS => g_NUM_TRIG_INPUTS --! Number of trigger inputs --- ) --- PORT MAP ( --- clk_4x_logic_i => clk_4x_logic, --- ipbus_clk_i => clk_ipb, --- logic_strobe_i => strobe_4x_logic, --- logic_reset_i => logic_reset, --- rst_fifo_i => rst_fifo_o, --- buffer_full_i => buffer_full_o, --- trigger_i => overall_trigger, --- trigger_times_i => postVetoTrigger_times, --- trigger_inputs_fired_i => postVetotrigger, --- trigger_cnt_i => trigger_count, --- shutter_i => shutter_i, --- shutter_cnt_i => shutter_cnt_i, --- spill_i => spill_i, --- spill_cnt_i => spill_cnt_i, --- edge_rise_i => s_edge_rising, --- edge_fall_i => s_edge_falling, --- edge_rise_time_i => s_edge_rise_times, --- edge_fall_time_i => s_edge_fall_times, --- ipbus_i => ipbww(N_SLV_EVFMT), --- ipbus_o => ipbrr(N_SLV_EVFMT), --- data_strobe_o => data_strobe, --- event_data_o => event_data, --- reset_timestamp_i => T0_o, --- reset_timestamp_o => OPEN --- ); - ------------------------------------------- - I7 : eventBuffer - GENERIC MAP ( - g_EVENT_DATA_WIDTH => 32, - g_IPBUS_WIDTH => g_IPBUS_WIDTH, - g_READ_COUNTER_WIDTH => 13 - - ) - PORT MAP ( - clk_4x_logic_i => clk_4x_logic, - --clk_4x_logic_i => sysclk_40, - data_strobe_i => TriggerNumberStrobe(0), - event_data_i => TrigNArray(0), - ipbus_clk_i => clk_ipb, - ipbus_i => ipbww(N_SLV_EVBUF), - ipbus_reset_i => rst_ipb, - strobe_4x_logic_i => strobe_4x_logic, - rst_fifo_o => rst_fifo_o, - buffer_full_o => buffer_full_o, - ipbus_o => ipbrr(N_SLV_EVBUF), - logic_reset_i => logic_reset - ); - - ------------------------------------------- --- I9 : DUTInterfaces --- GENERIC MAP ( --- g_NUM_DUTS => g_NUM_DUTS, --- g_IPBUS_WIDTH => g_IPBUS_WIDTH --- ) --- PORT MAP ( --- clk_4x_logic_i => clk_4x_logic, --- strobe_4x_logic_i => strobe_4x_logic, --- trigger_counter_i => trigger_count, --- trigger_i => overall_trigger, --- reset_or_clk_to_dut_i => T0_o, --- shutter_to_dut_i => s_shutter, --- ipbus_clk_i => clk_ipb, --- ipbus_i => ipbww(N_SLV_DUT), --- ipbus_reset_i => rst_ipb, --- ipbus_o => ipbrr(N_SLV_DUT), --- busy_from_dut => busy_i, --- busy_to_dut => open, --- clk_from_dut => dut_clk_i, --- clk_to_dut => dut_clk_o, --- --reset_or_clk_to_dut_n_o => reset_or_clk_n_o, --- --reset_or_clk_to_dut_p_o => reset_or_clk_p_o, --- reset_to_dut => spare_o, --- trigger_to_dut => triggers_o, --- --shutter_to_dut_n_o => shutter_to_dut_n_o, --- --shutter_to_dut_p_o => shutter_to_dut_p_o, --- shutter_to_dut => cont_o, --- veto_o => veto_o --- ); - - - --------------TEST AREA------------ --- test0: entity work.test_inToOut --- port map( --- clk_in => clk_200, --- busy_in=> busy_i, --- control_in=> cont_i, --- trig_in=> triggers_i, --- clkDut_in=> dut_clk_i, --- spare_in=> spare_i, --- busy_out=> busy_o, --- control_out=> cont_o, --- trig_out=> triggers_o, --- clkDut_out=> dut_clk_o, --- spare_out=> spare_o --- ); - --- dutout0: entity work.DUTs_outputs --- port map( --- clk_in => encl_clock50, --- d_clk_o => dut_clk_o, --- d_trg_o => triggers_o, --- d_busy_o => busy_o, --- d_cont_o => cont_o, --- d_spare_o => spare_o --- ); - --- clk50_o_fromEnclustra : clk_wiz_0 --- port map ( --- -- Clock in ports --- clk_in1 => clk_encl_buf, --sysclk_40, --- -- Clock out ports --- clk_out1 => encl_clock50, --- -- Status and control signals --- reset => '0', --- locked => open --- ); - - ----------------------------------------------- - OutBlocks: - for iDUT in 0 to g_NUM_DUTS-1 generate - begin - - --- generate an instance of the Dummy DUT behind connector 0 - DUT_Instance: Dummy_DUT - Port map ( - --CLK => clk_4x_logic,--160 Mhz clock - CLK => sysclk_40, - RST => cont_i(iDUT),-- coming from HDMI pin - Trigger => triggers_i(iDUT), --coming from HDMI pin - stretchBusy => stretchFlags(iDUT), - Busy => busy_o(iDUT), --going out on HDMI pin - DUTClk => dut_clk_o(iDUT), --going out on HDMI pin - TriggerNumber => TrigNArray(iDUT), - TriggerNumberStrobe => TriggerNumberStrobe(iDUT), - FSM_Error => open - ); - - - - end generate; - - - - ------------------------------------------- - - ------------------------------------------- - IBUFGDS_inst: IBUFGDS - generic map ( - IBUF_LOW_PWR=> false - ) - port map ( - O => sysclk_40, - I => sysclk_40_i_p, - IB => sysclk_40_i_n - ); - ------------------------------------------- - IBUFG_inst: IBUFG - port map ( - O => clk_encl_buf, - I => clk_enclustra--sysclk - ); - - - - - - -end rtl; diff --git a/EUDETdummy/scripts/EUDETdummy.py b/EUDETdummy/scripts/EUDETdummy.py deleted file mode 100644 index ff9d2d9..0000000 --- a/EUDETdummy/scripts/EUDETdummy.py +++ /dev/null @@ -1,588 +0,0 @@ -# -*- coding: utf-8 -*- -import uhal; -import pprint; -#from FmcTluI2c import * -import time -from I2CuHal import I2CCore -from si5345 import si5345 # Library for clock chip -from AD5665R import AD5665R # Library for DAC -from PCA9539PW import PCA9539PW # Library for serial line expander - -class EUDETdummy: - """docstring for TLU""" - def __init__(self, dev_name, man_file): - self.dev_name = dev_name - self.manager= uhal.ConnectionManager(man_file) - self.hw = self.manager.getDevice(self.dev_name) - self.nDUTs= 4 #Number of DUT connectors - self.nChannels= 6 #Number of trigger inputs - self.VrefInt= 2.5 #Internal DAC voltage reference - self.VrefExt= 1.3 #External DAC voltage reference - self.intRefOn= False #Internal reference is OFF by default - - self.fwVersion = self.hw.getNode("version").read() - self.hw.dispatch() - print "EUDUMMY FIRMWARE VERSION= " , hex(self.fwVersion) - - # Instantiate a I2C core to configure components - self.TLU_I2C= I2CCore(self.hw, 10, 5, "i2c_master", None) - #self.TLU_I2C.state() - - enableCore= True #Only need to run this once, after power-up - self.enableCore() - - # Instantiate clock chip - self.zeClock=si5345(self.TLU_I2C, 0x68) - res= self.zeClock.getDeviceVersion() - self.zeClock.checkDesignID() - - # Instantiate DACs and configure them to use reference based on TLU setting - self.zeDAC1=AD5665R(self.TLU_I2C, 0x13) - self.zeDAC2=AD5665R(self.TLU_I2C, 0x1F) - self.zeDAC1.setIntRef(self.intRefOn) - self.zeDAC2.setIntRef(self.intRefOn) - - # Instantiate the serial line expanders and configure them to default values - self.IC6=PCA9539PW(self.TLU_I2C, 0x74) - self.IC6.setInvertReg(0, 0x00)# 0= normal, 1= inverted - self.IC6.setIOReg(0, 0x00)# 0= output, 1= input - self.IC6.setOutputs(0, 0x88)# If output, set to XX - - self.IC6.setInvertReg(1, 0x00)# 0= normal, 1= inverted - self.IC6.setIOReg(1, 0x00)# 0= output, 1= input - self.IC6.setOutputs(1, 0x88)# If output, set to XX - - self.IC7=PCA9539PW(self.TLU_I2C, 0x75) - self.IC7.setInvertReg(0, 0x00)# 0= normal, 1= inverted - self.IC7.setIOReg(0, 0x00)# 0= output, 1= input - self.IC7.setOutputs(0, 0x0F)# If output, set to XX - - self.IC7.setInvertReg(1, 0x00)# 0= normal, 1= inverted - self.IC7.setIOReg(1, 0x00)# 0= output, 1= input - self.IC7.setOutputs(1, 0x50)# If output, set to XX - - -################################################################################################################################## -################################################################################################################################## - def DUTOutputs(self, dutN, enable=False, verbose=False): - ## Set the status of the transceivers for a specific HDMI connector. When enable= False the transceivers are disabled and the - ## connector cannot send signals from FPGA to the outside world. When enable= True then signals from the FPGA will be sent out to the HDMI. - ## NOTE: the other direction is always enabled, i.e. signals from the DUTs are always sent to the FPGA. - ## NOTE: CLK direction must be defined separately using DUTClkSrc - - if (dutN < 0) | (dutN> (self.nDUTs-1)): - print "\tERROR: DUTOutputs. The DUT number must be comprised between 0 and ", self.nDUTs-1 - return -1 - bank= dutN//2 # DUT0 and DUT1 are on bank 0. DUT2 and DUT3 on bank 1 - nibble= dutN%2 # DUT0 and DUT2 are on nibble 0. DUT1 and DUT3 are on nibble 1 - print " Setting DUT:", dutN, "to", enable - if verbose: - print "\tBank", bank, "Nibble", nibble - res= self.IC6.getIOReg(bank) - oldStatus= res[0] - mask= 0xF << 4*nibble - newStatus= oldStatus & (~mask) - if (not enable): # we want to write 0 to activate the outputs so check opposite of "enable" - newStatus |= mask - if verbose: - print "\tOldStatus= ", "{0:#0{1}x}".format(oldStatus,4), "Mask=" , hex(mask), "newStatus=", "{0:#0{1}x}".format(newStatus,4) - self.IC6.setIOReg(bank, newStatus) - return newStatus - - def DUTClkSrc(self, dutN, clkSrc=0, verbose= False): - ## Allows to choose the source of the clock signal sent to the DUTs over HDMI - ## clkSrc= 0: clock disabled - ## clkSrc= 1: clock from Si5345 - ## clkSrc=2: clock from FPGA - if (dutN < 0) | (dutN> (self.nDUTs-1)): - print "\tERROR: DUTClkSrc. The DUT number must be comprised between 0 and ", self.nDUTs-1 - return -1 - if (clkSrc < 0) | (clkSrc> 2): - print "\tERROR: DUTClkSrc. clkSrc can only be 0 (disabled), 1 (Si5345) or 2 (FPGA)" - return -1 - bank=0 - maskLow= 1 << (1* dutN) #CLK FROM FPGA - maskHigh= 1<< (1* dutN +4) #CLK FROM Si5345 - mask= maskLow | maskHigh - res= self.IC7.getIOReg(bank) - oldStatus= res[0] - newStatus= oldStatus & ~mask #set both bits to zero - outStat= "" - if clkSrc==0: - newStatus = newStatus | mask - outStat= "disabled" - elif clkSrc==1: - newStatus = newStatus | maskLow - outStat= "Si5435" - elif clkSrc==2: - newStatus= newStatus | maskHigh - outStat= "FPGA" - print " Setting DUT:", dutN, "clock source to", outStat - if verbose: - print "\tOldStatus= ", "{0:#0{1}x}".format(oldStatus,4), "Mask=" , hex(mask), "newStatus=", "{0:#0{1}x}".format(newStatus,4) - self.IC7.setIOReg(bank, newStatus) - return newStatus - - def enableClkLEMO(self, enable= False, verbose= False): - ## Enable or disable the output clock to the differential LEMO output - bank=1 - mask= 0x10 - res= self.IC7.getIOReg(bank) - oldStatus= res[0] - newStatus= oldStatus & ~mask - outStat= "enabled" - if (not enable): #A 0 activates the output. A 1 disables it. - newStatus= newStatus | mask - outStat= "disabled" - print " Clk LEMO", outStat - if verbose: - print "\tOldStatus= ", "{0:#0{1}x}".format(oldStatus,4), "Mask=" , hex(mask), "newStatus=", "{0:#0{1}x}".format(newStatus,4) - self.IC7.setIOReg(bank, newStatus) - return newStatus - - def enableCore(self): - ## At power up the Enclustra I2C lines are disabled (tristate buffer is off). - ## This function enables the lines. It is only required once. - mystop=True - print " Enabling I2C bus (expect 127):" - myslave= 0x21 - mycmd= [0x01, 0x7F] - nwords= 1 - self.TLU_I2C.write(myslave, mycmd, mystop) - - mystop=False - mycmd= [0x01] - self.TLU_I2C.write(myslave, mycmd, mystop) - res= self.TLU_I2C.read( myslave, nwords) - print "\tPost RegDir: ", res - - def getAllChannelsCounts(self): - chCounts=[] - for ch in range (0,self.nChannels): - chCounts.append(int(self.getChCount(ch))) - return chCounts - - def getChStatus(self): - inputStatus= self.hw.getNode("triggerInputs.SerdesRstR").read() - self.hw.dispatch() - print "\tInput status= " , hex(inputStatus) - return inputStatus - - def getChCount(self, channel): - regString= "triggerInputs.ThrCount"+ str(channel)+"R" - count = self.hw.getNode(regString).read() - self.hw.dispatch() - print "\tCh", channel, "Count:" , count - return count - - def getClockStatus(self): - clockStatus = self.hw.getNode("logic_clocks.LogicClocksCSR").read() - self.hw.dispatch() - print " CLOCK STATUS [expected 1]" - print "\t", hex(clockStatus) - if ( clockStatus == 0 ): - "ERROR: Clocks in EUDUMMY FPGA are not locked." - return clockStatus - - def getDUTmask(self): - DUTMaskR = self.hw.getNode("DUTInterfaces.DutMaskR").read() - self.hw.dispatch() - print "\tDUTMask read back as:" , hex(DUTMaskR) - return DUTMaskR - - def getExternalVeto(self): - extVeto= self.hw.getNode("triggerLogic.ExternalTriggerVetoR").read() - self.hw.dispatch() - print "\tEXTERNAL Veto read back as:", hex(extVeto) - return extVeto - - def getFifoData(self, nWords): - #fifoData= self.hw.getNode("eventBuffer.EventFifoData").read() - fifoData= self.hw.getNode("eventBuffer.EventFifoData").readBlock (nWords); - self.hw.dispatch() - #print "\tFIFO Data:", hex(fifoData) - return fifoData - - def getFifoLevel(self): - FifoFill= self.hw.getNode("eventBuffer.EventFifoFillLevel").read() - self.hw.dispatch() - print "\tFIFO level read back as:", hex(FifoFill) - return FifoFill - - def getFifoCSR(self): - FifoCSR= self.hw.getNode("eventBuffer.EventFifoCSR").read() - self.hw.dispatch() - print "\tFIFO CSR read back as:", hex(FifoCSR) - return FifoCSR - - def getInternalTrg(self): - trigIntervalR = self.hw.getNode("triggerLogic.InternalTriggerIntervalR").read() - self.hw.dispatch() - print "\tTrigger frequency read back as:", trigIntervalR, "Hz" - return trigIntervalR - - def getMode(self): - DUTInterfaceModeR = self.hw.getNode("DUTInterfaces.DUTInterfaceModeR").read() - self.hw.dispatch() - print "\tDUT mode read back as:" , hex(DUTInterfaceModeR) - return DUTInterfaceModeR - - def getModeModifier(self): - DUTInterfaceModeModifierR = self.hw.getNode("DUTInterfaces.DUTInterfaceModeModifierR").read() - self.hw.dispatch() - print "\tDUT mode modifier read back as:" , hex(DUTInterfaceModeModifierR) - return DUTInterfaceModeModifierR - - def getSN(self): - epromcontent=self.readEEPROM(0xfa, 6) - print " EUDET dummy serial number (EEPROM):" - result="\t" - for iaddr in epromcontent: - result+="%02x "%(iaddr) - print result - return epromcontent - - def getPostVetoTrg(self): - triggerN = self.hw.getNode("triggerLogic.PostVetoTriggersR").read() - self.hw.dispatch() - print "\tPOST VETO TRIGGER NUMBER:", (triggerN) - return triggerN - - def getPulseDelay(self): - pulseDelayR = self.hw.getNode("triggerLogic.PulseDelayR").read() - self.hw.dispatch() - print "\tPulse delay read back as:", hex(pulseDelayR) - return pulseDelayR - - def getPulseStretch(self): - pulseStretchR = self.hw.getNode("triggerLogic.PulseStretchR").read() - self.hw.dispatch() - print "\tPulse stretch read back as:", hex(pulseStretchR) - return pulseStretchR - - def getRecordDataStatus(self): - RecordStatus= self.hw.getNode("Event_Formatter.Enable_Record_Data").read() - self.hw.dispatch() - print "\tData recording:", RecordStatus - return RecordStatus - - def getTriggerVetoStatus(self): - trgVetoStatus= self.hw.getNode("triggerLogic.TriggerVetoR").read() - self.hw.dispatch() - print "\tTrigger veto status read back as:", trgVetoStatus - return trgVetoStatus - - def getTrgPattern(self): - triggerPattern_low = self.hw.getNode("triggerLogic.TriggerPattern_lowR").read() - triggerPattern_high = self.hw.getNode("triggerLogic.TriggerPattern_highR").read() - self.hw.dispatch() - print "\tTrigger pattern read back as: 0x%08X 0x%08X" %(triggerPattern_high, triggerPattern_low) - return triggerPattern_low, triggerPattern_high - - def getVetoDUT(self): - IgnoreDUTBusyR = self.hw.getNode("DUTInterfaces.IgnoreDUTBusyR").read() - self.hw.dispatch() - print "\tIgnoreDUTBusy read back as:" , hex(IgnoreDUTBusyR) - return IgnoreDUTBusyR - - def getVetoShutters(self): - IgnoreShutterVeto = self.hw.getNode("DUTInterfaces.IgnoreShutterVetoR").read() - self.hw.dispatch() - print "\tIgnoreShutterVeto read back as:" , IgnoreShutterVeto - return IgnoreShutterVeto - - def pulseT0(self): - cmd = int("0x1",16) - self.hw.getNode("Shutter.PulseT0").write(cmd) - self.hw.dispatch() - print "\tPulsing T0" - - def readEEPROM(self, startadd, bytes): - mystop= 1 - time.sleep(0.1) - myaddr= [startadd]#0xfa - self.TLU_I2C.write( 0x50, [startadd], mystop) - res= self.TLU_I2C.read( 0x50, bytes) - return res - - def resetClock(self): - # Set the RST pin from the PLL to 1 - print " Clocks reset" - cmd = int("0x1",16) - self.hw.getNode("logic_clocks.LogicRst").write(cmd) - self.hw.dispatch() - - def resetClocks(self): - #Reset clock PLL - self.resetClock() - #Get clock status after reset - self.getClockStatus() - #Restore clock PLL - self.restoreClock() - #Get clock status after restore - self.getClockStatus() - #Get serdes status - self.getChStatus() - - def resetCounters(self): - cmd = int("0x2", 16) #write 0x2 to reset - self.hw.getNode("triggerInputs.SerdesRstW").write(cmd) - restatus= self.hw.getNode("triggerInputs.SerdesRstR").read() - self.hw.dispatch() - cmd = int("0x0", 16) #write 0x2 to reset - self.hw.getNode("triggerInputs.SerdesRstW").write(cmd) - restatus= self.hw.getNode("triggerInputs.SerdesRstR").read() - self.hw.dispatch() - #print "Trigger Reset: 0x%X" % restatus - print "\tTrigger counters reset" - - def resetSerdes(self): - cmd = int("0x3",16) - self.setChStatus(cmd) - inputStatus= self.getChStatus() - print "\t Input status during reset = " , hex(inputStatus) - - cmd = int("0x0",16) - self.setChStatus(cmd) - inputStatus= self.getChStatus() - print "\t Input status after reset = " , hex(inputStatus) - - cmd = int("0x4",16) - self.setChStatus(cmd) - inputStatus= self.getChStatus() - print "\t Input status during calibration = " , hex(inputStatus) - - cmd = int("0x0",16) - self.setChStatus(cmd) - inputStatus= self.getChStatus() - print "\t Input status after calibration = " , hex(inputStatus) - - def restoreClock(self): - # Set the RST pin from the PLL to 0 - print " Clocks restore" - cmd = int("0x0",16) - self.hw.getNode("logic_clocks.LogicRst").write(cmd) - self.hw.dispatch() - - def setChStatus(self, cmd): - self.hw.getNode("triggerInputs.SerdesRstW").write(cmd) - inputStatus= self.hw.getNode("triggerInputs.SerdesRstR").read() - self.hw.dispatch() - print " INPUT STATUS SET TO= " , hex(inputStatus) - - def setClockStatus(self, cmd): - # Only use this for testing. The clock source is actually selected in the Si5345. - self.hw.getNode("logic_clocks.LogicClocksCSR").write(cmd) - self.hw.dispatch() - - def setDUTmask(self, DUTMask): - print " DUT MASK ENABLING: Mask= " , hex(DUTMask) - self.hw.getNode("DUTInterfaces.DutMaskW").write(DUTMask) - self.hw.dispatch() - self.getDUTmask() - - def setFifoCSR(self, cmd): - self.hw.getNode("eventBuffer.EventFifoCSR").write(cmd) - self.hw.dispatch() - self.getFifoCSR() - - def setInternalTrg(self, triggerInterval): - print " TRIGGERS INTERNAL:" - if triggerInterval == 0: - internalTriggerFreq = 0 - print "\tdisabled" - else: - internalTriggerFreq = 160000.0/triggerInterval - print "\t Setting:", internalTriggerFreq, "Hz" - self.hw.getNode("triggerLogic.InternalTriggerIntervalW").write(int(internalTriggerFreq)) - self.hw.dispatch() - self.getInternalTrg() - - def setMode(self, mode): - print " DUT MODE SET TO: ", hex(mode) - self.hw.getNode("DUTInterfaces.DUTInterfaceModeW").write(mode) - self.hw.dispatch() - self.getMode() - - def setModeModifier(self, modifier): - print " DUT MODE MODIFIER:", hex(modifier) - self.hw.getNode("DUTInterfaces.DUTInterfaceModeModifierW").write(modifier) - self.hw.dispatch() - self.getModeModifier() - - def setPulseDelay(self, pulseDelay): - print " TRIGGER DELAY SET TO", hex(pulseDelay), "[Units= 160MHz clock, 5-bit values (one per input) packed in to 32-bit word]" - self.hw.getNode("triggerLogic.PulseDelayW").write(pulseDelay) - self.hw.dispatch() - self.getPulseDelay() - - def setPulseStretch(self, pulseStretch): - print " INPUT COINCIDENCE WINDOW SET TO", hex(pulseStretch) ,"[Units= 160MHz clock cycles, 5-bit values (one per input) packed in to 32-bit word]" - self.hw.getNode("triggerLogic.PulseStretchW").write(pulseStretch) - self.hw.dispatch() - self.getPulseStretch() - - def setRecordDataStatus(self, status=False): - print " Data recording set:" - self.hw.getNode("Event_Formatter.Enable_Record_Data").write(status) - self.hw.dispatch() - self.getRecordDataStatus() - - def setTriggerVetoStatus(self, status=False): - self.hw.getNode("triggerLogic.TriggerVetoW").write(status) - self.hw.dispatch() - self.getTriggerVetoStatus() - - def setTrgPattern(self, triggerPatternH, triggerPatternL): - triggerPatternL &= 0xffffffff - triggerPatternH &= 0xffffffff - print " TRIGGER PATTERN (for external triggers) SET TO 0x%08X 0x%08X. Two 32-bit words." %(triggerPatternH, triggerPatternL) - self.hw.getNode("triggerLogic.TriggerPattern_lowW").write(triggerPatternL) - self.hw.getNode("triggerLogic.TriggerPattern_highW").write(triggerPatternH) - self.hw.dispatch() - self.getTrgPattern() - - def setVetoDUT(self, ignoreDUTBusy): - print " VETO IGNORE BY DUT BUSY MASK SET TO" , hex(ignoreDUTBusy) - self.hw.getNode("DUTInterfaces.IgnoreDUTBusyW").write(ignoreDUTBusy) - self.hw.dispatch() - self.getVetoDUT() - - def setVetoShutters(self, newState): - if newState: - print " IgnoreShutterVetoW SET TO LISTEN FOR VETO FROM SHUTTER" - cmd= int("0x0",16) - else: - print " IgnoreShutterVetoW SET TO IGNORE VETO FROM SHUTTER" - cmd= int("0x1",16) - self.hw.getNode("DUTInterfaces.IgnoreShutterVetoW").write(cmd) - self.hw.dispatch() - self.getVetoShutters() - - def writeThreshold(self, DACtarget, Vtarget, channel): - #Writes the threshold. The DAC voltage differs from the threshold voltage because - #the range is shifted to be symmetrical around 0V. - - #Check if the DACs are using the internal reference - if (self.intRefOn): - Vref= self.VrefInt - else: - Vref= self.VrefExt - - #Calculate offset voltage (because of the following shifter) - Vdac= ( Vtarget + Vref ) / 2 - print" THRESHOLD setting:" - if channel==7: - print "\tCH: ALL" - else: - print "\tCH:", channel - print "\tTarget V:", Vtarget - dacValue = 0xFFFF * (Vdac / Vref) - DACtarget.writeDAC(int(dacValue), channel, True) - - def parseFifoData(self, fifoData, nEvents, verbose): - #for index in range(0, len(fifoData)-1, 6): - outList= [] - for index in range(0, (nEvents)*6, 6): - word0= (fifoData[index] << 32) + fifoData[index + 1] - word1= (fifoData[index + 2] << 32) + fifoData[index + 3] - word2= (fifoData[index + 4] << 32) + fifoData[index + 5] - evType= (fifoData[index] & 0xF0000000) >> 28 - inTrig= (fifoData[index] & 0x0FFF0000) >> 16 - tStamp= ((fifoData[index] & 0x0000FFFF) << 32) + fifoData[index + 1] - fineTs= fifoData[index + 2] - evNum= fifoData[index + 3] - fineTsList=[-1]*12 - fineTsList[3]= (fineTs & 0x000000FF) - fineTsList[2]= (fineTs & 0x0000FF00) >> 8 - fineTsList[1]= (fineTs & 0x00FF0000) >> 16 - fineTsList[0]= (fineTs & 0xFF000000) >> 24 - fineTsList[7]= (fifoData[index + 4] & 0x000000FF) - fineTsList[6]= (fifoData[index + 4] & 0x0000FF00) >> 8 - fineTsList[5]= (fifoData[index + 4] & 0x00FF0000) >> 16 - fineTsList[4]= (fifoData[index + 4] & 0xFF000000) >> 24 - fineTsList[11]= (fifoData[index + 5] & 0x000000FF) - fineTsList[10]= (fifoData[index + 5] & 0x0000FF00) >> 8 - fineTsList[9]= (fifoData[index + 5] & 0x00FF0000) >> 16 - fineTsList[8]= (fifoData[index + 5] & 0xFF000000) >> 24 - if verbose: - print "====== EVENT", evNum, "=================================================" - print "[", hex(word0), "]", "\t TYPE", hex(evType), "\t TRIGGER", hex(inTrig), "\t TIMESTAMP", (tStamp) - print "[",hex(word1), "]", "\tEV NUM", evNum, "\tFINETS[0,3]", hex(fineTs) - print "[",hex(word2), "]", "\tFINETS[4,11]", hex(word2) - print fineTsList - fineTsList.insert(0, tStamp) - fineTsList.insert(0, evNum) - #print fineTsList - outList.insert(len(outList), fineTsList) - printdata= False - if (printdata): - print "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=" - print "EN#\tCOARSE_TS\tFINE_TS0...FINE_TS11" - pprint.pprint(outList) - return outList - - - - -################################################################################################################################## -################################################################################################################################## - - def initialize(self): - print "\nEUDUMMY INITIALIZING..." - - # We need to pass it listenForTelescopeShutter , pulseDelay , pulseStretch , triggerPattern , DUTMask , ignoreDUTBusy , triggerInterval , thresholdVoltage - - #READ CONTENT OF EPROM VIA I2C - self.getSN() - - - # - # #SET DACs - targetV= -0.12 - DACchannel= 7 - self.writeThreshold(self.zeDAC1, targetV, DACchannel, ) - self.writeThreshold(self.zeDAC2, targetV, DACchannel, ) - - # - # #ENABLE/DISABLE HDMI OUTPUTS - #self.DUTOutputs(0, True, False) - #self.DUTOutputs(1, True, False) - #self.DUTOutputs(2, True, False) - #self.DUTOutputs(3, True, False) - - ## ENABLE/DISABLE LEMO CLOCK OUTPUT - #self.enableClkLEMO(True, False) - - # - # #Check clock status - self.getClockStatus() - - resetClocks = 0 - resetSerdes = 0 - resetCounters= 0 - if resetClocks: - self.resetClocks() - self.getClockStatus() - if resetSerdes: - self.resetSerdes() - if resetCounters: - self.resetCounters() - - - - print "EUDUMMY INITIALIZED" - -################################################################################################################################## -################################################################################################################################## - def start(self, logtimestamps=False): - print "EUDUMMY STARTING..." - - print " EUDUMMY RUNNING" - -################################################################################################################################## -################################################################################################################################## - def stop(self): - print "EUDUMMY STOPPING..." - - print " EUDUMMY STOPPED" diff --git a/EUDETdummy/scripts/EUDETdummyconnection.xml b/EUDETdummy/scripts/EUDETdummyconnection.xml deleted file mode 100644 index 6084306..0000000 --- a/EUDETdummy/scripts/EUDETdummyconnection.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - diff --git a/EUDETdummy/scripts/EUDummy_testscript.py b/EUDETdummy/scripts/EUDummy_testscript.py deleted file mode 100644 index 5c7d7e3..0000000 --- a/EUDETdummy/scripts/EUDummy_testscript.py +++ /dev/null @@ -1,155 +0,0 @@ -# -*- coding: utf-8 -*- -import uhal -from I2CuHal import I2CCore -import time -#import miniTLU -from si5345 import si5345 -from AD5665R import AD5665R -from PCA9539PW import PCA9539PW -from E24AA025E48T import E24AA025E48T - -manager = uhal.ConnectionManager("file://./EUDETdummyconnection.xml") -hw = manager.getDevice("eudummy") - -# hw.getNode("A").write(255) -reg = hw.getNode("version").read() -hw.dispatch() -print "CHECK REG= ", hex(reg) - - -# #First I2C core -print ("Instantiating master I2C core:") -master_I2C= I2CCore(hw, 10, 5, "i2c_master", None) -master_I2C.state() - - - - -# -# ####################################### -enableCore= True #Only need to run this once, after power-up -if (enableCore): - mystop=True - print " Write RegDir to set I/O[7] to output:" - myslave= 0x21 - mycmd= [0x01, 0x7F] - nwords= 1 - master_I2C.write(myslave, mycmd, mystop) - - - mystop=False - mycmd= [0x01] - master_I2C.write(myslave, mycmd, mystop) - res= master_I2C.read( myslave, nwords) - print "\tPost RegDir: ", res -# ####################################### -# -# time.sleep(0.1) -# #Read the EPROM -# mystop=False -# nwords=6 -# myslave= 0x53 #DUNE EPROM 0x53 (Possibly) -# myaddr= [0xfa]#0xfa -# master_I2C.write( myslave, myaddr, mystop) -# #res= master_I2C.read( 0x50, 6) -# res= master_I2C.read( myslave, nwords) -# print " PCB EPROM: " -# result="\t " -# for iaddr in res: -# result+="%02x "%(iaddr) -# print result -# ####################################### - - -#CLOCK CONFIGURATION BEGIN -zeClock=si5345(master_I2C, 0x68) -res= zeClock.getDeviceVersion() -zeClock.checkDesignID() -#zeClock.setPage(0, True) -#zeClock.getPage(True) -clkRegList= zeClock.parse_clk("./../../bitFiles/TLU_CLK_Config.txt") -zeClock.writeConfiguration(clkRegList)###### -zeClock.writeRegister(0x0536, [0x0B]) #Configures manual switch of inputs -zeClock.writeRegister(0x0949, [0x0F]) #Enable all inputs -zeClock.writeRegister(0x052A, [0x05]) #Configures source of input -iopower= zeClock.readRegister(0x0949, 1) -print " Clock IO power: 0x%X" % iopower[0] -lol= zeClock.readRegister(0x000E, 1) -print " Clock LOL: 0x%X" % lol[0] -los= zeClock.readRegister(0x000D, 1) -print " Clock LOS: 0x%X" % los[0] -#CLOCK CONFIGURATION END - -#DAC CONFIGURATION BEGIN -zeDAC1=AD5665R(master_I2C, 0x13) -zeDAC1.setIntRef(intRef= False, verbose= True) -zeDAC1.writeDAC(0x0, 7, verbose= True)#7626 - -zeDAC2=AD5665R(master_I2C, 0x1F) -zeDAC2.setIntRef(intRef= False, verbose= True) -zeDAC2.writeDAC(0x2fff, 3, verbose= True) -#DAC CONFIGURATION END - -#EEPROM BEGIN -zeEEPROM= E24AA025E48T(master_I2C, 0x50) -res=zeEEPROM.readEEPROM(0xfa, 6) -result=" EEPROM ID:\n\t" -for iaddr in res: - result+="%02x "%(iaddr) -print result -#EEPROM END - -# #I2C EXPANDER CONFIGURATION BEGIN -IC6=PCA9539PW(master_I2C, 0x74) -#BANK 0 -IC6.setInvertReg(0, 0x00)# 0= normal -IC6.setIOReg(0, 0xF7)# 0= output <<<<<<<<<<<<<<<<<<< -IC6.setOutputs(0, 0xFF) -res= IC6.getInputs(0) -print "IC6 read back bank 0: 0x%X" % res[0] -# -#BANK 1 -IC6.setInvertReg(1, 0x00)# 0= normal -IC6.setIOReg(1, 0xFF)# 0= output <<<<<<<<<<<<<<<<<<< -IC6.setOutputs(1, 0xFF) -res= IC6.getInputs(1) -print "IC6 read back bank 1: 0x%X" % res[0] - -# # # -IC7=PCA9539PW(master_I2C, 0x75) -#BANK 0 -IC7.setInvertReg(0, 0xFF)# 0= normal -IC7.setIOReg(0, 0xFA)# 0= output <<<<<<<<<<<<<<<<<<< -IC7.setOutputs(0, 0xFF) -res= IC7.getInputs(0) -print "IC7 read back bank 0: 0x%X" % res[0] -# -#BANK 1 -IC7.setInvertReg(1, 0x00)# 0= normal -IC7.setIOReg(1, 0x0F)# 0= output <<<<<<<<<<<<<<<<<<< -IC7.setOutputs(1, 0xFF) -res= IC7.getInputs(1) -print "IC7 read back bank 1: 0x%X" % res[0] -# #I2C EXPANDER CONFIGURATION END - - -# #Reset counters -#cmd = int("0x0", 16) #write 0x2 to reset -#hw.getNode("triggerInputs.SerdesRstW").write(cmd) -#restatus= hw.getNode("triggerInputs.SerdesRstR").read() -#hw.dispatch() -#print "Trigger Reset: 0x%X" % restatus -## #Read trigger inputs -#myreg= [-1, -1, -1, -1, -1, -1] -#for inputN in range(0, 6): -# regString= "triggerInputs.ThrCount%dR" % inputN -# myreg[inputN]= hw.getNode(regString).read() -# hw.dispatch() -# print regString, myreg[inputN] - -## Read ev formatter -#cmd = int("0x0", 16) # -##hw.getNode("Event_Formatter.Enable_Record_Data").write(cmd) -#efstatus= hw.getNode("Event_Formatter.CurrentTimestampLR").read() -#hw.dispatch() -#print "Event Formatter Record: 0x%X" % efstatus diff --git a/EUDETdummy/scripts/initTLU.py b/EUDETdummy/scripts/initTLU.py deleted file mode 100644 index eb1ae65..0000000 --- a/EUDETdummy/scripts/initTLU.py +++ /dev/null @@ -1,184 +0,0 @@ -# -# Function to initialize TLU -# -# David Cussans, October 2015 -# -# Nasty hack - use both PyChips and uHAL ( for block read ... ) - -from PyChipsUser import * -from FmcTluI2c import * - -import uhal - -import sys -import time - -def startTLU( uhalDevice , pychipsBoard , writeTimestamps): - - print "RESETTING FIFO" - pychipsBoard.write("EventFifoCSR",0x2) - eventFifoFillLevel = pychipsBoard.read("EventFifoFillLevel") - print "FIFO FILL LEVEL AFTER RESET= " , eventFifoFillLevel - - - if writeTimestamps: - print "ENABLING DATA RECORDING" - pychipsBoard.write("Enable_Record_Data",1) - else: - print "Disabling data recording" - pychipsBoard.write("Enable_Record_Data",0) - - print "Pulsing T0" - pychipsBoard.write("PulseT0",1) - - print "Turning off software trigger veto" - pychipsBoard.write("TriggerVetoW",0) - - print "TLU is running" - - -def stopTLU( uhalDevice , pychipsBoard ): - - print "Turning on software trigger veto" - pychipsBoard.write("TriggerVetoW",1) - - print "TLU triggers are stopped" - -def initTLU( uhalDevice , pychipsBoard , listenForTelescopeShutter , pulseDelay , pulseStretch , triggerPattern , DUTMask , ignoreDUTBusy , triggerInterval , thresholdVoltage ): - - print "SETTING UP AIDA TLU" - - fwVersion = uhalDevice.getNode("version").read() - uhalDevice.dispatch() - print "\tVersion (uHAL)= " , hex(fwVersion) - - print "\tTurning on software trigger veto" - pychipsBoard.write("TriggerVetoW",1) - - # Check the bus for I2C devices - pychipsBoardi2c = FmcTluI2c(pychipsBoard) - - print "\tScanning I2C bus:" - scanResults = pychipsBoardi2c.i2c_scan() - #print scanResults - print '\t', ', '.join(scanResults), '\n' - - boardId = pychipsBoardi2c.get_serial_number() - print "\tFMC-TLU serial number= " , boardId - - resetClocks = 0 - resetSerdes = 0 - -# set DACs to -200mV - print "\tSETTING ALL DAC THRESHOLDS TO" , thresholdVoltage , "V" - pychipsBoardi2c.set_threshold_voltage(7, thresholdVoltage) - - clockStatus = pychipsBoard.read("LogicClocksCSR") - print "\tCLOCK STATUS (should be 3 if all clocks locked)= " , hex(clockStatus) - assert ( clockStatus == 3 ) , "Clocks in TLU FPGA are not locked. No point in continuing. Re-prgramme or power cycle board" - - if resetClocks: - print "Resetting clocks" - pychipsBoard.write("LogicRst", 1 ) - - clockStatus = pychipsBoard.read("LogicClocksCSR") - print "Clock status after reset = " , hex(clockStatus) - - inputStatus = pychipsBoard.read("SerdesRstR") - print "Input status = " , hex(inputStatus) - - if resetSerdes: - pychipsBoard.write("SerdesRstW", 0x00000003 ) - inputStatus = pychipsBoard.read("SerdesRstR") - print "Input status during reset = " , hex(inputStatus) - - pychipsBoard.write("SerdesRstW", 0x00000000 ) - inputStatus = pychipsBoard.read("SerdesRstR") - print "Input status after reset = " , hex(inputStatus) - - pychipsBoard.write("SerdesRstW", 0x00000004 ) - inputStatus = pychipsBoard.read("SerdesRstR") - print "Input status during calibration = " , hex(inputStatus) - - pychipsBoard.write("SerdesRstW", 0x00000000 ) - inputStatus = pychipsBoard.read("SerdesRstR") - print "Input status after calibration = " , hex(inputStatus) - - - inputStatus = pychipsBoard.read("SerdesRstR") - print "\tINPUT STATUS= " , hex(inputStatus) - - count0 = pychipsBoard.read("ThrCount0R") - print "\t Count 0= " , count0 - - count1 = pychipsBoard.read("ThrCount1R") - print "\t Count 1= " , count1 - - count2 = pychipsBoard.read("ThrCount2R") - print "\t Count 2= " , count2 - - count3 = pychipsBoard.read("ThrCount3R") - print "\t Count 3= " , count3 - -# Stop internal triggers until setup complete - pychipsBoard.write("InternalTriggerIntervalW",0) - - print "\tSETTING INPUT COINCIDENCE WINDOW TO",pulseStretch,"[Units= 160MHz clock cycles, Four 5-bit values (one per input) packed in to 32-bit word]" - pychipsBoard.write("PulseStretchW",int(pulseStretch)) - pulseStretchR = pychipsBoard.read("PulseStretchR") - print "\t Pulse stretch read back as:", hex(pulseStretchR) - # assert (int(pulseStretch) == pulseStretchR) , "Pulse stretch read-back doesn't equal written value" - - print "\tSETTING INPUT TRIGGER DELAY TO",pulseDelay , "[Units= 160MHz clock cycles, Four 5-bit values (one per input) packed in to 32-bit word]" - pychipsBoard.write("PulseDelayW",int(pulseDelay)) - pulseDelayR = pychipsBoard.read("PulseDelayR") - print "\t Pulse delay read back as:", hex(pulseDelayR) - - print "\tSETTING TRIGGER PATTERN (for external triggers) TO 0x%08X. Two 16-bit patterns packed into 32 bit word " %(triggerPattern) - pychipsBoard.write("TriggerPatternW",int(triggerPattern)) - triggerPatternR = pychipsBoard.read("TriggerPatternR") - print "\t Trigger pattern read back as: 0x%08X " % (triggerPatternR) - - print "\tENABLING DUT(s): Mask= " , hex(DUTMask) - pychipsBoard.write("DUTMaskW",int(DUTMask)) - DUTMaskR = pychipsBoard.read("DUTMaskR") - print "\t DUTMask read back as:" , hex(DUTMaskR) - - print "\tSETTING ALL DUTs IN AIDA MODE" - pychipsBoard.write("DUTInterfaceModeW", 0xFF) - DUTInterfaceModeR = pychipsBoard.read("DUTInterfaceModeR") - print "\t DUT mode read back as:" , DUTInterfaceModeR - - print "\tSET DUT MODE MODIFIER" - pychipsBoard.write("DUTInterfaceModeModifierW", 0xFF) - DUTInterfaceModeModifierR = pychipsBoard.read("DUTInterfaceModeModifierR") - print "\t DUT mode modifier read back as:" , DUTInterfaceModeModifierR - - if listenForTelescopeShutter: - print "\tSET IgnoreShutterVetoW TO LISTEN FOR VETO FROM SHUTTER" - pychipsBoard.write("IgnoreShutterVetoW",0) - else: - print "\tSET IgnoreShutterVetoW TO IGNORE VETO FROM SHUTTER" - pychipsBoard.write("IgnoreShutterVetoW",1) - IgnoreShutterVeto = pychipsBoard.read("IgnoreShutterVetoR") - print "\t IgnoreShutterVeto read back as:" , IgnoreShutterVeto - - print "\tSETTING IGNORE VETO BY DUT BUSY MASK TO" , hex(ignoreDUTBusy) - pychipsBoard.write("IgnoreDUTBusyW",int(ignoreDUTBusy)) - IgnoreDUTBusy = pychipsBoard.read("IgnoreDUTBusyR") - print "\t IgnoreDUTBusy read back as:" , hex(IgnoreDUTBusy) - -#print "Enabling handshake: No-handshake" -#board.write("HandshakeTypeW",1) - - - print "\tSETTING INTERNAL TRIGGER INTERVAL TO" , triggerInterval , "(zero= no internal triggers)" - if triggerInterval == 0: - internalTriggerFreq = 0 - else: - internalTriggerFreq = 160000.0/triggerInterval - print "\tINTERNAL TRIGGER FREQUENCY= " , internalTriggerFreq , " kHz" - pychipsBoard.write("InternalTriggerIntervalW",triggerInterval) #0->Internal pulse generator disabled. Any other value will generate pulses with a frequency of n*6.25ns - trigIntervalR = pychipsBoard.read("InternalTriggerIntervalR") - print "\t Trigger interval read back as:", trigIntervalR - print "AIDA TLU SETUP COMPLETED" diff --git a/EUDETdummy/scripts/startDUMMY.sh b/EUDETdummy/scripts/startDUMMY.sh deleted file mode 100644 index 03f6c55..0000000 --- a/EUDETdummy/scripts/startDUMMY.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -echo "==========================" -CURRENT_DIR=${0%/*} -echo "CURRENT DIRECTORY: " $CURRENT_DIR - -echo "============" -echo "SETTING PATHS" -export PYTHONPATH=$CURRENT_DIR/../../../../Python_Scripts/PyChips_1_5_0_pre2A/src:$PYTHONPATH -export PYTHONPATH=~/Python_Scripts/PyChips_1_5_0_preexport PYTHONPATH=../../packages:$PYTHONPATH2A/src:$PYTHONPATH -echo "PYTHON PATH= " $PYTHONPATH -export LD_LIBRARY_PATH=/opt/cactus/lib:$LD_LIBRARY_PATH -echo "LD_LIBRARY_PATH= " $LD_LIBRARY_PATH -export PATH=/usr/bin/:/opt/cactus/bin:$PATH -echo "PATH= " $PATH - -cd $CURRENT_DIR - -echo "============" -echo "STARTING PYTHON SCRIPT FOR TLU" -#python $CURRENT_DIR/startTLU_v8.py $@ - -python startEUDETdummy.py $@ -#python testTLU_script.py diff --git a/EUDETdummy/scripts/startEUDETdummy.py b/EUDETdummy/scripts/startEUDETdummy.py deleted file mode 100644 index e253e82..0000000 --- a/EUDETdummy/scripts/startEUDETdummy.py +++ /dev/null @@ -1,78 +0,0 @@ -# -*- coding: utf-8 -*- -# miniTLU test script - -#from PyChipsUser import * -#from FmcTluI2c import * -import uhal -import sys -import time -# from ROOT import TFile, TTree -# from ROOT import gROOT -from datetime import datetime - -from EUDETdummy import EUDETdummy -# Use to have interactive shell -import cmd - -class MyPrompt(cmd.Cmd): - - - def do_startRun(self, args): - """Starts the TLU run""" - print "COMMAND RECEIVED: STARTING TLU RUN" - startTLU( uhalDevice = self.hw, pychipsBoard = self.board, writeTimestamps = ( options.writeTimestamps == "True" ) ) - #print self.hw - - def do_stopRun(self, args): - """Stops the TLU run""" - print "COMMAND RECEIVED: STOP TLU RUN" - #stopTLU( uhalDevice = hw, pychipsBoard = board ) - - def do_quit(self, args): - """Quits the program.""" - print "COMMAND RECEIVED: QUITTING SCRIPT." - #raise SystemExit - return True - -# # Override methods in Cmd object ## -# def preloop(self): -# """Initialization before prompting user for commands. -# Despite the claims in the Cmd documentaion, Cmd.preloop() is not a stub. -# """ -# cmd.Cmd.preloop(self) # # sets up command completion -# self._hist = [] # # No history yet -# self._locals = {} # # Initialize execution namespace for user -# self._globals = {} -# print "\nINITIALIZING" -# now = datetime.now().strftime('%Y-%m-%dT%H_%M_%S') -# default_filename = './rootfiles/tluData_' + now + '.root' -# print "SETTING UP AIDA TLU TO SUPPLY CLOCK AND TRIGGER TO TORCH READOUT\n" -# self.manager = uhal.ConnectionManager("file://./connection.xml") -# self.hw = self.manager.getDevice("minitlu") -# self.device_id = self.hw.id() -# -# # Point to TLU in Pychips -# self.bAddrTab = AddressTable("./aida_mini_tlu_addr_map.txt") -# -# # Assume DIP-switch controlled address. Switches at 2 -# self.board = ChipsBusUdp(self.bAddrTab,"192.168.200.32",50001) - - -################################################# -if __name__ == "__main__": - EUDummy= EUDETdummy("eudummy", "file://./EUDETdummyconnection.xml") - EUDummy.initialize() - - logdata= True - EUDummy.start(logdata) - time.sleep(0.2) - nwords= int( EUDummy.getFifoLevel() ) - print nwords - myarray= EUDummy.getFifoData(nwords) - for iel in myarray: - print iel >> 16 - - EUDummy.stop() - # prompt = MyPrompt() - # prompt.prompt = '>> ' - # prompt.cmdloop("Welcome to miniTLU test console.\nType HELP for a list of commands.") diff --git a/EUDETdummy/scripts/testTLU_script.py b/EUDETdummy/scripts/testTLU_script.py deleted file mode 100644 index 9d8b334..0000000 --- a/EUDETdummy/scripts/testTLU_script.py +++ /dev/null @@ -1,79 +0,0 @@ -# miniTLU test script - -from FmcTluI2c import * -import uhal -import sys -import time -from I2CuHal import I2CCore -from miniTLU import MiniTLU -from datetime import datetime - -if __name__ == "__main__": - print "\tTEST TLU SCRIPT" - miniTLU= MiniTLU("minitlu", "file://./connection.xml") - #(self, target, wclk, i2cclk, name="i2c", delay=None) - TLU_I2C= I2CCore(miniTLU.hw, 10, 5, "i2c_master", None) - TLU_I2C.state() - - - #READ CONTENT OF EEPROM ON 24AA02E48 (0xFA - 0XFF) - mystop= 1 - time.sleep(0.1) - myaddr= [0xfa] - TLU_I2C.write( 0x50, myaddr, mystop) - res=TLU_I2C.read( 0x50, 6) - print "Checkin EEPROM:" - result="\t" - for iaddr in res: - result+="%02x "%(iaddr) - print result - - #SCAN I2C ADDRESSES - #WRITE PROM - #WRITE DAC - - - #Convert required threshold voltage to DAC code - #def convert_voltage_to_dac(self, desiredVoltage, Vref=1.300): - print("Writing DAC setting:") - Vref= 1.300 - desiredVoltage= 3.3 - channel= 0 - i2cSlaveAddrDac = 0x1F - vrefOn= 0 - Vdaq = ( desiredVoltage + Vref ) / 2 - dacCode = 0xFFFF * Vdaq / Vref - dacCode= 0x391d - print "\tVreq:", desiredVoltage - print "\tDAC code:" , dacCode - print "\tCH:", channel - print "\tIntRef:", vrefOn - - #Set DAC value - #def set_dac(self,channel,value , vrefOn = 0 , i2cSlaveAddrDac = 0x1F): - if channel<0 or channel>7: - print "set_dac ERROR: channel",channel,"not in range 0-7 (bit mask)" - ##return -1 - if dacCode<0 or dacCode>0xFFFF: - print "set_dac ERROR: value",dacCode ,"not in range 0-0xFFFF" - ##return -1 - # AD5665R chip with A0,A1 tied to ground - #i2cSlaveAddrDac = 0x1F # seven bit address, binary 00011111 - - # print "I2C address of DAC = " , hex(i2cSlaveAddrDac) - # dac = RawI2cAccess(self.i2cBusProps, i2cSlaveAddrDac) - # # if we want to enable internal voltage reference: - - if vrefOn: - # enter vref-on mode: - print "\tTurning internal reference ON" - #dac.write([0x38,0x00,0x01]) - TLU_I2C.write( i2cSlaveAddrDac, [0x38,0x00,0x01], 0) - else: - print "\tTurning internal reference OFF" - #dac.write([0x38,0x00,0x00]) - TLU_I2C.write( i2cSlaveAddrDac, [0x38,0x00,0x00], 0) - # Now set the actual value - sequence=[( 0x18 + ( channel &0x7 ) ) , int(dacCode/256)&0xff , int(dacCode)&0xff] - print "\tWriting byte sequence:", sequence - TLU_I2C.write( i2cSlaveAddrDac, sequence, 0) diff --git a/README.md b/README.md index c70d7f2..07a1b95 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,81 @@ -# aidatlu +# AIDA-TLU [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) -Repository for controlling the AIDA-2020 TLU with python using uHAL bindings from [IPbus](https://ipbus.web.cern.ch/). - +Repository for controlling the AIDA-2020 Trigger Logic Unit (TLU) with Python using uHAL bindings from [IPbus](https://ipbus.web.cern.ch/). +The Python control software is based on [EUDAQ2](https://github.com/eudaq/eudaq/tree/master/user/tlu). +The software is a lightweight version written in Python with a focus on readability and user-friendliness. +Most user cases can be set with a .yaml configuration file and started by executing a single Python script. +For a more in-depth look at the hardware components please take a look at the official [AIDA-2020 TLU project](https://ohwr.org/project/fmc-mtlu). # Installation ## IPbus -You need to install [IPbus](https://ipbus.web.cern.ch/doc/user/html/software/install/compile.html) and its python bindings to the desired interpreter. -Follow the linked tutorial for pre-requisites and general installation. -The following commands have been proven useful for custom installation and building against current (non-system) python within an environment: +You need to install [IPbus](https://ipbus.web.cern.ch/doc/user/html/software/install/compile.html) and its Python bindings to the desired interpreter. +Follow the linked tutorial for prerequisites and general installation. +Install prerequisites. +```bash +sudo apt-get install -y make erlang g++ libboost-all-dev libpugixml-dev python-all-dev rsyslog +sudo touch /usr/lib/erlang/man/man1/x86_64-linux-gnu-gcov-tool.1.gz +sudo touch /usr/lib/erlang/man/man1/gcov-tool.1.gz +``` +Checkout from git and compile the repository. +```bash +git clone --depth=1 -b v2.8.12 --recurse-submodules https://github.com/ipbus/ipbus-software.git +cd ipbus-software +make +``` +Next install against the current Python environment. ```bash -make -j $((`nproc`-1)) # Pass current PATH to su shell to build against current environment python -sudo env PATH=$PATH make install prefix= +sudo env PATH=$PATH make install +``` +Afterwards you should be able to import uhal in your specific Python environment. +When using a custom installation path for IPbus you need to import the library path. +```bash +export LD_LIBRARY_PATH=/lib +``` +The default install location is located in /opt/cactus/. +Then start the controlhub from ipbus-software/controlhub/scripts. +```bash +./controlhub_start +``` +The contolhub needs to run for the working of the AIDA TLU, so needs to be started again each time the controlhub is stopped. +The default IP address of the TLU is: +``` +192.168.200.30 ``` -## Python package -Install the python package as usual +## Python packages +Install the Python package as usual. ``` pip install -e . ``` # Usage -TODO \ No newline at end of file +There are multiple ways to use the control software of the AIDA 2020 TLU. +If one executes tlu.py in the main directory, the TLU is initialized, configured and starts a run automatically. +```bash + python tlu.py +``` +The TLU is configured with the standard tlu_configuration file. To stop the run use ctrl+c. + + +While configuring the TLU outputs are powered on and off. +This leads to problems in AIDA mode where the clock is powered off shortly during configuration. +To avoid this at the start of runs in AIDA mode the best way is to use the aidatlu_run.py script. +This is started and controlled with the terminal input: +```bash + python -i aidatlu_run.py +``` +This initializes the main tlu.py script. One is now able to control the TLU through the Python terminal interface, +with the following commands: +```bash + tlu.configure() + tlu.run() + tlu.help() +``` +Naturally, this also works for any EUDET mode runs. +Runs are stopped with the keyboard interrupt ctr+c. +For more commands take a look at the python script aidatlu.py. + +All configurations are done by the use of a yaml file (tlu_configuration.yaml). + + +Additionally, take a look at the [documentation](https://silab-bonn.github.io/aidatlu/). \ No newline at end of file diff --git a/TLU_v1c/scripts/500ns_23ns.txt b/TLU_v1c/scripts/500ns_23ns.txt deleted file mode 100644 index 7d050b4..0000000 --- a/TLU_v1c/scripts/500ns_23ns.txt +++ /dev/null @@ -1,8048 +0,0 @@ -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000015250000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000507825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000507825000000 -0.0000004437400000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000507825000000 -0.0000004437400000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000515650000000 -0.0000004437400000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000515650000000 -0.0000004437400000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000507825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000004437400000000 -0.0000000507825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000004437400000000 -0.0000000507825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000507824999999 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000507824999999 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000000 -0.0000000250000000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000515650000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257824999999 -0.0000000250000000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000507825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000507825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000507825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000515650000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000250000000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000515650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000507824999999 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000015250000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000507824999999 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000015250000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000015250000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000015250000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000507824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000507824999999 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000507825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000250000000000 -0.0000000257825000001 -0.0000004437399999999 -0.0000000515650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257824999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257824999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000004437399999999 -0.0000000507825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265649999999 -0.0000000507825000000 -0.0000004437399999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000015250000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257824999999 -0.0000000257825000001 -0.0000004437399999999 -0.0000000515650000001 -0.0000000257825000000 -0.0000000250000000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000257824999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257824999999 -0.0000000250000000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000001 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000001 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265649999999 -0.0000000507825000000 -0.0000004437399999999 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000257824999999 -0.0000000250000000001 -0.0000004437399999999 -0.0000000515650000001 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257824999999 -0.0000000257825000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000004437399999999 -0.0000000507825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265649999999 -0.0000000507825000000 -0.0000004437399999999 -0.0000000257825000001 -0.0000000265650000000 -0.0000000257824999999 -0.0000000250000000001 -0.0000000257825000000 -0.0000000015250000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257824999999 -0.0000000257825000001 -0.0000004437399999999 -0.0000000515650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257824999999 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265649999999 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265649999999 -0.0000000257825000001 -0.0000000250000000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000515650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000257824999999 -0.0000000250000000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000250000000001 -0.0000000257825000000 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000001 -0.0000000257824999999 -0.0000000257825000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000257824999999 -0.0000000257825000001 -0.0000004437399999999 -0.0000000515650000001 -0.0000000265650000000 -0.0000000257824999999 -0.0000000257825000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000257824999999 -0.0000000257825000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000250000000001 -0.0000000257825000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000004437399999999 -0.0000000507825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000250000000001 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000001 -0.0000000257824999999 -0.0000000257825000000 -0.0000000515650000001 -0.0000004437399999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000257825000001 -0.0000000265650000000 -0.0000000257824999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000001 -0.0000000257824999999 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000001 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257824999999 -0.0000000257825000001 -0.0000004437399999999 -0.0000000515650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000001 -0.0000000250000000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000257824999999 -0.0000000250000000001 -0.0000000257825000000 -0.0000000265650000001 -0.0000000257824999999 -0.0000000257825000000 -0.0000000515650000001 -0.0000004437399999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000515650000000 -0.0000000257825000000 -0.0000000250000000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265649999999 -0.0000000507824999999 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257824999999 -0.0000000257825000001 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000257824999999 -0.0000000257825000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000004437399999999 -0.0000000507825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000257824999999 -0.0000000507825000000 -0.0000004437399999999 -0.0000000257825000001 -0.0000000265650000000 -0.0000000257824999999 -0.0000000257825000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000257824999999 -0.0000000250000000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000004437399999999 -0.0000000507825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000257824999999 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000507825000000 -0.0000000507825000000 -0.0000004437400000000 -0.0000000515650000000 -0.0000004437400000000 -0.0000000515650000000 -0.0000004437400000000 -0.0000000515650000000 -0.0000004437400000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000507825000000 -0.0000000507825000000 -0.0000004437400000000 -0.0000000507825000000 -0.0000000515650000000 -0.0000004437400000000 -0.0000000515650000000 -0.0000000515650000000 -0.0000004437400000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000000 -0.0000000015250000000 -0.0000000015250000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000004437400000000 -0.0000000507825000000 -0.0000000507825000000 -0.0000004437400000000 -0.0000000515650000000 -0.0000000515650000000 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000507824999999 -0.0000000507824999999 -0.0000000507824999999 -0.0000000515650000000 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000000 -0.0000000015250000000 -0.0000000015250000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257824999999 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000507825000000 -0.0000000507825000000 -0.0000000507824999999 -0.0000000515650000000 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000000 -0.0000000015250000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257824999999 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000507825000000 -0.0000000507824999999 -0.0000000515650000000 -0.0000000515650000000 -0.0000000515650000000 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000000 -0.0000000015250000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000507825000000 -0.0000004437399999999 -0.0000000507825000000 -0.0000000515650000001 -0.0000004437399999999 -0.0000000515650000001 -0.0000000515650000000 -0.0000000515650000001 -0.0000004437399999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000015250000001 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000507824999999 -0.0000000507825000000 -0.0000004437399999999 -0.0000000515650000001 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000250000000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000015250000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000265649999999 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000001 -0.0000004437399999999 -0.0000000507825000000 -0.0000000507825000000 -0.0000004437399999999 -0.0000000515650000001 -0.0000000515650000000 -0.0000000515650000001 -0.0000004437399999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257824999999 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000250000000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257824999999 -0.0000000257824999999 -0.0000000265649999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257824999999 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000507825000000 -0.0000004437399999999 -0.0000000507825000000 -0.0000000515650000000 -0.0000000515650000001 -0.0000004437399999999 -0.0000000515650000001 -0.0000000515650000001 -0.0000004437399999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265649999999 -0.0000000265649999999 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000015250000001 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000001 -0.0000000250000000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000250000000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257824999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000250000000001 -0.0000004437399999999 -0.0000000507825000000 -0.0000000507824999999 -0.0000000515650000001 -0.0000004437399999999 -0.0000000515650000001 -0.0000000515650000001 -0.0000004437399999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000015250000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000004437400000000 -0.0000000507825000000 -0.0000000507825000000 -0.0000000515650000000 -0.0000004437400000000 -0.0000000515650000000 -0.0000004437400000000 -0.0000000515650000000 -0.0000004437400000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000507825000000 -0.0000000507825000000 -0.0000004437400000000 -0.0000000507825000000 -0.0000000515650000000 -0.0000004437400000000 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000507825000000 -0.0000004437400000000 -0.0000000507825000000 -0.0000000515650000000 -0.0000004437400000000 -0.0000000515650000000 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000000 -0.0000000015250000000 -0.0000000015250000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000507824999999 -0.0000000507824999999 -0.0000000515650000000 -0.0000000515650000000 -0.0000000515650000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000000 -0.0000000015250000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000507824999999 -0.0000000507825000000 -0.0000000507825000000 -0.0000000515650000000 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000015250000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000507824999999 -0.0000000507825000000 -0.0000000515650000000 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000507825000000 -0.0000000507825000000 -0.0000000515650000000 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000250000000000 -0.0000000015250000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000250000000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000250000000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000250000000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000507825000000 -0.0000004437399999999 -0.0000000507825000000 -0.0000000515650000000 -0.0000000515650000001 -0.0000004437399999999 -0.0000000515650000001 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000015250000001 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257824999999 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257824999999 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000507825000000 -0.0000004437399999999 -0.0000000507825000000 -0.0000000507824999999 -0.0000000515650000001 -0.0000000515650000000 -0.0000000515650000001 -0.0000004437399999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000250000000001 -0.0000000257824999999 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000015250000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000004437399999999 -0.0000000507825000000 -0.0000000507825000000 -0.0000004437399999999 -0.0000000515650000001 -0.0000000515650000000 -0.0000000515650000001 -0.0000004437399999999 -0.0000000515650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000001 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000015250000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000250000000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257824999999 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257824999999 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000250000000000 -0.0000000507825000000 -0.0000004437399999999 -0.0000000507825000000 -0.0000000515650000000 -0.0000000515650000001 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000015250000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257824999999 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000507824999999 -0.0000000507825000000 -0.0000004437399999999 -0.0000000507825000000 -0.0000000507825000000 -0.0000004437399999999 -0.0000000515650000001 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000507825000000 -0.0000004437400000000 -0.0000000507825000000 -0.0000000515650000000 -0.0000004437400000000 -0.0000000515650000000 -0.0000000515650000000 -0.0000004437400000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000507825000000 -0.0000004437400000000 -0.0000000507825000000 -0.0000000515650000000 -0.0000004437400000000 -0.0000000515650000000 -0.0000000515650000000 -0.0000004437400000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000000 -0.0000000015250000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000507825000000 -0.0000000507825000000 -0.0000000515650000000 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000000 -0.0000000015250000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000507824999999 -0.0000000507824999999 -0.0000000515650000000 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000000 -0.0000000015250000000 -0.0000000015250000000 -0.0000000015250000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000507824999999 -0.0000000507824999999 -0.0000000507825000000 -0.0000000507825000000 -0.0000000515650000000 -0.0000000515650000000 -0.0000000515650000000 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000000 -0.0000000015250000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000507824999999 -0.0000000507824999999 -0.0000000507825000000 -0.0000000515650000000 -0.0000000515650000000 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000250000000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000001 -0.0000000015250000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000250000000001 -0.0000000257824999999 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000257825000001 -0.0000000250000000000 -0.0000000507825000000 -0.0000004437399999999 -0.0000000507825000000 -0.0000000515650000000 -0.0000000515650000001 -0.0000004437399999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000015250000001 -0.0000000015250000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000250000000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257824999999 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000507824999999 -0.0000000507825000000 -0.0000004437399999999 -0.0000000515650000001 -0.0000000515650000001 -0.0000004437399999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257824999999 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257824999999 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000250000000001 -0.0000000257824999999 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000507825000000 -0.0000004437399999999 -0.0000000507825000000 -0.0000000515650000000 -0.0000000515650000001 -0.0000004437399999999 -0.0000000515650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000001 -0.0000000015250000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000250000000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000507824999999 -0.0000000507825000000 -0.0000000515650000000 -0.0000000515650000001 -0.0000004437399999999 -0.0000000515650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000015250000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257824999999 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000507824999999 -0.0000000507825000000 -0.0000000515650000000 -0.0000000515650000001 -0.0000004437399999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257824999999 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000250000000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000015250000001 -0.0000000257825000000 -0.0000000250000000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000507825000000 -0.0000000515650000000 -0.0000004437400000000 -0.0000000515650000000 -0.0000004437400000000 -0.0000000515650000000 -0.0000004437400000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000000 -0.0000000015250000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000004437400000000 -0.0000000507825000000 -0.0000000507825000000 -0.0000004437400000000 -0.0000000515650000000 -0.0000000515650000000 -0.0000004437400000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000000 -0.0000000015250000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000507825000000 -0.0000004437400000000 -0.0000000507825000000 -0.0000000515650000000 -0.0000004437400000000 -0.0000000515650000000 -0.0000000515650000000 -0.0000004437400000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000507824999999 -0.0000000515650000000 -0.0000000515650000000 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000000 -0.0000000015250000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000507825000000 -0.0000000507824999999 -0.0000000515650000000 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000000 -0.0000000015250000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257824999999 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257824999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000507825000000 -0.0000000507824999999 -0.0000000515650000000 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000000 -0.0000000015250000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000507825000000 -0.0000000507824999999 -0.0000000515650000000 -0.0000000515650000000 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257824999999 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000000 -0.0000000015250000000 -0.0000000015250000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000507825000000 -0.0000000515650000000 -0.0000000515650000000 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000000 -0.0000000015250000000 -0.0000000015250000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257824999999 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000507825000000 -0.0000004437399999999 -0.0000000507825000000 -0.0000000515650000000 -0.0000000515650000001 -0.0000004437399999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000250000000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000015250000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000250000000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257824999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000507824999999 -0.0000000507825000000 -0.0000004437399999999 -0.0000000515650000001 -0.0000000515650000001 -0.0000004437399999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257824999999 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000015250000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257824999999 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257824999999 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000004437399999999 -0.0000000507825000000 -0.0000000507825000000 -0.0000004437399999999 -0.0000000515650000001 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000001 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000015250000001 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000257825000001 -0.0000000250000000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000250000000001 -0.0000000257824999999 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000507824999999 -0.0000000507825000000 -0.0000004437399999999 -0.0000000515650000001 -0.0000000515650000001 -0.0000004437399999999 -0.0000000515650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000015250000001 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257824999999 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257824999999 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000250000000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000507824999999 -0.0000000507825000000 -0.0000000515650000000 -0.0000000515650000001 -0.0000004437399999999 -0.0000000515650000001 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265649999999 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000001 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000015250000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000507825000000 -0.0000000507825000000 -0.0000004437400000000 -0.0000000515650000000 -0.0000000515650000000 -0.0000004437400000000 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000000 -0.0000000015250000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000507825000000 -0.0000004437400000000 -0.0000000507825000000 -0.0000000515650000000 -0.0000004437400000000 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000507824999999 -0.0000000515650000000 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000507824999999 -0.0000000507825000000 -0.0000000515650000000 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000000 -0.0000000015250000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257824999999 -0.0000000250000000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000507824999999 -0.0000000507824999999 -0.0000000515650000000 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000000 -0.0000000015250000000 -0.0000000015250000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257824999999 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000507825000000 -0.0000000507824999999 -0.0000000515650000000 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000507824999999 -0.0000000515650000000 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257824999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000250000000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000507825000000 -0.0000004437399999999 -0.0000000515650000001 -0.0000000515650000001 -0.0000004437399999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000001 -0.0000000250000000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000250000000001 -0.0000000257824999999 -0.0000000257824999999 -0.0000000265649999999 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257824999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000507825000000 -0.0000004437399999999 -0.0000000507825000000 -0.0000000507825000000 -0.0000004437399999999 -0.0000000515650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000015250000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257824999999 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257824999999 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000001 -0.0000000507824999999 -0.0000000507825000000 -0.0000004437399999999 -0.0000000515650000001 -0.0000000515650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000015250000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000507825000000 -0.0000004437399999999 -0.0000000507825000000 -0.0000000515650000000 -0.0000000515650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257824999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000015250000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257824999999 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257824999999 -0.0000000257824999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000507825000000 -0.0000004437399999999 -0.0000000507825000000 -0.0000000515650000001 -0.0000004437399999999 -0.0000000515650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000015250000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257824999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000250000000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257824999999 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000001 -0.0000000250000000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000001 -0.0000004437399999999 -0.0000000507825000000 -0.0000000507824999999 -0.0000000515650000001 -0.0000000515650000000 -0.0000000257825000000 -0.0000000250000000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257824999999 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000250000000001 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257824999999 -0.0000000257825000000 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000507825000000 -0.0000004437399999999 -0.0000000515650000001 -0.0000000515650000001 -0.0000004437399999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000265650000001 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000015250000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000250000000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257824999999 -0.0000000265649999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000257825000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000265650000000 -0.0000000265650000000 -0.0000000265650000001 -0.0000000257825000000 -0.0000000257825000001 -0.0000000257824999999 -0.0000000257824999999 -0.0000000265650000000 -0.0000000265649999999 -0.0000000257825000000 diff --git a/TLU_v1c/scripts/500ns_24ns.txt b/TLU_v1c/scripts/500ns_24ns.txt deleted file mode 100644 index c6f9734..0000000 --- a/TLU_v1c/scripts/500ns_24ns.txt +++ /dev/null @@ -1,665 +0,0 @@ -0.00000002656500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000309000 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000309000 -0.00000000152500 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000309000 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000309000 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000152500 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000309000 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 -0.00000000152500 -0.00000000230750 diff --git a/TLU_v1c/scripts/AIDA_testScript.py b/TLU_v1c/scripts/AIDA_testScript.py deleted file mode 100644 index 4b8f505..0000000 --- a/TLU_v1c/scripts/AIDA_testScript.py +++ /dev/null @@ -1,183 +0,0 @@ -# -*- coding: utf-8 -*- -import uhal -from I2CuHal import I2CCore -import time -#import miniTLU -from si5345 import si5345 -from AD5665R import AD5665R -from PCA9539PW import PCA9539PW -from E24AA025E48T import E24AA025E48T - -manager = uhal.ConnectionManager("file://./TLUconnection.xml") -hw = manager.getDevice("tlu") - -# hw.getNode("A").write(255) -reg = hw.getNode("version").read() -hw.dispatch() -print "CHECK REG= ", hex(reg) - - -# #First I2C core -print ("Instantiating master I2C core:") -master_I2C= I2CCore(hw, 10, 5, "i2c_master", None) -master_I2C.state() - - - - -# -# ####################################### -enableCore= True #Only need to run this once, after power-up -if (enableCore): - mystop=True - print " Write RegDir to set I/O[7] to output:" - myslave= 0x21 - mycmd= [0x01, 0x7F] - nwords= 1 - master_I2C.write(myslave, mycmd, mystop) - - - mystop=False - mycmd= [0x01] - master_I2C.write(myslave, mycmd, mystop) - res= master_I2C.read( myslave, nwords) - print "\tPost RegDir: ", res -# ####################################### -# -# time.sleep(0.1) -# #Read the EPROM -# mystop=False -# nwords=6 -# myslave= 0x53 #DUNE EPROM 0x53 (Possibly) -# myaddr= [0xfa]#0xfa -# master_I2C.write( myslave, myaddr, mystop) -# #res= master_I2C.read( 0x50, 6) -# res= master_I2C.read( myslave, nwords) -# print " PCB EPROM: " -# result="\t " -# for iaddr in res: -# result+="%02x "%(iaddr) -# print result -# ####################################### - - -#Second I2C core -#print ("Instantiating SFP I2C core:") -#clock_I2C= I2CCore(hw, 10, 5, "i2c_sfp", None) -#clock_I2C.state() - -# #Third I2C core -# print ("Instantiating clock I2C core:") -# clock_I2C= I2CCore(hw, 10, 5, "i2c_clk", None) -# clock_I2C.state() - - -# #time.sleep(0.01) -# #Read the EPROM -# mystop=False -# nwords=2 -# myslave= 0x68 #DUNE CLOCK CHIP 0x68 -# myaddr= [0x02 ]#0xfa -# clock_I2C.write( myslave, myaddr, mystop) -# #time.sleep(0.1) -# res= clock_I2C.read( myslave, nwords) -# print " CLOCK EPROM: " -# result="\t " -# for iaddr in res: -# result+="%02x "%(iaddr) -# print result - -# - -#CLOCK CONFIGURATION BEGIN -zeClock=si5345(master_I2C, 0x68) -res= zeClock.getDeviceVersion() -zeClock.checkDesignID() -#zeClock.setPage(0, True) -#zeClock.getPage(True) -clkRegList= zeClock.parse_clk("./../../bitFiles/TLU_CLK_Config.txt") -zeClock.writeConfiguration(clkRegList)###### -zeClock.writeRegister(0x0536, [0x0B]) #Configures manual switch of inputs -zeClock.writeRegister(0x0949, [0x0F]) #Enable all inputs -zeClock.writeRegister(0x052A, [0x05]) #Configures source of input -iopower= zeClock.readRegister(0x0949, 1) -print " Clock IO power: 0x%X" % iopower[0] -lol= zeClock.readRegister(0x000E, 1) -print " Clock LOL: 0x%X" % lol[0] -los= zeClock.readRegister(0x000D, 1) -print " Clock LOS: 0x%X" % los[0] -#CLOCK CONFIGURATION END - -#DAC CONFIGURATION BEGIN -zeDAC1=AD5665R(master_I2C, 0x13) -zeDAC1.setIntRef(intRef= False, verbose= True) -zeDAC1.writeDAC(0x0, 7, verbose= True)#7626 - -zeDAC2=AD5665R(master_I2C, 0x1F) -zeDAC2.setIntRef(intRef= False, verbose= True) -zeDAC2.writeDAC(0x2fff, 3, verbose= True) -#DAC CONFIGURATION END - -#EEPROM BEGIN -zeEEPROM= E24AA025E48T(master_I2C, 0x50) -res=zeEEPROM.readEEPROM(0xfa, 6) -result=" EEPROM ID:\n\t" -for iaddr in res: - result+="%02x "%(iaddr) -print result -#EEPROM END - -# #I2C EXPANDER CONFIGURATION BEGIN -IC6=PCA9539PW(master_I2C, 0x74) -#BANK 0 -IC6.setInvertReg(0, 0x00)# 0= normal -IC6.setIOReg(0, 0xFF)# 0= output <<<<<<<<<<<<<<<<<<< -IC6.setOutputs(0, 0xFF) -res= IC6.getInputs(0) -print "IC6 read back bank 0: 0x%X" % res[0] -# -#BANK 1 -IC6.setInvertReg(1, 0x00)# 0= normal -IC6.setIOReg(1, 0xFF)# 0= output <<<<<<<<<<<<<<<<<<< -IC6.setOutputs(1, 0xFF) -res= IC6.getInputs(1) -print "IC6 read back bank 1: 0x%X" % res[0] - -# # # -IC7=PCA9539PW(master_I2C, 0x75) -#BANK 0 -IC7.setInvertReg(0, 0xFF)# 0= normal -IC7.setIOReg(0, 0xFA)# 0= output <<<<<<<<<<<<<<<<<<< -IC7.setOutputs(0, 0xFF) -res= IC7.getInputs(0) -print "IC7 read back bank 0: 0x%X" % res[0] -# -#BANK 1 -IC7.setInvertReg(1, 0x00)# 0= normal -IC7.setIOReg(1, 0x0F)# 0= output <<<<<<<<<<<<<<<<<<< -IC7.setOutputs(1, 0xFF) -res= IC7.getInputs(1) -print "IC7 read back bank 1: 0x%X" % res[0] -# #I2C EXPANDER CONFIGURATION END - - -# #Reset counters -#cmd = int("0x0", 16) #write 0x2 to reset -#hw.getNode("triggerInputs.SerdesRstW").write(cmd) -#restatus= hw.getNode("triggerInputs.SerdesRstR").read() -#hw.dispatch() -#print "Trigger Reset: 0x%X" % restatus -## #Read trigger inputs -#myreg= [-1, -1, -1, -1, -1, -1] -#for inputN in range(0, 6): -# regString= "triggerInputs.ThrCount%dR" % inputN -# myreg[inputN]= hw.getNode(regString).read() -# hw.dispatch() -# print regString, myreg[inputN] - -## Read ev formatter -#cmd = int("0x0", 16) # -##hw.getNode("Event_Formatter.Enable_Record_Data").write(cmd) -#efstatus= hw.getNode("Event_Formatter.CurrentTimestampLR").read() -#hw.dispatch() -#print "Event Formatter Record: 0x%X" % efstatus diff --git a/TLU_v1c/scripts/TLU.py b/TLU_v1c/scripts/TLU.py deleted file mode 100644 index c340cfe..0000000 --- a/TLU_v1c/scripts/TLU.py +++ /dev/null @@ -1,749 +0,0 @@ -# -*- coding: utf-8 -*- -import uhal; -import pprint; -#from FmcTluI2c import * -from I2CuHal import I2CCore -from si5345 import si5345 # Library for clock chip -from AD5665R import AD5665R # Library for DAC -from PCA9539PW import PCA9539PW # Library for serial line expander -import time - -class TLU: - """docstring for TLU""" - def __init__(self, dev_name, man_file): - self.dev_name = dev_name - self.manager= uhal.ConnectionManager(man_file) - self.hw = self.manager.getDevice(self.dev_name) - self.nDUTs= 4 #Number of DUT connectors - self.nChannels= 6 #Number of trigger inputs - self.VrefInt= 2.5 #Internal DAC voltage reference - self.VrefExt= 1.3 #External DAC voltage reference - self.intRefOn= False #Internal reference is OFF by default - - self.fwVersion = self.hw.getNode("version").read() - self.hw.dispatch() - print "TLU FIRMWARE VERSION= " , hex(self.fwVersion) - - # Instantiate a I2C core to configure components - self.TLU_I2C= I2CCore(self.hw, 10, 5, "i2c_master", None) - #self.TLU_I2C.state() - - enableCore= True #Only need to run this once, after power-up - self.enableCore() - - # Instantiate clock chip - self.zeClock=si5345(self.TLU_I2C, 0x68) - res= self.zeClock.getDeviceVersion() - self.zeClock.checkDesignID() - - # Instantiate DACs and configure them to use reference based on TLU setting - self.zeDAC1=AD5665R(self.TLU_I2C, 0x13) - self.zeDAC2=AD5665R(self.TLU_I2C, 0x1F) - self.zeDAC1.setIntRef(self.intRefOn) - self.zeDAC2.setIntRef(self.intRefOn) - - # Instantiate the serial line expanders and configure them to default values - self.IC6=PCA9539PW(self.TLU_I2C, 0x74) - self.IC6.setInvertReg(0, 0x00)# 0= normal, 1= inverted - self.IC6.setIOReg(0, 0xFF)# 0= output, 1= input - self.IC6.setOutputs(0, 0xFF)# If output, set to 1 - self.IC6.setInvertReg(1, 0x00)# 0= normal, 1= inverted - self.IC6.setIOReg(1, 0xFF)# 0= output, 1= input - self.IC6.setOutputs(1, 0xFF)# If output, set to 1 - - self.IC7=PCA9539PW(self.TLU_I2C, 0x75) - self.IC7.setInvertReg(0, 0x00)# 0= normal, 1= inverted - self.IC7.setIOReg(0, 0xFF)# 0= output, 1= input - self.IC7.setOutputs(0, 0xFF)# If output, set to 1 - self.IC7.setInvertReg(1, 0x00)# 0= normal, 1= inverted - self.IC7.setIOReg(1, 0xFF)# 0= output, 1= input - self.IC7.setOutputs(1, 0xFF)# If output, set to 1 - - -################################################################################################################################## -################################################################################################################################## - def DUTOutputs(self, dutN, enable=False, verbose=False): - ## Set the status of the transceivers for a specific HDMI connector. When enable= False the transceivers are disabled and the - ## connector cannot send signals from FPGA to the outside world. When enable= True then signals from the FPGA will be sent out to the HDMI. - ## NOTE: the other direction is always enabled, i.e. signals from the DUTs are always sent to the FPGA. - ## NOTE: CLK direction must be defined separately using DUTClkSrc - - if (dutN < 0) | (dutN> (self.nDUTs-1)): - print "\tERROR: DUTOutputs. The DUT number must be comprised between 0 and ", self.nDUTs-1 - return -1 - bank= dutN//2 # DUT0 and DUT1 are on bank 0. DUT2 and DUT3 on bank 1 - nibble= dutN%2 # DUT0 and DUT2 are on nibble 0. DUT1 and DUT3 are on nibble 1 - print " Setting DUT:", dutN, "to", enable - if verbose: - print "\tBank", bank, "Nibble", nibble - res= self.IC6.getIOReg(bank) - oldStatus= res[0] - mask= 0xF << 4*nibble - newStatus= oldStatus & (~mask) - if (not enable): # we want to write 0 to activate the outputs so check opposite of "enable" - newStatus |= mask - if verbose: - print "\tOldStatus= ", "{0:#0{1}x}".format(oldStatus,4), "Mask=" , hex(mask), "newStatus=", "{0:#0{1}x}".format(newStatus,4) - self.IC6.setIOReg(bank, newStatus) - return newStatus - - def DUTClkSrc(self, dutN, clkSrc=0, verbose= False): - ## Allows to choose the source of the clock signal sent to the DUTs over HDMI - ## clkSrc= 0: clock disabled - ## clkSrc= 1: clock from Si5345 - ## clkSrc=2: clock from FPGA - if (dutN < 0) | (dutN> (self.nDUTs-1)): - print "\tERROR: DUTClkSrc. The DUT number must be comprised between 0 and ", self.nDUTs-1 - return -1 - if (clkSrc < 0) | (clkSrc> 2): - print "\tERROR: DUTClkSrc. clkSrc can only be 0 (disabled), 1 (Si5345) or 2 (FPGA)" - return -1 - bank=0 - maskLow= 1 << (1* dutN) #CLK FROM FPGA - maskHigh= 1<< (1* dutN +4) #CLK FROM Si5345 - mask= maskLow | maskHigh - res= self.IC7.getIOReg(bank) - oldStatus= res[0] - newStatus= oldStatus & ~mask #set both bits to zero - outStat= "" - if clkSrc==0: - newStatus = newStatus | mask - outStat= "disabled" - elif clkSrc==1: - newStatus = newStatus | maskLow - outStat= "Si5435" - elif clkSrc==2: - newStatus= newStatus | maskHigh - outStat= "FPGA" - print " Setting DUT:", dutN, "clock source to", outStat - if verbose: - print "\tOldStatus= ", "{0:#0{1}x}".format(oldStatus,4), "Mask=" , hex(mask), "newStatus=", "{0:#0{1}x}".format(newStatus,4) - self.IC7.setIOReg(bank, newStatus) - return newStatus - - def enableClkLEMO(self, enable= False, verbose= False): - ## Enable or disable the output clock to the differential LEMO output - bank=1 - mask= 0x10 - res= self.IC7.getIOReg(bank) - oldStatus= res[0] - newStatus= oldStatus & ~mask - outStat= "enabled" - if (not enable): #A 0 activates the output. A 1 disables it. - newStatus= newStatus | mask - outStat= "disabled" - print " Clk LEMO", outStat - if verbose: - print "\tOldStatus= ", "{0:#0{1}x}".format(oldStatus,4), "Mask=" , hex(mask), "newStatus=", "{0:#0{1}x}".format(newStatus,4) - self.IC7.setIOReg(bank, newStatus) - return newStatus - - def enableCore(self): - ## At power up the Enclustra I2C lines are disabled (tristate buffer is off). - ## This function enables the lines. It is only required once. - mystop=True - print " Enabling I2C bus (expect 127):" - myslave= 0x21 - mycmd= [0x01, 0x7F] - nwords= 1 - self.TLU_I2C.write(myslave, mycmd, mystop) - - mystop=False - mycmd= [0x01] - self.TLU_I2C.write(myslave, mycmd, mystop) - res= self.TLU_I2C.read( myslave, nwords) - print "\tPost RegDir: ", res - - def getAllChannelsCounts(self): - chCounts=[] - for ch in range (0,self.nChannels): - chCounts.append(int(self.getChCount(ch))) - return chCounts - - def getChStatus(self): - inputStatus= self.hw.getNode("triggerInputs.SerdesRstR").read() - self.hw.dispatch() - print "\tInput status= " , hex(inputStatus) - return inputStatus - - def getChCount(self, channel): - regString= "triggerInputs.ThrCount"+ str(channel)+"R" - count = self.hw.getNode(regString).read() - self.hw.dispatch() - print "\tCh", channel, "Count:" , count - return count - - def getClockStatus(self): - clockStatus = self.hw.getNode("logic_clocks.LogicClocksCSR").read() - self.hw.dispatch() - print " CLOCK STATUS [expected 1]" - print "\t", hex(clockStatus) - if ( clockStatus == 0 ): - "ERROR: Clocks in TLU FPGA are not locked." - return clockStatus - - def getDUTmask(self): - DUTMaskR = self.hw.getNode("DUTInterfaces.DutMaskR").read() - self.hw.dispatch() - print "\tDUTMask read back as:" , hex(DUTMaskR) - return DUTMaskR - - def getExternalVeto(self): - extVeto= self.hw.getNode("triggerLogic.ExternalTriggerVetoR").read() - self.hw.dispatch() - print "\tEXTERNAL Veto read back as:", hex(extVeto) - return extVeto - - def getFifoData(self, nWords): - #fifoData= self.hw.getNode("eventBuffer.EventFifoData").read() - fifoData= self.hw.getNode("eventBuffer.EventFifoData").readBlock (nWords); - self.hw.dispatch() - #print "\tFIFO Data:", hex(fifoData) - return fifoData - - def getFifoLevel(self): - FifoFill= self.hw.getNode("eventBuffer.EventFifoFillLevel").read() - self.hw.dispatch() - print "\tFIFO level read back as:", hex(FifoFill) - return FifoFill - - def getFifoCSR(self): - FifoCSR= self.hw.getNode("eventBuffer.EventFifoCSR").read() - self.hw.dispatch() - print "\tFIFO CSR read back as:", hex(FifoCSR) - return FifoCSR - - def getInternalTrg(self): - trigIntervalR = self.hw.getNode("triggerLogic.InternalTriggerIntervalR").read() - self.hw.dispatch() - print "\tTrigger frequency read back as:", trigIntervalR, "Hz" - return trigIntervalR - - def getMode(self): - DUTInterfaceModeR = self.hw.getNode("DUTInterfaces.DUTInterfaceModeR").read() - self.hw.dispatch() - print "\tDUT mode read back as:" , hex(DUTInterfaceModeR) - return DUTInterfaceModeR - - def getModeModifier(self): - DUTInterfaceModeModifierR = self.hw.getNode("DUTInterfaces.DUTInterfaceModeModifierR").read() - self.hw.dispatch() - print "\tDUT mode modifier read back as:" , hex(DUTInterfaceModeModifierR) - return DUTInterfaceModeModifierR - - def getSN(self): - epromcontent=self.readEEPROM(0xfa, 6) - print " FMC-TLU serial number (EEPROM):" - result="\t" - for iaddr in epromcontent: - result+="%02x "%(iaddr) - print result - return epromcontent - - def getPostVetoTrg(self): - triggerN = self.hw.getNode("triggerLogic.PostVetoTriggersR").read() - self.hw.dispatch() - print "\tPOST VETO TRIGGER NUMBER:", (triggerN) - return triggerN - - def getPulseDelay(self): - pulseDelayR = self.hw.getNode("triggerLogic.PulseDelayR").read() - self.hw.dispatch() - print "\tPulse delay read back as:", hex(pulseDelayR) - return pulseDelayR - - def getPulseStretch(self): - pulseStretchR = self.hw.getNode("triggerLogic.PulseStretchR").read() - self.hw.dispatch() - print "\tPulse stretch read back as:", hex(pulseStretchR) - return pulseStretchR - - def getRecordDataStatus(self): - RecordStatus= self.hw.getNode("Event_Formatter.Enable_Record_Data").read() - self.hw.dispatch() - print "\tData recording:", RecordStatus - return RecordStatus - - def getTriggerVetoStatus(self): - trgVetoStatus= self.hw.getNode("triggerLogic.TriggerVetoR").read() - self.hw.dispatch() - print "\tTrigger veto status read back as:", trgVetoStatus - return trgVetoStatus - - def getTrgPattern(self): - triggerPattern_low = self.hw.getNode("triggerLogic.TriggerPattern_lowR").read() - triggerPattern_high = self.hw.getNode("triggerLogic.TriggerPattern_highR").read() - self.hw.dispatch() - print "\tTrigger pattern read back as: 0x%08X 0x%08X" %(triggerPattern_high, triggerPattern_low) - return triggerPattern_low, triggerPattern_high - - def getVetoDUT(self): - IgnoreDUTBusyR = self.hw.getNode("DUTInterfaces.IgnoreDUTBusyR").read() - self.hw.dispatch() - print "\tIgnoreDUTBusy read back as:" , hex(IgnoreDUTBusyR) - return IgnoreDUTBusyR - - def getVetoShutters(self): - IgnoreShutterVeto = self.hw.getNode("DUTInterfaces.IgnoreShutterVetoR").read() - self.hw.dispatch() - print "\tIgnoreShutterVeto read back as:" , IgnoreShutterVeto - return IgnoreShutterVeto - - def pulseT0(self): - cmd = int("0x1",16) - self.hw.getNode("Shutter.PulseT0").write(cmd) - self.hw.dispatch() - print "\tPulsing T0" - - def readEEPROM(self, startadd, bytes): - mystop= 1 - time.sleep(0.1) - myaddr= [startadd]#0xfa - self.TLU_I2C.write( 0x50, [startadd], mystop) - res= self.TLU_I2C.read( 0x50, bytes) - return res - - def resetClock(self): - # Set the RST pin from the PLL to 1 - print " Clocks reset" - cmd = int("0x1",16) - self.hw.getNode("logic_clocks.LogicRst").write(cmd) - self.hw.dispatch() - - def resetClocks(self): - #Reset clock PLL - self.resetClock() - #Get clock status after reset - self.getClockStatus() - #Restore clock PLL - self.restoreClock() - #Get clock status after restore - self.getClockStatus() - #Get serdes status - self.getChStatus() - - def resetCounters(self): - cmd = int("0x2", 16) #write 0x2 to reset - self.hw.getNode("triggerInputs.SerdesRstW").write(cmd) - restatus= self.hw.getNode("triggerInputs.SerdesRstR").read() - self.hw.dispatch() - cmd = int("0x0", 16) #write 0x2 to reset - self.hw.getNode("triggerInputs.SerdesRstW").write(cmd) - restatus= self.hw.getNode("triggerInputs.SerdesRstR").read() - self.hw.dispatch() - #print "Trigger Reset: 0x%X" % restatus - print "\tTrigger counters reset" - - def resetSerdes(self): - cmd = int("0x3",16) - self.setChStatus(cmd) - inputStatus= self.getChStatus() - print "\t Input status during reset = " , hex(inputStatus) - - cmd = int("0x0",16) - self.setChStatus(cmd) - inputStatus= self.getChStatus() - print "\t Input status after reset = " , hex(inputStatus) - - cmd = int("0x4",16) - self.setChStatus(cmd) - inputStatus= self.getChStatus() - print "\t Input status during calibration = " , hex(inputStatus) - - cmd = int("0x0",16) - self.setChStatus(cmd) - inputStatus= self.getChStatus() - print "\t Input status after calibration = " , hex(inputStatus) - - def restoreClock(self): - # Set the RST pin from the PLL to 0 - print " Clocks restore" - cmd = int("0x0",16) - self.hw.getNode("logic_clocks.LogicRst").write(cmd) - self.hw.dispatch() - - def setChStatus(self, cmd): - self.hw.getNode("triggerInputs.SerdesRstW").write(cmd) - inputStatus= self.hw.getNode("triggerInputs.SerdesRstR").read() - self.hw.dispatch() - print " INPUT STATUS SET TO= " , hex(inputStatus) - - def setClockStatus(self, cmd): - # Only use this for testing. The clock source is actually selected in the Si5345. - self.hw.getNode("logic_clocks.LogicClocksCSR").write(cmd) - self.hw.dispatch() - - def setDUTmask(self, DUTMask): - print " DUT MASK ENABLING: Mask= " , hex(DUTMask) - self.hw.getNode("DUTInterfaces.DutMaskW").write(DUTMask) - self.hw.dispatch() - self.getDUTmask() - - def setFifoCSR(self, cmd): - self.hw.getNode("eventBuffer.EventFifoCSR").write(cmd) - self.hw.dispatch() - self.getFifoCSR() - - def setInternalTrg(self, triggerInterval): - print " TRIGGERS INTERNAL:" - if triggerInterval == 0: - internalTriggerFreq = 0 - print "\tdisabled" - else: - internalTriggerFreq = 160000.0/triggerInterval - print "\t Setting:", internalTriggerFreq, "Hz" - self.hw.getNode("triggerLogic.InternalTriggerIntervalW").write(int(internalTriggerFreq)) - self.hw.dispatch() - self.getInternalTrg() - - def setMode(self, mode): - print " DUT MODE SET TO: ", hex(mode) - self.hw.getNode("DUTInterfaces.DUTInterfaceModeW").write(mode) - self.hw.dispatch() - self.getMode() - - def setModeModifier(self, modifier): - print " DUT MODE MODIFIER:", hex(modifier) - self.hw.getNode("DUTInterfaces.DUTInterfaceModeModifierW").write(modifier) - self.hw.dispatch() - self.getModeModifier() - - def setPulseDelay(self, pulseDelay): - print " TRIGGER DELAY SET TO", hex(pulseDelay), "[Units= 160MHz clock, 5-bit values (one per input) packed in to 32-bit word]" - self.hw.getNode("triggerLogic.PulseDelayW").write(pulseDelay) - self.hw.dispatch() - self.getPulseDelay() - - def setPulseStretch(self, pulseStretch): - print " INPUT COINCIDENCE WINDOW SET TO", hex(pulseStretch) ,"[Units= 160MHz clock cycles, 5-bit values (one per input) packed in to 32-bit word]" - self.hw.getNode("triggerLogic.PulseStretchW").write(pulseStretch) - self.hw.dispatch() - self.getPulseStretch() - - def setRecordDataStatus(self, status=False): - print " Data recording set:" - self.hw.getNode("Event_Formatter.Enable_Record_Data").write(status) - self.hw.dispatch() - self.getRecordDataStatus() - - def setTriggerVetoStatus(self, status=False): - self.hw.getNode("triggerLogic.TriggerVetoW").write(status) - self.hw.dispatch() - self.getTriggerVetoStatus() - - def setTrgPattern(self, triggerPatternH, triggerPatternL): - triggerPatternL &= 0xffffffff - triggerPatternH &= 0xffffffff - print " TRIGGER PATTERN (for external triggers) SET TO 0x%08X 0x%08X. Two 32-bit words." %(triggerPatternH, triggerPatternL) - self.hw.getNode("triggerLogic.TriggerPattern_lowW").write(triggerPatternL) - self.hw.getNode("triggerLogic.TriggerPattern_highW").write(triggerPatternH) - self.hw.dispatch() - self.getTrgPattern() - - def setVetoDUT(self, ignoreDUTBusy): - print " VETO IGNORE BY DUT BUSY MASK SET TO" , hex(ignoreDUTBusy) - self.hw.getNode("DUTInterfaces.IgnoreDUTBusyW").write(ignoreDUTBusy) - self.hw.dispatch() - self.getVetoDUT() - - def setVetoShutters(self, newState): - if newState: - print " IgnoreShutterVetoW SET TO LISTEN FOR VETO FROM SHUTTER" - cmd= int("0x0",16) - else: - print " IgnoreShutterVetoW SET TO IGNORE VETO FROM SHUTTER" - cmd= int("0x1",16) - self.hw.getNode("DUTInterfaces.IgnoreShutterVetoW").write(cmd) - self.hw.dispatch() - self.getVetoShutters() - - def writeThreshold(self, DACtarget, Vtarget, channel): - #Writes the threshold. The DAC voltage differs from the threshold voltage because - #the range is shifted to be symmetrical around 0V. - - #Check if the DACs are using the internal reference - if (self.intRefOn): - Vref= self.VrefInt - else: - Vref= self.VrefExt - - #Calculate offset voltage (because of the following shifter) - Vdac= ( Vtarget + Vref ) / 2 - print" THRESHOLD setting:" - if channel==7: - print "\tCH: ALL" - else: - print "\tCH:", channel - print "\tTarget V:", Vtarget - dacValue = 0xFFFF * (Vdac / Vref) - DACtarget.writeDAC(int(dacValue), channel, True) - - def parseFifoData(self, fifoData, nEvents, verbose): - #for index in range(0, len(fifoData)-1, 6): - outList= [] - for index in range(0, (nEvents)*6, 6): - word0= (fifoData[index] << 32) + fifoData[index + 1] - word1= (fifoData[index + 2] << 32) + fifoData[index + 3] - word2= (fifoData[index + 4] << 32) + fifoData[index + 5] - evType= (fifoData[index] & 0xF0000000) >> 28 - inTrig= (fifoData[index] & 0x0FFF0000) >> 16 - tStamp= ((fifoData[index] & 0x0000FFFF) << 32) + fifoData[index + 1] - fineTs= fifoData[index + 2] - evNum= fifoData[index + 3] - fineTsList=[-1]*12 - fineTsList[3]= (fineTs & 0x000000FF) - fineTsList[2]= (fineTs & 0x0000FF00) >> 8 - fineTsList[1]= (fineTs & 0x00FF0000) >> 16 - fineTsList[0]= (fineTs & 0xFF000000) >> 24 - fineTsList[7]= (fifoData[index + 4] & 0x000000FF) - fineTsList[6]= (fifoData[index + 4] & 0x0000FF00) >> 8 - fineTsList[5]= (fifoData[index + 4] & 0x00FF0000) >> 16 - fineTsList[4]= (fifoData[index + 4] & 0xFF000000) >> 24 - fineTsList[11]= (fifoData[index + 5] & 0x000000FF) - fineTsList[10]= (fifoData[index + 5] & 0x0000FF00) >> 8 - fineTsList[9]= (fifoData[index + 5] & 0x00FF0000) >> 16 - fineTsList[8]= (fifoData[index + 5] & 0xFF000000) >> 24 - if verbose: - print "====== EVENT", evNum, "=================================================" - print "[", hex(word0), "]", "\t TYPE", hex(evType), "\t TRIGGER", hex(inTrig), "\t TIMESTAMP", (tStamp) - print "[",hex(word1), "]", "\tEV NUM", evNum, "\tFINETS[0,3]", hex(fineTs) - print "[",hex(word2), "]", "\tFINETS[4,11]", hex(word2) - print fineTsList - fineTsList.insert(0, tStamp) - fineTsList.insert(0, evNum) - #print fineTsList - outList.insert(len(outList), fineTsList) - printdata= False - if (printdata): - print "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=" - print "EN#\tCOARSE_TS\tFINE_TS0...FINE_TS11" - pprint.pprint(outList) - return outList - - def plotFifoData(self, outList): - import matplotlib.pyplot as plt - import numpy as np - import matplotlib.mlab as mlab - - coarseColumn= [row[1] for row in outList] - fineColumn= [row[2] for row in outList] - timeStamp= [sum(x) for x in zip(coarseColumn, fineColumn)] - correctTs= [-1]*len(coarseColumn) - coarseVal= 0.000000025 #coarse time value (40 Mhz, 25 ns) - fineVal= 0.00000000078125 #fine time value (1280 MHz, 0.78125 ns) - for iTs in range(0, len(coarseColumn)): - correctTs[iTs]= coarseColumn[iTs]*coarseVal + fineColumn[iTs]*fineVal - #if iTs: - #print correctTs[iTs]-correctTs[iTs-1], "\t ", correctTs[iTs], "\t", coarseColumn[iTs], "\t", fineColumn[iTs] - - xdiff = np.diff(correctTs) - np.all(xdiff[0] == xdiff) - P= 1000000000 #display in ns - nsDeltas = [x * P for x in xdiff] - #centerRange= np.mean(nsDeltas) - centerRange= 476 - windowsns= 30 - minRange= centerRange-windowsns - maxRange= centerRange+windowsns - - #Divide figure in two axes - plt.subplot(311) - - #Create first histogram - plt.hist(nsDeltas, 60, range=[minRange, maxRange], facecolor='blue', align='mid', alpha= 0.75) - #plt.hist(nsDeltas, 100, normed=True, facecolor='blue', align='mid', alpha=0.75) - #plt.xlim((min(nsDeltas), max(nsDeltas))) - plt.xlabel('Time (ns)') - plt.ylabel('Entries') - plt.title('Histogram DeltaTime') - plt.grid(True) - - #Superimpose Gauss to first plot - mean = np.mean(nsDeltas) - variance = np.var(nsDeltas) - sigma = np.sqrt(variance) - x = np.linspace(min(nsDeltas), max(nsDeltas), 100) - plt.plot(x, mlab.normpdf(x, mean, sigma)) - - MSBTs= [-1]*len(fineColumn) - LSBTs= [-1]*len(fineColumn) - for iTs in range(0, len(fineColumn)): - MSBTs[iTs]= fineColumn[iTs] & 0b11000 - LSBTs[iTs]= fineColumn[iTs] & 0b00111 - #if iTs: - #print correctTs[iTs]-correctTs[iTs-1], "\t ", correctTs[iTs], "\t", coarseColumn[iTs], "\t", fineColumn[iTs] - - #Second plot - plt.subplot(312) - plt.xlabel('Clock sample') - plt.ylabel('Entries') - plt.title('Histogram Fine Time Stamp (2 MSB)') - plt.grid(True) - plt.hist(MSBTs, 100, normed=False, facecolor='blue', align='mid', alpha=0.75) - - #Third plot - plt.subplot(313) - plt.xlabel('Clock sample') - plt.ylabel('Entries') - plt.title('Histogram Fine Time Stamp (3 LSB)') - plt.grid(True) - plt.hist(LSBTs, 100, normed=False, facecolor='blue', align='mid', alpha=0.75) - - #Display plot - plt.show() - - - def saveFifoData(self, outList): - import csv - with open("output.csv", "wb") as f: - writer = csv.writer(f) - writer.writerows(outList) - - -################################################################################################################################## -################################################################################################################################## - - def initialize(self): - print "\nTLU INITIALIZING..." - - # We need to pass it listenForTelescopeShutter , pulseDelay , pulseStretch , triggerPattern , DUTMask , ignoreDUTBusy , triggerInterval , thresholdVoltage - - #READ CONTENT OF EPROM VIA I2C - self.getSN() - - print " Turning on software trigger veto" - cmd = int("0x1",16) - self.setTriggerVetoStatus(cmd) - - # - # #SET DACs - targetV= -0.12 - DACchannel= 7 - self.writeThreshold(self.zeDAC1, targetV, DACchannel, ) - self.writeThreshold(self.zeDAC2, targetV, DACchannel, ) - - # - # #ENABLE/DISABLE HDMI OUTPUTS - self.DUTOutputs(0, True, False) - self.DUTOutputs(1, True, False) - self.DUTOutputs(2, True, False) - self.DUTOutputs(3, True, False) - - ## ENABLE/DISABLE LEMO CLOCK OUTPUT - self.enableClkLEMO(True, False) - - # - # #Check clock status - self.getClockStatus() - - resetClocks = 0 - resetSerdes = 0 - resetCounters= 0 - if resetClocks: - self.resetClocks() - self.getClockStatus() - if resetSerdes: - self.resetSerdes() - if resetCounters: - self.resetCounters() - - # # Get inputs status and counters - self.getChStatus() - self.getAllChannelsCounts() - # - # # Stop internal triggers until setup complete - cmd = int("0x0",16) - self.setInternalTrg(cmd) - # - # # Set pulse stretch - pulseStretch= 0x00000000 - self.setPulseStretch(pulseStretch) - # - # # Set pulse delay - pulseDelay= 0x00 - self.setPulseDelay(pulseDelay) - - # # Set trigger pattern - #triggerPattern_low= 0xFFFEFFFE - #triggerPattern_high= 0xFFFFFFFF - triggerPattern_low= 0x00010102 - triggerPattern_low= 0x00000002 - triggerPattern_high= 0x00000000 - self.setTrgPattern(triggerPattern_high, triggerPattern_low) - - # # Set DUTs - DUTMask= 0xF - self.setDUTmask(DUTMask) - # - # # # Set mode - DUTMode= 0xFFFFFFFF - self.setMode(DUTMode) - - # # # Set modifier - modifier = int("0xFF",16) - self.setModeModifier(modifier) - # - # # Set veto shutter - setVetoShutters=0 - self.setVetoShutters(setVetoShutters) - - # # Set veto by DUT - ignoreDUTBusy=0x0 - self.setVetoDUT(ignoreDUTBusy) - self.getExternalVeto() - # - # # Set trigger interval (use 0 to disable internal triggers) - triggerInterval= 0000 - self.setInternalTrg(triggerInterval) - - print "TLU INITIALIZED" - -################################################################################################################################## -################################################################################################################################## - def start(self, logtimestamps=False): - print "TLU STARTING..." - - print " FIFO RESET:" - FIFOcmd= 0x2 - self.setFifoCSR(FIFOcmd) - - eventFifoFillLevel= self.getFifoLevel() - cmd = int("0x000",16) - self.setInternalTrg(cmd) - - if logtimestamps: - self.setRecordDataStatus(True) - else: - self.setRecordDataStatus(False) - - # Pulse T0 - self.pulseT0() - - print " Turning off software trigger veto" - cmd = int("0x0",16) - self.setTriggerVetoStatus(cmd) - - print "TLU RUNNING" - -################################################################################################################################## -################################################################################################################################## - def stop(self): - print "TLU STOPPING..." - - self.getPostVetoTrg() - eventFifoFillLevel= self.getFifoLevel() - print " Turning on software trigger veto" - cmd = int("0x1",16) - self.setTriggerVetoStatus(cmd) - - nFifoWords= int(eventFifoFillLevel) - fifoData= self.getFifoData(nFifoWords) - - outList= self.parseFifoData(fifoData, nFifoWords/6, False) - self.saveFifoData(outList) - self.plotFifoData(outList) - #outFile = open('./test.txt', 'w') - #for iData in range (0, 30): - # outFile.write("%s\n" % fifoData[iData]) - # print hex(fifoData[iData]) - print "TLU STOPPED" diff --git a/TLU_v1c/scripts/TLUconnection.xml b/TLU_v1c/scripts/TLUconnection.xml deleted file mode 100644 index fca67f5..0000000 --- a/TLU_v1c/scripts/TLUconnection.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - diff --git a/TLU_v1c/scripts/initTLU.py b/TLU_v1c/scripts/initTLU.py deleted file mode 100644 index eb1ae65..0000000 --- a/TLU_v1c/scripts/initTLU.py +++ /dev/null @@ -1,184 +0,0 @@ -# -# Function to initialize TLU -# -# David Cussans, October 2015 -# -# Nasty hack - use both PyChips and uHAL ( for block read ... ) - -from PyChipsUser import * -from FmcTluI2c import * - -import uhal - -import sys -import time - -def startTLU( uhalDevice , pychipsBoard , writeTimestamps): - - print "RESETTING FIFO" - pychipsBoard.write("EventFifoCSR",0x2) - eventFifoFillLevel = pychipsBoard.read("EventFifoFillLevel") - print "FIFO FILL LEVEL AFTER RESET= " , eventFifoFillLevel - - - if writeTimestamps: - print "ENABLING DATA RECORDING" - pychipsBoard.write("Enable_Record_Data",1) - else: - print "Disabling data recording" - pychipsBoard.write("Enable_Record_Data",0) - - print "Pulsing T0" - pychipsBoard.write("PulseT0",1) - - print "Turning off software trigger veto" - pychipsBoard.write("TriggerVetoW",0) - - print "TLU is running" - - -def stopTLU( uhalDevice , pychipsBoard ): - - print "Turning on software trigger veto" - pychipsBoard.write("TriggerVetoW",1) - - print "TLU triggers are stopped" - -def initTLU( uhalDevice , pychipsBoard , listenForTelescopeShutter , pulseDelay , pulseStretch , triggerPattern , DUTMask , ignoreDUTBusy , triggerInterval , thresholdVoltage ): - - print "SETTING UP AIDA TLU" - - fwVersion = uhalDevice.getNode("version").read() - uhalDevice.dispatch() - print "\tVersion (uHAL)= " , hex(fwVersion) - - print "\tTurning on software trigger veto" - pychipsBoard.write("TriggerVetoW",1) - - # Check the bus for I2C devices - pychipsBoardi2c = FmcTluI2c(pychipsBoard) - - print "\tScanning I2C bus:" - scanResults = pychipsBoardi2c.i2c_scan() - #print scanResults - print '\t', ', '.join(scanResults), '\n' - - boardId = pychipsBoardi2c.get_serial_number() - print "\tFMC-TLU serial number= " , boardId - - resetClocks = 0 - resetSerdes = 0 - -# set DACs to -200mV - print "\tSETTING ALL DAC THRESHOLDS TO" , thresholdVoltage , "V" - pychipsBoardi2c.set_threshold_voltage(7, thresholdVoltage) - - clockStatus = pychipsBoard.read("LogicClocksCSR") - print "\tCLOCK STATUS (should be 3 if all clocks locked)= " , hex(clockStatus) - assert ( clockStatus == 3 ) , "Clocks in TLU FPGA are not locked. No point in continuing. Re-prgramme or power cycle board" - - if resetClocks: - print "Resetting clocks" - pychipsBoard.write("LogicRst", 1 ) - - clockStatus = pychipsBoard.read("LogicClocksCSR") - print "Clock status after reset = " , hex(clockStatus) - - inputStatus = pychipsBoard.read("SerdesRstR") - print "Input status = " , hex(inputStatus) - - if resetSerdes: - pychipsBoard.write("SerdesRstW", 0x00000003 ) - inputStatus = pychipsBoard.read("SerdesRstR") - print "Input status during reset = " , hex(inputStatus) - - pychipsBoard.write("SerdesRstW", 0x00000000 ) - inputStatus = pychipsBoard.read("SerdesRstR") - print "Input status after reset = " , hex(inputStatus) - - pychipsBoard.write("SerdesRstW", 0x00000004 ) - inputStatus = pychipsBoard.read("SerdesRstR") - print "Input status during calibration = " , hex(inputStatus) - - pychipsBoard.write("SerdesRstW", 0x00000000 ) - inputStatus = pychipsBoard.read("SerdesRstR") - print "Input status after calibration = " , hex(inputStatus) - - - inputStatus = pychipsBoard.read("SerdesRstR") - print "\tINPUT STATUS= " , hex(inputStatus) - - count0 = pychipsBoard.read("ThrCount0R") - print "\t Count 0= " , count0 - - count1 = pychipsBoard.read("ThrCount1R") - print "\t Count 1= " , count1 - - count2 = pychipsBoard.read("ThrCount2R") - print "\t Count 2= " , count2 - - count3 = pychipsBoard.read("ThrCount3R") - print "\t Count 3= " , count3 - -# Stop internal triggers until setup complete - pychipsBoard.write("InternalTriggerIntervalW",0) - - print "\tSETTING INPUT COINCIDENCE WINDOW TO",pulseStretch,"[Units= 160MHz clock cycles, Four 5-bit values (one per input) packed in to 32-bit word]" - pychipsBoard.write("PulseStretchW",int(pulseStretch)) - pulseStretchR = pychipsBoard.read("PulseStretchR") - print "\t Pulse stretch read back as:", hex(pulseStretchR) - # assert (int(pulseStretch) == pulseStretchR) , "Pulse stretch read-back doesn't equal written value" - - print "\tSETTING INPUT TRIGGER DELAY TO",pulseDelay , "[Units= 160MHz clock cycles, Four 5-bit values (one per input) packed in to 32-bit word]" - pychipsBoard.write("PulseDelayW",int(pulseDelay)) - pulseDelayR = pychipsBoard.read("PulseDelayR") - print "\t Pulse delay read back as:", hex(pulseDelayR) - - print "\tSETTING TRIGGER PATTERN (for external triggers) TO 0x%08X. Two 16-bit patterns packed into 32 bit word " %(triggerPattern) - pychipsBoard.write("TriggerPatternW",int(triggerPattern)) - triggerPatternR = pychipsBoard.read("TriggerPatternR") - print "\t Trigger pattern read back as: 0x%08X " % (triggerPatternR) - - print "\tENABLING DUT(s): Mask= " , hex(DUTMask) - pychipsBoard.write("DUTMaskW",int(DUTMask)) - DUTMaskR = pychipsBoard.read("DUTMaskR") - print "\t DUTMask read back as:" , hex(DUTMaskR) - - print "\tSETTING ALL DUTs IN AIDA MODE" - pychipsBoard.write("DUTInterfaceModeW", 0xFF) - DUTInterfaceModeR = pychipsBoard.read("DUTInterfaceModeR") - print "\t DUT mode read back as:" , DUTInterfaceModeR - - print "\tSET DUT MODE MODIFIER" - pychipsBoard.write("DUTInterfaceModeModifierW", 0xFF) - DUTInterfaceModeModifierR = pychipsBoard.read("DUTInterfaceModeModifierR") - print "\t DUT mode modifier read back as:" , DUTInterfaceModeModifierR - - if listenForTelescopeShutter: - print "\tSET IgnoreShutterVetoW TO LISTEN FOR VETO FROM SHUTTER" - pychipsBoard.write("IgnoreShutterVetoW",0) - else: - print "\tSET IgnoreShutterVetoW TO IGNORE VETO FROM SHUTTER" - pychipsBoard.write("IgnoreShutterVetoW",1) - IgnoreShutterVeto = pychipsBoard.read("IgnoreShutterVetoR") - print "\t IgnoreShutterVeto read back as:" , IgnoreShutterVeto - - print "\tSETTING IGNORE VETO BY DUT BUSY MASK TO" , hex(ignoreDUTBusy) - pychipsBoard.write("IgnoreDUTBusyW",int(ignoreDUTBusy)) - IgnoreDUTBusy = pychipsBoard.read("IgnoreDUTBusyR") - print "\t IgnoreDUTBusy read back as:" , hex(IgnoreDUTBusy) - -#print "Enabling handshake: No-handshake" -#board.write("HandshakeTypeW",1) - - - print "\tSETTING INTERNAL TRIGGER INTERVAL TO" , triggerInterval , "(zero= no internal triggers)" - if triggerInterval == 0: - internalTriggerFreq = 0 - else: - internalTriggerFreq = 160000.0/triggerInterval - print "\tINTERNAL TRIGGER FREQUENCY= " , internalTriggerFreq , " kHz" - pychipsBoard.write("InternalTriggerIntervalW",triggerInterval) #0->Internal pulse generator disabled. Any other value will generate pulses with a frequency of n*6.25ns - trigIntervalR = pychipsBoard.read("InternalTriggerIntervalR") - print "\t Trigger interval read back as:", trigIntervalR - print "AIDA TLU SETUP COMPLETED" diff --git a/TLU_v1c/scripts/output_check.csv b/TLU_v1c/scripts/output_check.csv deleted file mode 100644 index 7932e23..0000000 --- a/TLU_v1c/scripts/output_check.csv +++ /dev/null @@ -1,2727 +0,0 @@ -1,6027,12,8,8,8,16,16,0,0,0,0,0,0 -2,6047,11,8,8,8,16,16,0,0,0,0,0,0 -3,6067,10,8,8,8,16,16,0,0,0,0,0,0 -4,6087,8,8,8,8,16,16,0,0,0,0,0,0 -5,6106,6,0,0,0,8,8,0,0,0,0,0,0 -7,6126,6,0,0,0,8,8,0,0,0,0,0,0 -9,6146,4,0,0,0,8,8,0,0,0,0,0,0 -10,6166,3,0,0,0,8,8,0,0,0,0,0,0 -11,6186,2,0,0,0,8,8,0,0,0,0,0,0 -12,6206,0,0,0,0,8,8,0,0,0,0,0,0 -13,6226,31,24,24,24,0,0,0,0,0,0,0,0 -15,6246,30,24,24,24,0,0,0,0,0,0,0,0 -17,6266,28,24,24,24,0,0,0,0,0,0,0,0 -18,6286,27,24,24,24,0,0,0,0,0,0,0,0 -19,6306,26,24,24,24,0,0,0,0,0,0,0,0 -20,6326,24,24,24,24,0,0,0,0,0,0,0,0 -21,6346,23,16,16,16,24,24,0,0,0,0,0,0 -23,6366,22,16,16,16,24,24,0,0,0,0,0,0 -25,6386,20,16,16,16,24,24,0,0,0,0,0,0 -26,6406,20,16,16,16,24,24,0,0,0,0,0,0 -27,6426,18,16,16,16,24,24,0,0,0,0,0,0 -28,6446,17,16,16,16,24,24,0,0,0,0,0,0 -29,6466,16,16,16,16,24,24,0,0,0,0,0,0 -30,6486,14,8,8,8,16,16,0,0,0,0,0,0 -32,6506,13,8,8,8,16,16,0,0,0,0,0,0 -34,6526,12,8,8,8,16,16,0,0,0,0,0,0 -35,6546,10,8,8,8,16,16,0,0,0,0,0,0 -36,6566,9,8,8,8,16,16,0,0,0,0,0,0 -37,6586,8,8,8,8,16,16,0,0,0,0,0,0 -38,6605,6,0,0,0,8,8,0,0,0,0,0,0 -40,6625,5,0,0,0,8,8,0,0,0,0,0,0 -41,6645,4,0,0,0,8,8,0,0,0,0,0,0 -42,6665,2,0,0,0,8,8,0,0,0,0,0,0 -43,6685,1,0,0,0,8,8,0,0,0,0,0,0 -44,6705,0,0,0,0,8,8,0,0,0,0,0,0 -45,6725,30,24,24,24,0,0,0,0,0,0,0,0 -47,6745,29,24,24,24,0,0,0,0,0,0,0,0 -48,6765,28,24,24,24,0,0,0,0,0,0,0,0 -49,6785,26,24,24,24,0,0,0,0,0,0,0,0 -50,6805,24,24,24,24,0,0,0,0,0,0,0,0 -51,6825,23,16,16,16,24,24,0,0,0,0,0,0 -53,6845,22,16,16,16,24,24,0,0,0,0,0,0 -55,6865,21,16,16,16,24,24,0,0,0,0,0,0 -56,6885,20,16,16,16,24,24,0,0,0,0,0,0 -57,6905,18,16,16,16,24,24,0,0,0,0,0,0 -58,6925,17,16,16,16,24,24,0,0,0,0,0,0 -59,6945,16,16,16,16,24,24,0,0,0,0,0,0 -60,6965,14,8,8,8,16,16,0,0,0,0,0,0 -62,6985,13,8,8,8,16,16,0,0,0,0,0,0 -64,7005,12,8,8,8,16,16,0,0,0,0,0,0 -65,7025,10,8,8,8,16,16,0,0,0,0,0,0 -66,7045,9,8,8,8,16,16,0,0,0,0,0,0 -67,7065,8,8,8,8,16,16,0,0,0,0,0,0 -68,7084,6,0,0,0,8,8,0,0,0,0,0,0 -70,7104,4,0,0,0,8,8,0,0,0,0,0,0 -71,7124,4,0,0,0,8,8,0,0,0,0,0,0 -72,7144,2,0,0,0,8,8,0,0,0,0,0,0 -73,7164,0,0,0,0,8,8,0,0,0,0,0,0 -74,7184,31,24,24,24,0,0,0,0,0,0,0,0 -76,7204,30,24,24,24,0,0,0,0,0,0,0,0 -78,7224,28,24,24,24,0,0,0,0,0,0,0,0 -79,7244,27,24,24,24,0,0,0,0,0,0,0,0 -80,7264,26,24,24,24,0,0,0,0,0,0,0,0 -81,7284,24,24,24,24,0,0,0,0,0,0,0,0 -82,7304,23,16,16,16,24,24,0,0,0,0,0,0 -84,7324,22,16,16,16,24,24,0,0,0,0,0,0 -86,7344,20,16,16,16,24,24,0,0,0,0,0,0 -87,7364,20,16,16,16,24,24,0,0,0,0,0,0 -88,7384,18,16,16,16,24,24,0,0,0,0,0,0 -89,7404,16,16,16,16,24,24,0,0,0,0,0,0 -90,7424,16,16,16,16,24,24,0,0,0,0,0,0 -91,7444,14,8,8,8,16,16,0,0,0,0,0,0 -93,7464,13,8,8,8,16,16,0,0,0,0,0,0 -95,7484,12,8,8,8,16,16,0,0,0,0,0,0 -96,7504,10,8,8,8,16,16,0,0,0,0,0,0 -97,7524,9,8,8,8,16,16,0,0,0,0,0,0 -98,7544,8,8,8,8,16,16,0,0,0,0,0,0 -99,7563,6,0,0,0,8,8,0,0,0,0,0,0 -101,7583,5,0,0,0,8,8,0,0,0,0,0,0 -103,7603,4,0,0,0,8,8,0,0,0,0,0,0 -104,7623,2,0,0,0,8,8,0,0,0,0,0,0 -105,7643,1,0,0,0,8,8,0,0,0,0,0,0 -106,7663,0,0,0,0,8,8,0,0,0,0,0,0 -107,7683,30,24,24,24,0,0,0,0,0,0,0,0 -109,7703,29,24,24,24,0,0,0,0,0,0,0,0 -111,7723,28,24,24,24,0,0,0,0,0,0,0,0 -112,7743,27,24,24,24,0,0,0,0,0,0,0,0 -113,7763,26,24,24,24,0,0,0,0,0,0,0,0 -114,7783,24,24,24,24,0,0,0,0,0,0,0,0 -115,7803,23,16,16,16,24,24,0,0,0,0,0,0 -117,7823,22,16,16,16,24,24,0,0,0,0,0,0 -119,7843,20,16,16,16,24,24,0,0,0,0,0,0 -120,7863,19,16,16,16,24,24,0,0,0,0,0,0 -121,7883,18,16,16,16,24,24,0,0,0,0,0,0 -122,7903,16,16,16,16,24,24,0,0,0,0,0,0 -123,7923,15,8,8,8,16,16,0,0,0,0,0,0 -125,7943,14,8,8,8,16,16,0,0,0,0,0,0 -127,7963,12,8,8,8,16,16,0,0,0,0,0,0 -128,7983,11,8,8,8,16,16,0,0,0,0,0,0 -129,8003,10,8,8,8,16,16,0,0,0,0,0,0 -130,8023,8,8,8,8,16,16,0,0,0,0,0,0 -131,8042,7,0,0,0,8,8,0,0,0,0,0,0 -133,8062,6,0,0,0,8,8,0,0,0,0,0,0 -135,8082,4,0,0,0,8,8,0,0,0,0,0,0 -136,8102,3,0,0,0,8,8,0,0,0,0,0,0 -137,8122,2,0,0,0,8,8,0,0,0,0,0,0 -138,8142,0,0,0,0,8,8,0,0,0,0,0,0 -139,8162,31,24,24,24,0,0,0,0,0,0,0,0 -141,8182,30,24,24,24,0,0,0,0,0,0,0,0 -143,8202,28,24,24,24,0,0,0,0,0,0,0,0 -144,8222,27,24,24,24,0,0,0,0,0,0,0,0 -145,8242,26,24,24,24,0,0,0,0,0,0,0,0 -146,8262,24,24,24,24,0,0,0,0,0,0,0,0 -147,8282,23,16,16,16,24,24,0,0,0,0,0,0 -149,8302,22,16,16,16,24,24,0,0,0,0,0,0 -151,8322,20,16,16,16,24,24,0,0,0,0,0,0 -152,8342,19,16,16,16,24,24,0,0,0,0,0,0 -153,8362,18,16,16,16,24,24,0,0,0,0,0,0 -154,8382,16,16,16,16,24,24,0,0,0,0,0,0 -155,8402,15,8,8,8,16,16,0,0,0,0,0,0 -157,8422,14,8,8,8,16,16,0,0,0,0,0,0 -159,8442,12,8,8,8,16,16,0,0,0,0,0,0 -160,8462,11,8,8,8,16,16,0,0,0,0,0,0 -161,8482,10,8,8,8,16,16,0,0,0,0,0,0 -162,8502,8,8,8,8,16,16,0,0,0,0,0,0 -163,8521,7,0,0,0,8,8,0,0,0,0,0,0 -165,8541,6,0,0,0,8,8,0,0,0,0,0,0 -167,8561,4,0,0,0,8,8,0,0,0,0,0,0 -168,8581,3,0,0,0,8,8,0,0,0,0,0,0 -169,8601,2,0,0,0,8,8,0,0,0,0,0,0 -170,8621,0,0,0,0,8,8,0,0,0,0,0,0 -171,8641,31,24,24,24,0,0,0,0,0,0,0,0 -173,8661,30,24,24,24,0,0,0,0,0,0,0,0 -175,8681,28,24,24,24,0,0,0,0,0,0,0,0 -176,8701,27,24,24,24,0,0,0,0,0,0,0,0 -177,8721,26,24,24,24,0,0,0,0,0,0,0,0 -178,8741,24,24,24,24,0,0,0,0,0,0,0,0 -179,8761,23,16,16,16,24,24,0,0,0,0,0,0 -181,8781,22,16,16,16,24,24,0,0,0,0,0,0 -183,8801,20,16,16,16,24,24,0,0,0,0,0,0 -184,8821,19,16,16,16,24,24,0,0,0,0,0,0 -185,8841,18,16,16,16,24,24,0,0,0,0,0,0 -186,8861,16,16,16,16,24,24,0,0,0,0,0,0 -187,8881,15,8,8,8,16,16,0,0,0,0,0,0 -189,8901,14,8,8,8,16,16,0,0,0,0,0,0 -191,8921,12,8,8,8,16,16,0,0,0,0,0,0 -192,8941,11,8,8,8,16,16,0,0,0,0,0,0 -193,8961,10,8,8,8,16,16,0,0,0,0,0,0 -194,8981,8,8,8,8,16,16,0,0,0,0,0,0 -195,9000,7,0,0,0,8,8,0,0,0,0,0,0 -197,9020,6,0,0,0,8,8,0,0,0,0,0,0 -199,9040,4,0,0,0,8,8,0,0,0,0,0,0 -200,9060,3,0,0,0,8,8,0,0,0,0,0,0 -201,9080,2,0,0,0,8,8,0,0,0,0,0,0 -202,9100,0,0,0,0,8,8,0,0,0,0,0,0 -203,9120,31,24,24,24,0,0,0,0,0,0,0,0 -205,9140,30,24,24,24,0,0,0,0,0,0,0,0 -207,9160,28,24,24,24,0,0,0,0,0,0,0,0 -208,9180,27,24,24,24,0,0,0,0,0,0,0,0 -209,9200,26,24,24,24,0,0,0,0,0,0,0,0 -210,9220,24,24,24,24,0,0,0,0,0,0,0,0 -211,9240,23,16,16,16,24,24,0,0,0,0,0,0 -213,9260,22,16,16,16,24,24,0,0,0,0,0,0 -215,9280,20,16,16,16,24,24,0,0,0,0,0,0 -216,9300,19,16,16,16,24,24,0,0,0,0,0,0 -217,9320,18,16,16,16,24,24,0,0,0,0,0,0 -218,9340,16,16,16,16,24,24,0,0,0,0,0,0 -219,9360,15,8,8,8,16,16,0,0,0,0,0,0 -221,9380,14,8,8,8,16,16,0,0,0,0,0,0 -223,9400,12,8,8,8,16,16,0,0,0,0,0,0 -224,9420,11,8,8,8,16,16,0,0,0,0,0,0 -225,9440,10,8,8,8,16,16,0,0,0,0,0,0 -226,9460,8,8,8,8,16,16,0,0,0,0,0,0 -227,9479,7,0,0,0,8,8,0,0,0,0,0,0 -229,9499,6,0,0,0,8,8,0,0,0,0,0,0 -231,9519,4,0,0,0,8,8,0,0,0,0,0,0 -232,9539,3,0,0,0,8,8,0,0,0,0,0,0 -233,9559,2,0,0,0,8,8,0,0,0,0,0,0 -234,9579,0,0,0,0,8,8,0,0,0,0,0,0 -235,9599,31,24,24,24,0,0,0,0,0,0,0,0 -237,9619,30,24,24,24,0,0,0,0,0,0,0,0 -239,9639,28,24,24,24,0,0,0,0,0,0,0,0 -240,9659,27,24,24,24,0,0,0,0,0,0,0,0 -241,9679,26,24,24,24,0,0,0,0,0,0,0,0 -242,9699,24,24,24,24,0,0,0,0,0,0,0,0 -243,9719,23,16,16,16,24,24,0,0,0,0,0,0 -245,9739,22,16,16,16,24,24,0,0,0,0,0,0 -247,9759,21,16,16,16,24,24,0,0,0,0,0,0 -248,9779,20,16,16,16,24,24,0,0,0,0,0,0 -249,9799,18,16,16,16,24,24,0,0,0,0,0,0 -250,9819,17,16,16,16,24,24,0,0,0,0,0,0 -251,9839,16,16,16,16,24,24,0,0,0,0,0,0 -252,9859,14,8,8,8,16,16,0,0,0,0,0,0 -254,9879,13,8,8,8,16,16,0,0,0,0,0,0 -255,9899,12,8,8,8,16,16,0,0,0,0,0,0 -256,9919,10,8,8,8,16,16,0,0,0,0,0,0 -257,9939,9,8,8,8,16,16,0,0,0,0,0,0 -258,9959,8,8,8,8,16,16,0,0,0,0,0,0 -259,9978,6,0,0,0,8,8,0,0,0,0,0,0 -261,9998,5,0,0,0,8,8,0,0,0,0,0,0 -263,10018,4,0,0,0,8,8,0,0,0,0,0,0 -264,10038,2,0,0,0,8,8,0,0,0,0,0,0 -265,10058,1,0,0,0,8,8,0,0,0,0,0,0 -266,10078,0,0,0,0,8,8,0,0,0,0,0,0 -267,10098,30,24,24,24,0,0,0,0,0,0,0,0 -269,10118,29,24,24,24,0,0,0,0,0,0,0,0 -271,10138,28,24,24,24,0,0,0,0,0,0,0,0 -272,10158,26,24,24,24,0,0,0,0,0,0,0,0 -273,10178,25,24,24,24,0,0,0,0,0,0,0,0 -274,10198,24,24,24,24,0,0,0,0,0,0,0,0 -275,10218,22,16,16,16,24,24,0,0,0,0,0,0 -277,10238,21,16,16,16,24,24,0,0,0,0,0,0 -279,10258,20,16,16,16,24,24,0,0,0,0,0,0 -280,10278,18,16,16,16,24,24,0,0,0,0,0,0 -281,10298,17,16,16,16,24,24,0,0,0,0,0,0 -282,10318,16,16,16,16,24,24,0,0,0,0,0,0 -283,10338,14,8,8,8,16,16,0,0,0,0,0,0 -285,10358,13,8,8,8,16,16,0,0,0,0,0,0 -287,10378,12,8,8,8,16,16,0,0,0,0,0,0 -288,10398,10,8,8,8,16,16,0,0,0,0,0,0 -289,10418,10,8,8,8,16,16,0,0,0,0,0,0 -290,10438,8,8,8,8,16,16,0,0,0,0,0,0 -291,10457,6,0,0,0,8,8,0,0,0,0,0,0 -293,10477,6,0,0,0,8,8,0,0,0,0,0,0 -295,10497,4,0,0,0,8,8,0,0,0,0,0,0 -296,10517,2,0,0,0,8,8,0,0,0,0,0,0 -297,10537,1,0,0,0,8,8,0,0,0,0,0,0 -298,10557,0,0,0,0,8,8,0,0,0,0,0,0 -299,10577,30,24,24,24,0,0,0,0,0,0,0,0 -301,10597,29,24,24,24,0,0,0,0,0,0,0,0 -303,10617,28,24,24,24,0,0,0,0,0,0,0,0 -304,10637,26,24,24,24,0,0,0,0,0,0,0,0 -305,10657,25,24,24,24,0,0,0,0,0,0,0,0 -306,10677,24,24,24,24,0,0,0,0,0,0,0,0 -307,10697,22,16,16,16,24,24,0,0,0,0,0,0 -309,10717,22,16,16,16,24,24,0,0,0,0,0,0 -311,10737,20,16,16,16,24,24,0,0,0,0,0,0 -312,10757,19,16,16,16,24,24,0,0,0,0,0,0 -313,10777,18,16,16,16,24,24,0,0,0,0,0,0 -314,10797,16,16,16,16,24,24,0,0,0,0,0,0 -315,10817,15,8,8,8,16,16,0,0,0,0,0,0 -317,10837,14,8,8,8,16,16,0,0,0,0,0,0 -319,10857,12,8,8,8,16,16,0,0,0,0,0,0 -320,10877,11,8,8,8,16,16,0,0,0,0,0,0 -321,10897,10,8,8,8,16,16,0,0,0,0,0,0 -322,10917,8,8,8,8,16,16,0,0,0,0,0,0 -323,10936,7,0,0,0,8,8,0,0,0,0,0,0 -325,10956,6,0,0,0,8,8,0,0,0,0,0,0 -327,10976,4,0,0,0,8,8,0,0,0,0,0,0 -328,10996,3,0,0,0,8,8,0,0,0,0,0,0 -329,11016,2,0,0,0,8,8,0,0,0,0,0,0 -330,11036,0,0,0,0,8,8,0,0,0,0,0,0 -331,11056,0,0,0,0,8,8,0,0,0,0,0,0 -332,11076,30,24,24,24,0,0,0,0,0,0,0,0 -334,11096,29,24,24,24,0,0,0,0,0,0,0,0 -335,11116,28,24,24,24,0,0,0,0,0,0,0,0 -336,11136,26,24,24,24,0,0,0,0,0,0,0,0 -337,11156,25,24,24,24,0,0,0,0,0,0,0,0 -338,11176,24,24,24,24,0,0,0,0,0,0,0,0 -339,11196,22,16,16,16,24,24,0,0,0,0,0,0 -341,11216,21,16,16,16,24,24,0,0,0,0,0,0 -343,11236,20,16,16,16,24,24,0,0,0,0,0,0 -344,11256,18,16,16,16,24,24,0,0,0,0,0,0 -345,11276,17,16,16,16,24,24,0,0,0,0,0,0 -346,11296,16,16,16,16,24,24,0,0,0,0,0,0 -347,11316,14,8,8,8,16,16,0,0,0,0,0,0 -349,11336,14,8,8,8,16,16,0,0,0,0,0,0 -351,11356,12,8,8,8,16,16,0,0,0,0,0,0 -352,11376,10,8,8,8,16,16,0,0,0,0,0,0 -353,11396,9,8,8,8,16,16,0,0,0,0,0,0 -354,11416,8,8,8,8,16,16,0,0,0,0,0,0 -355,11435,7,0,0,0,8,8,0,0,0,0,0,0 -357,11455,6,0,0,0,8,8,0,0,0,0,0,0 -359,11475,4,0,0,0,8,8,0,0,0,0,0,0 -360,11495,3,0,0,0,8,8,0,0,0,0,0,0 -361,11515,2,0,0,0,8,8,0,0,0,0,0,0 -362,11535,0,0,0,0,8,8,0,0,0,0,0,0 -363,11555,30,24,24,24,0,0,0,0,0,0,0,0 -365,11575,30,24,24,24,0,0,0,0,0,0,0,0 -367,11595,28,24,24,24,0,0,0,0,0,0,0,0 -368,11615,26,24,24,24,0,0,0,0,0,0,0,0 -369,11635,25,24,24,24,0,0,0,0,0,0,0,0 -370,11655,24,24,24,24,0,0,0,0,0,0,0,0 -371,11675,22,16,16,16,24,24,0,0,0,0,0,0 -373,11695,22,16,16,16,24,24,0,0,0,0,0,0 -375,11715,20,16,16,16,24,24,0,0,0,0,0,0 -376,11735,19,16,16,16,24,24,0,0,0,0,0,0 -377,11755,18,16,16,16,24,24,0,0,0,0,0,0 -378,11775,16,16,16,16,24,24,0,0,0,0,0,0 -379,11795,15,8,8,8,16,16,0,0,0,0,0,0 -381,11815,14,8,8,8,16,16,0,0,0,0,0,0 -383,11835,12,8,8,8,16,16,0,0,0,0,0,0 -384,11855,11,8,8,8,16,16,0,0,0,0,0,0 -385,11875,10,8,8,8,16,16,0,0,0,0,0,0 -386,11895,8,8,8,8,16,16,0,0,0,0,0,0 -387,11914,7,0,0,0,8,8,0,0,0,0,0,0 -389,11934,6,0,0,0,8,8,0,0,0,0,0,0 -391,11954,5,0,0,0,8,8,0,0,0,0,0,0 -392,11974,4,0,0,0,8,8,0,0,0,0,0,0 -393,11994,2,0,0,0,8,8,0,0,0,0,0,0 -394,12014,1,0,0,0,8,8,0,0,0,0,0,0 -395,12034,0,0,0,0,8,8,0,0,0,0,0,0 -396,12054,30,24,24,24,0,0,0,0,0,0,0,0 -398,12074,29,24,24,24,0,0,0,0,0,0,0,0 -399,12094,28,24,24,24,0,0,0,0,0,0,0,0 -400,12114,26,24,24,24,0,0,0,0,0,0,0,0 -401,12134,25,24,24,24,0,0,0,0,0,0,0,0 -402,12154,24,24,24,24,0,0,0,0,0,0,0,0 -403,12174,22,16,16,16,24,24,0,0,0,0,0,0 -405,12194,21,16,16,16,24,24,0,0,0,0,0,0 -406,12214,20,16,16,16,24,24,0,0,0,0,0,0 -407,12234,18,16,16,16,24,24,0,0,0,0,0,0 -408,12254,17,16,16,16,24,24,0,0,0,0,0,0 -409,12274,16,16,16,16,24,24,0,0,0,0,0,0 -410,12294,14,8,8,8,16,16,0,0,0,0,0,0 -412,12314,13,8,8,8,16,16,0,0,0,0,0,0 -414,12334,12,8,8,8,16,16,0,0,0,0,0,0 -415,12354,10,8,8,8,16,16,0,0,0,0,0,0 -416,12374,9,8,8,8,16,16,0,0,0,0,0,0 -417,12394,8,8,8,8,16,16,0,0,0,0,0,0 -418,12413,6,0,0,0,8,8,0,0,0,0,0,0 -420,12433,5,0,0,0,8,8,0,0,0,0,0,0 -422,12453,4,0,0,0,8,8,0,0,0,0,0,0 -423,12473,2,0,0,0,8,8,0,0,0,0,0,0 -424,12493,1,0,0,0,8,8,0,0,0,0,0,0 -425,12513,0,0,0,0,8,8,0,0,0,0,0,0 -426,12533,30,24,24,24,0,0,0,0,0,0,0,0 -428,12553,29,24,24,24,0,0,0,0,0,0,0,0 -429,12573,28,24,24,24,0,0,0,0,0,0,0,0 -430,12593,26,24,24,24,0,0,0,0,0,0,0,0 -431,12613,25,24,24,24,0,0,0,0,0,0,0,0 -432,12633,24,24,24,24,0,0,0,0,0,0,0,0 -433,12653,22,16,16,16,24,24,0,0,0,0,0,0 -435,12673,21,16,16,16,24,24,0,0,0,0,0,0 -437,12693,20,16,16,16,24,24,0,0,0,0,0,0 -438,12713,18,16,16,16,24,24,0,0,0,0,0,0 -439,12733,17,16,16,16,24,24,0,0,0,0,0,0 -440,12753,16,16,16,16,24,24,0,0,0,0,0,0 -441,12773,14,8,8,8,16,16,0,0,0,0,0,0 -443,12793,13,8,8,8,16,16,0,0,0,0,0,0 -445,12813,12,8,8,8,16,16,0,0,0,0,0,0 -446,12833,10,8,8,8,16,16,0,0,0,0,0,0 -447,12853,9,8,8,8,16,16,0,0,0,0,0,0 -448,12873,8,8,8,8,16,16,0,0,0,0,0,0 -449,12892,6,0,0,0,8,8,0,0,0,0,0,0 -451,12912,5,0,0,0,8,8,0,0,0,0,0,0 -452,12932,4,0,0,0,8,8,0,0,0,0,0,0 -453,12952,2,0,0,0,8,8,0,0,0,0,0,0 -454,12972,1,0,0,0,8,8,0,0,0,0,0,0 -455,12992,0,0,0,0,8,8,0,0,0,0,0,0 -456,13012,30,24,24,24,0,0,0,0,0,0,0,0 -458,13032,29,24,24,24,0,0,0,0,0,0,0,0 -460,13052,28,24,24,24,0,0,0,0,0,0,0,0 -461,13072,26,24,24,24,0,0,0,0,0,0,0,0 -462,13092,26,24,24,24,0,0,0,0,0,0,0,0 -463,13112,24,24,24,24,0,0,0,0,0,0,0,0 -464,13132,23,16,16,16,24,24,0,0,0,0,0,0 -466,13152,22,16,16,16,24,24,0,0,0,0,0,0 -468,13172,20,16,16,16,24,24,0,0,0,0,0,0 -469,13192,19,16,16,16,24,24,0,0,0,0,0,0 -470,13212,18,16,16,16,24,24,0,0,0,0,0,0 -471,13232,16,16,16,16,24,24,0,0,0,0,0,0 -472,13252,15,8,8,8,16,16,0,0,0,0,0,0 -474,13272,14,8,8,8,16,16,0,0,0,0,0,0 -476,13292,12,8,8,8,16,16,0,0,0,0,0,0 -477,13312,11,8,8,8,16,16,0,0,0,0,0,0 -478,13332,10,8,8,8,16,16,0,0,0,0,0,0 -479,13352,8,8,8,8,16,16,0,0,0,0,0,0 -480,13371,7,0,0,0,8,8,0,0,0,0,0,0 -482,13391,6,0,0,0,8,8,0,0,0,0,0,0 -484,13411,4,0,0,0,8,8,0,0,0,0,0,0 -485,13431,3,0,0,0,8,8,0,0,0,0,0,0 -486,13451,2,0,0,0,8,8,0,0,0,0,0,0 -487,13471,0,0,0,0,8,8,0,0,0,0,0,0 -488,13491,31,24,24,24,0,0,0,0,0,0,0,0 -490,13511,30,24,24,24,0,0,0,0,0,0,0,0 -492,13531,28,24,24,24,0,0,0,0,0,0,0,0 -493,13551,26,24,24,24,0,0,0,0,0,0,0,0 -494,13571,25,24,24,24,0,0,0,0,0,0,0,0 -495,13591,24,24,24,24,0,0,0,0,0,0,0,0 -496,13611,22,16,16,16,24,24,0,0,0,0,0,0 -498,13631,21,16,16,16,24,24,0,0,0,0,0,0 -500,13651,20,16,16,16,24,24,0,0,0,0,0,0 -501,13671,18,16,16,16,24,24,0,0,0,0,0,0 -502,13691,18,16,16,16,24,24,0,0,0,0,0,0 -503,13711,16,16,16,16,24,24,0,0,0,0,0,0 -504,13731,15,8,8,8,16,16,0,0,0,0,0,0 -506,13751,14,8,8,8,16,16,0,0,0,0,0,0 -508,13771,12,8,8,8,16,16,0,0,0,0,0,0 -509,13791,11,8,8,8,16,16,0,0,0,0,0,0 -510,13811,10,8,8,8,16,16,0,0,0,0,0,0 -511,13831,8,8,8,8,16,16,0,0,0,0,0,0 -512,13850,7,0,0,0,8,8,0,0,0,0,0,0 -514,13870,6,0,0,0,8,8,0,0,0,0,0,0 -516,13890,4,0,0,0,8,8,0,0,0,0,0,0 -517,13910,3,0,0,0,8,8,0,0,0,0,0,0 -518,13930,2,0,0,0,8,8,0,0,0,0,0,0 -519,13950,1,0,0,0,8,8,0,0,0,0,0,0 -520,13970,0,0,0,0,8,8,0,0,0,0,0,0 -521,13990,30,24,24,24,0,0,0,0,0,0,0,0 -523,14010,28,24,24,24,0,0,0,0,0,0,0,0 -524,14030,28,24,24,24,0,0,0,0,0,0,0,0 -525,14050,26,24,24,24,0,0,0,0,0,0,0,0 -526,14070,25,24,24,24,0,0,0,0,0,0,0,0 -527,14090,24,24,24,24,0,0,0,0,0,0,0,0 -528,14110,22,16,16,16,24,24,0,0,0,0,0,0 -530,14130,21,16,16,16,24,24,0,0,0,0,0,0 -532,14150,20,16,16,16,24,24,0,0,0,0,0,0 -533,14170,18,16,16,16,24,24,0,0,0,0,0,0 -534,14190,17,16,16,16,24,24,0,0,0,0,0,0 -535,14210,16,16,16,16,24,24,0,0,0,0,0,0 -536,14230,14,8,8,8,16,16,0,0,0,0,0,0 -538,14250,13,8,8,8,16,16,0,0,0,0,0,0 -540,14270,12,8,8,8,16,16,0,0,0,0,0,0 -541,14290,10,8,8,8,16,16,0,0,0,0,0,0 -542,14310,9,8,8,8,16,16,0,0,0,0,0,0 -543,14330,8,8,8,8,16,16,0,0,0,0,0,0 -544,14349,6,0,0,0,8,8,0,0,0,0,0,0 -546,14369,5,0,0,0,8,8,0,0,0,0,0,0 -548,14389,4,0,0,0,8,8,0,0,0,0,0,0 -549,14409,2,0,0,0,8,8,0,0,0,0,0,0 -550,14429,1,0,0,0,8,8,0,0,0,0,0,0 -551,14449,0,0,0,0,8,8,0,0,0,0,0,0 -552,14469,30,24,24,24,0,0,0,0,0,0,0,0 -554,14489,29,24,24,24,0,0,0,0,0,0,0,0 -556,14509,28,24,24,24,0,0,0,0,0,0,0,0 -557,14529,27,24,24,24,0,0,0,0,0,0,0,0 -558,14549,26,24,24,24,0,0,0,0,0,0,0,0 -559,14569,24,24,24,24,0,0,0,0,0,0,0,0 -560,14589,23,16,16,16,24,24,0,0,0,0,0,0 -562,14609,22,16,16,16,24,24,0,0,0,0,0,0 -564,14629,20,16,16,16,24,24,0,0,0,0,0,0 -565,14649,19,16,16,16,24,24,0,0,0,0,0,0 -566,14669,18,16,16,16,24,24,0,0,0,0,0,0 -567,14689,16,16,16,16,24,24,0,0,0,0,0,0 -568,14709,15,8,8,8,16,16,0,0,0,0,0,0 -570,14729,14,8,8,8,16,16,0,0,0,0,0,0 -572,14749,12,8,8,8,16,16,0,0,0,0,0,0 -573,14769,11,8,8,8,16,16,0,0,0,0,0,0 -574,14789,10,8,8,8,16,16,0,0,0,0,0,0 -575,14809,8,8,8,8,16,16,0,0,0,0,0,0 -576,14828,7,0,0,0,8,8,0,0,0,0,0,0 -578,14848,6,0,0,0,8,8,0,0,0,0,0,0 -580,14868,4,0,0,0,8,8,0,0,0,0,0,0 -581,14888,3,0,0,0,8,8,0,0,0,0,0,0 -582,14908,2,0,0,0,8,8,0,0,0,0,0,0 -583,14928,0,0,0,0,8,8,0,0,0,0,0,0 -584,14948,31,24,24,24,0,0,0,0,0,0,0,0 -586,14968,30,24,24,24,0,0,0,0,0,0,0,0 -588,14988,28,24,24,24,0,0,0,0,0,0,0,0 -589,15008,27,24,24,24,0,0,0,0,0,0,0,0 -590,15028,26,24,24,24,0,0,0,0,0,0,0,0 -591,15048,24,24,24,24,0,0,0,0,0,0,0,0 -592,15068,23,16,16,16,24,24,0,0,0,0,0,0 -594,15088,22,16,16,16,24,24,0,0,0,0,0,0 -596,15108,20,16,16,16,24,24,0,0,0,0,0,0 -597,15128,19,16,16,16,24,24,0,0,0,0,0,0 -598,15148,18,16,16,16,24,24,0,0,0,0,0,0 -599,15168,16,16,16,16,24,24,0,0,0,0,0,0 -600,15188,15,8,8,8,16,16,0,0,0,0,0,0 -602,15208,14,8,8,8,16,16,0,0,0,0,0,0 -604,15228,12,8,8,8,16,16,0,0,0,0,0,0 -605,15248,11,8,8,8,16,16,0,0,0,0,0,0 -606,15268,10,8,8,8,16,16,0,0,0,0,0,0 -607,15288,8,8,8,8,16,16,0,0,0,0,0,0 -608,15308,8,8,8,8,16,16,0,0,0,0,0,0 -609,15327,6,0,0,0,8,8,0,0,0,0,0,0 -611,15347,5,0,0,0,8,8,0,0,0,0,0,0 -612,15367,4,0,0,0,8,8,0,0,0,0,0,0 -613,15387,2,0,0,0,8,8,0,0,0,0,0,0 -614,15407,1,0,0,0,8,8,0,0,0,0,0,0 -615,15427,0,0,0,0,8,8,0,0,0,0,0,0 -616,15447,30,24,24,24,0,0,0,0,0,0,0,0 -618,15467,29,24,24,24,0,0,0,0,0,0,0,0 -620,15487,28,24,24,24,0,0,0,0,0,0,0,0 -621,15507,26,24,24,24,0,0,0,0,0,0,0,0 -622,15527,25,24,24,24,0,0,0,0,0,0,0,0 -623,15547,24,24,24,24,0,0,0,0,0,0,0,0 -624,15567,22,16,16,16,24,24,0,0,0,0,0,0 -626,15587,21,16,16,16,24,24,0,0,0,0,0,0 -628,15607,20,16,16,16,24,24,0,0,0,0,0,0 -629,15627,18,16,16,16,24,24,0,0,0,0,0,0 -630,15647,17,16,16,16,24,24,0,0,0,0,0,0 -631,15667,16,16,16,16,24,24,0,0,0,0,0,0 -632,15687,14,8,8,8,16,16,0,0,0,0,0,0 -634,15707,13,8,8,8,16,16,0,0,0,0,0,0 -636,15727,12,8,8,8,16,16,0,0,0,0,0,0 -637,15747,11,8,8,8,16,16,0,0,0,0,0,0 -638,15767,10,8,8,8,16,16,0,0,0,0,0,0 -639,15787,8,8,8,8,16,16,0,0,0,0,0,0 -640,15806,7,0,0,0,8,8,0,0,0,0,0,0 -642,15826,6,0,0,0,8,8,0,0,0,0,0,0 -644,15846,4,0,0,0,8,8,0,0,0,0,0,0 -645,15866,3,0,0,0,8,8,0,0,0,0,0,0 -646,15886,2,0,0,0,8,8,0,0,0,0,0,0 -647,15906,0,0,0,0,8,8,0,0,0,0,0,0 -648,15926,31,24,24,24,0,0,0,0,0,0,0,0 -650,15946,30,24,24,24,0,0,0,0,0,0,0,0 -652,15966,28,24,24,24,0,0,0,0,0,0,0,0 -653,15986,27,24,24,24,0,0,0,0,0,0,0,0 -654,16006,26,24,24,24,0,0,0,0,0,0,0,0 -655,16026,24,24,24,24,0,0,0,0,0,0,0,0 -656,16046,23,16,16,16,24,24,0,0,0,0,0,0 -658,16066,22,16,16,16,24,24,0,0,0,0,0,0 -660,16086,20,16,16,16,24,24,0,0,0,0,0,0 -661,16106,19,16,16,16,24,24,0,0,0,0,0,0 -662,16126,18,16,16,16,24,24,0,0,0,0,0,0 -663,16146,16,16,16,16,24,24,0,0,0,0,0,0 -664,16166,15,8,8,8,16,16,0,0,0,0,0,0 -666,16186,14,8,8,8,16,16,0,0,0,0,0,0 -668,16206,13,8,8,8,16,16,0,0,0,0,0,0 -670,16226,12,8,8,8,16,16,0,0,0,0,0,0 -671,16246,10,8,8,8,16,16,0,0,0,0,0,0 -672,16266,9,8,8,8,16,16,0,0,0,0,0,0 -673,16286,8,8,8,8,16,16,0,0,0,0,0,0 -674,16305,6,0,0,0,8,8,0,0,0,0,0,0 -676,16325,5,0,0,0,8,8,0,0,0,0,0,0 -678,16345,4,0,0,0,8,8,0,0,0,0,0,0 -679,16365,2,0,0,0,8,8,0,0,0,0,0,0 -680,16385,1,0,0,0,8,8,0,0,0,0,0,0 -681,16405,0,0,0,0,8,8,0,0,0,0,0,0 -682,16425,30,24,24,24,0,0,0,0,0,0,0,0 -684,16445,29,24,24,24,0,0,0,0,0,0,0,0 -686,16465,28,24,24,24,0,0,0,0,0,0,0,0 -687,16485,26,24,24,24,0,0,0,0,0,0,0,0 -688,16505,25,24,24,24,0,0,0,0,0,0,0,0 -689,16525,24,24,24,24,0,0,0,0,0,0,0,0 -690,16545,22,16,16,16,24,24,0,0,0,0,0,0 -692,16565,21,16,16,16,24,24,0,0,0,0,0,0 -694,16585,20,16,16,16,24,24,0,0,0,0,0,0 -695,16605,18,16,16,16,24,24,0,0,0,0,0,0 -696,16625,17,16,16,16,24,24,0,0,0,0,0,0 -697,16645,16,16,16,16,24,24,0,0,0,0,0,0 -698,16665,14,8,8,8,16,16,0,0,0,0,0,0 -700,16685,13,8,8,8,16,16,0,0,0,0,0,0 -702,16705,12,8,8,8,16,16,0,0,0,0,0,0 -703,16725,10,8,8,8,16,16,0,0,0,0,0,0 -704,16745,9,8,8,8,16,16,0,0,0,0,0,0 -705,16765,8,8,8,8,16,16,0,0,0,0,0,0 -706,16784,6,0,0,0,8,8,0,0,0,0,0,0 -708,16804,5,0,0,0,8,8,0,0,0,0,0,0 -710,16824,4,0,0,0,8,8,0,0,0,0,0,0 -711,16844,2,0,0,0,8,8,0,0,0,0,0,0 -712,16864,1,0,0,0,8,8,0,0,0,0,0,0 -713,16884,0,0,0,0,8,8,0,0,0,0,0,0 -714,16904,30,24,24,24,0,0,0,0,0,0,0,0 -716,16924,29,24,24,24,0,0,0,0,0,0,0,0 -718,16944,28,24,24,24,0,0,0,0,0,0,0,0 -719,16964,26,24,24,24,0,0,0,0,0,0,0,0 -720,16984,25,24,24,24,0,0,0,0,0,0,0,0 -721,17004,24,24,24,24,0,0,0,0,0,0,0,0 -722,17024,22,16,16,16,24,24,0,0,0,0,0,0 -724,17044,21,16,16,16,24,24,0,0,0,0,0,0 -726,17064,20,16,16,16,24,24,0,0,0,0,0,0 -727,17084,18,16,16,16,24,24,0,0,0,0,0,0 -728,17104,18,16,16,16,24,24,0,0,0,0,0,0 -729,17124,16,16,16,16,24,24,0,0,0,0,0,0 -730,17144,15,8,8,8,16,16,0,0,0,0,0,0 -732,17164,14,8,8,8,16,16,0,0,0,0,0,0 -734,17184,12,8,8,8,16,16,0,0,0,0,0,0 -735,17204,11,8,8,8,16,16,0,0,0,0,0,0 -736,17224,10,8,8,8,16,16,0,0,0,0,0,0 -737,17244,8,8,8,8,16,16,0,0,0,0,0,0 -738,17263,7,0,0,0,8,8,0,0,0,0,0,0 -740,17283,6,0,0,0,8,8,0,0,0,0,0,0 -742,17303,4,0,0,0,8,8,0,0,0,0,0,0 -743,17323,4,0,0,0,8,8,0,0,0,0,0,0 -744,17343,2,0,0,0,8,8,0,0,0,0,0,0 -745,17363,1,0,0,0,8,8,0,0,0,0,0,0 -746,17383,0,0,0,0,8,8,0,0,0,0,0,0 -747,17403,30,24,24,24,0,0,0,0,0,0,0,0 -749,17423,29,24,24,24,0,0,0,0,0,0,0,0 -750,17443,28,24,24,24,0,0,0,0,0,0,0,0 -751,17463,26,24,24,24,0,0,0,0,0,0,0,0 -752,17483,25,24,24,24,0,0,0,0,0,0,0,0 -753,17503,24,24,24,24,0,0,0,0,0,0,0,0 -754,17523,22,16,16,16,24,24,0,0,0,0,0,0 -756,17543,21,16,16,16,24,24,0,0,0,0,0,0 -758,17563,20,16,16,16,24,24,0,0,0,0,0,0 -759,17583,18,16,16,16,24,24,0,0,0,0,0,0 -760,17603,18,16,16,16,24,24,0,0,0,0,0,0 -761,17623,16,16,16,16,24,24,0,0,0,0,0,0 -762,17643,15,8,8,8,16,16,0,0,0,0,0,0 -764,17663,14,8,8,8,16,16,0,0,0,0,0,0 -766,17683,12,8,8,8,16,16,0,0,0,0,0,0 -767,17703,11,8,8,8,16,16,0,0,0,0,0,0 -768,17723,10,8,8,8,16,16,0,0,0,0,0,0 -769,17743,8,8,8,8,16,16,0,0,0,0,0,0 -770,17762,7,0,0,0,8,8,0,0,0,0,0,0 -772,17782,6,0,0,0,8,8,0,0,0,0,0,0 -774,17802,5,0,0,0,8,8,0,0,0,0,0,0 -776,17822,4,0,0,0,8,8,0,0,0,0,0,0 -777,17842,2,0,0,0,8,8,0,0,0,0,0,0 -778,17862,1,0,0,0,8,8,0,0,0,0,0,0 -779,17882,0,0,0,0,8,8,0,0,0,0,0,0 -780,17902,30,24,24,24,0,0,0,0,0,0,0,0 -782,17922,30,24,24,24,0,0,0,0,0,0,0,0 -784,17942,28,24,24,24,0,0,0,0,0,0,0,0 -785,17962,27,24,24,24,0,0,0,0,0,0,0,0 -786,17982,26,24,24,24,0,0,0,0,0,0,0,0 -787,18002,24,24,24,24,0,0,0,0,0,0,0,0 -788,18022,23,16,16,16,24,24,0,0,0,0,0,0 -790,18042,22,16,16,16,24,24,0,0,0,0,0,0 -792,18062,20,16,16,16,24,24,0,0,0,0,0,0 -793,18082,19,16,16,16,24,24,0,0,0,0,0,0 -794,18102,18,16,16,16,24,24,0,0,0,0,0,0 -795,18122,16,16,16,16,24,24,0,0,0,0,0,0 -796,18142,16,16,16,16,24,24,0,0,0,0,0,0 -797,18162,14,8,8,8,16,16,0,0,0,0,0,0 -799,18182,13,8,8,8,16,16,0,0,0,0,0,0 -800,18202,12,8,8,8,16,16,0,0,0,0,0,0 -801,18222,10,8,8,8,16,16,0,0,0,0,0,0 -802,18242,9,8,8,8,16,16,0,0,0,0,0,0 -803,18262,8,8,8,8,16,16,0,0,0,0,0,0 -804,18281,6,0,0,0,8,8,0,0,0,0,0,0 -806,18301,5,0,0,0,8,8,0,0,0,0,0,0 -807,18321,4,0,0,0,8,8,0,0,0,0,0,0 -808,18341,2,0,0,0,8,8,0,0,0,0,0,0 -809,18361,1,0,0,0,8,8,0,0,0,0,0,0 -810,18381,0,0,0,0,8,8,0,0,0,0,0,0 -811,18401,30,24,24,24,0,0,0,0,0,0,0,0 -813,18421,29,24,24,24,0,0,0,0,0,0,0,0 -815,18441,28,24,24,24,0,0,0,0,0,0,0,0 -816,18461,26,24,24,24,0,0,0,0,0,0,0,0 -817,18481,25,24,24,24,0,0,0,0,0,0,0,0 -818,18501,24,24,24,24,0,0,0,0,0,0,0,0 -819,18521,22,16,16,16,24,24,0,0,0,0,0,0 -821,18541,21,16,16,16,24,24,0,0,0,0,0,0 -823,18561,20,16,16,16,24,24,0,0,0,0,0,0 -824,18581,19,16,16,16,24,24,0,0,0,0,0,0 -825,18601,17,16,16,16,24,24,0,0,0,0,0,0 -826,18621,16,16,16,16,24,24,0,0,0,0,0,0 -827,18641,15,8,8,8,16,16,0,0,0,0,0,0 -829,18661,14,8,8,8,16,16,0,0,0,0,0,0 -831,18681,12,8,8,8,16,16,0,0,0,0,0,0 -832,18701,11,8,8,8,16,16,0,0,0,0,0,0 -833,18721,10,8,8,8,16,16,0,0,0,0,0,0 -834,18741,8,8,8,8,16,16,0,0,0,0,0,0 -835,18760,7,0,0,0,8,8,0,0,0,0,0,0 -837,18780,6,0,0,0,8,8,0,0,0,0,0,0 -839,18800,4,0,0,0,8,8,0,0,0,0,0,0 -840,18820,3,0,0,0,8,8,0,0,0,0,0,0 -841,18840,2,0,0,0,8,8,0,0,0,0,0,0 -842,18860,0,0,0,0,8,8,0,0,0,0,0,0 -843,18880,31,24,24,24,0,0,0,0,0,0,0,0 -845,18900,30,24,24,24,0,0,0,0,0,0,0,0 -847,18920,28,24,24,24,0,0,0,0,0,0,0,0 -848,18940,27,24,24,24,0,0,0,0,0,0,0,0 -849,18960,26,24,24,24,0,0,0,0,0,0,0,0 -850,18980,24,24,24,24,0,0,0,0,0,0,0,0 -851,19000,24,24,24,24,0,0,0,0,0,0,0,0 -852,19020,22,16,16,16,24,24,0,0,0,0,0,0 -854,19040,21,16,16,16,24,24,0,0,0,0,0,0 -855,19060,20,16,16,16,24,24,0,0,0,0,0,0 -856,19080,18,16,16,16,24,24,0,0,0,0,0,0 -857,19100,17,16,16,16,24,24,0,0,0,0,0,0 -858,19120,16,16,16,16,24,24,0,0,0,0,0,0 -859,19140,14,8,8,8,16,16,0,0,0,0,0,0 -861,19160,13,8,8,8,16,16,0,0,0,0,0,0 -863,19180,12,8,8,8,16,16,0,0,0,0,0,0 -864,19200,10,8,8,8,16,16,0,0,0,0,0,0 -865,19220,9,8,8,8,16,16,0,0,0,0,0,0 -866,19240,8,8,8,8,16,16,0,0,0,0,0,0 -867,19259,6,0,0,0,8,8,0,0,0,0,0,0 -869,19279,5,0,0,0,8,8,0,0,0,0,0,0 -871,19299,4,0,0,0,8,8,0,0,0,0,0,0 -872,19319,2,0,0,0,8,8,0,0,0,0,0,0 -873,19339,1,0,0,0,8,8,0,0,0,0,0,0 -874,19359,0,0,0,0,8,8,0,0,0,0,0,0 -875,19379,30,24,24,24,0,0,0,0,0,0,0,0 -877,19399,29,24,24,24,0,0,0,0,0,0,0,0 -879,19419,28,24,24,24,0,0,0,0,0,0,0,0 -880,19439,26,24,24,24,0,0,0,0,0,0,0,0 -881,19459,25,24,24,24,0,0,0,0,0,0,0,0 -882,19479,24,24,24,24,0,0,0,0,0,0,0,0 -883,19499,22,16,16,16,24,24,0,0,0,0,0,0 -885,19519,21,16,16,16,24,24,0,0,0,0,0,0 -887,19539,20,16,16,16,24,24,0,0,0,0,0,0 -888,19559,18,16,16,16,24,24,0,0,0,0,0,0 -889,19579,17,16,16,16,24,24,0,0,0,0,0,0 -890,19599,16,16,16,16,24,24,0,0,0,0,0,0 -891,19619,14,8,8,8,16,16,0,0,0,0,0,0 -893,19639,13,8,8,8,16,16,0,0,0,0,0,0 -895,19659,12,8,8,8,16,16,0,0,0,0,0,0 -896,19679,10,8,8,8,16,16,0,0,0,0,0,0 -897,19699,9,8,8,8,16,16,0,0,0,0,0,0 -898,19719,8,8,8,8,16,16,0,0,0,0,0,0 -899,19738,7,0,0,0,8,8,0,0,0,0,0,0 -901,19758,6,0,0,0,8,8,0,0,0,0,0,0 -903,19778,4,0,0,0,8,8,0,0,0,0,0,0 -904,19798,3,0,0,0,8,8,0,0,0,0,0,0 -905,19818,2,0,0,0,8,8,0,0,0,0,0,0 -906,19838,0,0,0,0,8,8,0,0,0,0,0,0 -907,19858,31,24,24,24,0,0,0,0,0,0,0,0 -909,19878,30,24,24,24,0,0,0,0,0,0,0,0 -911,19898,28,24,24,24,0,0,0,0,0,0,0,0 -912,19918,27,24,24,24,0,0,0,0,0,0,0,0 -913,19938,26,24,24,24,0,0,0,0,0,0,0,0 -914,19958,25,24,24,24,0,0,0,0,0,0,0,0 -915,19978,24,24,24,24,0,0,0,0,0,0,0,0 -916,19998,22,16,16,16,24,24,0,0,0,0,0,0 -918,20018,21,16,16,16,24,24,0,0,0,0,0,0 -920,20038,20,16,16,16,24,24,0,0,0,0,0,0 -921,20058,18,16,16,16,24,24,0,0,0,0,0,0 -922,20078,17,16,16,16,24,24,0,0,0,0,0,0 -923,20098,16,16,16,16,24,24,0,0,0,0,0,0 -924,20118,14,8,8,8,16,16,0,0,0,0,0,0 -926,20138,13,8,8,8,16,16,0,0,0,0,0,0 -928,20158,12,8,8,8,16,16,0,0,0,0,0,0 -929,20178,10,8,8,8,16,16,0,0,0,0,0,0 -930,20198,9,8,8,8,16,16,0,0,0,0,0,0 -931,20218,8,8,8,8,16,16,0,0,0,0,0,0 -932,20237,6,0,0,0,8,8,0,0,0,0,0,0 -934,20257,5,0,0,0,8,8,0,0,0,0,0,0 -936,20277,4,0,0,0,8,8,0,0,0,0,0,0 -937,20297,3,0,0,0,8,8,0,0,0,0,0,0 -938,20317,2,0,0,0,8,8,0,0,0,0,0,0 -939,20337,0,0,0,0,8,8,0,0,0,0,0,0 -940,20357,31,24,24,24,0,0,0,0,0,0,0,0 -942,20377,30,24,24,24,0,0,0,0,0,0,0,0 -944,20397,29,24,24,24,0,0,0,0,0,0,0,0 -945,20417,28,24,24,24,0,0,0,0,0,0,0,0 -946,20437,26,24,24,24,0,0,0,0,0,0,0,0 -947,20457,24,24,24,24,0,0,0,0,0,0,0,0 -948,20477,24,24,24,24,0,0,0,0,0,0,0,0 -949,20497,22,16,16,16,24,24,0,0,0,0,0,0 -951,20517,21,16,16,16,24,24,0,0,0,0,0,0 -952,20537,20,16,16,16,24,24,0,0,0,0,0,0 -953,20557,18,16,16,16,24,24,0,0,0,0,0,0 -954,20577,17,16,16,16,24,24,0,0,0,0,0,0 -955,20597,16,16,16,16,24,24,0,0,0,0,0,0 -956,20617,14,8,8,8,16,16,0,0,0,0,0,0 -958,20637,13,8,8,8,16,16,0,0,0,0,0,0 -960,20657,12,8,8,8,16,16,0,0,0,0,0,0 -961,20677,10,8,8,8,16,16,0,0,0,0,0,0 -962,20697,9,8,8,8,16,16,0,0,0,0,0,0 -963,20717,8,8,8,8,16,16,0,0,0,0,0,0 -964,20736,6,0,0,0,8,8,0,0,0,0,0,0 -966,20756,6,0,0,0,8,8,0,0,0,0,0,0 -968,20776,4,0,0,0,8,8,0,0,0,0,0,0 -969,20796,3,0,0,0,8,8,0,0,0,0,0,0 -970,20816,2,0,0,0,8,8,0,0,0,0,0,0 -971,20836,0,0,0,0,8,8,0,0,0,0,0,0 -972,20856,31,24,24,24,0,0,0,0,0,0,0,0 -974,20876,30,24,24,24,0,0,0,0,0,0,0,0 -976,20896,28,24,24,24,0,0,0,0,0,0,0,0 -977,20916,27,24,24,24,0,0,0,0,0,0,0,0 -978,20936,26,24,24,24,0,0,0,0,0,0,0,0 -979,20956,24,24,24,24,0,0,0,0,0,0,0,0 -980,20976,24,24,24,24,0,0,0,0,0,0,0,0 -981,20996,22,16,16,16,24,24,0,0,0,0,0,0 -983,21016,21,16,16,16,24,24,0,0,0,0,0,0 -985,21036,20,16,16,16,24,24,0,0,0,0,0,0 -986,21056,18,16,16,16,24,24,0,0,0,0,0,0 -987,21076,17,16,16,16,24,24,0,0,0,0,0,0 -988,21096,16,16,16,16,24,24,0,0,0,0,0,0 -989,21116,14,8,8,8,16,16,0,0,0,0,0,0 -991,21136,14,8,8,8,16,16,0,0,0,0,0,0 -993,21156,12,8,8,8,16,16,0,0,0,0,0,0 -994,21176,11,8,8,8,16,16,0,0,0,0,0,0 -995,21196,10,8,8,8,16,16,0,0,0,0,0,0 -996,21216,8,8,8,8,16,16,0,0,0,0,0,0 -997,21235,7,0,0,0,8,8,0,0,0,0,0,0 -999,21255,6,0,0,0,8,8,0,0,0,0,0,0 -1001,21275,4,0,0,0,8,8,0,0,0,0,0,0 -1002,21295,3,0,0,0,8,8,0,0,0,0,0,0 -1003,21315,2,0,0,0,8,8,0,0,0,0,0,0 -1004,21335,0,0,0,0,8,8,0,0,0,0,0,0 -1005,21355,31,24,24,24,0,0,0,0,0,0,0,0 -1007,21375,30,24,24,24,0,0,0,0,0,0,0,0 -1009,21395,28,24,24,24,0,0,0,0,0,0,0,0 -1010,21415,27,24,24,24,0,0,0,0,0,0,0,0 -1011,21435,26,24,24,24,0,0,0,0,0,0,0,0 -1012,21455,24,24,24,24,0,0,0,0,0,0,0,0 -1013,21475,23,16,16,16,24,24,0,0,0,0,0,0 -1015,21495,22,16,16,16,24,24,0,0,0,0,0,0 -1017,21515,20,16,16,16,24,24,0,0,0,0,0,0 -1018,21535,19,16,16,16,24,24,0,0,0,0,0,0 -1019,21555,18,16,16,16,24,24,0,0,0,0,0,0 -1020,21575,16,16,16,16,24,24,0,0,0,0,0,0 -1021,21595,16,16,16,16,24,24,0,0,0,0,0,0 -1022,21615,14,8,8,8,16,16,0,0,0,0,0,0 -1024,21635,13,8,8,8,16,16,0,0,0,0,0,0 -1025,21655,12,8,8,8,16,16,0,0,0,0,0,0 -1026,21675,10,8,8,8,16,16,0,0,0,0,0,0 -1027,21695,9,8,8,8,16,16,0,0,0,0,0,0 -1028,21715,8,8,8,8,16,16,0,0,0,0,0,0 -1029,21734,6,0,0,0,8,8,0,0,0,0,0,0 -1031,21754,5,0,0,0,8,8,0,0,0,0,0,0 -1033,21774,4,0,0,0,8,8,0,0,0,0,0,0 -1034,21794,2,0,0,0,8,8,0,0,0,0,0,0 -1035,21814,1,0,0,0,8,8,0,0,0,0,0,0 -1036,21834,0,0,0,0,8,8,0,0,0,0,0,0 -1037,21854,30,24,24,24,0,0,0,0,0,0,0,0 -1039,21874,29,24,24,24,0,0,0,0,0,0,0,0 -1041,21894,28,24,24,24,0,0,0,0,0,0,0,0 -1042,21914,26,24,24,24,0,0,0,0,0,0,0,0 -1043,21934,26,24,24,24,0,0,0,0,0,0,0,0 -1044,21954,24,24,24,24,0,0,0,0,0,0,0,0 -1045,21974,23,16,16,16,24,24,0,0,0,0,0,0 -1047,21994,22,16,16,16,24,24,0,0,0,0,0,0 -1049,22014,20,16,16,16,24,24,0,0,0,0,0,0 -1050,22034,19,16,16,16,24,24,0,0,0,0,0,0 -1051,22054,18,16,16,16,24,24,0,0,0,0,0,0 -1052,22074,17,16,16,16,24,24,0,0,0,0,0,0 -1053,22094,16,16,16,16,24,24,0,0,0,0,0,0 -1054,22114,14,8,8,8,16,16,0,0,0,0,0,0 -1056,22134,13,8,8,8,16,16,0,0,0,0,0,0 -1058,22154,12,8,8,8,16,16,0,0,0,0,0,0 -1059,22174,10,8,8,8,16,16,0,0,0,0,0,0 -1060,22194,9,8,8,8,16,16,0,0,0,0,0,0 -1061,22214,8,8,8,8,16,16,0,0,0,0,0,0 -1062,22233,6,0,0,0,8,8,0,0,0,0,0,0 -1064,22253,6,0,0,0,8,8,0,0,0,0,0,0 -1066,22273,4,0,0,0,8,8,0,0,0,0,0,0 -1067,22293,3,0,0,0,8,8,0,0,0,0,0,0 -1068,22313,2,0,0,0,8,8,0,0,0,0,0,0 -1069,22333,0,0,0,0,8,8,0,0,0,0,0,0 -1070,22353,31,24,24,24,0,0,0,0,0,0,0,0 -1072,22373,30,24,24,24,0,0,0,0,0,0,0,0 -1074,22393,28,24,24,24,0,0,0,0,0,0,0,0 -1075,22413,27,24,24,24,0,0,0,0,0,0,0,0 -1076,22433,26,24,24,24,0,0,0,0,0,0,0,0 -1077,22453,24,24,24,24,0,0,0,0,0,0,0,0 -1078,22473,23,16,16,16,24,24,0,0,0,0,0,0 -1080,22493,22,16,16,16,24,24,0,0,0,0,0,0 -1082,22513,20,16,16,16,24,24,0,0,0,0,0,0 -1083,22533,19,16,16,16,24,24,0,0,0,0,0,0 -1084,22553,18,16,16,16,24,24,0,0,0,0,0,0 -1085,22573,16,16,16,16,24,24,0,0,0,0,0,0 -1086,22593,15,8,8,8,16,16,0,0,0,0,0,0 -1088,22613,14,8,8,8,16,16,0,0,0,0,0,0 -1090,22633,12,8,8,8,16,16,0,0,0,0,0,0 -1091,22653,11,8,8,8,16,16,0,0,0,0,0,0 -1092,22673,10,8,8,8,16,16,0,0,0,0,0,0 -1093,22693,8,8,8,8,16,16,0,0,0,0,0,0 -1094,22712,6,0,0,0,8,8,0,0,0,0,0,0 -1096,22732,6,0,0,0,8,8,0,0,0,0,0,0 -1098,22752,4,0,0,0,8,8,0,0,0,0,0,0 -1099,22772,2,0,0,0,8,8,0,0,0,0,0,0 -1100,22792,1,0,0,0,8,8,0,0,0,0,0,0 -1101,22812,0,0,0,0,8,8,0,0,0,0,0,0 -1102,22832,30,24,24,24,0,0,0,0,0,0,0,0 -1104,22852,29,24,24,24,0,0,0,0,0,0,0,0 -1106,22872,28,24,24,24,0,0,0,0,0,0,0,0 -1107,22892,27,24,24,24,0,0,0,0,0,0,0,0 -1108,22912,26,24,24,24,0,0,0,0,0,0,0,0 -1109,22932,24,24,24,24,0,0,0,0,0,0,0,0 -1110,22952,23,16,16,16,24,24,0,0,0,0,0,0 -1112,22972,22,16,16,16,24,24,0,0,0,0,0,0 -1114,22992,20,16,16,16,24,24,0,0,0,0,0,0 -1115,23012,19,16,16,16,24,24,0,0,0,0,0,0 -1116,23032,18,16,16,16,24,24,0,0,0,0,0,0 -1117,23052,16,16,16,16,24,24,0,0,0,0,0,0 -1118,23072,16,16,16,16,24,24,0,0,0,0,0,0 -1119,23092,14,8,8,8,16,16,0,0,0,0,0,0 -1121,23112,13,8,8,8,16,16,0,0,0,0,0,0 -1122,23132,12,8,8,8,16,16,0,0,0,0,0,0 -1123,23152,10,8,8,8,16,16,0,0,0,0,0,0 -1124,23172,9,8,8,8,16,16,0,0,0,0,0,0 -1125,23192,8,8,8,8,16,16,0,0,0,0,0,0 -1126,23211,6,0,0,0,8,8,0,0,0,0,0,0 -1128,23231,5,0,0,0,8,8,0,0,0,0,0,0 -1130,23251,4,0,0,0,8,8,0,0,0,0,0,0 -1131,23271,2,0,0,0,8,8,0,0,0,0,0,0 -1132,23291,2,0,0,0,8,8,0,0,0,0,0,0 -1133,23311,0,0,0,0,8,8,0,0,0,0,0,0 -1134,23331,31,24,24,24,0,0,0,0,0,0,0,0 -1136,23351,30,24,24,24,0,0,0,0,0,0,0,0 -1138,23371,28,24,24,24,0,0,0,0,0,0,0,0 -1139,23391,27,24,24,24,0,0,0,0,0,0,0,0 -1140,23411,26,24,24,24,0,0,0,0,0,0,0,0 -1141,23431,24,24,24,24,0,0,0,0,0,0,0,0 -1142,23451,23,16,16,16,24,24,0,0,0,0,0,0 -1144,23471,22,16,16,16,24,24,0,0,0,0,0,0 -1146,23491,20,16,16,16,24,24,0,0,0,0,0,0 -1147,23511,19,16,16,16,24,24,0,0,0,0,0,0 -1148,23531,18,16,16,16,24,24,0,0,0,0,0,0 -1149,23551,16,16,16,16,24,24,0,0,0,0,0,0 -1150,23571,15,8,8,8,16,16,0,0,0,0,0,0 -1152,23591,14,8,8,8,16,16,0,0,0,0,0,0 -1154,23611,12,8,8,8,16,16,0,0,0,0,0,0 -1155,23631,11,8,8,8,16,16,0,0,0,0,0,0 -1156,23651,10,8,8,8,16,16,0,0,0,0,0,0 -1157,23671,8,8,8,8,16,16,0,0,0,0,0,0 -1158,23690,7,0,0,0,8,8,0,0,0,0,0,0 -1160,23710,6,0,0,0,8,8,0,0,0,0,0,0 -1162,23730,4,0,0,0,8,8,0,0,0,0,0,0 -1163,23750,3,0,0,0,8,8,0,0,0,0,0,0 -1164,23770,2,0,0,0,8,8,0,0,0,0,0,0 -1165,23790,1,0,0,0,8,8,0,0,0,0,0,0 -1166,23810,0,0,0,0,8,8,0,0,0,0,0,0 -1167,23830,30,24,24,24,0,0,0,0,0,0,0,0 -1169,23850,29,24,24,24,0,0,0,0,0,0,0,0 -1170,23870,28,24,24,24,0,0,0,0,0,0,0,0 -1171,23890,26,24,24,24,0,0,0,0,0,0,0,0 -1172,23910,25,24,24,24,0,0,0,0,0,0,0,0 -1173,23930,24,24,24,24,0,0,0,0,0,0,0,0 -1174,23950,22,16,16,16,24,24,0,0,0,0,0,0 -1176,23970,21,16,16,16,24,24,0,0,0,0,0,0 -1178,23990,20,16,16,16,24,24,0,0,0,0,0,0 -1179,24010,18,16,16,16,24,24,0,0,0,0,0,0 -1180,24030,17,16,16,16,24,24,0,0,0,0,0,0 -1181,24050,16,16,16,16,24,24,0,0,0,0,0,0 -1182,24070,14,8,8,8,16,16,0,0,0,0,0,0 -1184,24090,13,8,8,8,16,16,0,0,0,0,0,0 -1186,24110,12,8,8,8,16,16,0,0,0,0,0,0 -1187,24130,10,8,8,8,16,16,0,0,0,0,0,0 -1188,24150,9,8,8,8,16,16,0,0,0,0,0,0 -1189,24170,8,8,8,8,16,16,0,0,0,0,0,0 -1190,24189,6,0,0,0,8,8,0,0,0,0,0,0 -1192,24209,5,0,0,0,8,8,0,0,0,0,0,0 -1194,24229,4,0,0,0,8,8,0,0,0,0,0,0 -1195,24249,2,0,0,0,8,8,0,0,0,0,0,0 -1196,24269,1,0,0,0,8,8,0,0,0,0,0,0 -1197,24289,0,0,0,0,8,8,0,0,0,0,0,0 -1198,24309,30,24,24,24,0,0,0,0,0,0,0,0 -1200,24329,29,24,24,24,0,0,0,0,0,0,0,0 -1202,24349,28,24,24,24,0,0,0,0,0,0,0,0 -1203,24369,26,24,24,24,0,0,0,0,0,0,0,0 -1204,24389,25,24,24,24,0,0,0,0,0,0,0,0 -1205,24409,24,24,24,24,0,0,0,0,0,0,0,0 -1206,24429,22,16,16,16,24,24,0,0,0,0,0,0 -1208,24449,21,16,16,16,24,24,0,0,0,0,0,0 -1210,24469,20,16,16,16,24,24,0,0,0,0,0,0 -1211,24489,18,16,16,16,24,24,0,0,0,0,0,0 -1212,24509,17,16,16,16,24,24,0,0,0,0,0,0 -1213,24529,16,16,16,16,24,24,0,0,0,0,0,0 -1214,24549,14,8,8,8,16,16,0,0,0,0,0,0 -1216,24569,13,8,8,8,16,16,0,0,0,0,0,0 -1218,24589,12,8,8,8,16,16,0,0,0,0,0,0 -1219,24609,10,8,8,8,16,16,0,0,0,0,0,0 -1220,24629,9,8,8,8,16,16,0,0,0,0,0,0 -1221,24649,8,8,8,8,16,16,0,0,0,0,0,0 -1222,24668,6,0,0,0,8,8,0,0,0,0,0,0 -1224,24688,5,0,0,0,8,8,0,0,0,0,0,0 -1226,24708,4,0,0,0,8,8,0,0,0,0,0,0 -1227,24728,2,0,0,0,8,8,0,0,0,0,0,0 -1228,24748,1,0,0,0,8,8,0,0,0,0,0,0 -1229,24768,0,0,0,0,8,8,0,0,0,0,0,0 -1230,24788,31,24,24,24,0,0,0,0,0,0,0,0 -1232,24808,30,24,24,24,0,0,0,0,0,0,0,0 -1234,24828,28,24,24,24,0,0,0,0,0,0,0,0 -1235,24848,27,24,24,24,0,0,0,0,0,0,0,0 -1236,24868,26,24,24,24,0,0,0,0,0,0,0,0 -1237,24888,24,24,24,24,0,0,0,0,0,0,0,0 -1238,24908,23,16,16,16,24,24,0,0,0,0,0,0 -1240,24928,22,16,16,16,24,24,0,0,0,0,0,0 -1242,24948,20,16,16,16,24,24,0,0,0,0,0,0 -1243,24968,19,16,16,16,24,24,0,0,0,0,0,0 -1244,24988,18,16,16,16,24,24,0,0,0,0,0,0 -1245,25008,16,16,16,16,24,24,0,0,0,0,0,0 -1246,25028,15,8,8,8,16,16,0,0,0,0,0,0 -1248,25048,14,8,8,8,16,16,0,0,0,0,0,0 -1250,25068,12,8,8,8,16,16,0,0,0,0,0,0 -1251,25088,11,8,8,8,16,16,0,0,0,0,0,0 -1252,25108,10,8,8,8,16,16,0,0,0,0,0,0 -1253,25128,9,8,8,8,16,16,0,0,0,0,0,0 -1254,25148,8,8,8,8,16,16,0,0,0,0,0,0 -1255,25167,6,0,0,0,8,8,0,0,0,0,0,0 -1257,25187,5,0,0,0,8,8,0,0,0,0,0,0 -1259,25207,4,0,0,0,8,8,0,0,0,0,0,0 -1260,25227,2,0,0,0,8,8,0,0,0,0,0,0 -1261,25247,1,0,0,0,8,8,0,0,0,0,0,0 -1262,25267,0,0,0,0,8,8,0,0,0,0,0,0 -1263,25287,31,24,24,24,0,0,0,0,0,0,0,0 -1265,25307,30,24,24,24,0,0,0,0,0,0,0,0 -1267,25327,28,24,24,24,0,0,0,0,0,0,0,0 -1268,25347,27,24,24,24,0,0,0,0,0,0,0,0 -1269,25367,26,24,24,24,0,0,0,0,0,0,0,0 -1270,25387,24,24,24,24,0,0,0,0,0,0,0,0 -1271,25407,23,16,16,16,24,24,0,0,0,0,0,0 -1273,25427,22,16,16,16,24,24,0,0,0,0,0,0 -1275,25447,20,16,16,16,24,24,0,0,0,0,0,0 -1276,25467,19,16,16,16,24,24,0,0,0,0,0,0 -1277,25487,18,16,16,16,24,24,0,0,0,0,0,0 -1278,25507,16,16,16,16,24,24,0,0,0,0,0,0 -1279,25527,15,8,8,8,16,16,0,0,0,0,0,0 -1281,25547,14,8,8,8,16,16,0,0,0,0,0,0 -1283,25567,12,8,8,8,16,16,0,0,0,0,0,0 -1284,25587,11,8,8,8,16,16,0,0,0,0,0,0 -1285,25607,10,8,8,8,16,16,0,0,0,0,0,0 -1286,25627,9,8,8,8,16,16,0,0,0,0,0,0 -1287,25647,8,8,8,8,16,16,0,0,0,0,0,0 -1288,25666,6,0,0,0,8,8,0,0,0,0,0,0 -1290,25686,5,0,0,0,8,8,0,0,0,0,0,0 -1292,25706,4,0,0,0,8,8,0,0,0,0,0,0 -1293,25726,2,0,0,0,8,8,0,0,0,0,0,0 -1294,25746,1,0,0,0,8,8,0,0,0,0,0,0 -1295,25766,0,0,0,0,8,8,0,0,0,0,0,0 -1296,25786,30,24,24,24,0,0,0,0,0,0,0,0 -1298,25806,29,24,24,24,0,0,0,0,0,0,0,0 -1300,25826,28,24,24,24,0,0,0,0,0,0,0,0 -1301,25846,27,24,24,24,0,0,0,0,0,0,0,0 -1302,25866,26,24,24,24,0,0,0,0,0,0,0,0 -1303,25886,24,24,24,24,0,0,0,0,0,0,0,0 -1304,25906,23,16,16,16,24,24,0,0,0,0,0,0 -1306,25926,22,16,16,16,24,24,0,0,0,0,0,0 -1308,25946,20,16,16,16,24,24,0,0,0,0,0,0 -1309,25966,19,16,16,16,24,24,0,0,0,0,0,0 -1310,25986,18,16,16,16,24,24,0,0,0,0,0,0 -1311,26006,16,16,16,16,24,24,0,0,0,0,0,0 -1312,26026,16,16,16,16,24,24,0,0,0,0,0,0 -1313,26046,14,8,8,8,16,16,0,0,0,0,0,0 -1315,26066,13,8,8,8,16,16,0,0,0,0,0,0 -1316,26086,12,8,8,8,16,16,0,0,0,0,0,0 -1317,26106,10,8,8,8,16,16,0,0,0,0,0,0 -1318,26126,9,8,8,8,16,16,0,0,0,0,0,0 -1319,26146,8,8,8,8,16,16,0,0,0,0,0,0 -1320,26165,6,0,0,0,8,8,0,0,0,0,0,0 -1322,26185,5,0,0,0,8,8,0,0,0,0,0,0 -1323,26205,4,0,0,0,8,8,0,0,0,0,0,0 -1324,26225,2,0,0,0,8,8,0,0,0,0,0,0 -1325,26245,1,0,0,0,8,8,0,0,0,0,0,0 -1326,26265,0,0,0,0,8,8,0,0,0,0,0,0 -1327,26285,30,24,24,24,0,0,0,0,0,0,0,0 -1329,26305,29,24,24,24,0,0,0,0,0,0,0,0 -1330,26325,28,24,24,24,0,0,0,0,0,0,0,0 -1331,26345,26,24,24,24,0,0,0,0,0,0,0,0 -1332,26365,25,24,24,24,0,0,0,0,0,0,0,0 -1333,26385,24,24,24,24,0,0,0,0,0,0,0,0 -1334,26405,22,16,16,16,24,24,0,0,0,0,0,0 -1336,26425,21,16,16,16,24,24,0,0,0,0,0,0 -1337,26445,20,16,16,16,24,24,0,0,0,0,0,0 -1338,26465,18,16,16,16,24,24,0,0,0,0,0,0 -1339,26485,17,16,16,16,24,24,0,0,0,0,0,0 -1340,26505,16,16,16,16,24,24,0,0,0,0,0,0 -1341,26525,14,8,8,8,16,16,0,0,0,0,0,0 -1343,26545,13,8,8,8,16,16,0,0,0,0,0,0 -1344,26565,12,8,8,8,16,16,0,0,0,0,0,0 -1345,26585,10,8,8,8,16,16,0,0,0,0,0,0 -1346,26605,9,8,8,8,16,16,0,0,0,0,0,0 -1347,26625,8,8,8,8,16,16,0,0,0,0,0,0 -1348,26644,6,0,0,0,8,8,0,0,0,0,0,0 -1350,26664,5,0,0,0,8,8,0,0,0,0,0,0 -1351,26684,4,0,0,0,8,8,0,0,0,0,0,0 -1352,26704,2,0,0,0,8,8,0,0,0,0,0,0 -1353,26724,1,0,0,0,8,8,0,0,0,0,0,0 -1354,26744,0,0,0,0,8,8,0,0,0,0,0,0 -1355,26764,30,24,24,24,0,0,0,0,0,0,0,0 -1357,26784,29,24,24,24,0,0,0,0,0,0,0,0 -1359,26804,28,24,24,24,0,0,0,0,0,0,0,0 -1360,26824,26,24,24,24,0,0,0,0,0,0,0,0 -1361,26844,25,24,24,24,0,0,0,0,0,0,0,0 -1362,26864,24,24,24,24,0,0,0,0,0,0,0,0 -1363,26884,22,16,16,16,24,24,0,0,0,0,0,0 -1365,26904,21,16,16,16,24,24,0,0,0,0,0,0 -1367,26924,20,16,16,16,24,24,0,0,0,0,0,0 -1368,26944,18,16,16,16,24,24,0,0,0,0,0,0 -1369,26964,17,16,16,16,24,24,0,0,0,0,0,0 -1370,26984,16,16,16,16,24,24,0,0,0,0,0,0 -1371,27004,15,8,8,8,16,16,0,0,0,0,0,0 -1373,27024,14,8,8,8,16,16,0,0,0,0,0,0 -1375,27044,12,8,8,8,16,16,0,0,0,0,0,0 -1376,27064,11,8,8,8,16,16,0,0,0,0,0,0 -1377,27084,10,8,8,8,16,16,0,0,0,0,0,0 -1378,27104,8,8,8,8,16,16,0,0,0,0,0,0 -1379,27123,7,0,0,0,8,8,0,0,0,0,0,0 -1381,27143,6,0,0,0,8,8,0,0,0,0,0,0 -1383,27163,4,0,0,0,8,8,0,0,0,0,0,0 -1384,27183,3,0,0,0,8,8,0,0,0,0,0,0 -1385,27203,2,0,0,0,8,8,0,0,0,0,0,0 -1386,27223,0,0,0,0,8,8,0,0,0,0,0,0 -1387,27243,0,0,0,0,8,8,0,0,0,0,0,0 -1388,27263,30,24,24,24,0,0,0,0,0,0,0,0 -1390,27283,29,24,24,24,0,0,0,0,0,0,0,0 -1391,27303,28,24,24,24,0,0,0,0,0,0,0,0 -1392,27323,26,24,24,24,0,0,0,0,0,0,0,0 -1393,27343,25,24,24,24,0,0,0,0,0,0,0,0 -1394,27363,24,24,24,24,0,0,0,0,0,0,0,0 -1395,27383,22,16,16,16,24,24,0,0,0,0,0,0 -1397,27403,21,16,16,16,24,24,0,0,0,0,0,0 -1399,27423,20,16,16,16,24,24,0,0,0,0,0,0 -1400,27443,18,16,16,16,24,24,0,0,0,0,0,0 -1401,27463,17,16,16,16,24,24,0,0,0,0,0,0 -1402,27483,16,16,16,16,24,24,0,0,0,0,0,0 -1403,27503,14,8,8,8,16,16,0,0,0,0,0,0 -1405,27523,13,8,8,8,16,16,0,0,0,0,0,0 -1407,27543,12,8,8,8,16,16,0,0,0,0,0,0 -1408,27563,11,8,8,8,16,16,0,0,0,0,0,0 -1409,27583,10,8,8,8,16,16,0,0,0,0,0,0 -1410,27603,8,8,8,8,16,16,0,0,0,0,0,0 -1411,27622,7,0,0,0,8,8,0,0,0,0,0,0 -1413,27642,6,0,0,0,8,8,0,0,0,0,0,0 -1415,27662,4,0,0,0,8,8,0,0,0,0,0,0 -1416,27682,3,0,0,0,8,8,0,0,0,0,0,0 -1417,27702,2,0,0,0,8,8,0,0,0,0,0,0 -1418,27722,0,0,0,0,8,8,0,0,0,0,0,0 -1419,27742,31,24,24,24,0,0,0,0,0,0,0,0 -1421,27762,30,24,24,24,0,0,0,0,0,0,0,0 -1423,27782,28,24,24,24,0,0,0,0,0,0,0,0 -1424,27802,27,24,24,24,0,0,0,0,0,0,0,0 -1425,27822,26,24,24,24,0,0,0,0,0,0,0,0 -1426,27842,24,24,24,24,0,0,0,0,0,0,0,0 -1427,27862,23,16,16,16,24,24,0,0,0,0,0,0 -1429,27882,22,16,16,16,24,24,0,0,0,0,0,0 -1431,27902,20,16,16,16,24,24,0,0,0,0,0,0 -1432,27922,19,16,16,16,24,24,0,0,0,0,0,0 -1433,27942,18,16,16,16,24,24,0,0,0,0,0,0 -1434,27962,16,16,16,16,24,24,0,0,0,0,0,0 -1435,27982,15,8,8,8,16,16,0,0,0,0,0,0 -1437,28002,14,8,8,8,16,16,0,0,0,0,0,0 -1439,28022,12,8,8,8,16,16,0,0,0,0,0,0 -1440,28042,11,8,8,8,16,16,0,0,0,0,0,0 -1441,28062,10,8,8,8,16,16,0,0,0,0,0,0 -1442,28082,8,8,8,8,16,16,0,0,0,0,0,0 -1443,28101,7,0,0,0,8,8,0,0,0,0,0,0 -1445,28121,6,0,0,0,8,8,0,0,0,0,0,0 -1447,28141,5,0,0,0,8,8,0,0,0,0,0,0 -1448,28161,4,0,0,0,8,8,0,0,0,0,0,0 -1449,28181,2,0,0,0,8,8,0,0,0,0,0,0 -1450,28201,1,0,0,0,8,8,0,0,0,0,0,0 -1451,28221,0,0,0,0,8,8,0,0,0,0,0,0 -1452,28241,30,24,24,24,0,0,0,0,0,0,0,0 -1454,28261,29,24,24,24,0,0,0,0,0,0,0,0 -1455,28281,28,24,24,24,0,0,0,0,0,0,0,0 -1456,28301,26,24,24,24,0,0,0,0,0,0,0,0 -1457,28321,25,24,24,24,0,0,0,0,0,0,0,0 -1458,28341,24,24,24,24,0,0,0,0,0,0,0,0 -1459,28361,22,16,16,16,24,24,0,0,0,0,0,0 -1461,28381,21,16,16,16,24,24,0,0,0,0,0,0 -1462,28401,20,16,16,16,24,24,0,0,0,0,0,0 -1463,28421,18,16,16,16,24,24,0,0,0,0,0,0 -1464,28441,17,16,16,16,24,24,0,0,0,0,0,0 -1465,28461,16,16,16,16,24,24,0,0,0,0,0,0 -1466,28481,14,8,8,8,16,16,0,0,0,0,0,0 -1468,28501,13,8,8,8,16,16,0,0,0,0,0,0 -1470,28521,12,8,8,8,16,16,0,0,0,0,0,0 -1471,28541,10,8,8,8,16,16,0,0,0,0,0,0 -1472,28561,9,8,8,8,16,16,0,0,0,0,0,0 -1473,28581,8,8,8,8,16,16,0,0,0,0,0,0 -1474,28600,7,0,0,0,8,8,0,0,0,0,0,0 -1476,28620,6,0,0,0,8,8,0,0,0,0,0,0 -1478,28640,4,0,0,0,8,8,0,0,0,0,0,0 -1479,28660,3,0,0,0,8,8,0,0,0,0,0,0 -1480,28680,2,0,0,0,8,8,0,0,0,0,0,0 -1481,28700,0,0,0,0,8,8,0,0,0,0,0,0 -1482,28720,31,24,24,24,0,0,0,0,0,0,0,0 -1484,28740,30,24,24,24,0,0,0,0,0,0,0,0 -1486,28760,28,24,24,24,0,0,0,0,0,0,0,0 -1487,28780,26,24,24,24,0,0,0,0,0,0,0,0 -1488,28800,25,24,24,24,0,0,0,0,0,0,0,0 -1489,28820,24,24,24,24,0,0,0,0,0,0,0,0 -1490,28840,23,16,16,16,24,24,0,0,0,0,0,0 -1492,28860,22,16,16,16,24,24,0,0,0,0,0,0 -1494,28880,20,16,16,16,24,24,0,0,0,0,0,0 -1495,28900,19,16,16,16,24,24,0,0,0,0,0,0 -1496,28920,18,16,16,16,24,24,0,0,0,0,0,0 -1497,28940,16,16,16,16,24,24,0,0,0,0,0,0 -1498,28960,15,8,8,8,16,16,0,0,0,0,0,0 -1500,28980,14,8,8,8,16,16,0,0,0,0,0,0 -1502,29000,13,8,8,8,16,16,0,0,0,0,0,0 -1503,29020,12,8,8,8,16,16,0,0,0,0,0,0 -1504,29040,10,8,8,8,16,16,0,0,0,0,0,0 -1505,29060,9,8,8,8,16,16,0,0,0,0,0,0 -1506,29080,8,8,8,8,16,16,0,0,0,0,0,0 -1507,29099,6,0,0,0,8,8,0,0,0,0,0,0 -1509,29119,5,0,0,0,8,8,0,0,0,0,0,0 -1511,29139,4,0,0,0,8,8,0,0,0,0,0,0 -1512,29159,2,0,0,0,8,8,0,0,0,0,0,0 -1513,29179,1,0,0,0,8,8,0,0,0,0,0,0 -1514,29199,0,0,0,0,8,8,0,0,0,0,0,0 -1515,29219,30,24,24,24,0,0,0,0,0,0,0,0 -1517,29239,29,24,24,24,0,0,0,0,0,0,0,0 -1518,29259,28,24,24,24,0,0,0,0,0,0,0,0 -1519,29279,26,24,24,24,0,0,0,0,0,0,0,0 -1520,29299,24,24,24,24,0,0,0,0,0,0,0,0 -1521,29319,24,24,24,24,0,0,0,0,0,0,0,0 -1522,29339,22,16,16,16,24,24,0,0,0,0,0,0 -1524,29359,21,16,16,16,24,24,0,0,0,0,0,0 -1525,29379,20,16,16,16,24,24,0,0,0,0,0,0 -1526,29399,18,16,16,16,24,24,0,0,0,0,0,0 -1527,29419,17,16,16,16,24,24,0,0,0,0,0,0 -1528,29439,16,16,16,16,24,24,0,0,0,0,0,0 -1529,29459,14,8,8,8,16,16,0,0,0,0,0,0 -1531,29479,13,8,8,8,16,16,0,0,0,0,0,0 -1533,29499,12,8,8,8,16,16,0,0,0,0,0,0 -1534,29519,10,8,8,8,16,16,0,0,0,0,0,0 -1535,29539,10,8,8,8,16,16,0,0,0,0,0,0 -1536,29559,8,8,8,8,16,16,0,0,0,0,0,0 -1537,29578,7,0,0,0,8,8,0,0,0,0,0,0 -1539,29598,6,0,0,0,8,8,0,0,0,0,0,0 -1541,29618,4,0,0,0,8,8,0,0,0,0,0,0 -1542,29638,3,0,0,0,8,8,0,0,0,0,0,0 -1543,29658,2,0,0,0,8,8,0,0,0,0,0,0 -1544,29678,0,0,0,0,8,8,0,0,0,0,0,0 -1545,29698,31,24,24,24,0,0,0,0,0,0,0,0 -1547,29718,30,24,24,24,0,0,0,0,0,0,0,0 -1549,29738,28,24,24,24,0,0,0,0,0,0,0,0 -1550,29758,28,24,24,24,0,0,0,0,0,0,0,0 -1551,29778,26,24,24,24,0,0,0,0,0,0,0,0 -1552,29798,25,24,24,24,0,0,0,0,0,0,0,0 -1553,29818,24,24,24,24,0,0,0,0,0,0,0,0 -1554,29838,22,16,16,16,24,24,0,0,0,0,0,0 -1556,29858,20,16,16,16,24,24,0,0,0,0,0,0 -1557,29878,19,16,16,16,24,24,0,0,0,0,0,0 -1558,29898,18,16,16,16,24,24,0,0,0,0,0,0 -1559,29918,16,16,16,16,24,24,0,0,0,0,0,0 -1560,29938,15,8,8,8,16,16,0,0,0,0,0,0 -1562,29958,14,8,8,8,16,16,0,0,0,0,0,0 -1564,29978,13,8,8,8,16,16,0,0,0,0,0,0 -1565,29998,11,8,8,8,16,16,0,0,0,0,0,0 -1566,30018,10,8,8,8,16,16,0,0,0,0,0,0 -1567,30038,8,8,8,8,16,16,0,0,0,0,0,0 -1568,30058,8,8,8,8,16,16,0,0,0,0,0,0 -1569,30077,6,0,0,0,8,8,0,0,0,0,0,0 -1571,30097,4,0,0,0,8,8,0,0,0,0,0,0 -1572,30117,3,0,0,0,8,8,0,0,0,0,0,0 -1573,30137,2,0,0,0,8,8,0,0,0,0,0,0 -1574,30157,0,0,0,0,8,8,0,0,0,0,0,0 -1575,30177,31,24,24,24,0,0,0,0,0,0,0,0 -1577,30197,30,24,24,24,0,0,0,0,0,0,0,0 -1579,30217,28,24,24,24,0,0,0,0,0,0,0,0 -1580,30237,27,24,24,24,0,0,0,0,0,0,0,0 -1581,30257,26,24,24,24,0,0,0,0,0,0,0,0 -1582,30277,24,24,24,24,0,0,0,0,0,0,0,0 -1583,30297,24,24,24,24,0,0,0,0,0,0,0,0 -1584,30317,22,16,16,16,24,24,0,0,0,0,0,0 -1586,30337,21,16,16,16,24,24,0,0,0,0,0,0 -1588,30357,20,16,16,16,24,24,0,0,0,0,0,0 -1589,30377,18,16,16,16,24,24,0,0,0,0,0,0 -1590,30397,17,16,16,16,24,24,0,0,0,0,0,0 -1591,30417,16,16,16,16,24,24,0,0,0,0,0,0 -1592,30437,14,8,8,8,16,16,0,0,0,0,0,0 -1594,30457,13,8,8,8,16,16,0,0,0,0,0,0 -1596,30477,12,8,8,8,16,16,0,0,0,0,0,0 -1597,30497,10,8,8,8,16,16,0,0,0,0,0,0 -1598,30517,9,8,8,8,16,16,0,0,0,0,0,0 -1599,30537,8,8,8,8,16,16,0,0,0,0,0,0 -1600,30556,6,0,0,0,8,8,0,0,0,0,0,0 -1602,30576,5,0,0,0,8,8,0,0,0,0,0,0 -1604,30596,4,0,0,0,8,8,0,0,0,0,0,0 -1605,30616,2,0,0,0,8,8,0,0,0,0,0,0 -1606,30636,1,0,0,0,8,8,0,0,0,0,0,0 -1607,30656,0,0,0,0,8,8,0,0,0,0,0,0 -1608,30676,30,24,24,24,0,0,0,0,0,0,0,0 -1610,30696,29,24,24,24,0,0,0,0,0,0,0,0 -1612,30716,28,24,24,24,0,0,0,0,0,0,0,0 -1613,30736,26,24,24,24,0,0,0,0,0,0,0,0 -1614,30756,25,24,24,24,0,0,0,0,0,0,0,0 -1615,30776,24,24,24,24,0,0,0,0,0,0,0,0 -1616,30796,22,16,16,16,24,24,0,0,0,0,0,0 -1618,30816,21,16,16,16,24,24,0,0,0,0,0,0 -1620,30836,20,16,16,16,24,24,0,0,0,0,0,0 -1621,30856,18,16,16,16,24,24,0,0,0,0,0,0 -1622,30876,17,16,16,16,24,24,0,0,0,0,0,0 -1623,30896,16,16,16,16,24,24,0,0,0,0,0,0 -1624,30916,14,8,8,8,16,16,0,0,0,0,0,0 -1626,30936,13,8,8,8,16,16,0,0,0,0,0,0 -1628,30956,12,8,8,8,16,16,0,0,0,0,0,0 -1629,30976,10,8,8,8,16,16,0,0,0,0,0,0 -1630,30996,9,8,8,8,16,16,0,0,0,0,0,0 -1631,31016,8,8,8,8,16,16,0,0,0,0,0,0 -1632,31035,6,0,0,0,8,8,0,0,0,0,0,0 -1634,31055,5,0,0,0,8,8,0,0,0,0,0,0 -1635,31075,4,0,0,0,8,8,0,0,0,0,0,0 -1636,31095,2,0,0,0,8,8,0,0,0,0,0,0 -1637,31115,1,0,0,0,8,8,0,0,0,0,0,0 -1638,31135,0,0,0,0,8,8,0,0,0,0,0,0 -1639,31155,30,24,24,24,0,0,0,0,0,0,0,0 -1641,31175,29,24,24,24,0,0,0,0,0,0,0,0 -1643,31195,28,24,24,24,0,0,0,0,0,0,0,0 -1644,31215,26,24,24,24,0,0,0,0,0,0,0,0 -1645,31235,25,24,24,24,0,0,0,0,0,0,0,0 -1646,31255,24,24,24,24,0,0,0,0,0,0,0,0 -1647,31275,22,16,16,16,24,24,0,0,0,0,0,0 -1649,31295,21,16,16,16,24,24,0,0,0,0,0,0 -1651,31315,20,16,16,16,24,24,0,0,0,0,0,0 -1652,31335,18,16,16,16,24,24,0,0,0,0,0,0 -1653,31355,17,16,16,16,24,24,0,0,0,0,0,0 -1654,31375,16,16,16,16,24,24,0,0,0,0,0,0 -1655,31395,14,8,8,8,16,16,0,0,0,0,0,0 -1657,31415,13,8,8,8,16,16,0,0,0,0,0,0 -1659,31435,12,8,8,8,16,16,0,0,0,0,0,0 -1660,31455,10,8,8,8,16,16,0,0,0,0,0,0 -1661,31475,9,8,8,8,16,16,0,0,0,0,0,0 -1662,31495,8,8,8,8,16,16,0,0,0,0,0,0 -1663,31514,6,0,0,0,8,8,0,0,0,0,0,0 -1665,31534,5,0,0,0,8,8,0,0,0,0,0,0 -1667,31554,4,0,0,0,8,8,0,0,0,0,0,0 -1668,31574,2,0,0,0,8,8,0,0,0,0,0,0 -1669,31594,1,0,0,0,8,8,0,0,0,0,0,0 -1670,31614,0,0,0,0,8,8,0,0,0,0,0,0 -1671,31634,30,24,24,24,0,0,0,0,0,0,0,0 -1673,31654,29,24,24,24,0,0,0,0,0,0,0,0 -1675,31674,28,24,24,24,0,0,0,0,0,0,0,0 -1676,31694,26,24,24,24,0,0,0,0,0,0,0,0 -1677,31714,25,24,24,24,0,0,0,0,0,0,0,0 -1678,31734,24,24,24,24,0,0,0,0,0,0,0,0 -1679,31754,22,16,16,16,24,24,0,0,0,0,0,0 -1681,31774,21,16,16,16,24,24,0,0,0,0,0,0 -1683,31794,20,16,16,16,24,24,0,0,0,0,0,0 -1684,31814,18,16,16,16,24,24,0,0,0,0,0,0 -1685,31834,17,16,16,16,24,24,0,0,0,0,0,0 -1686,31854,16,16,16,16,24,24,0,0,0,0,0,0 -1687,31874,14,8,8,8,16,16,0,0,0,0,0,0 -1689,31894,13,8,8,8,16,16,0,0,0,0,0,0 -1691,31914,12,8,8,8,16,16,0,0,0,0,0,0 -1692,31934,10,8,8,8,16,16,0,0,0,0,0,0 -1693,31954,9,8,8,8,16,16,0,0,0,0,0,0 -1694,31974,8,8,8,8,16,16,0,0,0,0,0,0 -1695,31993,6,0,0,0,8,8,0,0,0,0,0,0 -1697,32013,5,0,0,0,8,8,0,0,0,0,0,0 -1699,32033,4,0,0,0,8,8,0,0,0,0,0,0 -1700,32053,2,0,0,0,8,8,0,0,0,0,0,0 -1701,32073,1,0,0,0,8,8,0,0,0,0,0,0 -1702,32093,0,0,0,0,8,8,0,0,0,0,0,0 -1703,32113,30,24,24,24,0,0,0,0,0,0,0,0 -1705,32133,29,24,24,24,0,0,0,0,0,0,0,0 -1707,32153,28,24,24,24,0,0,0,0,0,0,0,0 -1708,32173,26,24,24,24,0,0,0,0,0,0,0,0 -1709,32193,25,24,24,24,0,0,0,0,0,0,0,0 -1710,32213,24,24,24,24,0,0,0,0,0,0,0,0 -1711,32233,22,16,16,16,24,24,0,0,0,0,0,0 -1713,32253,21,16,16,16,24,24,0,0,0,0,0,0 -1715,32273,20,16,16,16,24,24,0,0,0,0,0,0 -1716,32293,18,16,16,16,24,24,0,0,0,0,0,0 -1717,32313,17,16,16,16,24,24,0,0,0,0,0,0 -1718,32333,16,16,16,16,24,24,0,0,0,0,0,0 -1719,32353,14,8,8,8,16,16,0,0,0,0,0,0 -1721,32373,13,8,8,8,16,16,0,0,0,0,0,0 -1722,32393,12,8,8,8,16,16,0,0,0,0,0,0 -1723,32413,10,8,8,8,16,16,0,0,0,0,0,0 -1724,32433,9,8,8,8,16,16,0,0,0,0,0,0 -1725,32453,8,8,8,8,16,16,0,0,0,0,0,0 -1726,32472,6,0,0,0,8,8,0,0,0,0,0,0 -1728,32492,5,0,0,0,8,8,0,0,0,0,0,0 -1730,32512,4,0,0,0,8,8,0,0,0,0,0,0 -1731,32532,2,0,0,0,8,8,0,0,0,0,0,0 -1732,32552,1,0,0,0,8,8,0,0,0,0,0,0 -1733,32572,0,0,0,0,8,8,0,0,0,0,0,0 -1734,32592,30,24,24,24,0,0,0,0,0,0,0,0 -1736,32612,29,24,24,24,0,0,0,0,0,0,0,0 -1738,32632,28,24,24,24,0,0,0,0,0,0,0,0 -1739,32652,26,24,24,24,0,0,0,0,0,0,0,0 -1740,32672,25,24,24,24,0,0,0,0,0,0,0,0 -1741,32692,24,24,24,24,0,0,0,0,0,0,0,0 -1742,32712,22,16,16,16,24,24,0,0,0,0,0,0 -1744,32732,22,16,16,16,24,24,0,0,0,0,0,0 -1746,32752,20,16,16,16,24,24,0,0,0,0,0,0 -1747,32772,18,16,16,16,24,24,0,0,0,0,0,0 -1748,32792,18,16,16,16,24,24,0,0,0,0,0,0 -1749,32812,16,16,16,16,24,24,0,0,0,0,0,0 -1750,32832,14,8,8,8,16,16,0,0,0,0,0,0 -1752,32852,14,8,8,8,16,16,0,0,0,0,0,0 -1754,32872,12,8,8,8,16,16,0,0,0,0,0,0 -1755,32892,10,8,8,8,16,16,0,0,0,0,0,0 -1756,32912,9,8,8,8,16,16,0,0,0,0,0,0 -1757,32932,8,8,8,8,16,16,0,0,0,0,0,0 -1758,32951,6,0,0,0,8,8,0,0,0,0,0,0 -1760,32971,5,0,0,0,8,8,0,0,0,0,0,0 -1762,32991,4,0,0,0,8,8,0,0,0,0,0,0 -1763,33011,2,0,0,0,8,8,0,0,0,0,0,0 -1764,33031,1,0,0,0,8,8,0,0,0,0,0,0 -1765,33051,0,0,0,0,8,8,0,0,0,0,0,0 -1766,33071,31,24,24,24,0,0,0,0,0,0,0,0 -1768,33091,30,24,24,24,0,0,0,0,0,0,0,0 -1770,33111,28,24,24,24,0,0,0,0,0,0,0,0 -1771,33131,27,24,24,24,0,0,0,0,0,0,0,0 -1772,33151,26,24,24,24,0,0,0,0,0,0,0,0 -1773,33171,24,24,24,24,0,0,0,0,0,0,0,0 -1774,33191,23,16,16,16,24,24,0,0,0,0,0,0 -1776,33211,22,16,16,16,24,24,0,0,0,0,0,0 -1778,33231,20,16,16,16,24,24,0,0,0,0,0,0 -1779,33251,19,16,16,16,24,24,0,0,0,0,0,0 -1780,33271,18,16,16,16,24,24,0,0,0,0,0,0 -1781,33291,16,16,16,16,24,24,0,0,0,0,0,0 -1782,33311,15,8,8,8,16,16,0,0,0,0,0,0 -1784,33331,14,8,8,8,16,16,0,0,0,0,0,0 -1786,33351,12,8,8,8,16,16,0,0,0,0,0,0 -1787,33371,11,8,8,8,16,16,0,0,0,0,0,0 -1788,33391,10,8,8,8,16,16,0,0,0,0,0,0 -1789,33411,8,8,8,8,16,16,0,0,0,0,0,0 -1790,33431,8,8,8,8,16,16,0,0,0,0,0,0 -1791,33450,6,0,0,0,8,8,0,0,0,0,0,0 -1793,33470,4,0,0,0,8,8,0,0,0,0,0,0 -1794,33490,4,0,0,0,8,8,0,0,0,0,0,0 -1795,33510,2,0,0,0,8,8,0,0,0,0,0,0 -1796,33530,0,0,0,0,8,8,0,0,0,0,0,0 -1797,33550,0,0,0,0,8,8,0,0,0,0,0,0 -1798,33570,30,24,24,24,0,0,0,0,0,0,0,0 -1800,33590,29,24,24,24,0,0,0,0,0,0,0,0 -1801,33610,28,24,24,24,0,0,0,0,0,0,0,0 -1802,33630,26,24,24,24,0,0,0,0,0,0,0,0 -1803,33650,24,24,24,24,0,0,0,0,0,0,0,0 -1804,33670,24,24,24,24,0,0,0,0,0,0,0,0 -1805,33690,22,16,16,16,24,24,0,0,0,0,0,0 -1807,33710,21,16,16,16,24,24,0,0,0,0,0,0 -1808,33730,19,16,16,16,24,24,0,0,0,0,0,0 -1809,33750,18,16,16,16,24,24,0,0,0,0,0,0 -1810,33770,16,16,16,16,24,24,0,0,0,0,0,0 -1811,33790,15,8,8,8,16,16,0,0,0,0,0,0 -1813,33810,14,8,8,8,16,16,0,0,0,0,0,0 -1815,33830,13,8,8,8,16,16,0,0,0,0,0,0 -1816,33850,12,8,8,8,16,16,0,0,0,0,0,0 -1817,33870,10,8,8,8,16,16,0,0,0,0,0,0 -1818,33890,9,8,8,8,16,16,0,0,0,0,0,0 -1819,33910,8,8,8,8,16,16,0,0,0,0,0,0 -1820,33929,6,0,0,0,8,8,0,0,0,0,0,0 -1822,33949,5,0,0,0,8,8,0,0,0,0,0,0 -1824,33969,4,0,0,0,8,8,0,0,0,0,0,0 -1825,33989,2,0,0,0,8,8,0,0,0,0,0,0 -1826,34009,1,0,0,0,8,8,0,0,0,0,0,0 -1827,34029,0,0,0,0,8,8,0,0,0,0,0,0 -1828,34049,30,24,24,24,0,0,0,0,0,0,0,0 -1830,34069,29,24,24,24,0,0,0,0,0,0,0,0 -1832,34089,28,24,24,24,0,0,0,0,0,0,0,0 -1833,34109,26,24,24,24,0,0,0,0,0,0,0,0 -1834,34129,25,24,24,24,0,0,0,0,0,0,0,0 -1835,34149,24,24,24,24,0,0,0,0,0,0,0,0 -1836,34169,22,16,16,16,24,24,0,0,0,0,0,0 -1838,34189,21,16,16,16,24,24,0,0,0,0,0,0 -1840,34209,20,16,16,16,24,24,0,0,0,0,0,0 -1841,34229,18,16,16,16,24,24,0,0,0,0,0,0 -1842,34249,17,16,16,16,24,24,0,0,0,0,0,0 -1843,34269,16,16,16,16,24,24,0,0,0,0,0,0 -1844,34289,14,8,8,8,16,16,0,0,0,0,0,0 -1846,34309,13,8,8,8,16,16,0,0,0,0,0,0 -1848,34329,12,8,8,8,16,16,0,0,0,0,0,0 -1849,34349,10,8,8,8,16,16,0,0,0,0,0,0 -1850,34369,9,8,8,8,16,16,0,0,0,0,0,0 -1851,34389,8,8,8,8,16,16,0,0,0,0,0,0 -1852,34408,6,0,0,0,8,8,0,0,0,0,0,0 -1854,34428,5,0,0,0,8,8,0,0,0,0,0,0 -1855,34448,4,0,0,0,8,8,0,0,0,0,0,0 -1856,34468,2,0,0,0,8,8,0,0,0,0,0,0 -1857,34488,1,0,0,0,8,8,0,0,0,0,0,0 -1858,34508,0,0,0,0,8,8,0,0,0,0,0,0 -1859,34528,30,24,24,24,0,0,0,0,0,0,0,0 -1861,34548,29,24,24,24,0,0,0,0,0,0,0,0 -1863,34568,28,24,24,24,0,0,0,0,0,0,0,0 -1864,34588,26,24,24,24,0,0,0,0,0,0,0,0 -1865,34608,25,24,24,24,0,0,0,0,0,0,0,0 -1866,34628,24,24,24,24,0,0,0,0,0,0,0,0 -1867,34648,22,16,16,16,24,24,0,0,0,0,0,0 -1869,34668,21,16,16,16,24,24,0,0,0,0,0,0 -1871,34688,20,16,16,16,24,24,0,0,0,0,0,0 -1872,34708,18,16,16,16,24,24,0,0,0,0,0,0 -1873,34728,17,16,16,16,24,24,0,0,0,0,0,0 -1874,34748,16,16,16,16,24,24,0,0,0,0,0,0 -1875,34768,14,8,8,8,16,16,0,0,0,0,0,0 -1877,34788,13,8,8,8,16,16,0,0,0,0,0,0 -1879,34808,12,8,8,8,16,16,0,0,0,0,0,0 -1880,34828,10,8,8,8,16,16,0,0,0,0,0,0 -1881,34848,9,8,8,8,16,16,0,0,0,0,0,0 -1882,34868,8,8,8,8,16,16,0,0,0,0,0,0 -1883,34887,6,0,0,0,8,8,0,0,0,0,0,0 -1885,34907,5,0,0,0,8,8,0,0,0,0,0,0 -1887,34927,4,0,0,0,8,8,0,0,0,0,0,0 -1888,34947,3,0,0,0,8,8,0,0,0,0,0,0 -1889,34967,2,0,0,0,8,8,0,0,0,0,0,0 -1890,34987,0,0,0,0,8,8,0,0,0,0,0,0 -1891,35007,31,24,24,24,0,0,0,0,0,0,0,0 -1893,35027,30,24,24,24,0,0,0,0,0,0,0,0 -1895,35047,28,24,24,24,0,0,0,0,0,0,0,0 -1896,35067,28,24,24,24,0,0,0,0,0,0,0,0 -1897,35087,26,24,24,24,0,0,0,0,0,0,0,0 -1898,35107,25,24,24,24,0,0,0,0,0,0,0,0 -1899,35127,24,24,24,24,0,0,0,0,0,0,0,0 -1900,35147,22,16,16,16,24,24,0,0,0,0,0,0 -1902,35167,21,16,16,16,24,24,0,0,0,0,0,0 -1904,35187,20,16,16,16,24,24,0,0,0,0,0,0 -1905,35207,18,16,16,16,24,24,0,0,0,0,0,0 -1906,35227,17,16,16,16,24,24,0,0,0,0,0,0 -1907,35247,16,16,16,16,24,24,0,0,0,0,0,0 -1908,35267,14,8,8,8,16,16,0,0,0,0,0,0 -1910,35287,12,8,8,8,16,16,0,0,0,0,0,0 -1911,35307,11,8,8,8,16,16,0,0,0,0,0,0 -1912,35327,10,8,8,8,16,16,0,0,0,0,0,0 -1913,35347,8,8,8,8,16,16,0,0,0,0,0,0 -1914,35366,7,0,0,0,8,8,0,0,0,0,0,0 -1916,35386,6,0,0,0,8,8,0,0,0,0,0,0 -1918,35406,4,0,0,0,8,8,0,0,0,0,0,0 -1919,35426,3,0,0,0,8,8,0,0,0,0,0,0 -1920,35446,2,0,0,0,8,8,0,0,0,0,0,0 -1921,35466,0,0,0,0,8,8,0,0,0,0,0,0 -1922,35486,31,24,24,24,0,0,0,0,0,0,0,0 -1924,35506,30,24,24,24,0,0,0,0,0,0,0,0 -1926,35526,28,24,24,24,0,0,0,0,0,0,0,0 -1927,35546,27,24,24,24,0,0,0,0,0,0,0,0 -1928,35566,26,24,24,24,0,0,0,0,0,0,0,0 -1929,35586,24,24,24,24,0,0,0,0,0,0,0,0 -1930,35606,23,16,16,16,24,24,0,0,0,0,0,0 -1932,35626,22,16,16,16,24,24,0,0,0,0,0,0 -1934,35646,20,16,16,16,24,24,0,0,0,0,0,0 -1935,35666,18,16,16,16,24,24,0,0,0,0,0,0 -1936,35686,17,16,16,16,24,24,0,0,0,0,0,0 -1937,35706,16,16,16,16,24,24,0,0,0,0,0,0 -1938,35726,14,8,8,8,16,16,0,0,0,0,0,0 -1940,35746,13,8,8,8,16,16,0,0,0,0,0,0 -1942,35766,12,8,8,8,16,16,0,0,0,0,0,0 -1943,35786,11,8,8,8,16,16,0,0,0,0,0,0 -1944,35806,10,8,8,8,16,16,0,0,0,0,0,0 -1945,35826,8,8,8,8,16,16,0,0,0,0,0,0 -1946,35845,6,0,0,0,8,8,0,0,0,0,0,0 -1948,35865,6,0,0,0,8,8,0,0,0,0,0,0 -1950,35885,4,0,0,0,8,8,0,0,0,0,0,0 -1951,35905,3,0,0,0,8,8,0,0,0,0,0,0 -1952,35925,2,0,0,0,8,8,0,0,0,0,0,0 -1953,35945,0,0,0,0,8,8,0,0,0,0,0,0 -1954,35965,30,24,24,24,0,0,0,0,0,0,0,0 -1956,35985,30,24,24,24,0,0,0,0,0,0,0,0 -1958,36005,28,24,24,24,0,0,0,0,0,0,0,0 -1959,36025,26,24,24,24,0,0,0,0,0,0,0,0 -1960,36045,26,24,24,24,0,0,0,0,0,0,0,0 -1961,36065,24,24,24,24,0,0,0,0,0,0,0,0 -1962,36085,23,16,16,16,24,24,0,0,0,0,0,0 -1964,36105,22,16,16,16,24,24,0,0,0,0,0,0 -1966,36125,20,16,16,16,24,24,0,0,0,0,0,0 -1967,36145,19,16,16,16,24,24,0,0,0,0,0,0 -1968,36165,18,16,16,16,24,24,0,0,0,0,0,0 -1969,36185,16,16,16,16,24,24,0,0,0,0,0,0 -1970,36205,15,8,8,8,16,16,0,0,0,0,0,0 -1972,36225,14,8,8,8,16,16,0,0,0,0,0,0 -1974,36245,13,8,8,8,16,16,0,0,0,0,0,0 -1975,36265,12,8,8,8,16,16,0,0,0,0,0,0 -1976,36285,10,8,8,8,16,16,0,0,0,0,0,0 -1977,36305,9,8,8,8,16,16,0,0,0,0,0,0 -1978,36325,8,8,8,8,16,16,0,0,0,0,0,0 -1979,36344,6,0,0,0,8,8,0,0,0,0,0,0 -1981,36364,5,0,0,0,8,8,0,0,0,0,0,0 -1983,36384,4,0,0,0,8,8,0,0,0,0,0,0 -1984,36404,2,0,0,0,8,8,0,0,0,0,0,0 -1985,36424,1,0,0,0,8,8,0,0,0,0,0,0 -1986,36444,0,0,0,0,8,8,0,0,0,0,0,0 -1987,36464,30,24,24,24,0,0,0,0,0,0,0,0 -1989,36484,30,24,24,24,0,0,0,0,0,0,0,0 -1991,36504,28,24,24,24,0,0,0,0,0,0,0,0 -1992,36524,27,24,24,24,0,0,0,0,0,0,0,0 -1993,36544,26,24,24,24,0,0,0,0,0,0,0,0 -1994,36564,24,24,24,24,0,0,0,0,0,0,0,0 -1995,36584,23,16,16,16,24,24,0,0,0,0,0,0 -1997,36604,22,16,16,16,24,24,0,0,0,0,0,0 -1999,36624,20,16,16,16,24,24,0,0,0,0,0,0 -2000,36644,19,16,16,16,24,24,0,0,0,0,0,0 -2001,36664,18,16,16,16,24,24,0,0,0,0,0,0 -2002,36684,16,16,16,16,24,24,0,0,0,0,0,0 -2003,36704,15,8,8,8,16,16,0,0,0,0,0,0 -2005,36724,14,8,8,8,16,16,0,0,0,0,0,0 -2007,36744,12,8,8,8,16,16,0,0,0,0,0,0 -2008,36764,11,8,8,8,16,16,0,0,0,0,0,0 -2009,36784,10,8,8,8,16,16,0,0,0,0,0,0 -2010,36804,8,8,8,8,16,16,0,0,0,0,0,0 -2011,36823,7,0,0,0,8,8,0,0,0,0,0,0 -2013,36843,6,0,0,0,8,8,0,0,0,0,0,0 -2015,36863,4,0,0,0,8,8,0,0,0,0,0,0 -2016,36883,3,0,0,0,8,8,0,0,0,0,0,0 -2017,36903,2,0,0,0,8,8,0,0,0,0,0,0 -2018,36923,0,0,0,0,8,8,0,0,0,0,0,0 -2019,36943,31,24,24,24,0,0,0,0,0,0,0,0 -2021,36963,30,24,24,24,0,0,0,0,0,0,0,0 -2023,36983,28,24,24,24,0,0,0,0,0,0,0,0 -2024,37003,27,24,24,24,0,0,0,0,0,0,0,0 -2025,37023,26,24,24,24,0,0,0,0,0,0,0,0 -2026,37043,24,24,24,24,0,0,0,0,0,0,0,0 -2027,37063,22,16,16,16,24,24,0,0,0,0,0,0 -2029,37083,21,16,16,16,24,24,0,0,0,0,0,0 -2031,37103,20,16,16,16,24,24,0,0,0,0,0,0 -2032,37123,18,16,16,16,24,24,0,0,0,0,0,0 -2033,37143,17,16,16,16,24,24,0,0,0,0,0,0 -2034,37163,16,16,16,16,24,24,0,0,0,0,0,0 -2035,37183,14,8,8,8,16,16,0,0,0,0,0,0 -2037,37203,13,8,8,8,16,16,0,0,0,0,0,0 -2039,37223,12,8,8,8,16,16,0,0,0,0,0,0 -2040,37243,10,8,8,8,16,16,0,0,0,0,0,0 -2041,37263,9,8,8,8,16,16,0,0,0,0,0,0 -2042,37283,8,8,8,8,16,16,0,0,0,0,0,0 -2043,37302,6,0,0,0,8,8,0,0,0,0,0,0 -2045,37322,5,0,0,0,8,8,0,0,0,0,0,0 -2047,37342,4,0,0,0,8,8,0,0,0,0,0,0 -2048,37362,2,0,0,0,8,8,0,0,0,0,0,0 -2049,37382,1,0,0,0,8,8,0,0,0,0,0,0 -2050,37402,0,0,0,0,8,8,0,0,0,0,0,0 -2051,37422,30,24,24,24,0,0,0,0,0,0,0,0 -2053,37442,29,24,24,24,0,0,0,0,0,0,0,0 -2054,37462,28,24,24,24,0,0,0,0,0,0,0,0 -2055,37482,26,24,24,24,0,0,0,0,0,0,0,0 -2056,37502,24,24,24,24,0,0,0,0,0,0,0,0 -2057,37522,24,24,24,24,0,0,0,0,0,0,0,0 -2058,37542,22,16,16,16,24,24,0,0,0,0,0,0 -2060,37562,20,16,16,16,24,24,0,0,0,0,0,0 -2061,37582,19,16,16,16,24,24,0,0,0,0,0,0 -2062,37602,18,16,16,16,24,24,0,0,0,0,0,0 -2063,37622,16,16,16,16,24,24,0,0,0,0,0,0 -2064,37642,15,8,8,8,16,16,0,0,0,0,0,0 -2066,37662,14,8,8,8,16,16,0,0,0,0,0,0 -2068,37682,12,8,8,8,16,16,0,0,0,0,0,0 -2069,37702,11,8,8,8,16,16,0,0,0,0,0,0 -2070,37722,10,8,8,8,16,16,0,0,0,0,0,0 -2071,37742,8,8,8,8,16,16,0,0,0,0,0,0 -2072,37761,7,0,0,0,8,8,0,0,0,0,0,0 -2074,37781,6,0,0,0,8,8,0,0,0,0,0,0 -2076,37801,4,0,0,0,8,8,0,0,0,0,0,0 -2077,37821,3,0,0,0,8,8,0,0,0,0,0,0 -2078,37841,2,0,0,0,8,8,0,0,0,0,0,0 -2079,37861,0,0,0,0,8,8,0,0,0,0,0,0 -2080,37881,30,24,24,24,0,0,0,0,0,0,0,0 -2082,37901,30,24,24,24,0,0,0,0,0,0,0,0 -2084,37921,28,24,24,24,0,0,0,0,0,0,0,0 -2085,37941,27,24,24,24,0,0,0,0,0,0,0,0 -2086,37961,26,24,24,24,0,0,0,0,0,0,0,0 -2087,37981,24,24,24,24,0,0,0,0,0,0,0,0 -2088,38001,23,16,16,16,24,24,0,0,0,0,0,0 -2090,38021,22,16,16,16,24,24,0,0,0,0,0,0 -2092,38041,20,16,16,16,24,24,0,0,0,0,0,0 -2093,38061,19,16,16,16,24,24,0,0,0,0,0,0 -2094,38081,18,16,16,16,24,24,0,0,0,0,0,0 -2095,38101,16,16,16,16,24,24,0,0,0,0,0,0 -2096,38121,15,8,8,8,16,16,0,0,0,0,0,0 -2098,38141,14,8,8,8,16,16,0,0,0,0,0,0 -2100,38161,12,8,8,8,16,16,0,0,0,0,0,0 -2101,38181,10,8,8,8,16,16,0,0,0,0,0,0 -2102,38201,10,8,8,8,16,16,0,0,0,0,0,0 -2103,38221,8,8,8,8,16,16,0,0,0,0,0,0 -2104,38240,6,0,0,0,8,8,0,0,0,0,0,0 -2106,38260,5,0,0,0,8,8,0,0,0,0,0,0 -2108,38280,4,0,0,0,8,8,0,0,0,0,0,0 -2109,38300,2,0,0,0,8,8,0,0,0,0,0,0 -2110,38320,2,0,0,0,8,8,0,0,0,0,0,0 -2111,38340,0,0,0,0,8,8,0,0,0,0,0,0 -2112,38360,31,24,24,24,0,0,0,0,0,0,0,0 -2114,38380,30,24,24,24,0,0,0,0,0,0,0,0 -2116,38400,28,24,24,24,0,0,0,0,0,0,0,0 -2117,38420,27,24,24,24,0,0,0,0,0,0,0,0 -2118,38440,26,24,24,24,0,0,0,0,0,0,0,0 -2119,38460,24,24,24,24,0,0,0,0,0,0,0,0 -2120,38480,23,16,16,16,24,24,0,0,0,0,0,0 -2122,38500,22,16,16,16,24,24,0,0,0,0,0,0 -2124,38520,20,16,16,16,24,24,0,0,0,0,0,0 -2125,38540,19,16,16,16,24,24,0,0,0,0,0,0 -2126,38560,18,16,16,16,24,24,0,0,0,0,0,0 -2127,38580,17,16,16,16,24,24,0,0,0,0,0,0 -2128,38600,16,16,16,16,24,24,0,0,0,0,0,0 -2129,38620,14,8,8,8,16,16,0,0,0,0,0,0 -2131,38640,12,8,8,8,16,16,0,0,0,0,0,0 -2132,38660,12,8,8,8,16,16,0,0,0,0,0,0 -2133,38680,10,8,8,8,16,16,0,0,0,0,0,0 -2134,38700,9,8,8,8,16,16,0,0,0,0,0,0 -2135,38720,8,8,8,8,16,16,0,0,0,0,0,0 -2136,38739,6,0,0,0,8,8,0,0,0,0,0,0 -2138,38759,5,0,0,0,8,8,0,0,0,0,0,0 -2140,38779,4,0,0,0,8,8,0,0,0,0,0,0 -2141,38799,2,0,0,0,8,8,0,0,0,0,0,0 -2142,38819,1,0,0,0,8,8,0,0,0,0,0,0 -2143,38839,0,0,0,0,8,8,0,0,0,0,0,0 -2144,38859,30,24,24,24,0,0,0,0,0,0,0,0 -2146,38879,30,24,24,24,0,0,0,0,0,0,0,0 -2148,38899,28,24,24,24,0,0,0,0,0,0,0,0 -2149,38919,27,24,24,24,0,0,0,0,0,0,0,0 -2150,38939,26,24,24,24,0,0,0,0,0,0,0,0 -2151,38959,24,24,24,24,0,0,0,0,0,0,0,0 -2152,38979,23,16,16,16,24,24,0,0,0,0,0,0 -2154,38999,22,16,16,16,24,24,0,0,0,0,0,0 -2156,39019,20,16,16,16,24,24,0,0,0,0,0,0 -2157,39039,19,16,16,16,24,24,0,0,0,0,0,0 -2158,39059,18,16,16,16,24,24,0,0,0,0,0,0 -2159,39079,16,16,16,16,24,24,0,0,0,0,0,0 -2160,39099,14,8,8,8,16,16,0,0,0,0,0,0 -2162,39119,14,8,8,8,16,16,0,0,0,0,0,0 -2164,39139,12,8,8,8,16,16,0,0,0,0,0,0 -2165,39159,10,8,8,8,16,16,0,0,0,0,0,0 -2166,39179,9,8,8,8,16,16,0,0,0,0,0,0 -2167,39199,8,8,8,8,16,16,0,0,0,0,0,0 -2168,39218,6,0,0,0,8,8,0,0,0,0,0,0 -2170,39238,5,0,0,0,8,8,0,0,0,0,0,0 -2172,39258,4,0,0,0,8,8,0,0,0,0,0,0 -2173,39278,2,0,0,0,8,8,0,0,0,0,0,0 -2174,39298,1,0,0,0,8,8,0,0,0,0,0,0 -2175,39318,0,0,0,0,8,8,0,0,0,0,0,0 -2176,39338,31,24,24,24,0,0,0,0,0,0,0,0 -2178,39358,30,24,24,24,0,0,0,0,0,0,0,0 -2180,39378,28,24,24,24,0,0,0,0,0,0,0,0 -2181,39398,27,24,24,24,0,0,0,0,0,0,0,0 -2182,39418,26,24,24,24,0,0,0,0,0,0,0,0 -2183,39438,24,24,24,24,0,0,0,0,0,0,0,0 -2184,39458,23,16,16,16,24,24,0,0,0,0,0,0 -2186,39478,22,16,16,16,24,24,0,0,0,0,0,0 -2188,39498,20,16,16,16,24,24,0,0,0,0,0,0 -2189,39518,19,16,16,16,24,24,0,0,0,0,0,0 -2190,39538,18,16,16,16,24,24,0,0,0,0,0,0 -2191,39558,16,16,16,16,24,24,0,0,0,0,0,0 -2192,39578,15,8,8,8,16,16,0,0,0,0,0,0 -2194,39598,14,8,8,8,16,16,0,0,0,0,0,0 -2196,39618,12,8,8,8,16,16,0,0,0,0,0,0 -2197,39638,11,8,8,8,16,16,0,0,0,0,0,0 -2198,39658,10,8,8,8,16,16,0,0,0,0,0,0 -2199,39678,8,8,8,8,16,16,0,0,0,0,0,0 -2200,39697,6,0,0,0,8,8,0,0,0,0,0,0 -2202,39717,6,0,0,0,8,8,0,0,0,0,0,0 -2204,39737,4,0,0,0,8,8,0,0,0,0,0,0 -2205,39757,3,0,0,0,8,8,0,0,0,0,0,0 -2206,39777,2,0,0,0,8,8,0,0,0,0,0,0 -2207,39797,0,0,0,0,8,8,0,0,0,0,0,0 -2208,39817,31,24,24,24,0,0,0,0,0,0,0,0 -2210,39837,30,24,24,24,0,0,0,0,0,0,0,0 -2212,39857,28,24,24,24,0,0,0,0,0,0,0,0 -2213,39877,26,24,24,24,0,0,0,0,0,0,0,0 -2214,39897,25,24,24,24,0,0,0,0,0,0,0,0 -2215,39917,24,24,24,24,0,0,0,0,0,0,0,0 -2216,39937,22,16,16,16,24,24,0,0,0,0,0,0 -2218,39957,21,16,16,16,24,24,0,0,0,0,0,0 -2220,39977,20,16,16,16,24,24,0,0,0,0,0,0 -2221,39997,18,16,16,16,24,24,0,0,0,0,0,0 -2222,40017,17,16,16,16,24,24,0,0,0,0,0,0 -2223,40037,16,16,16,16,24,24,0,0,0,0,0,0 -2224,40057,14,8,8,8,16,16,0,0,0,0,0,0 -2226,40077,13,8,8,8,16,16,0,0,0,0,0,0 -2228,40097,12,8,8,8,16,16,0,0,0,0,0,0 -2229,40117,10,8,8,8,16,16,0,0,0,0,0,0 -2230,40137,9,8,8,8,16,16,0,0,0,0,0,0 -2231,40157,8,8,8,8,16,16,0,0,0,0,0,0 -2232,40176,6,0,0,0,8,8,0,0,0,0,0,0 -2234,40196,5,0,0,0,8,8,0,0,0,0,0,0 -2236,40216,4,0,0,0,8,8,0,0,0,0,0,0 -2237,40236,2,0,0,0,8,8,0,0,0,0,0,0 -2238,40256,1,0,0,0,8,8,0,0,0,0,0,0 -2239,40276,0,0,0,0,8,8,0,0,0,0,0,0 -2240,40296,30,24,24,24,0,0,0,0,0,0,0,0 -2242,40316,29,24,24,24,0,0,0,0,0,0,0,0 -2244,40336,28,24,24,24,0,0,0,0,0,0,0,0 -2245,40356,26,24,24,24,0,0,0,0,0,0,0,0 -2246,40376,25,24,24,24,0,0,0,0,0,0,0,0 -2247,40396,24,24,24,24,0,0,0,0,0,0,0,0 -2248,40416,22,16,16,16,24,24,0,0,0,0,0,0 -2250,40436,21,16,16,16,24,24,0,0,0,0,0,0 -2252,40456,20,16,16,16,24,24,0,0,0,0,0,0 -2253,40476,18,16,16,16,24,24,0,0,0,0,0,0 -2254,40496,17,16,16,16,24,24,0,0,0,0,0,0 -2255,40516,16,16,16,16,24,24,0,0,0,0,0,0 -2256,40536,14,8,8,8,16,16,0,0,0,0,0,0 -2258,40556,13,8,8,8,16,16,0,0,0,0,0,0 -2260,40576,12,8,8,8,16,16,0,0,0,0,0,0 -2261,40596,10,8,8,8,16,16,0,0,0,0,0,0 -2262,40616,9,8,8,8,16,16,0,0,0,0,0,0 -2263,40636,8,8,8,8,16,16,0,0,0,0,0,0 -2264,40655,6,0,0,0,8,8,0,0,0,0,0,0 -2266,40675,5,0,0,0,8,8,0,0,0,0,0,0 -2268,40695,4,0,0,0,8,8,0,0,0,0,0,0 -2269,40715,2,0,0,0,8,8,0,0,0,0,0,0 -2270,40735,1,0,0,0,8,8,0,0,0,0,0,0 -2271,40755,0,0,0,0,8,8,0,0,0,0,0,0 -2272,40775,30,24,24,24,0,0,0,0,0,0,0,0 -2274,40795,29,24,24,24,0,0,0,0,0,0,0,0 -2276,40815,28,24,24,24,0,0,0,0,0,0,0,0 -2277,40835,26,24,24,24,0,0,0,0,0,0,0,0 -2278,40855,25,24,24,24,0,0,0,0,0,0,0,0 -2279,40875,24,24,24,24,0,0,0,0,0,0,0,0 -2280,40895,22,16,16,16,24,24,0,0,0,0,0,0 -2282,40915,21,16,16,16,24,24,0,0,0,0,0,0 -2284,40935,20,16,16,16,24,24,0,0,0,0,0,0 -2285,40955,18,16,16,16,24,24,0,0,0,0,0,0 -2286,40975,16,16,16,16,24,24,0,0,0,0,0,0 -2287,40995,15,8,8,8,16,16,0,0,0,0,0,0 -2289,41015,14,8,8,8,16,16,0,0,0,0,0,0 -2291,41035,12,8,8,8,16,16,0,0,0,0,0,0 -2292,41055,11,8,8,8,16,16,0,0,0,0,0,0 -2293,41075,10,8,8,8,16,16,0,0,0,0,0,0 -2294,41095,8,8,8,8,16,16,0,0,0,0,0,0 -2295,41114,7,0,0,0,8,8,0,0,0,0,0,0 -2297,41134,6,0,0,0,8,8,0,0,0,0,0,0 -2299,41154,4,0,0,0,8,8,0,0,0,0,0,0 -2300,41174,3,0,0,0,8,8,0,0,0,0,0,0 -2301,41194,2,0,0,0,8,8,0,0,0,0,0,0 -2302,41214,0,0,0,0,8,8,0,0,0,0,0,0 -2303,41234,31,24,24,24,0,0,0,0,0,0,0,0 -2305,41254,30,24,24,24,0,0,0,0,0,0,0,0 -2307,41274,28,24,24,24,0,0,0,0,0,0,0,0 -2308,41294,27,24,24,24,0,0,0,0,0,0,0,0 -2309,41314,26,24,24,24,0,0,0,0,0,0,0,0 -2310,41334,24,24,24,24,0,0,0,0,0,0,0,0 -2311,41354,23,16,16,16,24,24,0,0,0,0,0,0 -2313,41374,22,16,16,16,24,24,0,0,0,0,0,0 -2315,41394,20,16,16,16,24,24,0,0,0,0,0,0 -2316,41414,19,16,16,16,24,24,0,0,0,0,0,0 -2317,41434,18,16,16,16,24,24,0,0,0,0,0,0 -2318,41454,16,16,16,16,24,24,0,0,0,0,0,0 -2319,41474,14,8,8,8,16,16,0,0,0,0,0,0 -2321,41494,14,8,8,8,16,16,0,0,0,0,0,0 -2323,41514,12,8,8,8,16,16,0,0,0,0,0,0 -2324,41534,10,8,8,8,16,16,0,0,0,0,0,0 -2325,41554,10,8,8,8,16,16,0,0,0,0,0,0 -2326,41574,8,8,8,8,16,16,0,0,0,0,0,0 -2327,41593,6,0,0,0,8,8,0,0,0,0,0,0 -2329,41613,5,0,0,0,8,8,0,0,0,0,0,0 -2331,41633,4,0,0,0,8,8,0,0,0,0,0,0 -2332,41653,2,0,0,0,8,8,0,0,0,0,0,0 -2333,41673,1,0,0,0,8,8,0,0,0,0,0,0 -2334,41693,0,0,0,0,8,8,0,0,0,0,0,0 -2335,41713,30,24,24,24,0,0,0,0,0,0,0,0 -2337,41733,29,24,24,24,0,0,0,0,0,0,0,0 -2339,41753,28,24,24,24,0,0,0,0,0,0,0,0 -2340,41773,26,24,24,24,0,0,0,0,0,0,0,0 -2341,41793,25,24,24,24,0,0,0,0,0,0,0,0 -2342,41813,24,24,24,24,0,0,0,0,0,0,0,0 -2343,41833,22,16,16,16,24,24,0,0,0,0,0,0 -2345,41853,21,16,16,16,24,24,0,0,0,0,0,0 -2347,41873,20,16,16,16,24,24,0,0,0,0,0,0 -2348,41893,18,16,16,16,24,24,0,0,0,0,0,0 -2349,41913,17,16,16,16,24,24,0,0,0,0,0,0 -2350,41933,16,16,16,16,24,24,0,0,0,0,0,0 -2351,41953,14,8,8,8,16,16,0,0,0,0,0,0 -2353,41973,13,8,8,8,16,16,0,0,0,0,0,0 -2355,41993,12,8,8,8,16,16,0,0,0,0,0,0 -2356,42013,10,8,8,8,16,16,0,0,0,0,0,0 -2357,42033,9,8,8,8,16,16,0,0,0,0,0,0 -2358,42053,8,8,8,8,16,16,0,0,0,0,0,0 -2359,42072,6,0,0,0,8,8,0,0,0,0,0,0 -2361,42092,6,0,0,0,8,8,0,0,0,0,0,0 -2363,42112,4,0,0,0,8,8,0,0,0,0,0,0 -2364,42132,2,0,0,0,8,8,0,0,0,0,0,0 -2365,42152,2,0,0,0,8,8,0,0,0,0,0,0 -2366,42172,0,0,0,0,8,8,0,0,0,0,0,0 -2367,42192,31,24,24,24,0,0,0,0,0,0,0,0 -2369,42212,30,24,24,24,0,0,0,0,0,0,0,0 -2371,42232,28,24,24,24,0,0,0,0,0,0,0,0 -2372,42252,27,24,24,24,0,0,0,0,0,0,0,0 -2373,42272,26,24,24,24,0,0,0,0,0,0,0,0 -2374,42292,24,24,24,24,0,0,0,0,0,0,0,0 -2375,42312,23,16,16,16,24,24,0,0,0,0,0,0 -2377,42332,22,16,16,16,24,24,0,0,0,0,0,0 -2379,42352,21,16,16,16,24,24,0,0,0,0,0,0 -2380,42372,19,16,16,16,24,24,0,0,0,0,0,0 -2381,42392,18,16,16,16,24,24,0,0,0,0,0,0 -2382,42412,16,16,16,16,24,24,0,0,0,0,0,0 -2383,42432,15,8,8,8,16,16,0,0,0,0,0,0 -2385,42452,14,8,8,8,16,16,0,0,0,0,0,0 -2387,42472,12,8,8,8,16,16,0,0,0,0,0,0 -2388,42492,11,8,8,8,16,16,0,0,0,0,0,0 -2389,42512,10,8,8,8,16,16,0,0,0,0,0,0 -2390,42532,8,8,8,8,16,16,0,0,0,0,0,0 -2391,42551,7,0,0,0,8,8,0,0,0,0,0,0 -2393,42571,6,0,0,0,8,8,0,0,0,0,0,0 -2395,42591,4,0,0,0,8,8,0,0,0,0,0,0 -2396,42611,3,0,0,0,8,8,0,0,0,0,0,0 -2397,42631,2,0,0,0,8,8,0,0,0,0,0,0 -2398,42651,0,0,0,0,8,8,0,0,0,0,0,0 -2399,42671,31,24,24,24,0,0,0,0,0,0,0,0 -2401,42691,30,24,24,24,0,0,0,0,0,0,0,0 -2403,42711,28,24,24,24,0,0,0,0,0,0,0,0 -2404,42731,27,24,24,24,0,0,0,0,0,0,0,0 -2405,42751,26,24,24,24,0,0,0,0,0,0,0,0 -2406,42771,24,24,24,24,0,0,0,0,0,0,0,0 -2407,42791,23,16,16,16,24,24,0,0,0,0,0,0 -2409,42811,22,16,16,16,24,24,0,0,0,0,0,0 -2411,42831,20,16,16,16,24,24,0,0,0,0,0,0 -2412,42851,19,16,16,16,24,24,0,0,0,0,0,0 -2413,42871,18,16,16,16,24,24,0,0,0,0,0,0 -2414,42891,16,16,16,16,24,24,0,0,0,0,0,0 -2415,42911,15,8,8,8,16,16,0,0,0,0,0,0 -2417,42931,14,8,8,8,16,16,0,0,0,0,0,0 -2419,42951,12,8,8,8,16,16,0,0,0,0,0,0 -2420,42971,11,8,8,8,16,16,0,0,0,0,0,0 -2421,42991,10,8,8,8,16,16,0,0,0,0,0,0 -2422,43011,8,8,8,8,16,16,0,0,0,0,0,0 -2423,43030,7,0,0,0,8,8,0,0,0,0,0,0 -2425,43050,6,0,0,0,8,8,0,0,0,0,0,0 -2427,43070,4,0,0,0,8,8,0,0,0,0,0,0 -2428,43090,2,0,0,0,8,8,0,0,0,0,0,0 -2429,43110,1,0,0,0,8,8,0,0,0,0,0,0 -2430,43130,0,0,0,0,8,8,0,0,0,0,0,0 -2431,43150,31,24,24,24,0,0,0,0,0,0,0,0 -2433,43170,30,24,24,24,0,0,0,0,0,0,0,0 -2435,43190,28,24,24,24,0,0,0,0,0,0,0,0 -2436,43210,27,24,24,24,0,0,0,0,0,0,0,0 -2437,43230,26,24,24,24,0,0,0,0,0,0,0,0 -2438,43250,24,24,24,24,0,0,0,0,0,0,0,0 -2439,43270,23,16,16,16,24,24,0,0,0,0,0,0 -2441,43290,22,16,16,16,24,24,0,0,0,0,0,0 -2443,43310,20,16,16,16,24,24,0,0,0,0,0,0 -2444,43330,18,16,16,16,24,24,0,0,0,0,0,0 -2445,43350,17,16,16,16,24,24,0,0,0,0,0,0 -2446,43370,16,16,16,16,24,24,0,0,0,0,0,0 -2447,43390,14,8,8,8,16,16,0,0,0,0,0,0 -2449,43410,13,8,8,8,16,16,0,0,0,0,0,0 -2451,43430,12,8,8,8,16,16,0,0,0,0,0,0 -2452,43450,10,8,8,8,16,16,0,0,0,0,0,0 -2453,43470,9,8,8,8,16,16,0,0,0,0,0,0 -2454,43490,8,8,8,8,16,16,0,0,0,0,0,0 -2455,43509,6,0,0,0,8,8,0,0,0,0,0,0 -2457,43529,5,0,0,0,8,8,0,0,0,0,0,0 -2459,43549,4,0,0,0,8,8,0,0,0,0,0,0 -2460,43569,2,0,0,0,8,8,0,0,0,0,0,0 -2461,43589,1,0,0,0,8,8,0,0,0,0,0,0 -2462,43609,0,0,0,0,8,8,0,0,0,0,0,0 -2463,43629,30,24,24,24,0,0,0,0,0,0,0,0 -2465,43649,29,24,24,24,0,0,0,0,0,0,0,0 -2467,43669,28,24,24,24,0,0,0,0,0,0,0,0 -2468,43689,26,24,24,24,0,0,0,0,0,0,0,0 -2469,43709,25,24,24,24,0,0,0,0,0,0,0,0 -2470,43729,24,24,24,24,0,0,0,0,0,0,0,0 -2471,43749,22,16,16,16,24,24,0,0,0,0,0,0 -2473,43769,21,16,16,16,24,24,0,0,0,0,0,0 -2475,43789,20,16,16,16,24,24,0,0,0,0,0,0 -2476,43809,18,16,16,16,24,24,0,0,0,0,0,0 -2477,43829,17,16,16,16,24,24,0,0,0,0,0,0 -2478,43849,16,16,16,16,24,24,0,0,0,0,0,0 -2479,43869,14,8,8,8,16,16,0,0,0,0,0,0 -2481,43889,12,8,8,8,16,16,0,0,0,0,0,0 -2482,43909,12,8,8,8,16,16,0,0,0,0,0,0 -2483,43929,10,8,8,8,16,16,0,0,0,0,0,0 -2484,43949,8,8,8,8,16,16,0,0,0,0,0,0 -2485,43969,8,8,8,8,16,16,0,0,0,0,0,0 -2486,43988,6,0,0,0,8,8,0,0,0,0,0,0 -2488,44008,5,0,0,0,8,8,0,0,0,0,0,0 -2489,44028,4,0,0,0,8,8,0,0,0,0,0,0 -2490,44048,2,0,0,0,8,8,0,0,0,0,0,0 -2491,44068,0,0,0,0,8,8,0,0,0,0,0,0 -2492,44088,31,24,24,24,0,0,0,0,0,0,0,0 -2494,44108,30,24,24,24,0,0,0,0,0,0,0,0 -2496,44128,28,24,24,24,0,0,0,0,0,0,0,0 -2497,44148,28,24,24,24,0,0,0,0,0,0,0,0 -2498,44168,26,24,24,24,0,0,0,0,0,0,0,0 -2499,44188,24,24,24,24,0,0,0,0,0,0,0,0 -2500,44208,23,16,16,16,24,24,0,0,0,0,0,0 -2502,44228,22,16,16,16,24,24,0,0,0,0,0,0 -2504,44248,20,16,16,16,24,24,0,0,0,0,0,0 -2505,44268,19,16,16,16,24,24,0,0,0,0,0,0 -2506,44288,18,16,16,16,24,24,0,0,0,0,0,0 -2507,44308,16,16,16,16,24,24,0,0,0,0,0,0 -2508,44328,15,8,8,8,16,16,0,0,0,0,0,0 -2510,44348,14,8,8,8,16,16,0,0,0,0,0,0 -2512,44368,12,8,8,8,16,16,0,0,0,0,0,0 -2513,44388,11,8,8,8,16,16,0,0,0,0,0,0 -2514,44408,10,8,8,8,16,16,0,0,0,0,0,0 -2515,44428,8,8,8,8,16,16,0,0,0,0,0,0 -2516,44447,7,0,0,0,8,8,0,0,0,0,0,0 -2518,44467,6,0,0,0,8,8,0,0,0,0,0,0 -2520,44487,4,0,0,0,8,8,0,0,0,0,0,0 -2521,44507,2,0,0,0,8,8,0,0,0,0,0,0 -2522,44527,2,0,0,0,8,8,0,0,0,0,0,0 -2523,44547,0,0,0,0,8,8,0,0,0,0,0,0 -2524,44567,31,24,24,24,0,0,0,0,0,0,0,0 -2526,44587,30,24,24,24,0,0,0,0,0,0,0,0 -2528,44607,28,24,24,24,0,0,0,0,0,0,0,0 -2529,44627,27,24,24,24,0,0,0,0,0,0,0,0 -2530,44647,26,24,24,24,0,0,0,0,0,0,0,0 -2531,44667,24,24,24,24,0,0,0,0,0,0,0,0 -2532,44687,23,16,16,16,24,24,0,0,0,0,0,0 -2534,44707,22,16,16,16,24,24,0,0,0,0,0,0 -2536,44727,20,16,16,16,24,24,0,0,0,0,0,0 -2537,44747,18,16,16,16,24,24,0,0,0,0,0,0 -2538,44767,18,16,16,16,24,24,0,0,0,0,0,0 -2539,44787,16,16,16,16,24,24,0,0,0,0,0,0 -2540,44807,15,8,8,8,16,16,0,0,0,0,0,0 -2542,44827,14,8,8,8,16,16,0,0,0,0,0,0 -2544,44847,12,8,8,8,16,16,0,0,0,0,0,0 -2545,44867,11,8,8,8,16,16,0,0,0,0,0,0 -2546,44887,10,8,8,8,16,16,0,0,0,0,0,0 -2547,44907,8,8,8,8,16,16,0,0,0,0,0,0 -2548,44926,7,0,0,0,8,8,0,0,0,0,0,0 -2550,44946,6,0,0,0,8,8,0,0,0,0,0,0 -2552,44966,4,0,0,0,8,8,0,0,0,0,0,0 -2553,44986,2,0,0,0,8,8,0,0,0,0,0,0 -2554,45006,2,0,0,0,8,8,0,0,0,0,0,0 -2555,45026,0,0,0,0,8,8,0,0,0,0,0,0 -2556,45046,30,24,24,24,0,0,0,0,0,0,0,0 -2558,45066,29,24,24,24,0,0,0,0,0,0,0,0 -2560,45086,28,24,24,24,0,0,0,0,0,0,0,0 -2561,45106,26,24,24,24,0,0,0,0,0,0,0,0 -2562,45126,25,24,24,24,0,0,0,0,0,0,0,0 -2563,45146,24,24,24,24,0,0,0,0,0,0,0,0 -2564,45166,22,16,16,16,24,24,0,0,0,0,0,0 -2566,45186,21,16,16,16,24,24,0,0,0,0,0,0 -2568,45206,20,16,16,16,24,24,0,0,0,0,0,0 -2569,45226,18,16,16,16,24,24,0,0,0,0,0,0 -2570,45246,17,16,16,16,24,24,0,0,0,0,0,0 -2571,45266,16,16,16,16,24,24,0,0,0,0,0,0 -2572,45286,14,8,8,8,16,16,0,0,0,0,0,0 -2574,45306,13,8,8,8,16,16,0,0,0,0,0,0 -2575,45326,11,8,8,8,16,16,0,0,0,0,0,0 -2576,45346,10,8,8,8,16,16,0,0,0,0,0,0 -2577,45366,8,8,8,8,16,16,0,0,0,0,0,0 -2578,45385,7,0,0,0,8,8,0,0,0,0,0,0 -2580,45405,6,0,0,0,8,8,0,0,0,0,0,0 -2582,45425,4,0,0,0,8,8,0,0,0,0,0,0 -2583,45445,3,0,0,0,8,8,0,0,0,0,0,0 -2584,45465,2,0,0,0,8,8,0,0,0,0,0,0 -2585,45485,0,0,0,0,8,8,0,0,0,0,0,0 -2586,45505,31,24,24,24,0,0,0,0,0,0,0,0 -2588,45525,30,24,24,24,0,0,0,0,0,0,0,0 -2590,45545,28,24,24,24,0,0,0,0,0,0,0,0 -2591,45565,27,24,24,24,0,0,0,0,0,0,0,0 -2592,45585,26,24,24,24,0,0,0,0,0,0,0,0 -2593,45605,24,24,24,24,0,0,0,0,0,0,0,0 -2594,45625,23,16,16,16,24,24,0,0,0,0,0,0 -2596,45645,22,16,16,16,24,24,0,0,0,0,0,0 -2598,45665,20,16,16,16,24,24,0,0,0,0,0,0 -2599,45685,19,16,16,16,24,24,0,0,0,0,0,0 -2600,45705,18,16,16,16,24,24,0,0,0,0,0,0 -2601,45725,16,16,16,16,24,24,0,0,0,0,0,0 -2602,45745,15,8,8,8,16,16,0,0,0,0,0,0 -2604,45765,14,8,8,8,16,16,0,0,0,0,0,0 -2606,45785,12,8,8,8,16,16,0,0,0,0,0,0 -2607,45805,11,8,8,8,16,16,0,0,0,0,0,0 -2608,45825,10,8,8,8,16,16,0,0,0,0,0,0 -2609,45845,8,8,8,8,16,16,0,0,0,0,0,0 -2610,45864,6,0,0,0,8,8,0,0,0,0,0,0 -2612,45884,6,0,0,0,8,8,0,0,0,0,0,0 -2614,45904,4,0,0,0,8,8,0,0,0,0,0,0 -2615,45924,2,0,0,0,8,8,0,0,0,0,0,0 -2616,45944,1,0,0,0,8,8,0,0,0,0,0,0 -2617,45964,0,0,0,0,8,8,0,0,0,0,0,0 -2618,45984,30,24,24,24,0,0,0,0,0,0,0,0 -2620,46004,29,24,24,24,0,0,0,0,0,0,0,0 -2622,46024,28,24,24,24,0,0,0,0,0,0,0,0 -2623,46044,26,24,24,24,0,0,0,0,0,0,0,0 -2624,46064,26,24,24,24,0,0,0,0,0,0,0,0 -2625,46084,24,24,24,24,0,0,0,0,0,0,0,0 -2626,46104,22,16,16,16,24,24,0,0,0,0,0,0 -2628,46124,21,16,16,16,24,24,0,0,0,0,0,0 -2630,46144,20,16,16,16,24,24,0,0,0,0,0,0 -2631,46164,18,16,16,16,24,24,0,0,0,0,0,0 -2632,46184,17,16,16,16,24,24,0,0,0,0,0,0 -2633,46204,16,16,16,16,24,24,0,0,0,0,0,0 -2634,46224,14,8,8,8,16,16,0,0,0,0,0,0 -2636,46244,13,8,8,8,16,16,0,0,0,0,0,0 -2638,46264,12,8,8,8,16,16,0,0,0,0,0,0 -2639,46284,10,8,8,8,16,16,0,0,0,0,0,0 -2640,46304,9,8,8,8,16,16,0,0,0,0,0,0 -2641,46324,8,8,8,8,16,16,0,0,0,0,0,0 -2642,46343,6,0,0,0,8,8,0,0,0,0,0,0 -2644,46363,5,0,0,0,8,8,0,0,0,0,0,0 -2646,46383,4,0,0,0,8,8,0,0,0,0,0,0 -2647,46403,2,0,0,0,8,8,0,0,0,0,0,0 -2648,46423,1,0,0,0,8,8,0,0,0,0,0,0 -2649,46443,0,0,0,0,8,8,0,0,0,0,0,0 -2650,46463,30,24,24,24,0,0,0,0,0,0,0,0 -2652,46483,29,24,24,24,0,0,0,0,0,0,0,0 -2654,46503,28,24,24,24,0,0,0,0,0,0,0,0 -2655,46523,26,24,24,24,0,0,0,0,0,0,0,0 -2656,46543,25,24,24,24,0,0,0,0,0,0,0,0 -2657,46563,24,24,24,24,0,0,0,0,0,0,0,0 -2658,46583,22,16,16,16,24,24,0,0,0,0,0,0 -2660,46603,21,16,16,16,24,24,0,0,0,0,0,0 -2662,46623,20,16,16,16,24,24,0,0,0,0,0,0 -2663,46643,18,16,16,16,24,24,0,0,0,0,0,0 -2664,46663,17,16,16,16,24,24,0,0,0,0,0,0 -2665,46683,16,16,16,16,24,24,0,0,0,0,0,0 -2666,46703,14,8,8,8,16,16,0,0,0,0,0,0 -2668,46723,13,8,8,8,16,16,0,0,0,0,0,0 -2670,46743,12,8,8,8,16,16,0,0,0,0,0,0 -2671,46763,10,8,8,8,16,16,0,0,0,0,0,0 -2672,46783,9,8,8,8,16,16,0,0,0,0,0,0 -2673,46803,8,8,8,8,16,16,0,0,0,0,0,0 -2674,46822,6,0,0,0,8,8,0,0,0,0,0,0 -2676,46842,5,0,0,0,8,8,0,0,0,0,0,0 -2678,46862,4,0,0,0,8,8,0,0,0,0,0,0 -2679,46882,2,0,0,0,8,8,0,0,0,0,0,0 -2680,46902,1,0,0,0,8,8,0,0,0,0,0,0 -2681,46922,0,0,0,0,8,8,0,0,0,0,0,0 -2682,46942,30,24,24,24,0,0,0,0,0,0,0,0 -2684,46962,29,24,24,24,0,0,0,0,0,0,0,0 -2686,46982,28,24,24,24,0,0,0,0,0,0,0,0 -2687,47002,26,24,24,24,0,0,0,0,0,0,0,0 -2688,47022,25,24,24,24,0,0,0,0,0,0,0,0 -2689,47042,24,24,24,24,0,0,0,0,0,0,0,0 -2690,47062,22,16,16,16,24,24,0,0,0,0,0,0 -2692,47082,21,16,16,16,24,24,0,0,0,0,0,0 -2694,47102,20,16,16,16,24,24,0,0,0,0,0,0 -2695,47122,18,16,16,16,24,24,0,0,0,0,0,0 -2696,47142,17,16,16,16,24,24,0,0,0,0,0,0 -2697,47162,16,16,16,16,24,24,0,0,0,0,0,0 -2698,47182,14,8,8,8,16,16,0,0,0,0,0,0 -2700,47202,13,8,8,8,16,16,0,0,0,0,0,0 -2702,47222,12,8,8,8,16,16,0,0,0,0,0,0 -2703,47242,10,8,8,8,16,16,0,0,0,0,0,0 -2704,47262,9,8,8,8,16,16,0,0,0,0,0,0 -2705,47282,8,8,8,8,16,16,0,0,0,0,0,0 -2706,47301,6,0,0,0,8,8,0,0,0,0,0,0 -2708,47321,5,0,0,0,8,8,0,0,0,0,0,0 -2710,47341,4,0,0,0,8,8,0,0,0,0,0,0 -2711,47361,2,0,0,0,8,8,0,0,0,0,0,0 -2712,47381,1,0,0,0,8,8,0,0,0,0,0,0 -2713,47401,0,0,0,0,8,8,0,0,0,0,0,0 -2714,47421,30,24,24,24,0,0,0,0,0,0,0,0 -2716,47441,29,24,24,24,0,0,0,0,0,0,0,0 -2718,47461,28,24,24,24,0,0,0,0,0,0,0,0 -2719,47481,26,24,24,24,0,0,0,0,0,0,0,0 -2720,47501,25,24,24,24,0,0,0,0,0,0,0,0 -2721,47521,24,24,24,24,0,0,0,0,0,0,0,0 -2722,47541,22,16,16,16,24,24,0,0,0,0,0,0 -2724,47561,21,16,16,16,24,24,0,0,0,0,0,0 -2726,47581,20,16,16,16,24,24,0,0,0,0,0,0 -2727,47601,18,16,16,16,24,24,0,0,0,0,0,0 -2728,47621,17,16,16,16,24,24,0,0,0,0,0,0 -2729,47641,16,16,16,16,24,24,0,0,0,0,0,0 -2730,47661,14,8,8,8,16,16,0,0,0,0,0,0 -2732,47681,13,8,8,8,16,16,0,0,0,0,0,0 -2733,47701,12,8,8,8,16,16,0,0,0,0,0,0 -2734,47721,10,8,8,8,16,16,0,0,0,0,0,0 -2735,47741,9,8,8,8,16,16,0,0,0,0,0,0 -2736,47761,8,8,8,8,16,16,0,0,0,0,0,0 -2737,47780,6,0,0,0,8,8,0,0,0,0,0,0 -2739,47800,5,0,0,0,8,8,0,0,0,0,0,0 -2740,47820,4,0,0,0,8,8,0,0,0,0,0,0 -2741,47840,2,0,0,0,8,8,0,0,0,0,0,0 -2742,47860,1,0,0,0,8,8,0,0,0,0,0,0 -2743,47880,0,0,0,0,8,8,0,0,0,0,0,0 -2744,47900,30,24,24,24,0,0,0,0,0,0,0,0 -2746,47920,29,24,24,24,0,0,0,0,0,0,0,0 -2748,47940,28,24,24,24,0,0,0,0,0,0,0,0 -2749,47960,26,24,24,24,0,0,0,0,0,0,0,0 -2750,47980,25,24,24,24,0,0,0,0,0,0,0,0 -2751,48000,24,24,24,24,0,0,0,0,0,0,0,0 -2752,48020,22,16,16,16,24,24,0,0,0,0,0,0 -2754,48040,21,16,16,16,24,24,0,0,0,0,0,0 -2756,48060,20,16,16,16,24,24,0,0,0,0,0,0 -2757,48080,18,16,16,16,24,24,0,0,0,0,0,0 -2758,48100,17,16,16,16,24,24,0,0,0,0,0,0 -2759,48120,15,8,8,8,16,16,0,0,0,0,0,0 -2761,48140,14,8,8,8,16,16,0,0,0,0,0,0 -2763,48160,12,8,8,8,16,16,0,0,0,0,0,0 -2764,48180,11,8,8,8,16,16,0,0,0,0,0,0 -2765,48200,10,8,8,8,16,16,0,0,0,0,0,0 -2766,48220,8,8,8,8,16,16,0,0,0,0,0,0 -2767,48239,7,0,0,0,8,8,0,0,0,0,0,0 -2769,48259,6,0,0,0,8,8,0,0,0,0,0,0 -2771,48279,4,0,0,0,8,8,0,0,0,0,0,0 -2772,48299,3,0,0,0,8,8,0,0,0,0,0,0 -2773,48319,2,0,0,0,8,8,0,0,0,0,0,0 -2774,48339,0,0,0,0,8,8,0,0,0,0,0,0 -2775,48359,31,24,24,24,0,0,0,0,0,0,0,0 -2777,48379,30,24,24,24,0,0,0,0,0,0,0,0 -2779,48399,28,24,24,24,0,0,0,0,0,0,0,0 -2780,48419,27,24,24,24,0,0,0,0,0,0,0,0 -2781,48439,26,24,24,24,0,0,0,0,0,0,0,0 -2782,48459,24,24,24,24,0,0,0,0,0,0,0,0 -2783,48479,23,16,16,16,24,24,0,0,0,0,0,0 -2785,48499,22,16,16,16,24,24,0,0,0,0,0,0 -2787,48519,20,16,16,16,24,24,0,0,0,0,0,0 -2788,48539,19,16,16,16,24,24,0,0,0,0,0,0 -2789,48559,18,16,16,16,24,24,0,0,0,0,0,0 -2790,48579,16,16,16,16,24,24,0,0,0,0,0,0 -2791,48599,14,8,8,8,16,16,0,0,0,0,0,0 -2793,48619,13,8,8,8,16,16,0,0,0,0,0,0 -2795,48639,12,8,8,8,16,16,0,0,0,0,0,0 -2796,48659,10,8,8,8,16,16,0,0,0,0,0,0 -2797,48679,9,8,8,8,16,16,0,0,0,0,0,0 -2798,48699,8,8,8,8,16,16,0,0,0,0,0,0 -2799,48718,6,0,0,0,8,8,0,0,0,0,0,0 -2801,48738,5,0,0,0,8,8,0,0,0,0,0,0 -2803,48758,4,0,0,0,8,8,0,0,0,0,0,0 -2804,48778,2,0,0,0,8,8,0,0,0,0,0,0 -2805,48798,1,0,0,0,8,8,0,0,0,0,0,0 -2806,48818,0,0,0,0,8,8,0,0,0,0,0,0 -2807,48838,30,24,24,24,0,0,0,0,0,0,0,0 -2809,48858,29,24,24,24,0,0,0,0,0,0,0,0 -2811,48878,28,24,24,24,0,0,0,0,0,0,0,0 -2812,48898,26,24,24,24,0,0,0,0,0,0,0,0 -2813,48918,25,24,24,24,0,0,0,0,0,0,0,0 -2814,48938,24,24,24,24,0,0,0,0,0,0,0,0 -2815,48958,22,16,16,16,24,24,0,0,0,0,0,0 -2817,48978,21,16,16,16,24,24,0,0,0,0,0,0 -2818,48998,20,16,16,16,24,24,0,0,0,0,0,0 -2819,49018,18,16,16,16,24,24,0,0,0,0,0,0 -2820,49038,17,16,16,16,24,24,0,0,0,0,0,0 -2821,49058,15,8,8,8,16,16,0,0,0,0,0,0 -2823,49078,14,8,8,8,16,16,0,0,0,0,0,0 -2825,49098,13,8,8,8,16,16,0,0,0,0,0,0 -2826,49118,12,8,8,8,16,16,0,0,0,0,0,0 -2827,49138,10,8,8,8,16,16,0,0,0,0,0,0 -2828,49158,9,8,8,8,16,16,0,0,0,0,0,0 -2829,49177,7,0,0,0,8,8,0,0,0,0,0,0 -2831,49197,6,0,0,0,8,8,0,0,0,0,0,0 -2833,49217,5,0,0,0,8,8,0,0,0,0,0,0 -2834,49237,4,0,0,0,8,8,0,0,0,0,0,0 -2835,49257,2,0,0,0,8,8,0,0,0,0,0,0 -2836,49277,1,0,0,0,8,8,0,0,0,0,0,0 -2837,49297,0,0,0,0,8,8,0,0,0,0,0,0 -2838,49317,30,24,24,24,0,0,0,0,0,0,0,0 -2840,49337,28,24,24,24,0,0,0,0,0,0,0,0 -2841,49357,27,24,24,24,0,0,0,0,0,0,0,0 -2842,49377,26,24,24,24,0,0,0,0,0,0,0,0 -2843,49397,24,24,24,24,0,0,0,0,0,0,0,0 -2844,49417,23,16,16,16,24,24,0,0,0,0,0,0 -2846,49437,22,16,16,16,24,24,0,0,0,0,0,0 -2848,49457,20,16,16,16,24,24,0,0,0,0,0,0 -2849,49477,19,16,16,16,24,24,0,0,0,0,0,0 -2850,49497,18,16,16,16,24,24,0,0,0,0,0,0 -2851,49517,16,16,16,16,24,24,0,0,0,0,0,0 -2852,49537,15,8,8,8,16,16,0,0,0,0,0,0 -2854,49557,14,8,8,8,16,16,0,0,0,0,0,0 -2856,49577,12,8,8,8,16,16,0,0,0,0,0,0 -2857,49597,11,8,8,8,16,16,0,0,0,0,0,0 -2858,49617,10,8,8,8,16,16,0,0,0,0,0,0 -2859,49637,8,8,8,8,16,16,0,0,0,0,0,0 -2860,49656,7,0,0,0,8,8,0,0,0,0,0,0 -2862,49676,6,0,0,0,8,8,0,0,0,0,0,0 -2864,49696,4,0,0,0,8,8,0,0,0,0,0,0 -2865,49716,3,0,0,0,8,8,0,0,0,0,0,0 -2866,49736,2,0,0,0,8,8,0,0,0,0,0,0 -2867,49756,1,0,0,0,8,8,0,0,0,0,0,0 -2868,49776,0,0,0,0,8,8,0,0,0,0,0,0 -2869,49796,30,24,24,24,0,0,0,0,0,0,0,0 -2871,49816,29,24,24,24,0,0,0,0,0,0,0,0 -2873,49836,28,24,24,24,0,0,0,0,0,0,0,0 -2874,49856,26,24,24,24,0,0,0,0,0,0,0,0 -2875,49876,25,24,24,24,0,0,0,0,0,0,0,0 -2876,49896,24,24,24,24,0,0,0,0,0,0,0,0 -2877,49916,22,16,16,16,24,24,0,0,0,0,0,0 -2879,49936,21,16,16,16,24,24,0,0,0,0,0,0 -2881,49956,20,16,16,16,24,24,0,0,0,0,0,0 -2882,49976,18,16,16,16,24,24,0,0,0,0,0,0 -2883,49996,16,16,16,16,24,24,0,0,0,0,0,0 -2884,50016,15,8,8,8,16,16,0,0,0,0,0,0 -2886,50036,14,8,8,8,16,16,0,0,0,0,0,0 -2888,50056,12,8,8,8,16,16,0,0,0,0,0,0 -2889,50076,11,8,8,8,16,16,0,0,0,0,0,0 -2890,50096,10,8,8,8,16,16,0,0,0,0,0,0 -2891,50116,8,8,8,8,16,16,0,0,0,0,0,0 -2892,50135,6,0,0,0,8,8,0,0,0,0,0,0 -2894,50155,6,0,0,0,8,8,0,0,0,0,0,0 -2896,50175,4,0,0,0,8,8,0,0,0,0,0,0 -2897,50195,3,0,0,0,8,8,0,0,0,0,0,0 -2898,50215,2,0,0,0,8,8,0,0,0,0,0,0 -2899,50235,0,0,0,0,8,8,0,0,0,0,0,0 -2900,50255,31,24,24,24,0,0,0,0,0,0,0,0 -2902,50275,30,24,24,24,0,0,0,0,0,0,0,0 -2904,50295,28,24,24,24,0,0,0,0,0,0,0,0 -2905,50315,27,24,24,24,0,0,0,0,0,0,0,0 -2906,50335,26,24,24,24,0,0,0,0,0,0,0,0 -2907,50355,24,24,24,24,0,0,0,0,0,0,0,0 -2908,50375,22,16,16,16,24,24,0,0,0,0,0,0 -2910,50395,21,16,16,16,24,24,0,0,0,0,0,0 -2912,50415,20,16,16,16,24,24,0,0,0,0,0,0 -2913,50435,18,16,16,16,24,24,0,0,0,0,0,0 -2914,50455,17,16,16,16,24,24,0,0,0,0,0,0 -2915,50475,16,16,16,16,24,24,0,0,0,0,0,0 -2916,50495,14,8,8,8,16,16,0,0,0,0,0,0 -2918,50515,14,8,8,8,16,16,0,0,0,0,0,0 -2920,50535,12,8,8,8,16,16,0,0,0,0,0,0 -2921,50555,10,8,8,8,16,16,0,0,0,0,0,0 -2922,50575,9,8,8,8,16,16,0,0,0,0,0,0 -2923,50595,8,8,8,8,16,16,0,0,0,0,0,0 -2924,50614,6,0,0,0,8,8,0,0,0,0,0,0 -2926,50634,5,0,0,0,8,8,0,0,0,0,0,0 -2928,50654,4,0,0,0,8,8,0,0,0,0,0,0 -2929,50674,2,0,0,0,8,8,0,0,0,0,0,0 -2930,50694,1,0,0,0,8,8,0,0,0,0,0,0 -2931,50714,0,0,0,0,8,8,0,0,0,0,0,0 -2932,50734,30,24,24,24,0,0,0,0,0,0,0,0 -2934,50754,29,24,24,24,0,0,0,0,0,0,0,0 -2936,50774,28,24,24,24,0,0,0,0,0,0,0,0 -2937,50794,27,24,24,24,0,0,0,0,0,0,0,0 -2938,50814,26,24,24,24,0,0,0,0,0,0,0,0 -2939,50834,24,24,24,24,0,0,0,0,0,0,0,0 -2940,50854,23,16,16,16,24,24,0,0,0,0,0,0 -2942,50874,22,16,16,16,24,24,0,0,0,0,0,0 -2944,50894,20,16,16,16,24,24,0,0,0,0,0,0 -2945,50914,19,16,16,16,24,24,0,0,0,0,0,0 -2946,50934,18,16,16,16,24,24,0,0,0,0,0,0 -2947,50954,16,16,16,16,24,24,0,0,0,0,0,0 -2948,50974,14,8,8,8,16,16,0,0,0,0,0,0 -2950,50994,14,8,8,8,16,16,0,0,0,0,0,0 -2952,51014,12,8,8,8,16,16,0,0,0,0,0,0 -2953,51034,11,8,8,8,16,16,0,0,0,0,0,0 -2954,51054,10,8,8,8,16,16,0,0,0,0,0,0 -2955,51074,8,8,8,8,16,16,0,0,0,0,0,0 -2956,51093,6,0,0,0,8,8,0,0,0,0,0,0 -2958,51113,6,0,0,0,8,8,0,0,0,0,0,0 -2960,51133,4,0,0,0,8,8,0,0,0,0,0,0 -2961,51153,3,0,0,0,8,8,0,0,0,0,0,0 -2962,51173,2,0,0,0,8,8,0,0,0,0,0,0 -2963,51193,0,0,0,0,8,8,0,0,0,0,0,0 -2964,51213,31,24,24,24,0,0,0,0,0,0,0,0 -2966,51233,30,24,24,24,0,0,0,0,0,0,0,0 -2968,51253,28,24,24,24,0,0,0,0,0,0,0,0 -2969,51273,27,24,24,24,0,0,0,0,0,0,0,0 -2970,51293,26,24,24,24,0,0,0,0,0,0,0,0 -2971,51313,24,24,24,24,0,0,0,0,0,0,0,0 -2972,51333,23,16,16,16,24,24,0,0,0,0,0,0 -2974,51353,22,16,16,16,24,24,0,0,0,0,0,0 -2976,51373,20,16,16,16,24,24,0,0,0,0,0,0 -2977,51393,19,16,16,16,24,24,0,0,0,0,0,0 -2978,51413,18,16,16,16,24,24,0,0,0,0,0,0 -2979,51433,16,16,16,16,24,24,0,0,0,0,0,0 -2980,51453,15,8,8,8,16,16,0,0,0,0,0,0 -2982,51473,14,8,8,8,16,16,0,0,0,0,0,0 -2984,51493,12,8,8,8,16,16,0,0,0,0,0,0 -2985,51513,10,8,8,8,16,16,0,0,0,0,0,0 -2986,51533,9,8,8,8,16,16,0,0,0,0,0,0 -2987,51553,8,8,8,8,16,16,0,0,0,0,0,0 -2988,51572,6,0,0,0,8,8,0,0,0,0,0,0 -2990,51592,5,0,0,0,8,8,0,0,0,0,0,0 -2991,51612,4,0,0,0,8,8,0,0,0,0,0,0 -2992,51632,2,0,0,0,8,8,0,0,0,0,0,0 -2993,51652,1,0,0,0,8,8,0,0,0,0,0,0 -2994,51672,0,0,0,0,8,8,0,0,0,0,0,0 -2995,51692,30,24,24,24,0,0,0,0,0,0,0,0 -2997,51712,29,24,24,24,0,0,0,0,0,0,0,0 -2998,51732,28,24,24,24,0,0,0,0,0,0,0,0 -2999,51752,26,24,24,24,0,0,0,0,0,0,0,0 -3000,51772,25,24,24,24,0,0,0,0,0,0,0,0 -3001,51792,24,24,24,24,0,0,0,0,0,0,0,0 -3002,51812,22,16,16,16,24,24,0,0,0,0,0,0 -3004,51832,21,16,16,16,24,24,0,0,0,0,0,0 -3005,51852,20,16,16,16,24,24,0,0,0,0,0,0 -3006,51872,18,16,16,16,24,24,0,0,0,0,0,0 -3007,51892,16,16,16,16,24,24,0,0,0,0,0,0 -3008,51912,15,8,8,8,16,16,0,0,0,0,0,0 -3010,51932,14,8,8,8,16,16,0,0,0,0,0,0 -3012,51952,12,8,8,8,16,16,0,0,0,0,0,0 -3013,51972,11,8,8,8,16,16,0,0,0,0,0,0 -3014,51992,10,8,8,8,16,16,0,0,0,0,0,0 -3015,52012,8,8,8,8,16,16,0,0,0,0,0,0 -3016,52031,7,0,0,0,8,8,0,0,0,0,0,0 -3018,52051,6,0,0,0,8,8,0,0,0,0,0,0 -3020,52071,4,0,0,0,8,8,0,0,0,0,0,0 -3021,52091,3,0,0,0,8,8,0,0,0,0,0,0 -3022,52111,2,0,0,0,8,8,0,0,0,0,0,0 -3023,52131,0,0,0,0,8,8,0,0,0,0,0,0 -3024,52151,31,24,24,24,0,0,0,0,0,0,0,0 -3026,52171,30,24,24,24,0,0,0,0,0,0,0,0 -3028,52191,28,24,24,24,0,0,0,0,0,0,0,0 -3029,52211,27,24,24,24,0,0,0,0,0,0,0,0 -3030,52231,26,24,24,24,0,0,0,0,0,0,0,0 -3031,52251,24,24,24,24,0,0,0,0,0,0,0,0 -3032,52271,23,16,16,16,24,24,0,0,0,0,0,0 -3034,52291,22,16,16,16,24,24,0,0,0,0,0,0 -3036,52311,20,16,16,16,24,24,0,0,0,0,0,0 -3037,52331,19,16,16,16,24,24,0,0,0,0,0,0 -3038,52351,18,16,16,16,24,24,0,0,0,0,0,0 -3039,52371,16,16,16,16,24,24,0,0,0,0,0,0 -3040,52391,15,8,8,8,16,16,0,0,0,0,0,0 -3042,52411,14,8,8,8,16,16,0,0,0,0,0,0 -3044,52431,12,8,8,8,16,16,0,0,0,0,0,0 -3045,52451,10,8,8,8,16,16,0,0,0,0,0,0 -3046,52471,9,8,8,8,16,16,0,0,0,0,0,0 -3047,52491,8,8,8,8,16,16,0,0,0,0,0,0 -3048,52510,6,0,0,0,8,8,0,0,0,0,0,0 -3050,52530,6,0,0,0,8,8,0,0,0,0,0,0 -3052,52550,4,0,0,0,8,8,0,0,0,0,0,0 -3053,52570,3,0,0,0,8,8,0,0,0,0,0,0 -3054,52590,2,0,0,0,8,8,0,0,0,0,0,0 -3055,52610,0,0,0,0,8,8,0,0,0,0,0,0 -3056,52630,31,24,24,24,0,0,0,0,0,0,0,0 -3058,52650,30,24,24,24,0,0,0,0,0,0,0,0 -3060,52670,28,24,24,24,0,0,0,0,0,0,0,0 -3061,52690,27,24,24,24,0,0,0,0,0,0,0,0 -3062,52710,26,24,24,24,0,0,0,0,0,0,0,0 -3063,52730,24,24,24,24,0,0,0,0,0,0,0,0 -3064,52750,23,16,16,16,24,24,0,0,0,0,0,0 -3066,52770,22,16,16,16,24,24,0,0,0,0,0,0 -3068,52790,20,16,16,16,24,24,0,0,0,0,0,0 -3069,52810,19,16,16,16,24,24,0,0,0,0,0,0 -3070,52830,18,16,16,16,24,24,0,0,0,0,0,0 -3071,52850,16,16,16,16,24,24,0,0,0,0,0,0 -3072,52870,15,8,8,8,16,16,0,0,0,0,0,0 -3074,52890,14,8,8,8,16,16,0,0,0,0,0,0 -3076,52910,12,8,8,8,16,16,0,0,0,0,0,0 -3077,52930,11,8,8,8,16,16,0,0,0,0,0,0 -3078,52950,10,8,8,8,16,16,0,0,0,0,0,0 -3079,52970,8,8,8,8,16,16,0,0,0,0,0,0 -3080,52989,7,0,0,0,8,8,0,0,0,0,0,0 -3082,53009,6,0,0,0,8,8,0,0,0,0,0,0 -3084,53029,5,0,0,0,8,8,0,0,0,0,0,0 -3085,53049,4,0,0,0,8,8,0,0,0,0,0,0 -3086,53069,2,0,0,0,8,8,0,0,0,0,0,0 -3087,53089,0,0,0,0,8,8,0,0,0,0,0,0 -3088,53109,31,24,24,24,0,0,0,0,0,0,0,0 -3090,53129,30,24,24,24,0,0,0,0,0,0,0,0 -3092,53149,28,24,24,24,0,0,0,0,0,0,0,0 -3093,53169,27,24,24,24,0,0,0,0,0,0,0,0 -3094,53189,26,24,24,24,0,0,0,0,0,0,0,0 -3095,53209,24,24,24,24,0,0,0,0,0,0,0,0 -3096,53229,23,16,16,16,24,24,0,0,0,0,0,0 -3098,53249,22,16,16,16,24,24,0,0,0,0,0,0 -3100,53269,20,16,16,16,24,24,0,0,0,0,0,0 -3101,53289,19,16,16,16,24,24,0,0,0,0,0,0 -3102,53309,18,16,16,16,24,24,0,0,0,0,0,0 -3103,53329,16,16,16,16,24,24,0,0,0,0,0,0 -3104,53349,15,8,8,8,16,16,0,0,0,0,0,0 -3106,53369,14,8,8,8,16,16,0,0,0,0,0,0 -3108,53389,13,8,8,8,16,16,0,0,0,0,0,0 -3109,53409,12,8,8,8,16,16,0,0,0,0,0,0 -3110,53429,10,8,8,8,16,16,0,0,0,0,0,0 -3111,53449,9,8,8,8,16,16,0,0,0,0,0,0 -3112,53469,8,8,8,8,16,16,0,0,0,0,0,0 -3113,53488,6,0,0,0,8,8,0,0,0,0,0,0 -3115,53508,5,0,0,0,8,8,0,0,0,0,0,0 -3117,53528,4,0,0,0,8,8,0,0,0,0,0,0 -3118,53548,2,0,0,0,8,8,0,0,0,0,0,0 -3119,53568,1,0,0,0,8,8,0,0,0,0,0,0 -3120,53588,0,0,0,0,8,8,0,0,0,0,0,0 -3121,53608,30,24,24,24,0,0,0,0,0,0,0,0 -3123,53628,29,24,24,24,0,0,0,0,0,0,0,0 -3124,53648,28,24,24,24,0,0,0,0,0,0,0,0 -3125,53668,26,24,24,24,0,0,0,0,0,0,0,0 -3126,53688,24,24,24,24,0,0,0,0,0,0,0,0 -3127,53708,24,24,24,24,0,0,0,0,0,0,0,0 -3128,53728,22,16,16,16,24,24,0,0,0,0,0,0 -3130,53748,21,16,16,16,24,24,0,0,0,0,0,0 -3131,53768,20,16,16,16,24,24,0,0,0,0,0,0 -3132,53788,18,16,16,16,24,24,0,0,0,0,0,0 -3133,53808,17,16,16,16,24,24,0,0,0,0,0,0 -3134,53828,16,16,16,16,24,24,0,0,0,0,0,0 -3135,53848,14,8,8,8,16,16,0,0,0,0,0,0 -3137,53868,13,8,8,8,16,16,0,0,0,0,0,0 -3139,53888,12,8,8,8,16,16,0,0,0,0,0,0 -3140,53908,10,8,8,8,16,16,0,0,0,0,0,0 -3141,53928,9,8,8,8,16,16,0,0,0,0,0,0 -3142,53948,8,8,8,8,16,16,0,0,0,0,0,0 -3143,53967,6,0,0,0,8,8,0,0,0,0,0,0 -3145,53987,5,0,0,0,8,8,0,0,0,0,0,0 -3147,54007,4,0,0,0,8,8,0,0,0,0,0,0 -3148,54027,2,0,0,0,8,8,0,0,0,0,0,0 -3149,54047,1,0,0,0,8,8,0,0,0,0,0,0 -3150,54067,0,0,0,0,8,8,0,0,0,0,0,0 -3151,54087,30,24,24,24,0,0,0,0,0,0,0,0 -3153,54107,29,24,24,24,0,0,0,0,0,0,0,0 -3155,54127,28,24,24,24,0,0,0,0,0,0,0,0 -3156,54147,26,24,24,24,0,0,0,0,0,0,0,0 -3157,54167,26,24,24,24,0,0,0,0,0,0,0,0 -3158,54187,24,24,24,24,0,0,0,0,0,0,0,0 -3159,54207,23,16,16,16,24,24,0,0,0,0,0,0 -3161,54227,22,16,16,16,24,24,0,0,0,0,0,0 -3163,54247,20,16,16,16,24,24,0,0,0,0,0,0 -3164,54267,19,16,16,16,24,24,0,0,0,0,0,0 -3165,54287,18,16,16,16,24,24,0,0,0,0,0,0 -3166,54307,16,16,16,16,24,24,0,0,0,0,0,0 -3167,54327,15,8,8,8,16,16,0,0,0,0,0,0 -3169,54347,14,8,8,8,16,16,0,0,0,0,0,0 -3171,54367,12,8,8,8,16,16,0,0,0,0,0,0 -3172,54387,11,8,8,8,16,16,0,0,0,0,0,0 -3173,54407,10,8,8,8,16,16,0,0,0,0,0,0 -3174,54427,8,8,8,8,16,16,0,0,0,0,0,0 -3175,54446,6,0,0,0,8,8,0,0,0,0,0,0 -3177,54466,5,0,0,0,8,8,0,0,0,0,0,0 -3179,54486,4,0,0,0,8,8,0,0,0,0,0,0 -3180,54506,2,0,0,0,8,8,0,0,0,0,0,0 -3181,54526,1,0,0,0,8,8,0,0,0,0,0,0 -3182,54546,0,0,0,0,8,8,0,0,0,0,0,0 -3183,54566,30,24,24,24,0,0,0,0,0,0,0,0 -3185,54586,30,24,24,24,0,0,0,0,0,0,0,0 -3187,54606,28,24,24,24,0,0,0,0,0,0,0,0 -3188,54626,27,24,24,24,0,0,0,0,0,0,0,0 -3189,54646,26,24,24,24,0,0,0,0,0,0,0,0 -3190,54666,24,24,24,24,0,0,0,0,0,0,0,0 -3191,54686,23,16,16,16,24,24,0,0,0,0,0,0 -3193,54706,22,16,16,16,24,24,0,0,0,0,0,0 -3195,54726,20,16,16,16,24,24,0,0,0,0,0,0 -3196,54746,19,16,16,16,24,24,0,0,0,0,0,0 -3197,54766,18,16,16,16,24,24,0,0,0,0,0,0 -3198,54786,16,16,16,16,24,24,0,0,0,0,0,0 -3199,54806,15,8,8,8,16,16,0,0,0,0,0,0 -3201,54826,14,8,8,8,16,16,0,0,0,0,0,0 -3203,54846,12,8,8,8,16,16,0,0,0,0,0,0 -3204,54866,11,8,8,8,16,16,0,0,0,0,0,0 -3205,54886,10,8,8,8,16,16,0,0,0,0,0,0 -3206,54906,8,8,8,8,16,16,0,0,0,0,0,0 -3207,54925,7,0,0,0,8,8,0,0,0,0,0,0 -3209,54945,6,0,0,0,8,8,0,0,0,0,0,0 -3211,54965,4,0,0,0,8,8,0,0,0,0,0,0 -3212,54985,3,0,0,0,8,8,0,0,0,0,0,0 -3213,55005,2,0,0,0,8,8,0,0,0,0,0,0 -3214,55025,0,0,0,0,8,8,0,0,0,0,0,0 -3215,55045,31,24,24,24,0,0,0,0,0,0,0,0 -3217,55065,30,24,24,24,0,0,0,0,0,0,0,0 -3219,55085,28,24,24,24,0,0,0,0,0,0,0,0 -3220,55105,27,24,24,24,0,0,0,0,0,0,0,0 -3221,55125,26,24,24,24,0,0,0,0,0,0,0,0 -3222,55145,24,24,24,24,0,0,0,0,0,0,0,0 -3223,55165,23,16,16,16,24,24,0,0,0,0,0,0 -3225,55185,22,16,16,16,24,24,0,0,0,0,0,0 -3227,55205,20,16,16,16,24,24,0,0,0,0,0,0 -3228,55225,19,16,16,16,24,24,0,0,0,0,0,0 -3229,55245,18,16,16,16,24,24,0,0,0,0,0,0 -3230,55265,17,16,16,16,24,24,0,0,0,0,0,0 -3231,55285,16,16,16,16,24,24,0,0,0,0,0,0 -3232,55305,14,8,8,8,16,16,0,0,0,0,0,0 -3234,55325,12,8,8,8,16,16,0,0,0,0,0,0 -3235,55345,11,8,8,8,16,16,0,0,0,0,0,0 -3236,55365,10,8,8,8,16,16,0,0,0,0,0,0 -3237,55385,8,8,8,8,16,16,0,0,0,0,0,0 -3238,55404,7,0,0,0,8,8,0,0,0,0,0,0 -3240,55424,6,0,0,0,8,8,0,0,0,0,0,0 -3242,55444,4,0,0,0,8,8,0,0,0,0,0,0 -3243,55464,3,0,0,0,8,8,0,0,0,0,0,0 -3244,55484,2,0,0,0,8,8,0,0,0,0,0,0 -3245,55504,0,0,0,0,8,8,0,0,0,0,0,0 -3246,55524,31,24,24,24,0,0,0,0,0,0,0,0 -3248,55544,30,24,24,24,0,0,0,0,0,0,0,0 -3250,55564,28,24,24,24,0,0,0,0,0,0,0,0 -3251,55584,27,24,24,24,0,0,0,0,0,0,0,0 -3252,55604,26,24,24,24,0,0,0,0,0,0,0,0 -3253,55624,24,24,24,24,0,0,0,0,0,0,0,0 -3254,55644,23,16,16,16,24,24,0,0,0,0,0,0 -3256,55664,22,16,16,16,24,24,0,0,0,0,0,0 -3258,55684,20,16,16,16,24,24,0,0,0,0,0,0 -3259,55704,19,16,16,16,24,24,0,0,0,0,0,0 -3260,55724,18,16,16,16,24,24,0,0,0,0,0,0 -3261,55744,16,16,16,16,24,24,0,0,0,0,0,0 -3262,55764,15,8,8,8,16,16,0,0,0,0,0,0 -3264,55784,14,8,8,8,16,16,0,0,0,0,0,0 -3266,55804,12,8,8,8,16,16,0,0,0,0,0,0 -3267,55824,11,8,8,8,16,16,0,0,0,0,0,0 -3268,55844,10,8,8,8,16,16,0,0,0,0,0,0 -3269,55864,8,8,8,8,16,16,0,0,0,0,0,0 -3270,55883,7,0,0,0,8,8,0,0,0,0,0,0 -3272,55903,6,0,0,0,8,8,0,0,0,0,0,0 -3274,55923,4,0,0,0,8,8,0,0,0,0,0,0 -3275,55943,4,0,0,0,8,8,0,0,0,0,0,0 -3276,55963,2,0,0,0,8,8,0,0,0,0,0,0 -3277,55983,1,0,0,0,8,8,0,0,0,0,0,0 -3278,56003,0,0,0,0,8,8,0,0,0,0,0,0 -3279,56023,30,24,24,24,0,0,0,0,0,0,0,0 -3281,56043,29,24,24,24,0,0,0,0,0,0,0,0 -3282,56063,28,24,24,24,0,0,0,0,0,0,0,0 -3283,56083,26,24,24,24,0,0,0,0,0,0,0,0 -3284,56103,25,24,24,24,0,0,0,0,0,0,0,0 -3285,56123,24,24,24,24,0,0,0,0,0,0,0,0 -3286,56143,22,16,16,16,24,24,0,0,0,0,0,0 -3288,56163,21,16,16,16,24,24,0,0,0,0,0,0 -3290,56183,20,16,16,16,24,24,0,0,0,0,0,0 -3291,56203,18,16,16,16,24,24,0,0,0,0,0,0 -3292,56223,17,16,16,16,24,24,0,0,0,0,0,0 -3293,56243,16,16,16,16,24,24,0,0,0,0,0,0 -3294,56263,15,8,8,8,16,16,0,0,0,0,0,0 -3296,56283,14,8,8,8,16,16,0,0,0,0,0,0 -3298,56303,12,8,8,8,16,16,0,0,0,0,0,0 -3299,56323,10,8,8,8,16,16,0,0,0,0,0,0 -3300,56343,10,8,8,8,16,16,0,0,0,0,0,0 -3301,56363,8,8,8,8,16,16,0,0,0,0,0,0 -3302,56382,6,0,0,0,8,8,0,0,0,0,0,0 -3304,56402,6,0,0,0,8,8,0,0,0,0,0,0 -3306,56422,4,0,0,0,8,8,0,0,0,0,0,0 -3307,56442,3,0,0,0,8,8,0,0,0,0,0,0 -3308,56462,2,0,0,0,8,8,0,0,0,0,0,0 -3309,56482,0,0,0,0,8,8,0,0,0,0,0,0 -3310,56502,31,24,24,24,0,0,0,0,0,0,0,0 -3312,56522,30,24,24,24,0,0,0,0,0,0,0,0 -3314,56542,28,24,24,24,0,0,0,0,0,0,0,0 -3315,56562,27,24,24,24,0,0,0,0,0,0,0,0 -3316,56582,26,24,24,24,0,0,0,0,0,0,0,0 -3317,56602,24,24,24,24,0,0,0,0,0,0,0,0 -3318,56622,23,16,16,16,24,24,0,0,0,0,0,0 -3320,56642,22,16,16,16,24,24,0,0,0,0,0,0 -3322,56662,21,16,16,16,24,24,0,0,0,0,0,0 -3323,56682,20,16,16,16,24,24,0,0,0,0,0,0 -3324,56702,18,16,16,16,24,24,0,0,0,0,0,0 -3325,56722,17,16,16,16,24,24,0,0,0,0,0,0 -3326,56742,16,16,16,16,24,24,0,0,0,0,0,0 -3327,56762,14,8,8,8,16,16,0,0,0,0,0,0 -3329,56782,13,8,8,8,16,16,0,0,0,0,0,0 -3330,56802,12,8,8,8,16,16,0,0,0,0,0,0 -3331,56822,10,8,8,8,16,16,0,0,0,0,0,0 -3332,56842,8,8,8,8,16,16,0,0,0,0,0,0 -3333,56861,7,0,0,0,8,8,0,0,0,0,0,0 -3335,56881,6,0,0,0,8,8,0,0,0,0,0,0 -3337,56901,4,0,0,0,8,8,0,0,0,0,0,0 -3338,56921,3,0,0,0,8,8,0,0,0,0,0,0 -3339,56941,2,0,0,0,8,8,0,0,0,0,0,0 -3340,56961,0,0,0,0,8,8,0,0,0,0,0,0 -3341,56981,31,24,24,24,0,0,0,0,0,0,0,0 -3343,57001,30,24,24,24,0,0,0,0,0,0,0,0 -3345,57021,28,24,24,24,0,0,0,0,0,0,0,0 -3346,57041,27,24,24,24,0,0,0,0,0,0,0,0 -3347,57061,26,24,24,24,0,0,0,0,0,0,0,0 -3348,57081,24,24,24,24,0,0,0,0,0,0,0,0 -3349,57101,23,16,16,16,24,24,0,0,0,0,0,0 -3351,57121,22,16,16,16,24,24,0,0,0,0,0,0 -3353,57141,20,16,16,16,24,24,0,0,0,0,0,0 -3354,57161,19,16,16,16,24,24,0,0,0,0,0,0 -3355,57181,18,16,16,16,24,24,0,0,0,0,0,0 -3356,57201,16,16,16,16,24,24,0,0,0,0,0,0 -3357,57221,15,8,8,8,16,16,0,0,0,0,0,0 -3359,57241,14,8,8,8,16,16,0,0,0,0,0,0 -3361,57261,12,8,8,8,16,16,0,0,0,0,0,0 -3362,57281,11,8,8,8,16,16,0,0,0,0,0,0 -3363,57301,10,8,8,8,16,16,0,0,0,0,0,0 -3364,57321,8,8,8,8,16,16,0,0,0,0,0,0 -3365,57340,6,0,0,0,8,8,0,0,0,0,0,0 -3367,57360,5,0,0,0,8,8,0,0,0,0,0,0 -3369,57380,4,0,0,0,8,8,0,0,0,0,0,0 -3370,57400,2,0,0,0,8,8,0,0,0,0,0,0 -3371,57420,1,0,0,0,8,8,0,0,0,0,0,0 -3372,57440,0,0,0,0,8,8,0,0,0,0,0,0 -3373,57460,30,24,24,24,0,0,0,0,0,0,0,0 -3375,57480,29,24,24,24,0,0,0,0,0,0,0,0 -3377,57500,28,24,24,24,0,0,0,0,0,0,0,0 -3378,57520,26,24,24,24,0,0,0,0,0,0,0,0 -3379,57540,25,24,24,24,0,0,0,0,0,0,0,0 -3380,57560,24,24,24,24,0,0,0,0,0,0,0,0 -3381,57580,22,16,16,16,24,24,0,0,0,0,0,0 -3383,57600,22,16,16,16,24,24,0,0,0,0,0,0 -3385,57620,20,16,16,16,24,24,0,0,0,0,0,0 -3386,57640,19,16,16,16,24,24,0,0,0,0,0,0 -3387,57660,18,16,16,16,24,24,0,0,0,0,0,0 -3388,57680,16,16,16,16,24,24,0,0,0,0,0,0 -3389,57700,15,8,8,8,16,16,0,0,0,0,0,0 -3391,57720,14,8,8,8,16,16,0,0,0,0,0,0 -3393,57740,12,8,8,8,16,16,0,0,0,0,0,0 -3394,57760,11,8,8,8,16,16,0,0,0,0,0,0 -3395,57780,10,8,8,8,16,16,0,0,0,0,0,0 -3396,57800,8,8,8,8,16,16,0,0,0,0,0,0 -3397,57819,7,0,0,0,8,8,0,0,0,0,0,0 -3399,57839,6,0,0,0,8,8,0,0,0,0,0,0 -3401,57859,4,0,0,0,8,8,0,0,0,0,0,0 -3402,57879,3,0,0,0,8,8,0,0,0,0,0,0 -3403,57899,2,0,0,0,8,8,0,0,0,0,0,0 -3404,57919,0,0,0,0,8,8,0,0,0,0,0,0 -3405,57939,31,24,24,24,0,0,0,0,0,0,0,0 -3407,57959,30,24,24,24,0,0,0,0,0,0,0,0 -3409,57979,28,24,24,24,0,0,0,0,0,0,0,0 -3410,57999,27,24,24,24,0,0,0,0,0,0,0,0 -3411,58019,26,24,24,24,0,0,0,0,0,0,0,0 -3412,58039,24,24,24,24,0,0,0,0,0,0,0,0 -3413,58059,23,16,16,16,24,24,0,0,0,0,0,0 -3415,58079,22,16,16,16,24,24,0,0,0,0,0,0 -3417,58099,20,16,16,16,24,24,0,0,0,0,0,0 -3418,58119,19,16,16,16,24,24,0,0,0,0,0,0 -3419,58139,18,16,16,16,24,24,0,0,0,0,0,0 -3420,58159,16,16,16,16,24,24,0,0,0,0,0,0 -3421,58179,14,8,8,8,16,16,0,0,0,0,0,0 -3423,58199,13,8,8,8,16,16,0,0,0,0,0,0 -3425,58219,12,8,8,8,16,16,0,0,0,0,0,0 -3426,58239,10,8,8,8,16,16,0,0,0,0,0,0 -3427,58259,9,8,8,8,16,16,0,0,0,0,0,0 -3428,58279,8,8,8,8,16,16,0,0,0,0,0,0 -3429,58298,6,0,0,0,8,8,0,0,0,0,0,0 -3431,58318,5,0,0,0,8,8,0,0,0,0,0,0 -3433,58338,4,0,0,0,8,8,0,0,0,0,0,0 -3434,58358,2,0,0,0,8,8,0,0,0,0,0,0 -3435,58378,1,0,0,0,8,8,0,0,0,0,0,0 -3436,58398,0,0,0,0,8,8,0,0,0,0,0,0 -3437,58418,30,24,24,24,0,0,0,0,0,0,0,0 -3439,58438,29,24,24,24,0,0,0,0,0,0,0,0 -3441,58458,28,24,24,24,0,0,0,0,0,0,0,0 -3442,58478,27,24,24,24,0,0,0,0,0,0,0,0 -3443,58498,25,24,24,24,0,0,0,0,0,0,0,0 -3444,58518,24,24,24,24,0,0,0,0,0,0,0,0 -3445,58538,23,16,16,16,24,24,0,0,0,0,0,0 -3447,58558,22,16,16,16,24,24,0,0,0,0,0,0 -3449,58578,20,16,16,16,24,24,0,0,0,0,0,0 -3450,58598,19,16,16,16,24,24,0,0,0,0,0,0 -3451,58618,18,16,16,16,24,24,0,0,0,0,0,0 -3452,58638,16,16,16,16,24,24,0,0,0,0,0,0 -3453,58658,15,8,8,8,16,16,0,0,0,0,0,0 -3455,58678,14,8,8,8,16,16,0,0,0,0,0,0 -3457,58698,12,8,8,8,16,16,0,0,0,0,0,0 -3458,58718,10,8,8,8,16,16,0,0,0,0,0,0 -3459,58738,9,8,8,8,16,16,0,0,0,0,0,0 -3460,58758,8,8,8,8,16,16,0,0,0,0,0,0 -3461,58777,6,0,0,0,8,8,0,0,0,0,0,0 -3463,58797,5,0,0,0,8,8,0,0,0,0,0,0 -3465,58817,4,0,0,0,8,8,0,0,0,0,0,0 -3466,58837,2,0,0,0,8,8,0,0,0,0,0,0 -3467,58857,1,0,0,0,8,8,0,0,0,0,0,0 -3468,58877,0,0,0,0,8,8,0,0,0,0,0,0 -3469,58897,30,24,24,24,0,0,0,0,0,0,0,0 -3471,58917,29,24,24,24,0,0,0,0,0,0,0,0 -3473,58937,28,24,24,24,0,0,0,0,0,0,0,0 -3474,58957,26,24,24,24,0,0,0,0,0,0,0,0 -3475,58977,25,24,24,24,0,0,0,0,0,0,0,0 -3476,58997,24,24,24,24,0,0,0,0,0,0,0,0 -3477,59017,22,16,16,16,24,24,0,0,0,0,0,0 -3479,59037,21,16,16,16,24,24,0,0,0,0,0,0 -3481,59057,20,16,16,16,24,24,0,0,0,0,0,0 -3482,59077,18,16,16,16,24,24,0,0,0,0,0,0 -3483,59097,17,16,16,16,24,24,0,0,0,0,0,0 -3484,59117,16,16,16,16,24,24,0,0,0,0,0,0 -3485,59137,14,8,8,8,16,16,0,0,0,0,0,0 -3487,59157,13,8,8,8,16,16,0,0,0,0,0,0 -3488,59177,12,8,8,8,16,16,0,0,0,0,0,0 -3489,59197,10,8,8,8,16,16,0,0,0,0,0,0 -3490,59217,9,8,8,8,16,16,0,0,0,0,0,0 -3491,59237,8,8,8,8,16,16,0,0,0,0,0,0 -3492,59256,6,0,0,0,8,8,0,0,0,0,0,0 -3494,59276,4,0,0,0,8,8,0,0,0,0,0,0 -3495,59296,3,0,0,0,8,8,0,0,0,0,0,0 -3496,59316,2,0,0,0,8,8,0,0,0,0,0,0 -3497,59336,0,0,0,0,8,8,0,0,0,0,0,0 -3498,59356,31,24,24,24,0,0,0,0,0,0,0,0 -3500,59376,30,24,24,24,0,0,0,0,0,0,0,0 -3502,59396,28,24,24,24,0,0,0,0,0,0,0,0 -3503,59416,27,24,24,24,0,0,0,0,0,0,0,0 -3504,59436,26,24,24,24,0,0,0,0,0,0,0,0 -3505,59456,24,24,24,24,0,0,0,0,0,0,0,0 -3506,59476,23,16,16,16,24,24,0,0,0,0,0,0 -3508,59496,22,16,16,16,24,24,0,0,0,0,0,0 -3510,59516,20,16,16,16,24,24,0,0,0,0,0,0 -3511,59536,19,16,16,16,24,24,0,0,0,0,0,0 -3512,59556,18,16,16,16,24,24,0,0,0,0,0,0 -3513,59576,16,16,16,16,24,24,0,0,0,0,0,0 -3514,59596,15,8,8,8,16,16,0,0,0,0,0,0 -3516,59616,14,8,8,8,16,16,0,0,0,0,0,0 -3518,59636,12,8,8,8,16,16,0,0,0,0,0,0 -3519,59656,11,8,8,8,16,16,0,0,0,0,0,0 -3520,59676,10,8,8,8,16,16,0,0,0,0,0,0 -3521,59696,8,8,8,8,16,16,0,0,0,0,0,0 -3522,59715,7,0,0,0,8,8,0,0,0,0,0,0 -3524,59735,6,0,0,0,8,8,0,0,0,0,0,0 -3526,59755,4,0,0,0,8,8,0,0,0,0,0,0 -3527,59775,2,0,0,0,8,8,0,0,0,0,0,0 -3528,59795,2,0,0,0,8,8,0,0,0,0,0,0 -3529,59815,0,0,0,0,8,8,0,0,0,0,0,0 -3530,59835,30,24,24,24,0,0,0,0,0,0,0,0 -3532,59855,30,24,24,24,0,0,0,0,0,0,0,0 -3534,59875,28,24,24,24,0,0,0,0,0,0,0,0 -3535,59895,27,24,24,24,0,0,0,0,0,0,0,0 -3536,59915,26,24,24,24,0,0,0,0,0,0,0,0 -3537,59935,24,24,24,24,0,0,0,0,0,0,0,0 -3538,59955,23,16,16,16,24,24,0,0,0,0,0,0 -3540,59975,22,16,16,16,24,24,0,0,0,0,0,0 -3542,59995,20,16,16,16,24,24,0,0,0,0,0,0 -3543,60015,19,16,16,16,24,24,0,0,0,0,0,0 -3544,60035,18,16,16,16,24,24,0,0,0,0,0,0 -3545,60055,16,16,16,16,24,24,0,0,0,0,0,0 -3546,60075,15,8,8,8,16,16,0,0,0,0,0,0 -3548,60095,14,8,8,8,16,16,0,0,0,0,0,0 -3550,60115,12,8,8,8,16,16,0,0,0,0,0,0 -3551,60135,11,8,8,8,16,16,0,0,0,0,0,0 -3552,60155,10,8,8,8,16,16,0,0,0,0,0,0 -3553,60175,8,8,8,8,16,16,0,0,0,0,0,0 -3554,60194,7,0,0,0,8,8,0,0,0,0,0,0 -3556,60214,6,0,0,0,8,8,0,0,0,0,0,0 -3558,60234,4,0,0,0,8,8,0,0,0,0,0,0 -3559,60254,3,0,0,0,8,8,0,0,0,0,0,0 -3560,60274,2,0,0,0,8,8,0,0,0,0,0,0 -3561,60294,0,0,0,0,8,8,0,0,0,0,0,0 -3562,60314,31,24,24,24,0,0,0,0,0,0,0,0 -3564,60334,30,24,24,24,0,0,0,0,0,0,0,0 -3566,60354,28,24,24,24,0,0,0,0,0,0,0,0 -3567,60374,27,24,24,24,0,0,0,0,0,0,0,0 -3568,60394,26,24,24,24,0,0,0,0,0,0,0,0 -3569,60414,24,24,24,24,0,0,0,0,0,0,0,0 -3570,60434,23,16,16,16,24,24,0,0,0,0,0,0 diff --git a/TLU_v1c/scripts/startTLU.sh b/TLU_v1c/scripts/startTLU.sh deleted file mode 100644 index 311d785..0000000 --- a/TLU_v1c/scripts/startTLU.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -echo "==========================" -CURRENT_DIR=${0%/*} -echo "CURRENT DIRECTORY: " $CURRENT_DIR - -echo "============" -echo "SETTING PATHS" -#export PYTHONPATH=$CURRENT_DIR/../../../../Python_Scripts/PyChips_1_5_0_pre2A/src:$PYTHONPATH -#export PYTHONPATH=~/Python_Scripts/PyChips_1_5_0_pre2A/src:$PYTHONPATH -export PYTHONPATH=../../packages:$PYTHONPATH -echo "PYTHON PATH= " $PYTHONPATH -export LD_LIBRARY_PATH=/opt/cactus/lib:$LD_LIBRARY_PATH -echo "LD_LIBRARY_PATH= " $LD_LIBRARY_PATH -export PATH=/usr/bin/:/opt/cactus/bin:$PATH -echo "PATH= " $PATH - -cd $CURRENT_DIR - -echo "============" -echo "STARTING PYTHON SCRIPT FOR TLU" -#python $CURRENT_DIR/startTLU_v8.py $@ - -python startTLU_v8.py $@ -#python testTLU_script.py diff --git a/TLU_v1c/scripts/startTLU_v6.py b/TLU_v1c/scripts/startTLU_v6.py deleted file mode 100644 index b7948f2..0000000 --- a/TLU_v1c/scripts/startTLU_v6.py +++ /dev/null @@ -1,232 +0,0 @@ -# -# Script to setup AIDA TLU for TPix3 telescope <--> TORCH synchronization -# -# David Cussans, December 2012 -# -# Nasty hack - use both PyChips and uHAL ( for block read ... ) - -from PyChipsUser import * -from FmcTluI2c import * - -import uhal - -import sys - -import time - -from datetime import datetime - -from optparse import OptionParser - -# For single character non-blocking input: -import select -import tty -import termios - -from initTLU import * - -def isData(): - return select.select([sys.stdin], [], [], 0) == ([sys.stdin], [], []) - -now = datetime.now().strftime('%Y-%m-%dT%H_%M_%S') -default_filename = 'tluData_' + now + '.root' -parser = OptionParser() - -parser.add_option('-r','--rootFname',dest='rootFname', - default=default_filename,help='Path of output file') -parser.add_option('-o','--writeTimestamps',dest='writeTimestamps', - default="True",help='Set True to write timestamps to ROOT file') -parser.add_option('-p','--printTimestamps',dest='printTimestamps', - default="True",help='Set True to print timestamps to screen (nothing printed unless also output to file) ') -parser.add_option('-s','--listenForTelescopeShutter',dest='listenForTelescopeShutter', - default=False,help='Set True to veto triggers when shutter goes high') -parser.add_option('-d','--pulseDelay',dest='pulseDelay', type=int, - default=0x00,help='Delay added to input triggers. Four 5-bit numbers packed into 32-bt word, Units of 6.125ns') -parser.add_option('-w','--pulseStretch',dest='pulseStretch',type=int, - default=0x00,help='Width added to input triggers. Four 5-bit numbers packed into 32-bt word. Units of 6.125ns') -parser.add_option('-t','--triggerPattern',dest='triggerPattern',type=int, - default=0xFFFEFFFE,help='Pattern match to generate trigger. Two 16-bit words packed into 32-bit word.') -parser.add_option('-m','--DUTMask',dest='DUTMask',type=int, - default=0x01,help='Three-bit mask selecting which DUTs are active.') -parser.add_option('-y','--ignoreDUTBusy',dest='ignoreDUTBusy',type=int, - default=0x0F,help='Three-bit mask selecting which DUTs can veto triggers by setting BUSY high. Low = can veto, high = ignore busy.') -parser.add_option('-i','--triggerInterval',dest='triggerInterval',type=int, - default=0,help='Interval between internal trigers ( in units of 6.125ns ). Set to zero to turn off internal triggers') -parser.add_option('-v','--thresholdVoltage',dest='thresholdVoltage',type=float, - default=-0.2,help='Threshold voltage for TLU inputs ( units of volts)') - -(options, args) = parser.parse_args(sys.argv[1:]) - -from ROOT import TFile, TTree -from ROOT import gROOT - -print "SETTING UP AIDA TLU TO SUPPLY CLOCK AND TRIGGER TO TORCH READOUT\n" - -# Point to board in uHAL -manager = uhal.ConnectionManager("file://./connection.xml") -hw = manager.getDevice("minitlu") -device_id = hw.id() - -# Point to TLU in Pychips -bAddrTab = AddressTable("./aida_mini_tlu_addr_map.txt") - -# Assume DIP-switch controlled address. Switches at 2 -board = ChipsBusUdp(bAddrTab,"192.168.200.32",50001) - -# Open Root file -print "OPENING ROOT FILE:", options.rootFname -f = TFile( options.rootFname, 'RECREATE' ) - -# Create a root "tree" -tree = TTree( 'T', 'TLU Data' ) -highWord =0 -lowWord =0 -evtNumber=0 -timeStamp=0 -evtType=0 -trigsFired=0 -bufPos = 0 - -# Create a branch for each piece of data -tree.Branch( 'tluHighWord' , highWord , "HighWord/l") -tree.Branch( 'tluLowWord' , lowWord , "LowWord/l") -tree.Branch( 'tluTimeStamp' , timeStamp , "TimeStamp/l") -tree.Branch( 'tluBufPos' , bufPos , "Bufpos/s") -tree.Branch( 'tluEvtNumber' , evtNumber , "EvtNumber/i") -tree.Branch( 'tluEvtType' , evtType , "EvtType/b") -tree.Branch( 'tluTrigFired' , trigsFired, "TrigsFired/b") - -# Initialize TLU registers -initTLU( uhalDevice = hw, pychipsBoard = board, listenForTelescopeShutter = options.listenForTelescopeShutter, pulseDelay = options.pulseDelay, pulseStretch = options.pulseStretch, triggerPattern = options.triggerPattern , DUTMask = options.DUTMask, ignoreDUTBusy = options.ignoreDUTBusy , triggerInterval = options.triggerInterval, thresholdVoltage = options.thresholdVoltage ) - -loopWait = 0.1 -oldEvtNumber = 0 - -oldPreVetotriggerCount = board.read("PreVetoTriggersR") -oldPostVetotriggerCount = board.read("PostVetoTriggersR") - -oldThresholdCounter0 =0 -oldThresholdCounter1 =0 -oldThresholdCounter2 =0 -oldThresholdCounter3 =0 - -print "STARTING POLLING LOOP" - -eventFifoFillLevel = 0 -loopRunning = True -runStarted = False - -oldTime = time.time() - -# Save old terminal settings -oldTermSettings = termios.tcgetattr(sys.stdin) -tty.setcbreak(sys.stdin.fileno()) - -while loopRunning: - - if isData(): - c = sys.stdin.read(1) - print "\tGOT INPUT:", c - if c == 't': - loopRunning = False - print "\tTERMINATING LOOP" - elif c == 'c': - runStarted = True - print "\tSTARTING RUN" - startTLU( uhalDevice = hw, pychipsBoard = board, writeTimestamps = ( options.writeTimestamps == "True" ) ) - elif c == 'f': - # runStarted = True - print "\tSTOPPING TRIGGERS" - stopTLU( uhalDevice = hw, pychipsBoard = board ) - - - if runStarted: - - eventFifoFillLevel = hw.getNode("eventBuffer.EventFifoFillLevel").read() - - preVetotriggerCount = hw.getNode("triggerLogic.PreVetoTriggersR").read() - postVetotriggerCount = hw.getNode("triggerLogic.PostVetoTriggersR").read() - - timestampHigh = hw.getNode("Event_Formatter.CurrentTimestampHR").read() - timestampLow = hw.getNode("Event_Formatter.CurrentTimestampLR").read() - - thresholdCounter0 = hw.getNode("triggerInputs.ThrCount0R").read() - thresholdCounter1 = hw.getNode("triggerInputs.ThrCount1R").read() - thresholdCounter2 = hw.getNode("triggerInputs.ThrCount2R").read() - thresholdCounter3 = hw.getNode("triggerInputs.ThrCount3R").read() - - hw.dispatch() - - newTime = time.time() - timeDelta = newTime - oldTime - oldTime = newTime - #print "time delta = " , timeDelta - preVetoFreq = (preVetotriggerCount-oldPreVetotriggerCount)/timeDelta - postVetoFreq = (postVetotriggerCount-oldPostVetotriggerCount)/timeDelta - oldPreVetotriggerCount = preVetotriggerCount - oldPostVetotriggerCount = postVetotriggerCount - - deltaCounts0 = thresholdCounter0 - oldThresholdCounter0 - oldThresholdCounter0 = thresholdCounter0 - deltaCounts1 = thresholdCounter1 - oldThresholdCounter1 - oldThresholdCounter1 = thresholdCounter1 - deltaCounts2 = thresholdCounter2 - oldThresholdCounter2 - oldThresholdCounter2 = thresholdCounter2 - deltaCounts3 = thresholdCounter3 - oldThresholdCounter3 - oldThresholdCounter3 = thresholdCounter3 - - print "pre , post veto triggers , pre , post frequency = " , preVetotriggerCount , postVetotriggerCount , preVetoFreq , postVetoFreq - - print "CURRENT TIMESTAMP HIGH, LOW (hex) = " , hex(timestampHigh) , hex(timestampLow) - - print "Input counts 0,1,2,3 = " , thresholdCounter0 , thresholdCounter1 , thresholdCounter2 , thresholdCounter3 - print "Input freq (Hz) 0,1,2,3 = " , deltaCounts0/timeDelta , deltaCounts1/timeDelta , deltaCounts2/timeDelta , deltaCounts3/timeDelta - - nEvents = int(eventFifoFillLevel)//4 # only read out whole events ( 4 x 32-bit words ) - wordsToRead = nEvents*4 - - print "FIFO FILL LEVEL= " , eventFifoFillLevel - - print "# EVENTS IN FIFO = ",nEvents - print "WORDS TO READ FROM FIFO = ",wordsToRead - - # get timestamp data and fifo fill in same outgoing packet. - timestampData = hw.getNode("eventBuffer.EventFifoData").readBlock(wordsToRead) - - hw.dispatch() - - # print timestampData - for bufPos in range (0, nEvents ): - lowWord = timestampData[bufPos*4 + 1] + 0x100000000* timestampData[ (bufPos*4) + 0] # timestamp - - highWord = timestampData[bufPos*4 + 3] + 0x100000000* timestampData[ (bufPos*4) + 2] # evt number - evtNumber = timestampData[bufPos*4 + 3] - - if evtNumber != ( oldEvtNumber + 1 ): - print "***WARNING *** Non sqeuential event numbers *** , evt,oldEvt = ", evtNumber , oldEvtNumber - - oldEvtNumber = evtNumber - - timeStamp = lowWord & 0xFFFFFFFFFFFF - - evtType = timestampData[ (bufPos*4) + 0] >> 28 - - trigsFired = (timestampData[ (bufPos*4) + 0] >> 16) & 0xFFF - - if (options.printTimestamps == "True" ): - print "bufferPos, highWord , lowWord , event-number , timestamp , evtType = %x %016x %016x %08x %012x %01x %03x" % ( bufPos , highWord , lowWord, evtNumber , timeStamp , evtType , trigsFired) - - # Fill root branch - see example in http://wlav.web.cern.ch/wlav/pyroot/tpytree.html : write raw data and decoded data for now. - tree.Fill() - - time.sleep( loopWait) - -# Fixme - at the moment infinite loop. -preVetotriggerCount = board.read("PreVetoTriggersR") -postVetotriggerCount = board.read("PostVetoTriggersR") -print "EXIT POLLING LOOP" -print "\nTRIGGER COUNT AT THE END OF RUN [pre, post]:" , preVetotriggerCount , postVetotriggerCount - -termios.tcsetattr(sys.stdin, termios.TCSADRAIN, oldTermSettings) -f.Write() -f.Close() diff --git a/TLU_v1c/scripts/startTLU_v8.py b/TLU_v1c/scripts/startTLU_v8.py deleted file mode 100644 index 470d173..0000000 --- a/TLU_v1c/scripts/startTLU_v8.py +++ /dev/null @@ -1,72 +0,0 @@ -# -*- coding: utf-8 -*- -# miniTLU test script - -#from PyChipsUser import * -#from FmcTluI2c import * -import uhal -import sys -import time -# from ROOT import TFile, TTree -# from ROOT import gROOT -from datetime import datetime - -from TLU import TLU -# Use to have interactive shell -import cmd - -class MyPrompt(cmd.Cmd): - - - def do_startRun(self, args): - """Starts the TLU run""" - print "COMMAND RECEIVED: STARTING TLU RUN" - startTLU( uhalDevice = self.hw, pychipsBoard = self.board, writeTimestamps = ( options.writeTimestamps == "True" ) ) - #print self.hw - - def do_stopRun(self, args): - """Stops the TLU run""" - print "COMMAND RECEIVED: STOP TLU RUN" - #stopTLU( uhalDevice = hw, pychipsBoard = board ) - - def do_quit(self, args): - """Quits the program.""" - print "COMMAND RECEIVED: QUITTING SCRIPT." - #raise SystemExit - return True - -# # Override methods in Cmd object ## -# def preloop(self): -# """Initialization before prompting user for commands. -# Despite the claims in the Cmd documentaion, Cmd.preloop() is not a stub. -# """ -# cmd.Cmd.preloop(self) # # sets up command completion -# self._hist = [] # # No history yet -# self._locals = {} # # Initialize execution namespace for user -# self._globals = {} -# print "\nINITIALIZING" -# now = datetime.now().strftime('%Y-%m-%dT%H_%M_%S') -# default_filename = './rootfiles/tluData_' + now + '.root' -# print "SETTING UP AIDA TLU TO SUPPLY CLOCK AND TRIGGER TO TORCH READOUT\n" -# self.manager = uhal.ConnectionManager("file://./connection.xml") -# self.hw = self.manager.getDevice("minitlu") -# self.device_id = self.hw.id() -# -# # Point to TLU in Pychips -# self.bAddrTab = AddressTable("./aida_mini_tlu_addr_map.txt") -# -# # Assume DIP-switch controlled address. Switches at 2 -# self.board = ChipsBusUdp(self.bAddrTab,"192.168.200.32",50001) - - -################################################# -if __name__ == "__main__": - TLU= TLU("tlu", "file://./TLUconnection.xml") - TLU.initialize() - - logdata= True - TLU.start(logdata) - time.sleep(0.2) - TLU.stop() - # prompt = MyPrompt() - # prompt.prompt = '>> ' - # prompt.cmdloop("Welcome to miniTLU test console.\nType HELP for a list of commands.") diff --git a/TLU_v1c/scripts/test.py b/TLU_v1c/scripts/test.py deleted file mode 100644 index ac68201..0000000 --- a/TLU_v1c/scripts/test.py +++ /dev/null @@ -1,34 +0,0 @@ -import matplotlib.pyplot as plt -import numpy as np -import matplotlib.mlab as mlab - -print "TEST.py" -myFile= "./500ns_23ns.txt" - -with open(myFile) as f: - nsDeltas = map(float, f) - -P= 1000000000 #display in ns -nsDeltas = [x * P for x in nsDeltas] -centerRange= 25 -windowsns= 5 -minRange= centerRange-windowsns -maxRange= centerRange+windowsns -plt.hist(nsDeltas, 60, range=[minRange, maxRange], facecolor='blue', align='mid', alpha= 0.75) -#plt.hist(nsDeltas, 100, normed=True, facecolor='blue', align='mid', alpha=0.75) -#plt.xlim((min(nsDeltas), max(nsDeltas))) -plt.xlabel('Time (ns)') -plt.ylabel('Entries') -plt.title('Histogram DeltaTime') -plt.grid(True) - -#Superimpose Gauss -mean = np.mean(nsDeltas) -variance = np.var(nsDeltas) -sigma = np.sqrt(variance) -x = np.linspace(min(nsDeltas), max(nsDeltas), 100) -plt.plot(x, mlab.normpdf(x, mean, sigma)) -print (mean, sigma) - -#Display plot -plt.show() diff --git a/TLU_v1c/scripts/testTLU_script.py b/TLU_v1c/scripts/testTLU_script.py deleted file mode 100644 index 9d8b334..0000000 --- a/TLU_v1c/scripts/testTLU_script.py +++ /dev/null @@ -1,79 +0,0 @@ -# miniTLU test script - -from FmcTluI2c import * -import uhal -import sys -import time -from I2CuHal import I2CCore -from miniTLU import MiniTLU -from datetime import datetime - -if __name__ == "__main__": - print "\tTEST TLU SCRIPT" - miniTLU= MiniTLU("minitlu", "file://./connection.xml") - #(self, target, wclk, i2cclk, name="i2c", delay=None) - TLU_I2C= I2CCore(miniTLU.hw, 10, 5, "i2c_master", None) - TLU_I2C.state() - - - #READ CONTENT OF EEPROM ON 24AA02E48 (0xFA - 0XFF) - mystop= 1 - time.sleep(0.1) - myaddr= [0xfa] - TLU_I2C.write( 0x50, myaddr, mystop) - res=TLU_I2C.read( 0x50, 6) - print "Checkin EEPROM:" - result="\t" - for iaddr in res: - result+="%02x "%(iaddr) - print result - - #SCAN I2C ADDRESSES - #WRITE PROM - #WRITE DAC - - - #Convert required threshold voltage to DAC code - #def convert_voltage_to_dac(self, desiredVoltage, Vref=1.300): - print("Writing DAC setting:") - Vref= 1.300 - desiredVoltage= 3.3 - channel= 0 - i2cSlaveAddrDac = 0x1F - vrefOn= 0 - Vdaq = ( desiredVoltage + Vref ) / 2 - dacCode = 0xFFFF * Vdaq / Vref - dacCode= 0x391d - print "\tVreq:", desiredVoltage - print "\tDAC code:" , dacCode - print "\tCH:", channel - print "\tIntRef:", vrefOn - - #Set DAC value - #def set_dac(self,channel,value , vrefOn = 0 , i2cSlaveAddrDac = 0x1F): - if channel<0 or channel>7: - print "set_dac ERROR: channel",channel,"not in range 0-7 (bit mask)" - ##return -1 - if dacCode<0 or dacCode>0xFFFF: - print "set_dac ERROR: value",dacCode ,"not in range 0-0xFFFF" - ##return -1 - # AD5665R chip with A0,A1 tied to ground - #i2cSlaveAddrDac = 0x1F # seven bit address, binary 00011111 - - # print "I2C address of DAC = " , hex(i2cSlaveAddrDac) - # dac = RawI2cAccess(self.i2cBusProps, i2cSlaveAddrDac) - # # if we want to enable internal voltage reference: - - if vrefOn: - # enter vref-on mode: - print "\tTurning internal reference ON" - #dac.write([0x38,0x00,0x01]) - TLU_I2C.write( i2cSlaveAddrDac, [0x38,0x00,0x01], 0) - else: - print "\tTurning internal reference OFF" - #dac.write([0x38,0x00,0x00]) - TLU_I2C.write( i2cSlaveAddrDac, [0x38,0x00,0x00], 0) - # Now set the actual value - sequence=[( 0x18 + ( channel &0x7 ) ) , int(dacCode/256)&0xff , int(dacCode)&0xff] - print "\tWriting byte sequence:", sequence - TLU_I2C.write( i2cSlaveAddrDac, sequence, 0) diff --git a/TLU_v1c/scripts/test_T0.py b/TLU_v1c/scripts/test_T0.py deleted file mode 100644 index cf81b33..0000000 --- a/TLU_v1c/scripts/test_T0.py +++ /dev/null @@ -1,92 +0,0 @@ -# -# Script to exercise AIDA mini-TLU -# -# David Cussans, December 2012 -# -# Nasty hack - use both PyChips and uHAL ( for block read ... ) - -from PyChipsUser import * -from FmcTluI2c import * - -import sys -import time - - -# Point to TLU in Pychips -bAddrTab = AddressTable("./aida_mini_tlu_addr_map.txt") -# Assume DIP-switch controlled address. Switches at 2 -board = ChipsBusUdp(bAddrTab,"192.168.200.32",50001) - -# Check the bus for I2C devices -boardi2c = FmcTluI2c(board) - -firmwareID=board.read("FirmwareId") - -print "Firmware (from PyChips) = " , hex(firmwareID) - -print "Scanning I2C bus:" -scanResults = boardi2c.i2c_scan() -print scanResults - -boardId = boardi2c.get_serial_number() -print "FMC-TLU serial number = " , boardId - -resetClocks = 0 - - - -clockStatus = board.read("LogicClocksCSR") -print "Clock status = " , hex(clockStatus) - -if resetClocks: - print "Resetting clocks" - board.write("LogicRst", 1 ) - - clockStatus = board.read("LogicClocksCSR") - print "Clock status after reset = " , hex(clockStatus) - - -board.write("InternalTriggerIntervalW",0) - -print "Enabling DUT 0 and 1" -board.write("DUTMaskW",3) -DUTMask = board.read("DUTMaskR") -print "DUTMaskR = " , DUTMask - -print "Ignore veto on DUT 0 and 1" -board.write("IgnoreDUTBusyW",3) -IgnoreDUTBusy = board.read("IgnoreDUTBusyR") -print "IgnoreDUTBusyR = " , IgnoreDUTBusy - -print "Turning off software trigger veto" -board.write("TriggerVetoW",0) - -print "Reseting FIFO" -board.write("EventFifoCSR",0x2) -eventFifoFillLevel = board.read("EventFifoFillLevel") -print "FIFO fill level after resetting FIFO = " , eventFifoFillLevel - -print "Enabling data recording" -board.write("Enable_Record_Data",1) - -#print "Enabling handshake: No-handshake" -#board.write("HandshakeTypeW",1) - -#TriggerInterval = 400000 -TriggerInterval = 0 -print "Setting internal trigger interval to " , TriggerInterval -board.write("InternalTriggerIntervalW",TriggerInterval) #0->Internal pulse generator disabled. Any other value will generate pulses with a frequency of n*6.25ns -trigInterval = board.read("InternalTriggerIntervalR") -print "Trigger interval read back as ", trigInterval - -print "Setting TPix_maskexternal to ignore external shutter and T0" -board.write("TPix_maskexternal",0x0003) - -numLoops = 500000 -oldEvtNumber = 0 - -for iLoop in range(0,numLoops): - - board.write("TPix_T0", 0x0001) - -# time.sleep( 1.0) diff --git a/TLU_v1e/.svn/entries b/TLU_v1e/.svn/entries deleted file mode 100644 index b806c37..0000000 --- a/TLU_v1e/.svn/entries +++ /dev/null @@ -1,28 +0,0 @@ -10 - -dir -0 -https://app.deveo.com/universityofbristol/projects/fmc_tlu/repositories/subversion/AIDA/TLU_v1e -https://app.deveo.com/universityofbristol/projects/fmc_tlu/repositories/subversion/AIDA -add - - - - - - - - - - - - - - - - - - - -a80b426a-c11e-11e6-a987-c3d832fc0b90 - diff --git a/TLU_v1e/documents/FMC_TLU_TOPLEVEL_E.SCH.1.pdf b/TLU_v1e/documents/FMC_TLU_TOPLEVEL_E.SCH.1.pdf deleted file mode 100644 index e1c970a..0000000 Binary files a/TLU_v1e/documents/FMC_TLU_TOPLEVEL_E.SCH.1.pdf and /dev/null differ diff --git a/TLU_v1e/documents/TLU_v1E_TestPoints.pdf b/TLU_v1e/documents/TLU_v1E_TestPoints.pdf deleted file mode 100644 index 4e7a2b4..0000000 Binary files a/TLU_v1e/documents/TLU_v1E_TestPoints.pdf and /dev/null differ diff --git a/TLU_v1e/scripts/AIDA_testPower.py b/TLU_v1e/scripts/AIDA_testPower.py deleted file mode 100644 index 9c13ba6..0000000 --- a/TLU_v1e/scripts/AIDA_testPower.py +++ /dev/null @@ -1,85 +0,0 @@ -# -*- coding: utf-8 -*- -import uhal -from I2CuHal import I2CCore -import time -#import miniTLU -from si5345 import si5345 -from AD5665R import AD5665R -from PCA9539PW import PCA9539PW -from E24AA025E48T import E24AA025E48T - -manager = uhal.ConnectionManager("file://./TLUconnection.xml") -hw = manager.getDevice("tlu") - -# hw.getNode("A").write(255) -reg = hw.getNode("version").read() -hw.dispatch() -print "CHECK REG= ", hex(reg) - - -# #First I2C core -print ("Instantiating master I2C core:") -master_I2C= I2CCore(hw, 10, 5, "i2c_master", None) -master_I2C.state() - - - - -# -# ####################################### -enableCore= False #Only need to run this once, after power-up -if (enableCore): - mystop=True - print " Write RegDir to set I/O[7] to output:" - myslave= 0x21 - mycmd= [0x01, 0x7F] - nwords= 1 - master_I2C.write(myslave, mycmd, mystop) - - mystop=False - mycmd= [0x01] - master_I2C.write(myslave, mycmd, mystop) - res= master_I2C.read( myslave, nwords) - print "\tPost RegDir: ", res - - -#DAC CONFIGURATION BEGIN -if (False): - zeDAC1=AD5665R(master_I2C, 0x1C) - zeDAC1.setIntRef(intRef= False, verbose= True) - zeDAC1.writeDAC(0x0, 7, verbose= True)#7626 - -if (True): - # #I2C EXPANDER CONFIGURATION BEGIN - IC6=PCA9539PW(master_I2C, 0x76) - #BANK 0 - IC6.setInvertReg(0, 0x00)# 0= normal - IC6.setIOReg(0, 0x00)# 0= output <<<<<<<<<<<<<<<<<<< - IC6.setOutputs(0, 0x00) - res= IC6.getInputs(0) - print "IC6 read back bank 0: 0x%X" % res[0] - # - #BANK 1 - IC6.setInvertReg(1, 0x00)# 0= normal - IC6.setIOReg(1, 0x00)# 0= output <<<<<<<<<<<<<<<<<<< - IC6.setOutputs(1, 0x00) - res= IC6.getInputs(1) - print "IC6 read back bank 1: 0x%X" % res[0] - - # # # - IC7=PCA9539PW(master_I2C, 0x77) - #BANK 0 - IC7.setInvertReg(0, 0x00)# 0= normal - IC7.setIOReg(0, 0x00)# 0= output <<<<<<<<<<<<<<<<<<< - IC7.setOutputs(0, 0x00) - res= IC7.getInputs(0) - print "IC7 read back bank 0: 0x%X" % res[0] - # - #BANK 1 - IC7.setInvertReg(1, 0x00)# 0= normal - IC7.setIOReg(1, 0x00)# 0= output <<<<<<<<<<<<<<<<<<< - IC7.setOutputs(1, 0x00) - res= IC7.getInputs(1) - print "IC7 read back bank 1: 0x%X" % res[0] - # #I2C EXPANDER CONFIGURATION END - diff --git a/TLU_v1e/scripts/AIDA_testScript.py b/TLU_v1e/scripts/AIDA_testScript.py deleted file mode 100644 index de7316b..0000000 --- a/TLU_v1e/scripts/AIDA_testScript.py +++ /dev/null @@ -1,193 +0,0 @@ -# -*- coding: utf-8 -*- -import uhal -from I2CuHal import I2CCore -import time -#import miniTLU -from si5345 import si5345 -from AD5665R import AD5665R -from PCA9539PW import PCA9539PW -from E24AA025E48T import E24AA025E48T -from I2CDISP import LCD_ada #Library for display - -manager = uhal.ConnectionManager("file://./TLUconnection.xml") -hw = manager.getDevice("tlu") - -# hw.getNode("A").write(255) -reg = hw.getNode("version").read() -hw.dispatch() -print "CHECK REG= ", hex(reg) - - -# #First I2C core -print ("Instantiating master I2C core:") -master_I2C= I2CCore(hw, 10, 5, "i2c_master", None) -master_I2C.state() - - - - -# -# ####################################### -enableCore= True #Only need to run this once, after power-up -if (enableCore): - mystop=True - print " Write RegDir to set I/O[7] to output:" - myslave= 0x21 - mycmd= [0x01, 0x7F] - nwords= 1 - master_I2C.write(myslave, mycmd, mystop) - - - mystop=False - mycmd= [0x01] - master_I2C.write(myslave, mycmd, mystop) - res= master_I2C.read( myslave, nwords) - print "\tPost RegDir: ", res -# ####################################### -# -# time.sleep(0.1) -# #Read the EPROM -# mystop=False -# nwords=6 -# myslave= 0x53 #DUNE EPROM 0x53 (Possibly) -# myaddr= [0xfa]#0xfa -# master_I2C.write( myslave, myaddr, mystop) -# #res= master_I2C.read( 0x50, 6) -# res= master_I2C.read( myslave, nwords) -# print " PCB EPROM: " -# result="\t " -# for iaddr in res: -# result+="%02x "%(iaddr) -# print result -# ####################################### - - -#Second I2C core -#print ("Instantiating SFP I2C core:") -#clock_I2C= I2CCore(hw, 10, 5, "i2c_sfp", None) -#clock_I2C.state() - -# #Third I2C core -# print ("Instantiating clock I2C core:") -# clock_I2C= I2CCore(hw, 10, 5, "i2c_clk", None) -# clock_I2C.state() - - -# #time.sleep(0.01) -# #Read the EPROM -# mystop=False -# nwords=2 -# myslave= 0x68 #DUNE CLOCK CHIP 0x68 -# myaddr= [0x02 ]#0xfa -# clock_I2C.write( myslave, myaddr, mystop) -# #time.sleep(0.1) -# res= clock_I2C.read( myslave, nwords) -# print " CLOCK EPROM: " -# result="\t " -# for iaddr in res: -# result+="%02x "%(iaddr) -# print result - -# - -#CLOCK CONFIGURATION BEGIN -zeClock=si5345(master_I2C, 0x68) -res= zeClock.getDeviceVersion() -zeClock.checkDesignID() -#zeClock.setPage(0, True) -#zeClock.getPage(True) -doClock= False -if (doClock): - clkRegList= zeClock.parse_clk("./../../bitFiles/TLU_CLK_Config_v1e.txt") - zeClock.writeConfiguration(clkRegList)###### - zeClock.writeRegister(0x0536, [0x0A]) #Configures manual switch of inputs - zeClock.writeRegister(0x0949, [0x0F]) #Enable all inputs - zeClock.writeRegister(0x052A, [0x05]) #Configures source of input -iopower= zeClock.readRegister(0x0949, 1) -print " Clock IO power: 0x%X" % iopower[0] -lol= zeClock.readRegister(0x000E, 1) -print " Clock LOL (0x000E): 0x%X" % lol[0] -los= zeClock.readRegister(0x000D, 1) -print " Clock LOS (0x000D): 0x%X" % los[0] -#CLOCK CONFIGURATION END - -#DAC CONFIGURATION BEGIN -zeDAC1=AD5665R(master_I2C, 0x13) -zeDAC1.setIntRef(intRef= False, verbose= True) -zeDAC1.writeDAC(0x0, 7, verbose= True)#7626 - -zeDAC2=AD5665R(master_I2C, 0x1F) -zeDAC2.setIntRef(intRef= False, verbose= True) -zeDAC2.writeDAC(0x2fff, 3, verbose= True) -#DAC CONFIGURATION END - -#EEPROM BEGIN -zeEEPROM= E24AA025E48T(master_I2C, 0x50) -res=zeEEPROM.readEEPROM(0xfa, 6) -result=" EEPROM ID:\n\t" -for iaddr in res: - result+="%02x "%(iaddr) -print result -#EEPROM END - -# #I2C EXPANDER CONFIGURATION BEGIN -IC6=PCA9539PW(master_I2C, 0x74) -#BANK 0 -IC6.setInvertReg(0, 0x00)# 0= normal -IC6.setIOReg(0, 0x00)# 0= output <<<<<<<<<<<<<<<<<<< -IC6.setOutputs(0, 0x77)#77 -res= IC6.getInputs(0) -print "\tIC6 read back bank 0: 0x%X" % res[0] -# -#BANK 1 -IC6.setInvertReg(1, 0x00)# 0= normal -IC6.setIOReg(1, 0x00)# 0= output <<<<<<<<<<<<<<<<<<< -IC6.setOutputs(1, 0x77)#77 -res= IC6.getInputs(1) -print "\tIC6 read back bank 1: 0x%X" % res[0] - -# # # -IC7=PCA9539PW(master_I2C, 0x75) -#BANK 0 -IC7.setInvertReg(0, 0x00)# 0= normal -IC7.setIOReg(0, 0x00)# 0= output <<<<<<<<<<<<<<<<<<< -IC7.setOutputs(0, 0xF0) -res= IC7.getInputs(0) -print "\tIC7 read back bank 0: 0x%X" % res[0] -# -#BANK 1 -IC7.setInvertReg(1, 0x00)# 0= normal -IC7.setIOReg(1, 0x00)# 0= output <<<<<<<<<<<<<<<<<<< -IC7.setOutputs(1, 0xAF) -res= IC7.getInputs(1) -print "\tIC7 read back bank 1: 0x%X" % res[0] -# #I2C EXPANDER CONFIGURATION END - - -#Instantiate Display -doDisplaytest= False -if doDisplaytest: - DISP=LCD_ada(master_I2C, 0x20) #3A - #self.DISP.clear() - DISP.test() - -# #Reset counters -#cmd = int("0x0", 16) #write 0x2 to reset -#hw.getNode("triggerInputs.SerdesRstW").write(cmd) -#restatus= hw.getNode("triggerInputs.SerdesRstR").read() -#hw.dispatch() -#print "Trigger Reset: 0x%X" % restatus -## #Read trigger inputs -#myreg= [-1, -1, -1, -1, -1, -1] -#for inputN in range(0, 6): -# regString= "triggerInputs.ThrCount%dR" % inputN -# myreg[inputN]= hw.getNode(regString).read() -# hw.dispatch() -# print regString, myreg[inputN] - -## Read ev formatter -#cmd = int("0x0", 16) # -##hw.getNode("Event_Formatter.Enable_Record_Data").write(cmd) -#efstatus= hw.getNode("Event_Formatter.CurrentTimestampLR").read() -#hw.dispatch() -#print "Event Formatter Record: 0x%X" % efstatus diff --git a/TLU_v1e/scripts/TLU_v1e.py b/TLU_v1e/scripts/TLU_v1e.py deleted file mode 100644 index 82e2e8a..0000000 --- a/TLU_v1e/scripts/TLU_v1e.py +++ /dev/null @@ -1,993 +0,0 @@ -# -*- coding: utf-8 -*- -import uhal; -# import pprint; -# import ConfigParser -#from FmcTluI2c import * -# from ROOT import TFile, TTree, gROOT, AddressOf -# from ROOT import * -import time - -from packages.I2CuHal import I2CCore -from packages.si5345 import si5345 # Library for clock chip -from packages.AD5665R import AD5665R # Library for DAC -from packages.PCA9539PW import PCA9539PW # Library for serial line expander -from packages.I2CDISP import LCD_ada # Library for Adafruit display -from packages.I2CDISP import LCD09052 # Library for SparkFun display -from packages.TLU_powermodule import PWRLED -from packages.ATSHA204A import ATSHA204A - - -class TLU: - """docstring for TLU""" - def __init__(self, dev_name, man_file, parsed_cfg): - - uhal.setLogLevelTo(uhal.LogLevel.NOTICE) ## Get rid of initial flood of IPBUS messages - self.isRunning= False - - section_name= "Producer.fmctlu" - self.dev_name = dev_name - - #man_file= parsed_cfg.get(section_name, "ConnectionFile") - self.manager= uhal.ConnectionManager(man_file) - self.hw = self.manager.getDevice(self.dev_name) - - # #Get Verbose setting - self.verbose= parsed_cfg.getint(section_name, "verbose") - - #self.nDUTs= 4 #Number of DUT connectors - self.nDUTs= parsed_cfg.getint(section_name, "nDUTs") - - #self.nChannels= 6 #Number of trigger inputs - self.nChannels= parsed_cfg.getint(section_name, "nTrgIn") - - #self.VrefInt= 2.5 #Internal DAC voltage reference - self.VrefInt= parsed_cfg.getfloat(section_name, "VRefInt") - - #self.VrefExt= 1.3 #External DAC voltage reference - self.VrefExt= parsed_cfg.getfloat(section_name, "VRefExt") - - #self.intRefOn= False #Internal reference is OFF by default - self.intRefOn= int(parsed_cfg.get(section_name, "intRefOn")) - - self.fwVersion = self.hw.getNode("version").read() - self.hw.dispatch() - print("TLU V1E FIRMWARE VERSION= " , hex(self.fwVersion)) - - # Instantiate a I2C core to configure components - self.TLU_I2C= I2CCore(self.hw, 10, 5, "i2c_master", None) - #self.TLU_I2C.state() - - enableCore= True #Only need to run this once, after power-up - self.enableCore() - ####### EEPROM AX3 testing - doAtmel= False - if doAtmel: - self.ax3eeprom= ATSHA204A(self.TLU_I2C, 0x64) - print("shiftR\tdatBit\tcrcBit\tcrcReg \n", self.ax3eeprom._CalculateCrc([255, 12, 54, 28, 134, 89], 3)) - self.ax3eeprom._wake(True, True) - print(self.ax3eeprom._GetCommandPacketSize(8)) - #self.eepromAX3read() - ####### EEPROM AX3 testing end - - # Instantiate clock chip and configure it (if necessary) - #self.zeClock=si5345(self.TLU_I2C, 0x68) - clk_addr= int(parsed_cfg.get(section_name, "I2C_CLK_Addr"), 16) - self.zeClock=si5345(self.TLU_I2C, clk_addr) - res= self.zeClock.getDeviceVersion() - if (int(parsed_cfg.get(section_name, "CONFCLOCK"), 16)): - #clkRegList= self.zeClock.parse_clk("./../../bitFiles/TLU_CLK_Config_v1e.txt") - clkRegList= self.zeClock.parse_clk(parsed_cfg.get(section_name, "CLOCK_CFG_FILE")) - self.zeClock.writeConfiguration(clkRegList, self.verbose)###### - - self.zeClock.checkDesignID() - - # Instantiate DACs and configure them to use reference based on TLU setting - #self.zeDAC1=AD5665R(self.TLU_I2C, 0x13) - #self.zeDAC2=AD5665R(self.TLU_I2C, 0x1F) - dac_addr1= int(parsed_cfg.get(section_name, "I2C_DAC1_Addr"), 16) - self.zeDAC1=AD5665R(self.TLU_I2C, dac_addr1) - dac_addr2= int(parsed_cfg.get(section_name, "I2C_DAC2_Addr"), 16) - self.zeDAC2=AD5665R(self.TLU_I2C, dac_addr2) - self.zeDAC1.setIntRef(self.intRefOn, self.verbose) - self.zeDAC2.setIntRef(self.intRefOn, self.verbose) - - # Instantiate the serial line expanders and configure them to default values - #self.IC6=PCA9539PW(self.TLU_I2C, 0x74) - exp1_addr= int(parsed_cfg.get(section_name, "I2C_EXP1_Addr"), 16) - self.IC6=PCA9539PW(self.TLU_I2C, exp1_addr) - self.IC6.setInvertReg(0, 0x00)# 0= normal, 1= inverted - self.IC6.setIOReg(0, 0x00)# 0= output, 1= input - self.IC6.setOutputs(0, 0xFF)# If output, set to XX - - self.IC6.setInvertReg(1, 0x00)# 0= normal, 1= inverted - self.IC6.setIOReg(1, 0x00)# 0= output, 1= input - self.IC6.setOutputs(1, 0xFF)# If output, set to XX - - #self.IC7=PCA9539PW(self.TLU_I2C, 0x75) - exp2_addr= int(parsed_cfg.get(section_name, "I2C_EXP2_Addr"), 16) - self.IC7=PCA9539PW(self.TLU_I2C, exp2_addr) - self.IC7.setInvertReg(0, 0x00)# 0= normal, 1= inverted - self.IC7.setIOReg(0, 0x00)# 0= output, 1= input - self.IC7.setOutputs(0, 0x00)# If output, set to XX - - self.IC7.setInvertReg(1, 0x00)# 0= normal, 1= inverted - self.IC7.setIOReg(1, 0x00)# 0= output, 1= input - self.IC7.setOutputs(1, 0xB0)# If output, set to XX - - #Attempt to instantiate Display - self.displayPresent= True - i2ccmd= [7, 150] - mystop= True - print(" Attempting to detect TLU display") - # res= self.TLU_I2C.write( 0x3A, i2ccmd, mystop) - res= self.TLU_I2C.write( 0x20, i2ccmd, mystop) - if (res== -1): # if this fails, likely no display installed - self.displayPresent= False - print("\tNo TLU display detected") - if self.displayPresent: - self.DISP = LCD_ada(self.TLU_I2C, 0x20) - self.DISP.test() - # self.DISP=LCD09052(self.TLU_I2C, 0x3A) #0x3A for Sparkfun, 0x20 for Adafruit - # self.DISP.test2("192.168.200.30", "AIDA TLU") - #self.DISP=CFA632(self.TLU_I2C, 0x2A) # - - #Instantiate Power/Led Module - dac_addr_module= int(parsed_cfg.get(section_name, "I2C_DACModule_Addr"), 16) - exp1_addr= int(parsed_cfg.get(section_name, "I2C_EXP1Module_Addr"), 16) - exp2_addr= int(parsed_cfg.get(section_name, "I2C_EXP2Module_Addr"), 16) - pmtCtrVMax= parsed_cfg.getfloat(section_name, "PMT_vCtrlMax") - - self.pwdled= PWRLED(self.TLU_I2C, dac_addr_module, pmtCtrVMax, exp1_addr, exp2_addr) - - self.pwdled.allGreen() - time.sleep(0.1) - self.pwdled.allBlue() - time.sleep(0.1) - self.pwdled.allBlack() - time.sleep(0.1) - self.pwdled.kitt() - time.sleep(0.1) - self.pwdled.allWhite() - #self.pwdled.test() - - - -################################################################################################################################## -################################################################################################################################## - def DUTOutputs_old(self, dutN, enable=False, verbose=False): - ## Set the status of the transceivers for a specific HDMI connector. When enable= False the transceivers are disabled and the - ## connector cannot send signals from FPGA to the outside world. When enable= True then signals from the FPGA will be sent out to the HDMI. - ## NOTE: the other direction is always enabled, i.e. signals from the DUTs are always sent to the FPGA. - ## NOTE: CLK direction must be defined separately using DUTClkSrc - ## NOTE: This version changes all the pins together. Use DUTOutputs to control individual pins. - - if (dutN < 0) | (dutN> (self.nDUTs-1)): - print("\tERROR: DUTOutputs. The DUT number must be comprised between 0 and ", self.nDUTs-1) - return -1 - bank= dutN//2 # DUT0 and DUT1 are on bank 0. DUT2 and DUT3 on bank 1 - nibble= dutN%2 # DUT0 and DUT2 are on nibble 0. DUT1 and DUT3 are on nibble 1 - print(" Setting DUT:", dutN, "to", enable) - if (verbose > 1): - print("\tBank", bank, "Nibble", nibble) - res= self.IC6.getOutputs(bank) - oldStatus= res[0] - mask= 0xF << 4*nibble - newStatus= oldStatus & (~mask) - if (not enable): # we want to write 0 to activate the outputs so check opposite of "enable" - newStatus |= mask - self.IC6.setOutputs(bank, newStatus) - - if verbose: - print("\tOldStatus= ", "{0:#0{1}x}".format(oldStatus,4), "Mask=" , hex(mask), "newStatus=", "{0:#0{1}x}".format(newStatus,4)) - return newStatus - - def DUTOutputs(self, dutN, enable=0x7, verbose=False): - ## Set the status of the transceivers for a specific HDMI connector. When enable= False the transceivers are disabled and the - ## connector cannot send signals from FPGA to the outside world. When enable= True then signals from the FPGA will be sent out to the HDMI. - ## NOTE: the other direction is always enabled, i.e. signals from the DUTs are always sent to the FPGA. - ## NOTE: CLK direction must be defined separately using DUTClkSrc - - if (dutN < 0) | (dutN> (self.nDUTs-1)): - print("\tERROR: DUTOutputs. The DUT number must be comprised between 0 and ", self.nDUTs-1) - return -1 - bank= dutN//2 # DUT0 and DUT1 are on bank 0. DUT2 and DUT3 on bank 1 - nibble= dutN%2 # DUT0 and DUT2 are on nibble 0. DUT1 and DUT3 are on nibble 1 - print(" Setting DUT:", dutN, "pins status to", hex(enable)) - if (verbose > 1): - print("\tBank", bank, "Nibble", nibble) - res= self.IC6.getOutputs(bank) - oldStatus= res[0] - mask= 0xF << 4*nibble - newnibble= (enable & 0xF) << 4*nibble # bits we want to change are marked with 1 - newStatus= (oldStatus & (~mask)) | (newnibble & mask) - - self.IC6.setOutputs(bank, newStatus) - - if (verbose > 0): - self.getDUTOutpus(dutN, verbose) - if (verbose > 1): - print("\tOldStatus= ", "{0:#0{1}x}".format(oldStatus,4), "Mask=" , hex(mask), "newStatus=", "{0:#0{1}x}".format(newStatus,4)) - - return newStatus - - def DUTClkSrc(self, dutN, clkSrc=0, verbose= False): - ## Allows to choose the source of the clock signal sent to the DUTs over HDMI - ## clkSrc= 0: clock disabled - ## clkSrc= 1: clock from Si5345 - ## clkSrc=2: clock from FPGA - if (dutN < 0) | (dutN> (self.nDUTs-1)): - print("\tERROR: DUTClkSrc. The DUT number must be comprised between 0 and ", self.nDUTs-1) - return -1 - if (clkSrc < 0) | (clkSrc> 2): - print("\tERROR: DUTClkSrc. clkSrc can only be 0 (disabled), 1 (Si5345) or 2 (FPGA)") - return -1 - bank=0 - maskLow= 1 << (1* dutN) #CLK FROM FPGA - maskHigh= 1<< (1* dutN +4) #CLK FROM Si5345 - mask= maskLow | maskHigh - res= self.IC7.getOutputs(bank) - oldStatus= res[0] - newStatus= oldStatus & ~mask #set both bits to zero - outStat= "" - if clkSrc==0: - newStatus = newStatus - outStat= "disabled" - elif clkSrc==1: - newStatus = newStatus | maskLow - outStat= "Si5435" - elif clkSrc==2: - newStatus= newStatus | maskHigh - outStat= "FPGA" - print(" Setting DUT:", dutN, "clock source to", outStat) - if (verbose > 1): - print("\tOldStatus= ", "{0:#0{1}x}".format(oldStatus,4), "Mask=" , hex(mask), "newStatus=", "{0:#0{1}x}".format(newStatus,4)) - self.IC7.setOutputs(bank, newStatus) - return newStatus - - def eepromAX3read(self): - mystop=True - print(" Reading AX3 eeprom (not working 100% yet):") - myslave= 0x64 - self.TLU_I2C.write(myslave, [0x02, 0x00]) - nwords= 5 - res= self.TLU_I2C.read( myslave, nwords) - print("\tAX3 awake: ", res) - mystop=True - nwords= 7 - #mycmd= [0x03, 0x07, 0x02, 0x00, 0x00, 0x00, 0x1e, 0x2d]#conf 0? - mycmd= [0x03, 0x07, 0x02, 0x00, 0x01, 0x00, 0x17, 0xad]#conf 1 <<< seems to reply with correct error code (0) - #mycmd= [0x03, 0x07, 0x02, 0x02, 0x00, 0x00, 0x1d, 0xa8]#data 0? - self.TLU_I2C.write(myslave, mycmd, mystop) - res= self.TLU_I2C.read( myslave, nwords) - print("\tAX3 EEPROM: ", res) - - def enableClkLEMO(self, enable= False, verbose= False): - ## Enable or disable the output clock to the differential LEMO output - bank=1 - mask= 0x10 - res= self.IC7.getOutputs(bank) - oldStatus= res[0] - newStatus= oldStatus & ~mask - outStat= "enabled" - if (not enable): #A 0 activates the output. A 1 disables it. - newStatus= newStatus | mask - outStat= "disabled" - print(" Clk LEMO", outStat) - if verbose: - print("\tOldStatus= ", "{0:#0{1}x}".format(oldStatus,4), "Mask=" , hex(mask), "newStatus=", "{0:#0{1}x}".format(newStatus,4)) - self.IC7.setOutputs(bank, newStatus) - return newStatus - - def enableCore(self): - ## At power up the Enclustra I2C lines are disabled (tristate buffer is off). - ## This function enables the lines. It is only required once. - mystop=True - print(" Enabling I2C bus (expect 127):") - myslave= 0x21 - mycmd= [0x01, 0x7F] - nwords= 1 - self.TLU_I2C.write(myslave, mycmd, mystop) - - mystop=False - mycmd= [0x01] - self.TLU_I2C.write(myslave, mycmd, mystop) - res= self.TLU_I2C.read( myslave, nwords) - print("\tPost RegDir: ", res) - - def getDUTOutpus(self, dutN, verbose=0): - if (dutN < 0) | (dutN> (self.nDUTs-1)): - print("\tERROR: DUTOutputs. The DUT number must be comprised between 0 and ", self.nDUTs-1) - return -1 - bank= dutN//2 # DUT0 and DUT1 are on bank 0. DUT2 and DUT3 on bank 1 - nibble= dutN%2 # DUT0 and DUT2 are on nibble 0. DUT1 and DUT3 are on nibble 1 - res= self.IC6.getOutputs(bank) - dut_status= res[0] - dut_lines= ["CONT", "SPARE", "TRIG", "BUSY"] - dut_status= 0x0F & (dut_status >> (4*nibble)) - - if verbose > 0: - for idx, iLine in enumerate(dut_lines): - this_bit= 0x1 & (dut_status >> idx) - if this_bit: - this_status= "ENABLED" - else: - this_status= "DISABLED" - print("\t", iLine, "output is", this_status) - - if verbose > 1: - print("\tDUT CURRENT:", hex(dut_status), "Nibble:", nibble, "Bank:", bank) - - return dut_status - - def getAllChannelsCounts(self): - chCounts=[] - for ch in range (0,self.nChannels): - chCounts.append(int(self.getChCount(ch))) - return chCounts - - def getChStatus(self): - inputStatus= self.hw.getNode("triggerInputs.SerdesRstR").read() - self.hw.dispatch() - print("\tTRIGGER COUNTERS status= " , hex(inputStatus)) - return inputStatus - - def getChCount(self, channel): - regString= "triggerInputs.ThrCount"+ str(channel)+"R" - count = self.hw.getNode(regString).read() - self.hw.dispatch() - print("\tCh", channel, "Count:" , count) - return count - - def getClockStatus(self): - clockStatus = self.hw.getNode("logic_clocks.LogicClocksCSR").read() - self.hw.dispatch() - print(" CLOCK STATUS [expected 1]") - print("\t", hex(clockStatus)) - if ( clockStatus == 0 ): - "ERROR: Clocks in TLU FPGA are not locked." - return clockStatus - - def getDUTmask(self): - DUTMaskR = self.hw.getNode("DUTInterfaces.DUTMaskR").read() - self.hw.dispatch() - print("\tDUTMask read back as:" , hex(DUTMaskR)) - return DUTMaskR - - def getExternalVeto(self): - extVeto= self.hw.getNode("triggerLogic.ExternalTriggerVetoR").read() - self.hw.dispatch() - print("\tEXTERNAL Veto read back as:", hex(extVeto)) - return extVeto - - def getFifoData(self, nWords): - #fifoData= self.hw.getNode("eventBuffer.EventFifoData").read() - fifoData= self.hw.getNode("eventBuffer.EventFifoData").readBlock(nWords) - self.hw.dispatch() - #print "\tFIFO Data:", hex(fifoData) - return fifoData - - def getFifoLevel(self, verbose= 0): - FifoFill= self.hw.getNode("eventBuffer.EventFifoFillLevel").read() - self.hw.dispatch() - if (verbose > 0): - print("\tFIFO level read back as:", hex(FifoFill)) - return FifoFill - - def getFifoCSR(self): - FifoCSR= self.hw.getNode("eventBuffer.EventFifoCSR").read() - self.hw.dispatch() - print("\tFIFO CSR read back as:", hex(FifoCSR)) - return FifoCSR - - def getFifoFlags(self): - # Useless? - FifoFLAG= self.hw.getNode("eventBuffer.EventFifoFillLevelFlags").read() - self.hw.dispatch() - print("\tFIFO FLAGS read back as:", hex(FifoFLAG)) - return FifoFLAG - - def getInternalTrg(self): - trigIntervalR = self.hw.getNode("triggerLogic.InternalTriggerIntervalR").read() - self.hw.dispatch() - print("\tInternal interval read back as:", trigIntervalR) - return trigIntervalR - - def getMode(self): - DUTInterfaceModeR = self.hw.getNode("DUTInterfaces.DUTInterfaceModeR").read() - self.hw.dispatch() - print("\tDUT mode read back as:" , hex(DUTInterfaceModeR)) - return DUTInterfaceModeR - - def getModeModifier(self): - DUTInterfaceModeModifierR = self.hw.getNode("DUTInterfaces.DUTInterfaceModeModifierR").read() - self.hw.dispatch() - print("\tDUT mode modifier read back as:" , hex(DUTInterfaceModeModifierR)) - return DUTInterfaceModeModifierR - - def getSN(self): - epromcontent=self.readEEPROM(0xfa, 6) - print(" FMC-TLU serial number (EEPROM):") - result="\t" - for iaddr in epromcontent: - result+="%02x "%(iaddr) - print(result) - return epromcontent - - def getPostVetoTrg(self): - triggerN = self.hw.getNode("triggerLogic.PostVetoTriggersR").read() - self.hw.dispatch() - print("\tPOST VETO TRIGGER NUMBER:", (triggerN)) - return triggerN - - def getPulseDelay(self): - pulseDelayR = self.hw.getNode("triggerLogic.PulseDelayR").read() - self.hw.dispatch() - print("\tPulse delay read back as:", hex(pulseDelayR)) - return pulseDelayR - - def getPulseStretch(self): - pulseStretchR = self.hw.getNode("triggerLogic.PulseStretchR").read() - self.hw.dispatch() - print("\tPulse stretch read back as:", hex(pulseStretchR)) - return pulseStretchR - - def getRecordDataStatus(self): - RecordStatus= self.hw.getNode("Event_Formatter.Enable_Record_Data").read() - self.hw.dispatch() - print("\tData recording:", RecordStatus) - return RecordStatus - - def getTriggerVetoStatus(self): - trgVetoStatus= self.hw.getNode("triggerLogic.TriggerVetoR").read() - self.hw.dispatch() - print("\tTrigger veto status read back as:", trgVetoStatus) - return trgVetoStatus - - def getTrgPattern(self): - triggerPattern_low = self.hw.getNode("triggerLogic.TriggerPattern_lowR").read() - triggerPattern_high = self.hw.getNode("triggerLogic.TriggerPattern_highR").read() - self.hw.dispatch() - print("\tTrigger pattern read back as: 0x%08X 0x%08X" %(triggerPattern_high, triggerPattern_low)) - return triggerPattern_low, triggerPattern_high - - def getVetoDUT(self): - IgnoreDUTBusyR = self.hw.getNode("DUTInterfaces.IgnoreDUTBusyR").read() - self.hw.dispatch() - print("\tIgnoreDUTBusy read back as:" , hex(IgnoreDUTBusyR)) - return IgnoreDUTBusyR - - def getVetoShutters(self): - IgnoreShutterVeto = self.hw.getNode("DUTInterfaces.IgnoreShutterVetoR").read() - self.hw.dispatch() - print("\tIgnoreShutterVeto read back as:" , IgnoreShutterVeto) - return IgnoreShutterVeto - -# def pulseT0(self): -# cmd = int("0x1",16) -# self.hw.getNode("Shutter.PulseT0").write(cmd) -# self.hw.dispatch() -# print "\tPulsing T0" - - - def setRunActive(self): - cmd = int("0x1",16) - self.hw.getNode("Shutter.RunActiveRW").write(cmd) - self.hw.dispatch() - print("\tSet run active (pulses T0)") - - def setRunInactive(self): - cmd = int("0x0",16) - self.hw.getNode("Shutter.RunActiveRW").write(cmd) - self.hw.dispatch() - print("\tSet run inactive") - - def readEEPROM(self, startadd, bytes): - mystop= 1 - time.sleep(0.1) - myaddr= [startadd]#0xfa - self.TLU_I2C.write( 0x50, [startadd], mystop) - res= self.TLU_I2C.read( 0x50, bytes) - return res - - def resetClock(self): - # Set the RST pin from the PLL to 1 - print(" Clocks reset") - cmd = int("0x1",16) - self.hw.getNode("logic_clocks.LogicRst").write(cmd) - self.hw.dispatch() - - def resetClocks(self): - #Reset clock PLL - self.resetClock() - #Get clock status after reset - self.getClockStatus() - #Restore clock PLL - self.restoreClock() - #Get clock status after restore - self.getClockStatus() - #Get serdes status - self.getChStatus() - - def resetCounters(self): - cmd = int("0x2", 16) #write 0x2 to reset - self.hw.getNode("triggerInputs.SerdesRstW").write(cmd) - restatus= self.hw.getNode("triggerInputs.SerdesRstR").read() - self.hw.dispatch() - cmd = int("0x0", 16) #write 0x2 to reset - self.hw.getNode("triggerInputs.SerdesRstW").write(cmd) - restatus= self.hw.getNode("triggerInputs.SerdesRstR").read() - self.hw.dispatch() - #print "Trigger Reset: 0x%X" % restatus - print("\tTrigger counters reset") - - def resetSerdes(self): - cmd = int("0x3",16) - self.setChStatus(cmd) - inputStatus= self.getChStatus() - print("\t Input status during reset = " , hex(inputStatus)) - - cmd = int("0x0",16) - self.setChStatus(cmd) - inputStatus= self.getChStatus() - print("\t Input status after reset = " , hex(inputStatus)) - - cmd = int("0x4",16) - self.setChStatus(cmd) - inputStatus= self.getChStatus() - print("\t Input status during calibration = " , hex(inputStatus)) - - cmd = int("0x0",16) - self.setChStatus(cmd) - inputStatus= self.getChStatus() - print("\t Input status after calibration = " , hex(inputStatus)) - - def restoreClock(self): - # Set the RST pin from the PLL to 0 - print(" Clocks restore") - cmd = int("0x0",16) - self.hw.getNode("logic_clocks.LogicRst").write(cmd) - self.hw.dispatch() - - def setChStatus(self, cmd): - self.hw.getNode("triggerInputs.SerdesRstW").write(cmd) - inputStatus= self.hw.getNode("triggerInputs.SerdesRstR").read() - self.hw.dispatch() - print(" INPUT STATUS SET TO= " , hex(inputStatus)) - - def setClockStatus(self, cmd): - # Only use this for testing. The clock source is actually selected in the Si5345. - self.hw.getNode("logic_clocks.LogicClocksCSR").write(cmd) - self.hw.dispatch() - - def setDUTmask(self, DUTMask): - print(" DUT MASK ENABLING: Mask= " , hex(DUTMask)) - self.hw.getNode("DUTInterfaces.DUTMaskW").write(DUTMask) - self.hw.dispatch() - self.getDUTmask() - - def setFifoCSR(self, cmd): - self.hw.getNode("eventBuffer.EventFifoCSR").write(cmd) - self.hw.dispatch() - self.getFifoCSR() - - def setInternalTrg(self, triggerInterval): - print(" TRIGGERS INTERNAL:") - if triggerInterval == 0: - internalTriggerFreq = 0 - print("\tdisabled") - else: - internalTriggerFreq = 160000000.0/triggerInterval - print("\tRequired internal trigger frequency:", triggerInterval, "Hz") - print("\tSetting internal interval to:", internalTriggerFreq) - self.hw.getNode("triggerLogic.InternalTriggerIntervalW").write(int(internalTriggerFreq)) - self.hw.dispatch() - self.getInternalTrg() - - def setMode(self, mode): - print(" DUT MODE SET TO: ", hex(mode)) - self.hw.getNode("DUTInterfaces.DUTInterfaceModeW").write(mode) - self.hw.dispatch() - self.getMode() - - def setModeModifier(self, modifier): - print(" DUT MODE MODIFIER:", hex(modifier)) - self.hw.getNode("DUTInterfaces.DUTInterfaceModeModifierW").write(modifier) - self.hw.dispatch() - self.getModeModifier() - - def setPulseDelay(self, inArray): - print(" TRIGGER DELAY SET TO", inArray, "[Units= 160MHz clock, 5-bit values (one per input) packed in to 32-bit word]") - pulseDelay= self.packBits(inArray) - self.hw.getNode("triggerLogic.PulseDelayW").write(pulseDelay) - self.hw.dispatch() - self.getPulseDelay() - - def setPulseStretch(self, inArray): - print(" INPUT COINCIDENCE WINDOW SET TO", inArray ,"[Units= 160MHz clock cycles, 5-bit values (one per input) packed in to 32-bit word]") - pulseStretch= self.packBits(inArray) - self.hw.getNode("triggerLogic.PulseStretchW").write(pulseStretch) - self.hw.dispatch() - self.getPulseStretch() - - def setRecordDataStatus(self, status=False): - print(" Data recording set:") - self.hw.getNode("Event_Formatter.Enable_Record_Data").write(status) - self.hw.dispatch() - self.getRecordDataStatus() - - def setTriggerVetoStatus(self, status=False): - self.hw.getNode("triggerLogic.TriggerVetoW").write(status) - self.hw.dispatch() - self.getTriggerVetoStatus() - - def setTrgPattern(self, triggerPatternH, triggerPatternL): - triggerPatternL &= 0xffffffff - triggerPatternH &= 0xffffffff - print(" TRIGGER PATTERN (for external triggers) SET TO 0x%08X 0x%08X. Two 32-bit words." %(triggerPatternH, triggerPatternL)) - self.hw.getNode("triggerLogic.TriggerPattern_lowW").write(triggerPatternL) - self.hw.getNode("triggerLogic.TriggerPattern_highW").write(triggerPatternH) - self.hw.dispatch() - self.getTrgPattern() - - def setVetoDUT(self, ignoreDUTBusy): - print(" VETO IGNORE BY DUT BUSY MASK SET TO" , hex(ignoreDUTBusy)) - self.hw.getNode("DUTInterfaces.IgnoreDUTBusyW").write(ignoreDUTBusy) - self.hw.dispatch() - self.getVetoDUT() - - def setVetoShutters(self, newState): - if newState: - print(" IgnoreShutterVetoW SET TO LISTEN FOR VETO FROM SHUTTER") - cmd= int("0x0",16) - else: - print(" IgnoreShutterVetoW SET TO IGNORE VETO FROM SHUTTER") - cmd= int("0x1",16) - self.hw.getNode("DUTInterfaces.IgnoreShutterVetoW").write(cmd) - self.hw.dispatch() - self.getVetoShutters() - - def writeThreshold(self, DACtarget, Vtarget, channel, verbose=False): - #Writes the threshold. The DAC voltage differs from the threshold voltage because - #the range is shifted to be symmetrical around 0V. - - #Check if the DACs are using the internal reference - if (self.intRefOn): - Vref= self.VrefInt - else: - Vref= self.VrefExt - - #Calculate offset voltage (because of the following shifter) - Vdac= ( Vtarget + Vref ) / 2 - print(" THRESHOLD setting:") - if channel==7: - print("\tCH: ALL") - else: - print("\tCH:", channel) - print("\tTarget V:", Vtarget) - dacValue = 0xFFFF * (Vdac / Vref) - DACtarget.writeDAC(int(dacValue), channel, verbose) - - def packBits(self, raw_values): - packed_bits= 0 - if (len(raw_values) != self.nChannels): - print("Error (packBits): wrong number of elements in array") - else: - for idx, iCh in enumerate(raw_values): - tmpint= iCh << idx*5 - packed_bits= packed_bits | tmpint - print("\tPacked =", hex(packed_bits)) - return packed_bits - - def parseFifoData(self, fifoData, nEvents, mystruct, root_tree, verbose): - #for index in range(0, len(fifoData)-1, 6): - outList= [] - for index in range(0, (nEvents)*6, 6): - word0= (fifoData[index] << 32) + fifoData[index + 1] - word1= (fifoData[index + 2] << 32) + fifoData[index + 3] - word2= (fifoData[index + 4] << 32) + fifoData[index + 5] - evType= (fifoData[index] & 0xF0000000) >> 28 - inTrig= (fifoData[index] & 0x0FFF0000) >> 16 - tStamp= ((fifoData[index] & 0x0000FFFF) << 32) + fifoData[index + 1] - fineTs= fifoData[index + 2] - evNum= fifoData[index + 3] - fineTsList=[-1]*12 - fineTsList[3]= (fineTs & 0x000000FF) - fineTsList[2]= (fineTs & 0x0000FF00) >> 8 - fineTsList[1]= (fineTs & 0x00FF0000) >> 16 - fineTsList[0]= (fineTs & 0xFF000000) >> 24 - fineTsList[7]= (fifoData[index + 4] & 0x000000FF) - fineTsList[6]= (fifoData[index + 4] & 0x0000FF00) >> 8 - fineTsList[5]= (fifoData[index + 4] & 0x00FF0000) >> 16 - fineTsList[4]= (fifoData[index + 4] & 0xFF000000) >> 24 - fineTsList[11]= (fifoData[index + 5] & 0x000000FF) - fineTsList[10]= (fifoData[index + 5] & 0x0000FF00) >> 8 - fineTsList[9]= (fifoData[index + 5] & 0x00FF0000) >> 16 - fineTsList[8]= (fifoData[index + 5] & 0xFF000000) >> 24 - if verbose: - print("====== EVENT", evNum, "=================================================") - print("[", hex(word0), "]", "\t TYPE", hex(evType), "\t TRIGGER", hex(inTrig), "\t TIMESTAMP", (tStamp)) - print("[",hex(word1), "]", "\tEV NUM", evNum, "\tFINETS[0,3]", hex(fineTs)) - print("[",hex(word2), "]", "\tFINETS[4,11]", hex(word2)) - print(fineTsList) - fineTsList.insert(0, tStamp) - fineTsList.insert(0, evNum) - if (root_tree != None): - highWord= word0 - lowWord= word1 - extWord= word2 - timeStamp= tStamp - bufPos= 0 - evtNumber= evNum - evtType= evType - trigsFired= inTrig - mystruct.raw0= fifoData[index] - mystruct.raw1= fifoData[index+1] - mystruct.raw2= fifoData[index+2] - mystruct.raw3= fifoData[index+3] - mystruct.raw4= fifoData[index+4] - mystruct.raw5= fifoData[index+5] - mystruct.evtNumber= evNum - mystruct.tluTimeStamp= tStamp - mystruct.tluEvtType= evType - mystruct.tluTrigFired= inTrig - root_tree.Fill() - - outList.insert(len(outList), fineTsList) - #print "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=" - #print "EN#\tCOARSE_TS\tFINE_TS0...FINE_TS11" - #pprint.pprint(outList) - return outList - - def plotFifoData(self, outList): - import matplotlib.pyplot as plt - import numpy as np - import matplotlib.mlab as mlab - - coarseColumn= [row[1] for row in outList] - fineColumn= [row[2] for row in outList] - timeStamp= [sum(x) for x in zip(coarseColumn, fineColumn)] - correctTs= [-1]*len(coarseColumn) - coarseVal= 0.000000025 #coarse time value (40 Mhz, 25 ns) - fineVal= 0.00000000078125 #fine time value (1280 MHz, 0.78125 ns) - for iTs in range(0, len(coarseColumn)): - correctTs[iTs]= coarseColumn[iTs]*coarseVal + fineColumn[iTs]*fineVal - #if iTs: - #print correctTs[iTs]-correctTs[iTs-1], "\t ", correctTs[iTs], "\t", coarseColumn[iTs], "\t", fineColumn[iTs] - - xdiff = np.diff(correctTs) - np.all(xdiff[0] == xdiff) - P= 1000000000 #display in ns - nsDeltas = [x * P for x in xdiff] - #centerRange= np.mean(nsDeltas) - centerRange= 476 - windowsns= 30 - minRange= centerRange-windowsns - maxRange= centerRange+windowsns - plt.hist(nsDeltas, 60, range=[minRange, maxRange], facecolor='blue', align='mid', alpha= 0.75) - #plt.hist(nsDeltas, 100, normed=True, facecolor='blue', align='mid', alpha=0.75) - #plt.xlim((min(nsDeltas), max(nsDeltas))) - plt.xlabel('Time (ns)') - plt.ylabel('Entries') - plt.title('Histogram DeltaTime') - plt.grid(True) - - #Superimpose Gauss - mean = np.mean(nsDeltas) - variance = np.var(nsDeltas) - sigma = np.sqrt(variance) - x = np.linspace(min(nsDeltas), max(nsDeltas), 100) - plt.plot(x, mlab.normpdf(x, mean, sigma)) - - #Display plot - plt.show() - - def saveFifoData(self, outList): - import csv - with open("output.csv", "wb") as f: - writer = csv.writer(f) - writer.writerows(outList) - -################################################################################################################################## -################################################################################################################################## - def acquire(self, mystruct, root_tree= None): - print("STARTING ACQUIRE LOOP") - print("Run#" , self.runN, "\n") - self.isRunning= True - index=0 - while (self.isRunning == True): - eventFifoFillLevel= self.getFifoLevel(0) - nFifoWords= int(eventFifoFillLevel) - if (nFifoWords > 0): - fifoData= self.getFifoData(nFifoWords) - outList= self.parseFifoData(fifoData, nFifoWords/6, mystruct, root_tree, False) - - time.sleep(0.1) - index= index + nFifoWords/6 - print("STOPPING ACQUIRE LOOP:", index, "events collected") - return index - - def configure(self, parsed_cfg): - print("\nTLU INITIALIZING...") - section_name= "Producer.fmctlu" - - #READ CONTENT OF EPROM VIA I2C - self.getSN() - - print(" Turning on software trigger veto") - cmd = int("0x1",16) - self.setTriggerVetoStatus(cmd) - - # #Get Verbose setting - self.verbose= parsed_cfg.getint(section_name, "verbose") - - - # #SET DACs - self.writeThreshold(self.zeDAC1, parsed_cfg.getfloat(section_name, "DACThreshold0"), 1, self.verbose) - self.writeThreshold(self.zeDAC1, parsed_cfg.getfloat(section_name, "DACThreshold1"), 0, self.verbose) - self.writeThreshold(self.zeDAC2, parsed_cfg.getfloat(section_name, "DACThreshold2"), 3, self.verbose) - self.writeThreshold(self.zeDAC2, parsed_cfg.getfloat(section_name, "DACThreshold3"), 2, self.verbose) - self.writeThreshold(self.zeDAC2, parsed_cfg.getfloat(section_name, "DACThreshold4"), 1, self.verbose) - self.writeThreshold(self.zeDAC2, parsed_cfg.getfloat(section_name, "DACThreshold5"), 0, self.verbose) - - # - # #ENABLE/DISABLE HDMI OUTPUTS - self.DUTOutputs(0, int(parsed_cfg.get(section_name, "HDMI1_set"), 16) , self.verbose) - self.DUTOutputs(1, int(parsed_cfg.get(section_name, "HDMI2_set"), 16) , self.verbose) - self.DUTOutputs(2, int(parsed_cfg.get(section_name, "HDMI3_set"), 16) , self.verbose) - self.DUTOutputs(3, int(parsed_cfg.get(section_name, "HDMI4_set"), 16) , self.verbose) - - # #SELECT CLOCK SOURCE TO HDMI - self.DUTClkSrc(0, int(parsed_cfg.get(section_name, "HDMI1_clk"), 16) , self.verbose) - self.DUTClkSrc(1, int(parsed_cfg.get(section_name, "HDMI2_clk"), 16) , self.verbose) - self.DUTClkSrc(2, int(parsed_cfg.get(section_name, "HDMI3_clk"), 16) , self.verbose) - self.DUTClkSrc(3, int(parsed_cfg.get(section_name, "HDMI4_clk"), 16) , self.verbose) - - # #ENABLE/DISABLE LEMO CLOCK OUTPUT - self.enableClkLEMO(parsed_cfg.getint(section_name, "LEMOclk"), False) - - # - # #Check clock status - self.getClockStatus() - - resetClocks = 0 - resetSerdes = 0 - resetCounters= 0 - if resetClocks: - self.resetClocks() - self.getClockStatus() - if resetSerdes: - self.resetSerdes() - if resetCounters: - self.resetCounters() - - # # Get inputs status and counters - self.getChStatus() - self.getAllChannelsCounts() - - # # Stop internal triggers until setup complete - cmd = int("0x0",16) - self.setInternalTrg(cmd) - - # # Set the control voltages for the PMTs - PMT1_V= parsed_cfg.getfloat(section_name, "PMT1_V") - PMT2_V= parsed_cfg.getfloat(section_name, "PMT2_V") - PMT3_V= parsed_cfg.getfloat(section_name, "PMT3_V") - PMT4_V= parsed_cfg.getfloat(section_name, "PMT4_V") - self.pwdled.setVch(0, PMT1_V, True) - self.pwdled.setVch(1, PMT2_V, True) - self.pwdled.setVch(2, PMT3_V, True) - self.pwdled.setVch(3, PMT4_V, True) - - # # Set pulse stretches - str0= parsed_cfg.getint(section_name, "in0_STR") - str1= parsed_cfg.getint(section_name, "in1_STR") - str2= parsed_cfg.getint(section_name, "in2_STR") - str3= parsed_cfg.getint(section_name, "in3_STR") - str4= parsed_cfg.getint(section_name, "in4_STR") - str5= parsed_cfg.getint(section_name, "in5_STR") - self.setPulseStretch([str0, str1, str2, str3, str4, str5]) - - # # Set pulse delays - del0= parsed_cfg.getint(section_name, "in0_DEL") - del1= parsed_cfg.getint(section_name, "in1_DEL") - del2= parsed_cfg.getint(section_name, "in2_DEL") - del3= parsed_cfg.getint(section_name, "in3_DEL") - del4= parsed_cfg.getint(section_name, "in4_DEL") - del5= parsed_cfg.getint(section_name, "in5_DEL") - self.setPulseDelay([del0, del1, del2, del3, del4, del5]) - - # # Set trigger pattern - triggerPattern_low= int(parsed_cfg.get(section_name, "trigMaskLo"), 16) - triggerPattern_high= int(parsed_cfg.get(section_name, "trigMaskHi"), 16) - self.setTrgPattern(triggerPattern_high, triggerPattern_low) - - # # Set active DUTs - DUTMask= int(parsed_cfg.get(section_name, "DUTMask"), 16) - self.setDUTmask(DUTMask) - - # # Set mode (AIDA, EUDET) - DUTMode= int(parsed_cfg.get(section_name, "DUTMaskMode"), 16) - self.setMode(DUTMode) - - # # Set modifier - modifier = int(parsed_cfg.get(section_name, "DUTMaskModeModifier"), 16) - self.setModeModifier(modifier) - - # # Set veto shutter - setVetoShutters = int(parsed_cfg.get(section_name, "DUTIgnoreShutterVeto"), 16) - self.setVetoShutters(setVetoShutters) - - # # Set veto by DUT - ignoreDUTBusy = int(parsed_cfg.get(section_name, "DUTIgnoreBusy"), 16) - self.setVetoDUT(ignoreDUTBusy) - - print(" Check external veto:") - self.getExternalVeto() - - # # Set trigger interval (use 0 to disable internal triggers) - triggerInterval= parsed_cfg.getint(section_name, "InternalTriggerFreq") - self.setInternalTrg(triggerInterval) - - print("TLU INITIALIZED") - -################################################################################################################################## -################################################################################################################################## - def start(self, logtimestamps=False, runN=0, mystruct= None, root_tree= None): - print("TLU STARTING...") - self.runN= runN - - print(" FIFO RESET:") - FIFOcmd= 0x2 - self.setFifoCSR(FIFOcmd) - eventFifoFillLevel= self.getFifoLevel() - #cmd = int("0x000",16) - #self.setInternalTrg(cmd) - - if logtimestamps: - self.setRecordDataStatus(True) - else: - self.setRecordDataStatus(False) - - # Pulse T0 - #self.pulseT0() - # Set run active - self.setRunActive() - - print(" Turning off software trigger veto") - self.setTriggerVetoStatus( int("0x0",16) ) - - print("TLU STARTED") - - # nEvents= self.acquire(mystruct, root_tree) - return - - -################################################################################################################################## -################################################################################################################################## - def stop(self, saveD= False, plotD= False): - print("TLU STOPPING...") - - self.getPostVetoTrg() - eventFifoFillLevel= self.getFifoLevel() - self.getFifoFlags() - self.getFifoCSR() - print(" Turning on software trigger veto") - self.setTriggerVetoStatus( int("0x1",16) ) - - print("Turning off shutter (setting run inactive)") - self.setRunInactive() - - nFifoWords= int(eventFifoFillLevel) - fifoData= self.getFifoData(nFifoWords) - - #outList= self.parseFifoData(fifoData, nFifoWords/6, None, None, True) - #if saveD: - # self.saveFifoData(outList) - #if plotD: - # self.plotFifoData(outList) - #outFile = open('./test.txt', 'w') - #for iData in range (0, 30): - # outFile.write("%s\n" % fifoData[iData]) - # print hex(fifoData[iData]) - print("TLU STOPPED") - return diff --git a/TLU_v1e/scripts/TLUconnection.xml b/TLU_v1e/scripts/TLUconnection.xml deleted file mode 100644 index fca67f5..0000000 --- a/TLU_v1e/scripts/TLUconnection.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - diff --git a/TLU_v1e/scripts/config_parser.py b/TLU_v1e/scripts/config_parser.py deleted file mode 100644 index d05c5c4..0000000 --- a/TLU_v1e/scripts/config_parser.py +++ /dev/null @@ -1,29 +0,0 @@ -# Parse *.ini file and provide some methods to access data - -class ConfigParser(object): - def __init__(self, filename): - with open(filename, "r") as in_file: - parsed_cfg = {} - for line in in_file.readlines(): - line = line.strip() - if len(line) == 0: - continue - - if line[0] == "[": - section = line[1:-1] - parsed_cfg[section] = {} - elif line[0] != "#": - key = line.split("=")[0].strip() - value = line.split("=")[1].strip() - parsed_cfg[section][key] = value - - self.conf = parsed_cfg - - def get(self, section, key): - return self.conf[section][key] - - def getint(self, section, key): - return int(self.get(section, key)) - - def getfloat(self, section, key): - return float(self.get(section, key)) diff --git a/TLU_v1e/scripts/initTLU.py b/TLU_v1e/scripts/initTLU.py deleted file mode 100644 index eb1ae65..0000000 --- a/TLU_v1e/scripts/initTLU.py +++ /dev/null @@ -1,184 +0,0 @@ -# -# Function to initialize TLU -# -# David Cussans, October 2015 -# -# Nasty hack - use both PyChips and uHAL ( for block read ... ) - -from PyChipsUser import * -from FmcTluI2c import * - -import uhal - -import sys -import time - -def startTLU( uhalDevice , pychipsBoard , writeTimestamps): - - print "RESETTING FIFO" - pychipsBoard.write("EventFifoCSR",0x2) - eventFifoFillLevel = pychipsBoard.read("EventFifoFillLevel") - print "FIFO FILL LEVEL AFTER RESET= " , eventFifoFillLevel - - - if writeTimestamps: - print "ENABLING DATA RECORDING" - pychipsBoard.write("Enable_Record_Data",1) - else: - print "Disabling data recording" - pychipsBoard.write("Enable_Record_Data",0) - - print "Pulsing T0" - pychipsBoard.write("PulseT0",1) - - print "Turning off software trigger veto" - pychipsBoard.write("TriggerVetoW",0) - - print "TLU is running" - - -def stopTLU( uhalDevice , pychipsBoard ): - - print "Turning on software trigger veto" - pychipsBoard.write("TriggerVetoW",1) - - print "TLU triggers are stopped" - -def initTLU( uhalDevice , pychipsBoard , listenForTelescopeShutter , pulseDelay , pulseStretch , triggerPattern , DUTMask , ignoreDUTBusy , triggerInterval , thresholdVoltage ): - - print "SETTING UP AIDA TLU" - - fwVersion = uhalDevice.getNode("version").read() - uhalDevice.dispatch() - print "\tVersion (uHAL)= " , hex(fwVersion) - - print "\tTurning on software trigger veto" - pychipsBoard.write("TriggerVetoW",1) - - # Check the bus for I2C devices - pychipsBoardi2c = FmcTluI2c(pychipsBoard) - - print "\tScanning I2C bus:" - scanResults = pychipsBoardi2c.i2c_scan() - #print scanResults - print '\t', ', '.join(scanResults), '\n' - - boardId = pychipsBoardi2c.get_serial_number() - print "\tFMC-TLU serial number= " , boardId - - resetClocks = 0 - resetSerdes = 0 - -# set DACs to -200mV - print "\tSETTING ALL DAC THRESHOLDS TO" , thresholdVoltage , "V" - pychipsBoardi2c.set_threshold_voltage(7, thresholdVoltage) - - clockStatus = pychipsBoard.read("LogicClocksCSR") - print "\tCLOCK STATUS (should be 3 if all clocks locked)= " , hex(clockStatus) - assert ( clockStatus == 3 ) , "Clocks in TLU FPGA are not locked. No point in continuing. Re-prgramme or power cycle board" - - if resetClocks: - print "Resetting clocks" - pychipsBoard.write("LogicRst", 1 ) - - clockStatus = pychipsBoard.read("LogicClocksCSR") - print "Clock status after reset = " , hex(clockStatus) - - inputStatus = pychipsBoard.read("SerdesRstR") - print "Input status = " , hex(inputStatus) - - if resetSerdes: - pychipsBoard.write("SerdesRstW", 0x00000003 ) - inputStatus = pychipsBoard.read("SerdesRstR") - print "Input status during reset = " , hex(inputStatus) - - pychipsBoard.write("SerdesRstW", 0x00000000 ) - inputStatus = pychipsBoard.read("SerdesRstR") - print "Input status after reset = " , hex(inputStatus) - - pychipsBoard.write("SerdesRstW", 0x00000004 ) - inputStatus = pychipsBoard.read("SerdesRstR") - print "Input status during calibration = " , hex(inputStatus) - - pychipsBoard.write("SerdesRstW", 0x00000000 ) - inputStatus = pychipsBoard.read("SerdesRstR") - print "Input status after calibration = " , hex(inputStatus) - - - inputStatus = pychipsBoard.read("SerdesRstR") - print "\tINPUT STATUS= " , hex(inputStatus) - - count0 = pychipsBoard.read("ThrCount0R") - print "\t Count 0= " , count0 - - count1 = pychipsBoard.read("ThrCount1R") - print "\t Count 1= " , count1 - - count2 = pychipsBoard.read("ThrCount2R") - print "\t Count 2= " , count2 - - count3 = pychipsBoard.read("ThrCount3R") - print "\t Count 3= " , count3 - -# Stop internal triggers until setup complete - pychipsBoard.write("InternalTriggerIntervalW",0) - - print "\tSETTING INPUT COINCIDENCE WINDOW TO",pulseStretch,"[Units= 160MHz clock cycles, Four 5-bit values (one per input) packed in to 32-bit word]" - pychipsBoard.write("PulseStretchW",int(pulseStretch)) - pulseStretchR = pychipsBoard.read("PulseStretchR") - print "\t Pulse stretch read back as:", hex(pulseStretchR) - # assert (int(pulseStretch) == pulseStretchR) , "Pulse stretch read-back doesn't equal written value" - - print "\tSETTING INPUT TRIGGER DELAY TO",pulseDelay , "[Units= 160MHz clock cycles, Four 5-bit values (one per input) packed in to 32-bit word]" - pychipsBoard.write("PulseDelayW",int(pulseDelay)) - pulseDelayR = pychipsBoard.read("PulseDelayR") - print "\t Pulse delay read back as:", hex(pulseDelayR) - - print "\tSETTING TRIGGER PATTERN (for external triggers) TO 0x%08X. Two 16-bit patterns packed into 32 bit word " %(triggerPattern) - pychipsBoard.write("TriggerPatternW",int(triggerPattern)) - triggerPatternR = pychipsBoard.read("TriggerPatternR") - print "\t Trigger pattern read back as: 0x%08X " % (triggerPatternR) - - print "\tENABLING DUT(s): Mask= " , hex(DUTMask) - pychipsBoard.write("DUTMaskW",int(DUTMask)) - DUTMaskR = pychipsBoard.read("DUTMaskR") - print "\t DUTMask read back as:" , hex(DUTMaskR) - - print "\tSETTING ALL DUTs IN AIDA MODE" - pychipsBoard.write("DUTInterfaceModeW", 0xFF) - DUTInterfaceModeR = pychipsBoard.read("DUTInterfaceModeR") - print "\t DUT mode read back as:" , DUTInterfaceModeR - - print "\tSET DUT MODE MODIFIER" - pychipsBoard.write("DUTInterfaceModeModifierW", 0xFF) - DUTInterfaceModeModifierR = pychipsBoard.read("DUTInterfaceModeModifierR") - print "\t DUT mode modifier read back as:" , DUTInterfaceModeModifierR - - if listenForTelescopeShutter: - print "\tSET IgnoreShutterVetoW TO LISTEN FOR VETO FROM SHUTTER" - pychipsBoard.write("IgnoreShutterVetoW",0) - else: - print "\tSET IgnoreShutterVetoW TO IGNORE VETO FROM SHUTTER" - pychipsBoard.write("IgnoreShutterVetoW",1) - IgnoreShutterVeto = pychipsBoard.read("IgnoreShutterVetoR") - print "\t IgnoreShutterVeto read back as:" , IgnoreShutterVeto - - print "\tSETTING IGNORE VETO BY DUT BUSY MASK TO" , hex(ignoreDUTBusy) - pychipsBoard.write("IgnoreDUTBusyW",int(ignoreDUTBusy)) - IgnoreDUTBusy = pychipsBoard.read("IgnoreDUTBusyR") - print "\t IgnoreDUTBusy read back as:" , hex(IgnoreDUTBusy) - -#print "Enabling handshake: No-handshake" -#board.write("HandshakeTypeW",1) - - - print "\tSETTING INTERNAL TRIGGER INTERVAL TO" , triggerInterval , "(zero= no internal triggers)" - if triggerInterval == 0: - internalTriggerFreq = 0 - else: - internalTriggerFreq = 160000.0/triggerInterval - print "\tINTERNAL TRIGGER FREQUENCY= " , internalTriggerFreq , " kHz" - pychipsBoard.write("InternalTriggerIntervalW",triggerInterval) #0->Internal pulse generator disabled. Any other value will generate pulses with a frequency of n*6.25ns - trigIntervalR = pychipsBoard.read("InternalTriggerIntervalR") - print "\t Trigger interval read back as:", trigIntervalR - print "AIDA TLU SETUP COMPLETED" diff --git a/TLU_v1e/scripts/localConf.conf b/TLU_v1e/scripts/localConf.conf deleted file mode 100644 index 2892d29..0000000 --- a/TLU_v1e/scripts/localConf.conf +++ /dev/null @@ -1,93 +0,0 @@ -[Producer.fmctlu] -verbose= 2 -confid= 20170626 -delayStart= 1000 -nDUTs = 1 - -# HDMI pin direction: -# 4-bits to determine direction of HDMI pins -# 1-bit for the clock pair -# 0= pins are not driving signals, 1 pins drive signals (outputs) -HDMI1_set= 0x7 -HDMI2_set= 0x7 -HDMI3_set= 0x7 -HDMI4_set= 0x7 -HDMI1_clk = 0 -HDMI2_clk = 0 -HDMI3_clk = 0 -HDMI4_clk = 0 - -# Control voltages for the PMTs -PMT1_V= 0.5 -PMT2_V= 0.7 -PMT3_V= 0.9 -PMT4_V= 1 - -# Enable/disable differential LEMO CLOCK -LEMOclk = 1 - -# Set delay and stretch for trigger pulses -in0_STR = 1 -in0_DEL = 0 -in1_STR = 1 -in1_DEL = 0 -in2_STR = 1 -in2_DEL = 0 -in3_STR = 1 -in3_DEL = 0 -in4_STR = 1 -in4_DEL = 0 -in5_STR = 1 -in5_DEL = 0 -# -trigMaskHi = 0x00000000 -trigMaskLo = 0x00000002 -# -#### DAC THRESHOLD -DACThreshold0 = -0.12 -DACThreshold1 = -0.12 -DACThreshold2 = -0.12 -DACThreshold3 = -0.12 -DACThreshold4 = -0.12 -DACThreshold5 = -0.12 - -# Define which DUTs are ON -DUTMask = 0x1 - -# Define mode of DUT (00 EUDET, 11 AIDA) -DUTMaskMode= 0x00 - -# Allow asynchronous veto -DUTMaskModeModifier= 0x0 - -# Ignore busy from a specific DUT -DUTIgnoreBusy = 0x0 - -# Ignore the SHUTTER veto on a specific DUT -DUTIgnoreShutterVeto = 0x0 - -# Generate internal triggers (in Hz, 0= no triggers) -InternalTriggerFreq = 1000 - - - -[LogCollector.log] -# Currently, all LogCollectors have a hardcoded runtime name: log -# nothing - - -[DataCollector.my_dc] -EUDAQ_MON=my_mon -# send assambled event to the monitor with runtime name my_mon; -EUDAQ_FW=native -# the format of data file -EUDAQ_FW_PATTERN=$12D_run$6R$X -# the name pattern of data file -# the $12D will be converted a data/time string with 12 digits. -# the $6R will be converted a run number string with 6 digits. -# the $X will be converted the suffix name of data file. - -[Monitor.my_mon] -EX0_ENABLE_PRINT=0 -EX0_ENABLE_STD_PRINT=0 -EX0_ENABLE_STD_CONVERTER=1 diff --git a/TLU_v1e/scripts/run_tlu.py b/TLU_v1e/scripts/run_tlu.py deleted file mode 100644 index 652de3a..0000000 --- a/TLU_v1e/scripts/run_tlu.py +++ /dev/null @@ -1,22 +0,0 @@ -import time - -from config_parser import ConfigParser -from TLU_v1e import TLU - -conf = ConfigParser(filename="/home/silab/git/aida-tlu/TLU_v1e/scripts/localIni.ini") -configure_conf = ConfigParser(filename="/home/silab/git/aida-tlu/TLU_v1e/scripts/localConf.conf") -t = TLU(dev_name='tlu', man_file='file:///home/silab/git/aida-tlu/TLU_v1e/scripts/TLUconnection.xml', parsed_cfg=conf) -t.configure(configure_conf) -t.start() -t.isRunning = True -try: - while (t.isRunning == True): - eventFifoFillLevel= t.getFifoLevel(0) - nFifoWords= int(eventFifoFillLevel) - if (nFifoWords > 0): - fifoData= t.getFifoData(nFifoWords) - print(fifoData) - time.sleep(1) -except KeyboardInterrupt: - t.isRunning = False -t.stop() diff --git a/TLU_v1e/scripts/startTLU_v1e.py b/TLU_v1e/scripts/startTLU_v1e.py deleted file mode 100644 index d4a42b7..0000000 --- a/TLU_v1e/scripts/startTLU_v1e.py +++ /dev/null @@ -1,246 +0,0 @@ -# -*- coding: utf-8 -*- -# miniTLU test script - -#from PyChipsUser import * -#from FmcTluI2c import * -import uhal -import sys -import time -from datetime import datetime -import threading -# from ROOT import TFile, TTree -# from ROOT import gROOT -from datetime import datetime - -from TLU_v1e import TLU -# Use to have interactive shell -import cmd - -# Use to have config file parser -import ConfigParser - -# Use root -from ROOT import TFile, TTree, gROOT, AddressOf -from ROOT import * -import numpy as numpy - - -## Define class that creates the command user inteface -class MyPrompt(cmd.Cmd): - - # def do_initialise(self, args): - # """Processes the INI file and writes its values to the TLU. To use a specific file type:\n - # parseIni path/to/filename.ini\n - # (without quotation marks)""" - # print "COMMAND RECEIVED: PARSE INI" - # parsed_cfg= self.open_cfg_file(args, "/users/phpgb/workspace/myFirmware/AIDA/TLU_v1e/scripts/localIni.ini") - # try: - # theID = parsed_cfg.getint("Producer.fmctlu", "initid") - # print theID - # theSTRING= parsed_cfg.get("Producer.fmctlu", "ConnectionFile") - # print theSTRING - # #TLU= TLU("tlu", theSTRING, parsed_cfg) - # except IOError: - # print "\t Could not retrieve INI data." - # return - - - def do_configure(self, args): - """Processes the CONF file and writes its values to the TLU. To use a specific file type:\n - parseIni path/to/filename.conf\n - (without quotation marks)""" - print "==== COMMAND RECEIVED: PARSE CONFIG" - #self.testme() - parsed_cfg= self.open_cfg_file(args, "./localConf.conf") - try: - theID = parsed_cfg.getint("Producer.fmctlu", "confid") - print "\t", theID - TLU.configure(parsed_cfg) - except IOError: - print "\t Could not retrieve CONF data." - return - - def do_i2c(self, args): - arglist = args.split() - if len(arglist) == 0: - print "\tno command specified" - else: - i2ccmd= arglist[0] - results = list(map(int, arglist)) - TLU.DISP.writeSomething(results) - print "Sending i2c command to display" - return - - def do_id(self, args): - """Interrogates the TLU and prints it unique ID on screen""" - TLU.getSN() - return - - def do_triggers(self, args): - """Interrogates the TLU and prints the number of triggers seen by the input discriminators""" - TLU.getChStatus() - TLU.getAllChannelsCounts() - TLU.getPostVetoTrg() - return - - def do_startRun(self, args): - """Starts the TLU run. If a number is specified, this number will be appended to the file name as Run_#""" - print "==== COMMAND RECEIVED: STARTING TLU RUN" - #startTLU( uhalDevice = self.hw, pychipsBoard = self.board, writeTimestamps = ( options.writeTimestamps == "True" ) ) - arglist = args.split() - if len(arglist) == 0: - print "\tno run# specified, using 1" - runN= 1 - else: - runN= arglist[0] - - logdata= True - - #TLU.start(logdata) - if (TLU.isRunning): #Prevent double start - print " Run already in progress" - return - else: - now = datetime.now().strftime('%Y%m%d_%H%M%S') - default_filename = "./datafiles/"+ now + "_tluData_" + str(runN) + ".root" - rootFname= default_filename - print "OPENING ROOT FILE:", rootFname - self.root_file = TFile( rootFname, 'RECREATE' ) - # Create a root "tree" - root_tree = TTree( 'T', 'TLU Data' ) - #highWord =0 - #lowWord =0 - #evtNumber=0 - #timeStamp=0 - #evtType=0 - #trigsFired=0 - #bufPos = 0 - - #https://root-forum.cern.ch/t/long-integer/1961/2 - gROOT.ProcessLine( - "struct MyStruct {\ - UInt_t raw0;\ - UInt_t raw1;\ - UInt_t raw2;\ - UInt_t raw3;\ - UInt_t raw4;\ - UInt_t raw5;\ - UInt_t evtNumber;\ - ULong64_t tluTimeStamp;\ - UChar_t tluEvtType;\ - UChar_t tluTrigFired;\ - };" ); - - mystruct= MyStruct() - - - # Create a branch for each piece of data - root_tree.Branch('EVENTS', mystruct, 'raw0/i:raw1/i:raw2/i:raw3/i:raw4/i:raw5/i:evtNumber/i:tluTimeStamp/l:tluEvtType/b:tluTrigFired/b' ) - # root_tree.Branch( 'tluHighWord' , highWord , "HighWord/l") - # root_tree.Branch( 'tluLowWord' , lowWord , "LowWord/l") - # root_tree.Branch( 'tluExtWord' , extWord , "ExtWord/l") - # root_tree.Branch( 'tluTimeStamp' , timeStamp , "TimeStamp/l") - # root_tree.Branch( 'tluBufPos' , bufPos , "Bufpos/s") - # root_tree.Branch( 'tluEvtNumber' , evtNumber , "EvtNumber/i") - # root_tree.Branch( 'tluEvtType' , evtType , "EvtType/b") - # root_tree.Branch( 'tluTrigFired' , trigsFired, "TrigsFired/b") - #self.root_file.Write() - - daq_thread= threading.Thread(target = TLU.start, args=(logdata, runN, mystruct, root_tree)) - daq_thread.start() - - def do_endRun(self, args): - """Stops the TLU run""" - print "==== COMMAND RECEIVED: STOP TLU RUN" - if TLU.isRunning: - TLU.isRunning= False - TLU.stop(False, False) - self.root_file.Write() - self.root_file.Close() - else: - print " No run to stop" - - - def do_quit(self, args): - """Quits the program.""" - print "==== COMMAND RECEIVED: QUITTING TLU CONSOLE" - if TLU.isRunning: - TLU.isRunning= False - TLU.stop(False, False) - self.root_file.Write() - self.root_file.Close() - print "Terminating run" - return True - - def testme(self): - print "This is a test" - - def open_cfg_file(self, args, default_file): - # Parse the user arguments, attempts to opent the file and performs a (minimal) - # check to verify the file exists (but not that its content is correct) - - arglist = args.split() - if len(arglist) == 0: - print "\tno file specified, using default" - fileName= default_file - print "\t", fileName - else: - fileName= arglist[0] - if len(arglist) > 1: - print "\tinvalid: too many arguments. Max 1." - return - - parsed_file = ConfigParser.RawConfigParser() - try: - with open(fileName) as f: - parsed_file.readfp(f) - print "\t", parsed_file.sections() - except IOError: - print "\t Error while parsing the specified file." - return - return parsed_file - -# # Override methods in Cmd object ## -# def preloop(self): -# """Initialization before prompting user for commands. -# Despite the claims in the Cmd documentaion, Cmd.preloop() is not a stub. -# """ -# cmd.Cmd.preloop(self) # # sets up command completion -# self._hist = [] # # No history yet -# self._locals = {} # # Initialize execution namespace for user -# self._globals = {} -# print "\nINITIALIZING" -# now = datetime.now().strftime('%Y-%m-%dT%H_%M_%S') -# default_filename = './rootfiles/tluData_' + now + '.root' -# print "SETTING UP AIDA TLU TO SUPPLY CLOCK AND TRIGGER TO TORCH READOUT\n" -# self.manager = uhal.ConnectionManager("file://./connection.xml") -# self.hw = self.manager.getDevice("minitlu") -# self.device_id = self.hw.id() -# -# # Point to TLU in Pychips -# self.bAddrTab = AddressTable("./aida_mini_tlu_addr_map.txt") -# -# # Assume DIP-switch controlled address. Switches at 2 -# self.board = ChipsBusUdp(self.bAddrTab,"192.168.200.32",50001) - - -################################################# -if __name__ == "__main__": - print "TLU v1E MAIN" - prompt = MyPrompt() - prompt.prompt = '>> ' - - parsed_ini= prompt.open_cfg_file("", "./localIni.ini") - TLU= TLU("tlu", "file://./TLUconnection.xml", parsed_ini) - - ###TLU.configure(parsed_cfg) - ###logdata= True - ###TLU.start(logdata) - ###time.sleep(5) - ###TLU.stop(False, False) - - # Start interactive prompt - print "====================================================================" - print "==========================TLU TEST CONSOLE==========================" - print "====================================================================" - prompt.cmdloop("Type 'help' for a list of commands.") diff --git a/TLU_v1e/scripts/startTLU_v1e.sh b/TLU_v1e/scripts/startTLU_v1e.sh deleted file mode 100644 index f0bb387..0000000 --- a/TLU_v1e/scripts/startTLU_v1e.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -echo "==========================" -CURRENT_DIR=${0%/*} -echo "CURRENT DIRECTORY: " $CURRENT_DIR - -echo "============" -echo "SETTING PATHS" -#export PYTHONPATH=$CURRENT_DIR/../../../../../Python_Scripts/PyChips_1_5_0_pre2A/src:$PYTHONPATH -#export PYTHONPATH=~/Python_Scripts/PyChips_1_5_0_pre2A/src:$PYTHONPATH -export PYTHONPATH=../../packages:$PYTHONPATH -echo "PYTHON PATH= " $PYTHONPATH -export LD_LIBRARY_PATH=/opt/cactus/lib:$LD_LIBRARY_PATH -echo "LD_LIBRARY_PATH= " $LD_LIBRARY_PATH -export PATH=/usr/bin/:/opt/cactus/bin:$PATH -echo "PATH= " $PATH - -cd $CURRENT_DIR - -echo "============" -echo "STARTING PYTHON SCRIPT FOR TLU" -#python $CURRENT_DIR/startTLU_v8.py $@ - -python startTLU_v1e.py $@ -#python testTLU_script.py diff --git a/TLU_v1e/scripts/startTLU_v6.py b/TLU_v1e/scripts/startTLU_v6.py deleted file mode 100644 index b7948f2..0000000 --- a/TLU_v1e/scripts/startTLU_v6.py +++ /dev/null @@ -1,232 +0,0 @@ -# -# Script to setup AIDA TLU for TPix3 telescope <--> TORCH synchronization -# -# David Cussans, December 2012 -# -# Nasty hack - use both PyChips and uHAL ( for block read ... ) - -from PyChipsUser import * -from FmcTluI2c import * - -import uhal - -import sys - -import time - -from datetime import datetime - -from optparse import OptionParser - -# For single character non-blocking input: -import select -import tty -import termios - -from initTLU import * - -def isData(): - return select.select([sys.stdin], [], [], 0) == ([sys.stdin], [], []) - -now = datetime.now().strftime('%Y-%m-%dT%H_%M_%S') -default_filename = 'tluData_' + now + '.root' -parser = OptionParser() - -parser.add_option('-r','--rootFname',dest='rootFname', - default=default_filename,help='Path of output file') -parser.add_option('-o','--writeTimestamps',dest='writeTimestamps', - default="True",help='Set True to write timestamps to ROOT file') -parser.add_option('-p','--printTimestamps',dest='printTimestamps', - default="True",help='Set True to print timestamps to screen (nothing printed unless also output to file) ') -parser.add_option('-s','--listenForTelescopeShutter',dest='listenForTelescopeShutter', - default=False,help='Set True to veto triggers when shutter goes high') -parser.add_option('-d','--pulseDelay',dest='pulseDelay', type=int, - default=0x00,help='Delay added to input triggers. Four 5-bit numbers packed into 32-bt word, Units of 6.125ns') -parser.add_option('-w','--pulseStretch',dest='pulseStretch',type=int, - default=0x00,help='Width added to input triggers. Four 5-bit numbers packed into 32-bt word. Units of 6.125ns') -parser.add_option('-t','--triggerPattern',dest='triggerPattern',type=int, - default=0xFFFEFFFE,help='Pattern match to generate trigger. Two 16-bit words packed into 32-bit word.') -parser.add_option('-m','--DUTMask',dest='DUTMask',type=int, - default=0x01,help='Three-bit mask selecting which DUTs are active.') -parser.add_option('-y','--ignoreDUTBusy',dest='ignoreDUTBusy',type=int, - default=0x0F,help='Three-bit mask selecting which DUTs can veto triggers by setting BUSY high. Low = can veto, high = ignore busy.') -parser.add_option('-i','--triggerInterval',dest='triggerInterval',type=int, - default=0,help='Interval between internal trigers ( in units of 6.125ns ). Set to zero to turn off internal triggers') -parser.add_option('-v','--thresholdVoltage',dest='thresholdVoltage',type=float, - default=-0.2,help='Threshold voltage for TLU inputs ( units of volts)') - -(options, args) = parser.parse_args(sys.argv[1:]) - -from ROOT import TFile, TTree -from ROOT import gROOT - -print "SETTING UP AIDA TLU TO SUPPLY CLOCK AND TRIGGER TO TORCH READOUT\n" - -# Point to board in uHAL -manager = uhal.ConnectionManager("file://./connection.xml") -hw = manager.getDevice("minitlu") -device_id = hw.id() - -# Point to TLU in Pychips -bAddrTab = AddressTable("./aida_mini_tlu_addr_map.txt") - -# Assume DIP-switch controlled address. Switches at 2 -board = ChipsBusUdp(bAddrTab,"192.168.200.32",50001) - -# Open Root file -print "OPENING ROOT FILE:", options.rootFname -f = TFile( options.rootFname, 'RECREATE' ) - -# Create a root "tree" -tree = TTree( 'T', 'TLU Data' ) -highWord =0 -lowWord =0 -evtNumber=0 -timeStamp=0 -evtType=0 -trigsFired=0 -bufPos = 0 - -# Create a branch for each piece of data -tree.Branch( 'tluHighWord' , highWord , "HighWord/l") -tree.Branch( 'tluLowWord' , lowWord , "LowWord/l") -tree.Branch( 'tluTimeStamp' , timeStamp , "TimeStamp/l") -tree.Branch( 'tluBufPos' , bufPos , "Bufpos/s") -tree.Branch( 'tluEvtNumber' , evtNumber , "EvtNumber/i") -tree.Branch( 'tluEvtType' , evtType , "EvtType/b") -tree.Branch( 'tluTrigFired' , trigsFired, "TrigsFired/b") - -# Initialize TLU registers -initTLU( uhalDevice = hw, pychipsBoard = board, listenForTelescopeShutter = options.listenForTelescopeShutter, pulseDelay = options.pulseDelay, pulseStretch = options.pulseStretch, triggerPattern = options.triggerPattern , DUTMask = options.DUTMask, ignoreDUTBusy = options.ignoreDUTBusy , triggerInterval = options.triggerInterval, thresholdVoltage = options.thresholdVoltage ) - -loopWait = 0.1 -oldEvtNumber = 0 - -oldPreVetotriggerCount = board.read("PreVetoTriggersR") -oldPostVetotriggerCount = board.read("PostVetoTriggersR") - -oldThresholdCounter0 =0 -oldThresholdCounter1 =0 -oldThresholdCounter2 =0 -oldThresholdCounter3 =0 - -print "STARTING POLLING LOOP" - -eventFifoFillLevel = 0 -loopRunning = True -runStarted = False - -oldTime = time.time() - -# Save old terminal settings -oldTermSettings = termios.tcgetattr(sys.stdin) -tty.setcbreak(sys.stdin.fileno()) - -while loopRunning: - - if isData(): - c = sys.stdin.read(1) - print "\tGOT INPUT:", c - if c == 't': - loopRunning = False - print "\tTERMINATING LOOP" - elif c == 'c': - runStarted = True - print "\tSTARTING RUN" - startTLU( uhalDevice = hw, pychipsBoard = board, writeTimestamps = ( options.writeTimestamps == "True" ) ) - elif c == 'f': - # runStarted = True - print "\tSTOPPING TRIGGERS" - stopTLU( uhalDevice = hw, pychipsBoard = board ) - - - if runStarted: - - eventFifoFillLevel = hw.getNode("eventBuffer.EventFifoFillLevel").read() - - preVetotriggerCount = hw.getNode("triggerLogic.PreVetoTriggersR").read() - postVetotriggerCount = hw.getNode("triggerLogic.PostVetoTriggersR").read() - - timestampHigh = hw.getNode("Event_Formatter.CurrentTimestampHR").read() - timestampLow = hw.getNode("Event_Formatter.CurrentTimestampLR").read() - - thresholdCounter0 = hw.getNode("triggerInputs.ThrCount0R").read() - thresholdCounter1 = hw.getNode("triggerInputs.ThrCount1R").read() - thresholdCounter2 = hw.getNode("triggerInputs.ThrCount2R").read() - thresholdCounter3 = hw.getNode("triggerInputs.ThrCount3R").read() - - hw.dispatch() - - newTime = time.time() - timeDelta = newTime - oldTime - oldTime = newTime - #print "time delta = " , timeDelta - preVetoFreq = (preVetotriggerCount-oldPreVetotriggerCount)/timeDelta - postVetoFreq = (postVetotriggerCount-oldPostVetotriggerCount)/timeDelta - oldPreVetotriggerCount = preVetotriggerCount - oldPostVetotriggerCount = postVetotriggerCount - - deltaCounts0 = thresholdCounter0 - oldThresholdCounter0 - oldThresholdCounter0 = thresholdCounter0 - deltaCounts1 = thresholdCounter1 - oldThresholdCounter1 - oldThresholdCounter1 = thresholdCounter1 - deltaCounts2 = thresholdCounter2 - oldThresholdCounter2 - oldThresholdCounter2 = thresholdCounter2 - deltaCounts3 = thresholdCounter3 - oldThresholdCounter3 - oldThresholdCounter3 = thresholdCounter3 - - print "pre , post veto triggers , pre , post frequency = " , preVetotriggerCount , postVetotriggerCount , preVetoFreq , postVetoFreq - - print "CURRENT TIMESTAMP HIGH, LOW (hex) = " , hex(timestampHigh) , hex(timestampLow) - - print "Input counts 0,1,2,3 = " , thresholdCounter0 , thresholdCounter1 , thresholdCounter2 , thresholdCounter3 - print "Input freq (Hz) 0,1,2,3 = " , deltaCounts0/timeDelta , deltaCounts1/timeDelta , deltaCounts2/timeDelta , deltaCounts3/timeDelta - - nEvents = int(eventFifoFillLevel)//4 # only read out whole events ( 4 x 32-bit words ) - wordsToRead = nEvents*4 - - print "FIFO FILL LEVEL= " , eventFifoFillLevel - - print "# EVENTS IN FIFO = ",nEvents - print "WORDS TO READ FROM FIFO = ",wordsToRead - - # get timestamp data and fifo fill in same outgoing packet. - timestampData = hw.getNode("eventBuffer.EventFifoData").readBlock(wordsToRead) - - hw.dispatch() - - # print timestampData - for bufPos in range (0, nEvents ): - lowWord = timestampData[bufPos*4 + 1] + 0x100000000* timestampData[ (bufPos*4) + 0] # timestamp - - highWord = timestampData[bufPos*4 + 3] + 0x100000000* timestampData[ (bufPos*4) + 2] # evt number - evtNumber = timestampData[bufPos*4 + 3] - - if evtNumber != ( oldEvtNumber + 1 ): - print "***WARNING *** Non sqeuential event numbers *** , evt,oldEvt = ", evtNumber , oldEvtNumber - - oldEvtNumber = evtNumber - - timeStamp = lowWord & 0xFFFFFFFFFFFF - - evtType = timestampData[ (bufPos*4) + 0] >> 28 - - trigsFired = (timestampData[ (bufPos*4) + 0] >> 16) & 0xFFF - - if (options.printTimestamps == "True" ): - print "bufferPos, highWord , lowWord , event-number , timestamp , evtType = %x %016x %016x %08x %012x %01x %03x" % ( bufPos , highWord , lowWord, evtNumber , timeStamp , evtType , trigsFired) - - # Fill root branch - see example in http://wlav.web.cern.ch/wlav/pyroot/tpytree.html : write raw data and decoded data for now. - tree.Fill() - - time.sleep( loopWait) - -# Fixme - at the moment infinite loop. -preVetotriggerCount = board.read("PreVetoTriggersR") -postVetotriggerCount = board.read("PostVetoTriggersR") -print "EXIT POLLING LOOP" -print "\nTRIGGER COUNT AT THE END OF RUN [pre, post]:" , preVetotriggerCount , postVetotriggerCount - -termios.tcsetattr(sys.stdin, termios.TCSADRAIN, oldTermSettings) -f.Write() -f.Close() diff --git a/TLU_v1e/scripts/test.py b/TLU_v1e/scripts/test.py deleted file mode 100644 index ac68201..0000000 --- a/TLU_v1e/scripts/test.py +++ /dev/null @@ -1,34 +0,0 @@ -import matplotlib.pyplot as plt -import numpy as np -import matplotlib.mlab as mlab - -print "TEST.py" -myFile= "./500ns_23ns.txt" - -with open(myFile) as f: - nsDeltas = map(float, f) - -P= 1000000000 #display in ns -nsDeltas = [x * P for x in nsDeltas] -centerRange= 25 -windowsns= 5 -minRange= centerRange-windowsns -maxRange= centerRange+windowsns -plt.hist(nsDeltas, 60, range=[minRange, maxRange], facecolor='blue', align='mid', alpha= 0.75) -#plt.hist(nsDeltas, 100, normed=True, facecolor='blue', align='mid', alpha=0.75) -#plt.xlim((min(nsDeltas), max(nsDeltas))) -plt.xlabel('Time (ns)') -plt.ylabel('Entries') -plt.title('Histogram DeltaTime') -plt.grid(True) - -#Superimpose Gauss -mean = np.mean(nsDeltas) -variance = np.var(nsDeltas) -sigma = np.sqrt(variance) -x = np.linspace(min(nsDeltas), max(nsDeltas), 100) -plt.plot(x, mlab.normpdf(x, mean, sigma)) -print (mean, sigma) - -#Display plot -plt.show() diff --git a/TLU_v1e/scripts/testTLU_script.py b/TLU_v1e/scripts/testTLU_script.py deleted file mode 100644 index 9d8b334..0000000 --- a/TLU_v1e/scripts/testTLU_script.py +++ /dev/null @@ -1,79 +0,0 @@ -# miniTLU test script - -from FmcTluI2c import * -import uhal -import sys -import time -from I2CuHal import I2CCore -from miniTLU import MiniTLU -from datetime import datetime - -if __name__ == "__main__": - print "\tTEST TLU SCRIPT" - miniTLU= MiniTLU("minitlu", "file://./connection.xml") - #(self, target, wclk, i2cclk, name="i2c", delay=None) - TLU_I2C= I2CCore(miniTLU.hw, 10, 5, "i2c_master", None) - TLU_I2C.state() - - - #READ CONTENT OF EEPROM ON 24AA02E48 (0xFA - 0XFF) - mystop= 1 - time.sleep(0.1) - myaddr= [0xfa] - TLU_I2C.write( 0x50, myaddr, mystop) - res=TLU_I2C.read( 0x50, 6) - print "Checkin EEPROM:" - result="\t" - for iaddr in res: - result+="%02x "%(iaddr) - print result - - #SCAN I2C ADDRESSES - #WRITE PROM - #WRITE DAC - - - #Convert required threshold voltage to DAC code - #def convert_voltage_to_dac(self, desiredVoltage, Vref=1.300): - print("Writing DAC setting:") - Vref= 1.300 - desiredVoltage= 3.3 - channel= 0 - i2cSlaveAddrDac = 0x1F - vrefOn= 0 - Vdaq = ( desiredVoltage + Vref ) / 2 - dacCode = 0xFFFF * Vdaq / Vref - dacCode= 0x391d - print "\tVreq:", desiredVoltage - print "\tDAC code:" , dacCode - print "\tCH:", channel - print "\tIntRef:", vrefOn - - #Set DAC value - #def set_dac(self,channel,value , vrefOn = 0 , i2cSlaveAddrDac = 0x1F): - if channel<0 or channel>7: - print "set_dac ERROR: channel",channel,"not in range 0-7 (bit mask)" - ##return -1 - if dacCode<0 or dacCode>0xFFFF: - print "set_dac ERROR: value",dacCode ,"not in range 0-0xFFFF" - ##return -1 - # AD5665R chip with A0,A1 tied to ground - #i2cSlaveAddrDac = 0x1F # seven bit address, binary 00011111 - - # print "I2C address of DAC = " , hex(i2cSlaveAddrDac) - # dac = RawI2cAccess(self.i2cBusProps, i2cSlaveAddrDac) - # # if we want to enable internal voltage reference: - - if vrefOn: - # enter vref-on mode: - print "\tTurning internal reference ON" - #dac.write([0x38,0x00,0x01]) - TLU_I2C.write( i2cSlaveAddrDac, [0x38,0x00,0x01], 0) - else: - print "\tTurning internal reference OFF" - #dac.write([0x38,0x00,0x00]) - TLU_I2C.write( i2cSlaveAddrDac, [0x38,0x00,0x00], 0) - # Now set the actual value - sequence=[( 0x18 + ( channel &0x7 ) ) , int(dacCode/256)&0xff , int(dacCode)&0xff] - print "\tWriting byte sequence:", sequence - TLU_I2C.write( i2cSlaveAddrDac, sequence, 0) diff --git a/TLU_v1e/scripts/test_T0.py b/TLU_v1e/scripts/test_T0.py deleted file mode 100644 index cf81b33..0000000 --- a/TLU_v1e/scripts/test_T0.py +++ /dev/null @@ -1,92 +0,0 @@ -# -# Script to exercise AIDA mini-TLU -# -# David Cussans, December 2012 -# -# Nasty hack - use both PyChips and uHAL ( for block read ... ) - -from PyChipsUser import * -from FmcTluI2c import * - -import sys -import time - - -# Point to TLU in Pychips -bAddrTab = AddressTable("./aida_mini_tlu_addr_map.txt") -# Assume DIP-switch controlled address. Switches at 2 -board = ChipsBusUdp(bAddrTab,"192.168.200.32",50001) - -# Check the bus for I2C devices -boardi2c = FmcTluI2c(board) - -firmwareID=board.read("FirmwareId") - -print "Firmware (from PyChips) = " , hex(firmwareID) - -print "Scanning I2C bus:" -scanResults = boardi2c.i2c_scan() -print scanResults - -boardId = boardi2c.get_serial_number() -print "FMC-TLU serial number = " , boardId - -resetClocks = 0 - - - -clockStatus = board.read("LogicClocksCSR") -print "Clock status = " , hex(clockStatus) - -if resetClocks: - print "Resetting clocks" - board.write("LogicRst", 1 ) - - clockStatus = board.read("LogicClocksCSR") - print "Clock status after reset = " , hex(clockStatus) - - -board.write("InternalTriggerIntervalW",0) - -print "Enabling DUT 0 and 1" -board.write("DUTMaskW",3) -DUTMask = board.read("DUTMaskR") -print "DUTMaskR = " , DUTMask - -print "Ignore veto on DUT 0 and 1" -board.write("IgnoreDUTBusyW",3) -IgnoreDUTBusy = board.read("IgnoreDUTBusyR") -print "IgnoreDUTBusyR = " , IgnoreDUTBusy - -print "Turning off software trigger veto" -board.write("TriggerVetoW",0) - -print "Reseting FIFO" -board.write("EventFifoCSR",0x2) -eventFifoFillLevel = board.read("EventFifoFillLevel") -print "FIFO fill level after resetting FIFO = " , eventFifoFillLevel - -print "Enabling data recording" -board.write("Enable_Record_Data",1) - -#print "Enabling handshake: No-handshake" -#board.write("HandshakeTypeW",1) - -#TriggerInterval = 400000 -TriggerInterval = 0 -print "Setting internal trigger interval to " , TriggerInterval -board.write("InternalTriggerIntervalW",TriggerInterval) #0->Internal pulse generator disabled. Any other value will generate pulses with a frequency of n*6.25ns -trigInterval = board.read("InternalTriggerIntervalR") -print "Trigger interval read back as ", trigInterval - -print "Setting TPix_maskexternal to ignore external shutter and T0" -board.write("TPix_maskexternal",0x0003) - -numLoops = 500000 -oldEvtNumber = 0 - -for iLoop in range(0,numLoops): - - board.write("TPix_T0", 0x0001) - -# time.sleep( 1.0) diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..9f8e9b6 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +1.0 \ No newline at end of file diff --git a/aidatlu.egg-info/PKG-INFO b/aidatlu.egg-info/PKG-INFO deleted file mode 100644 index 5ab1187..0000000 --- a/aidatlu.egg-info/PKG-INFO +++ /dev/null @@ -1,16 +0,0 @@ -Metadata-Version: 2.1 -Name: aidatlu -Version: 0.1.0 -Summary: UNKNOWN -Home-page: UNKNOWN -Author: -Author-email: -Maintainer: -Maintainer-email: -License: UNKNOWN -Platform: any -Requires-Python: >=3.0 -License-File: LICENSE - -UNKNOWN - diff --git a/aidatlu.egg-info/SOURCES.txt b/aidatlu.egg-info/SOURCES.txt deleted file mode 100644 index d91eb47..0000000 --- a/aidatlu.egg-info/SOURCES.txt +++ /dev/null @@ -1,38 +0,0 @@ -LICENSE -README.md -setup.py -TLU_v1e/__init__.py -TLU_v1e/scripts/AIDA_testPower.py -TLU_v1e/scripts/AIDA_testScript.py -TLU_v1e/scripts/TLU_v1e.py -TLU_v1e/scripts/__init__.py -TLU_v1e/scripts/config_parser.py -TLU_v1e/scripts/initTLU.py -TLU_v1e/scripts/make_it_work.py -TLU_v1e/scripts/startTLU_v1e.py -TLU_v1e/scripts/startTLU_v6.py -TLU_v1e/scripts/test.py -TLU_v1e/scripts/testTLU_script.py -TLU_v1e/scripts/test_T0.py -aidatlu.egg-info/PKG-INFO -aidatlu.egg-info/SOURCES.txt -aidatlu.egg-info/dependency_links.txt -aidatlu.egg-info/top_level.txt -packages/AD5665R.py -packages/ADN2814ACPZ.py -packages/ATSHA204A.py -packages/E24AA025E48T.py -packages/FmcTluI2c.py -packages/I2CDISP.py -packages/I2CuHal.py -packages/I2CuHal2.py -packages/I2cBusProperties.py -packages/NHDC0220Biz.py -packages/PCA9539PW.py -packages/PCA9548ADW.py -packages/RawI2cAccess.py -packages/SFPI2C.py -packages/TLU_powermodule.py -packages/__init__.py -packages/si5345.py -packages/TLU_v1e/__init__.py \ No newline at end of file diff --git a/aidatlu.egg-info/dependency_links.txt b/aidatlu.egg-info/dependency_links.txt deleted file mode 100644 index 8b13789..0000000 --- a/aidatlu.egg-info/dependency_links.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/aidatlu.egg-info/top_level.txt b/aidatlu.egg-info/top_level.txt deleted file mode 100644 index c31d529..0000000 --- a/aidatlu.egg-info/top_level.txt +++ /dev/null @@ -1,2 +0,0 @@ -TLU_v1e -packages diff --git a/aidatlu/README.md b/aidatlu/README.md new file mode 100644 index 0000000..74a91db --- /dev/null +++ b/aidatlu/README.md @@ -0,0 +1,54 @@ +# Configuration +The AIDA-2020 TLU is configured using a yaml file (tlu_configuration.yaml). +In the following, the possible configuration parameters and settings are briefly explained. + +### Internal Trigger Generation (internal_trigger) +The setting internal trigger allows the TLU to generate a trigger internally with a given frequency. +To disable the generation of internal triggers set this frequency to zero. + +### DUT Module (dut_module) +The DUT module configures the individual DUT interfaces. +Where each interface can be set to one operating mode. +The possible modes are 'aida', 'aidatrig' and 'eudet'. +With 'aidatrig' the AIDA mode with additional trigger number. +And 'aida' or 'eudet' the AIDA or EUDET operating modes. +It is important to note that only working DUT devices should be enabled. +One not properly working DUT can block the TLU from sending out triggers (especially in EUDET mode). + +### Trigger Inputs (trigger_inputs) +Multiple settings of the trigger inputs are configurable. +This includes trigger input thresholds, trigger logic, trigger polarity and trigger signal shaping. + +The threshold for each trigger input can be tuned individually between [-1.3; 1.3] V. + +Another setting controls the trigger input logic. +Each trigger input can have one of three settings. The input can act as 'active', 'veto' or 'do not care'. +Between each trigger input, there is also the possibility to set 'AND' or 'OR'. +A desired trigger configuration is set with the use of the [Python bitwise operators](https://wiki.python.org/moin/BitwiseOperators). +These operators are used in conjunction with the input channels CH1-CH6 and interpreted as a literal logic expression. +For example "(CH1 & ~CH2) & (CH3 | CH4 | CH5 | CH6)" produces a valid trigger, when CH1 and not CH2 triggers and when one of CH3, CH4, CH5 or CH6 triggers. +An input channel that is not explicitly set to 'veto' or 'enabled' is automatically set to 'do not care'. + +Trigger polarity controls if the TLU should trigger on a rising (0) or falling (1) edge of an incoming trigger signal. + +Each trigger input signal can be delayed and stretched by a given number of clock cycles. +This is set with a list containing the number of clock cycles for every different trigger input. +This value is written in a 5-bit register so the maximum stretch or delay in clock cycles is 32. +One should stretch each used trigger input signal at least by 1 to prevent the generation of incomplete triggers. + +### Clock LEMO (clock_lemo) +The clock LEMO setting enables or disables the clock LEMO output. +Set this to 'True' or 'False'. + +### PMT Power (pmt_control) +Set the PMT control voltage. The possible range is between [0; 1] V. + +### Data Handling and Online Monitor +Two settings concern the data handling. The creation of raw and interpreted data files. +At last, the ZMQ connection can be configured. + +### Stop Conditions +Two optional stop conditions can be set in tlu_configuration.yaml. +The maximum number of trigger events (max_trigger_number, e.g. max_trigger_number: 1000000) +and a timeout in seconds (timeout, e.g. timeout: 100) can be set. +These configurations are not included by default in the tlu_configuration file, so add them manually if needed. \ No newline at end of file diff --git a/aidatlu/TLUPyProducer.py b/aidatlu/TLUPyProducer.py new file mode 100644 index 0000000..a0e702d --- /dev/null +++ b/aidatlu/TLUPyProducer.py @@ -0,0 +1,100 @@ +#! /usr/bin/env python3 +# load binary lib/pyeudaq.so +import pyeudaq +from pyeudaq import EUDAQ_INFO, EUDAQ_ERROR +import time +from main.tlu import AidaTLU +import uhal + +""" +Example Producer from EUDAQ +This is not well tested. But something like this should work. +Prob. one needs to work a bit on the run loop. + +""" + + +def exception_handler(method): + def inner(*args, **kwargs): + try: + return method(*args, **kwargs) + except Exception as e: + EUDAQ_ERROR(str(e)) + raise e + + return inner + + +class TLUPyProducer(pyeudaq.Producer): + def __init__(self, name, runctrl): + pyeudaq.Producer.__init__(self, name, runctrl) + + self.is_running = 0 + EUDAQ_INFO("New instance of TLUPyProducer") + + @exception_handler + def DoInitialise(self): + EUDAQ_INFO("DoInitialise") + uhal.setLogLevelTo(uhal.LogLevel.NOTICE) + manager = uhal.ConnectionManager("file://./misc/aida_tlu_connection.xml") + hw = uhal.HwInterface(manager.getDevice("aida_tlu.controlhub")) + + self.tlu = AidaTLU(hw) + # print 'key_a(init) = ', self.GetInitItem("key_a") + + @exception_handler + def DoConfigure(self): + EUDAQ_INFO("DoConfigure") + self.tlu.configure() + # print 'key_b(conf) = ', self.GetConfigItem("key_b") + + @exception_handler + def DoStartRun(self): + EUDAQ_INFO("DoStartRun") + self.tlu.run() + self.is_running = 1 + + @exception_handler + def DoStopRun(self): + EUDAQ_INFO("DoStopRun") + self.tlu.stop_run() + self.is_running = 0 + + @exception_handler + def DoReset(self): + EUDAQ_INFO("DoReset") + self.tlu.reset_configuration() + self.is_running = 0 + + @exception_handler + def RunLoop(self): + EUDAQ_INFO("Start of RunLoop in TLUPyProducer") + trigger_n = 0 + # TODO here the Run loop from the tlu is probably needed + while self.is_running: + ev = pyeudaq.Event("RawEvent", "sub_name") + ev.SetTriggerN(trigger_n) + # block = bytes(r'raw_data_string') + # ev.AddBlock(0, block) + # print ev + # Mengqing: + datastr = "raw_data_string" + block = bytes(datastr, "utf-8") + ev.AddBlock(0, block) + # print(ev) + + self.SendEvent(ev) + trigger_n += 1 + time.sleep(1) + EUDAQ_INFO("End of RunLoop in TLUPyProducer") + + +if __name__ == "__main__": + myproducer = TLUPyProducer("AIDA_TLU", "tcp://localhost:44000") + print( + "connecting to runcontrol in localhost:44000", + ) + myproducer.Connect() + time.sleep(2) + while myproducer.IsConnected(): + time.sleep(1) diff --git a/TLU_v1e/__init__.py b/aidatlu/__init__.py similarity index 100% rename from TLU_v1e/__init__.py rename to aidatlu/__init__.py diff --git a/aidatlu/aidatlu_run.py b/aidatlu/aidatlu_run.py new file mode 100644 index 0000000..97800f7 --- /dev/null +++ b/aidatlu/aidatlu_run.py @@ -0,0 +1,56 @@ +from main.tlu import AidaTLU +import uhal + + +class AIDATLU: + def __init__(self, config_path, clock_path): + print(" ---------------------------------------") + print(" _ ___ ___ _ _____ _ _ _ ") + print(" /_\ |_ _| \ /_\ |_ _| | | | | |") + print(" / _ \ | || |) / _ \ | | | |_| |_| |") + print(" /_/ \_\___|___/_/ \_\ |_| |____\___/ \n") + print(" ---------------------------------------") + print("tlu.help()\n") + + self.config_file = config_path + self.clock_file = clock_path + self.ready = False + + def run(self): + if not self.ready: + print("TLU not configured, Run aborted") + else: + self.aidatlu.run() + + def stop(self): + self.aidatlu.stop_run() + + def configure(self): + self.ready = True + self.init() + self.aidatlu.configure() + + def init(self): + self.aidatlu = AidaTLU(hw, self.config_file, self.clock_file) + + def help(self): + print("tlu.configure()") + print("start run: tlu.run()") + print("stop run: ctr+c") + print("exit: ctr+d/exit()\n") + print("for access to the main tlu functions: tlu.aidatlu....") + + +if __name__ == "__main__": + uhal.setLogLevelTo(uhal.LogLevel.NOTICE) + manager = uhal.ConnectionManager("file://./misc/aida_tlu_connection.xml") + hw = uhal.HwInterface(manager.getDevice("aida_tlu.controlhub")) + + config_path = "tlu_configuration.yaml" + clock_path = "misc/aida_tlu_clk_config.txt" + + tlu = AIDATLU(config_path, clock_path) + + # Uncomment if you just want to use EUDET mode and just plug and play TLU. + # tlu.configure + # tlu.run diff --git a/TLU_v1e/scripts/__init__.py b/aidatlu/hardware/__init__.py similarity index 100% rename from TLU_v1e/scripts/__init__.py rename to aidatlu/hardware/__init__.py diff --git a/aidatlu/hardware/clock_controller.py b/aidatlu/hardware/clock_controller.py new file mode 100644 index 0000000..a4efa52 --- /dev/null +++ b/aidatlu/hardware/clock_controller.py @@ -0,0 +1,129 @@ +from aidatlu.hardware.i2c import I2CCore +from aidatlu.hardware.ioexpander_controller import IOControl +from aidatlu import logger + + +class ClockControl(object): + """The control class for the Si5344 clock chip. + Main purpose is to read/write the clock configuration file to the chip. + """ + + def __init__(self, i2c: I2CCore, io_control: IOControl) -> None: + self.log = logger.setup_derived_logger("Clock Controller") + self.log.info("Initializing Clock Chip") + self.i2c = i2c + self.io_control = io_control + + def get_device_version(self) -> int: + """Get Chip information. + + Returns: + int: The Chip ID. + """ + my_adress = 0x02 + chip_id = 0x0 + self._set_page(0) + for i in range(2): + nibble = self.i2c.read(self.i2c.modules["clk"], my_adress + i) + chip_id = ((nibble & 0xFF) << (i * 8)) | chip_id + return chip_id + + def check_design_id(self, hex_str: bool = False) -> list: + """Checks the Chip ID. If the chip is correctly configured the list corresponds + to the data in the clock configuration file between the addresses 0x026B and 0x0272. + + Args: + hex_str (bool): Returns the design ID as a list of hex strings. Defaults to False. + + Returns: + list: List of the design ID contains 8 integers or hex strings. + """ + reg_address = 0x026B + n_words = 8 + words = [] + for _ in range(n_words): + words.append(self.read_clock_register(reg_address)) + reg_address += 1 + if hex_str: + words = [hex(words[i]) for i in range(n_words)] + return words + + def read_clock_register(self, address: int) -> int: + """Reads register of the clock chip. + + Args: + address (int): Address of the register. + + Returns: + int: Integer from the register address. + """ + address = address & 0xFFFF + current_page = self._get_page() + required_page = (address & 0xFF00) >> 8 + if current_page != required_page: + self._set_page(required_page) + return self.i2c.read(self.i2c.modules["clk"], address) + + def write_clock_register(self, address: int, data: int) -> None: + """Write data in specific Clock Chip register. + + Args: + address (int): Destination register. + data (int): Data to be written in address. + """ + address = address & 0xFFFF + current_page = self._get_page() + required_page = (address & 0xFF00) >> 8 + if current_page != required_page: + self._set_page(required_page) + + self.i2c.write(self.i2c.modules["clk"], address, data) + + def parse_clock_conf(self, file_path: str) -> list: + """reads the clock config file and returns a panda dataframe with two rows Adress and Data + The configuration file is produced by Clockbuilder Pro (Silicon Labs). + + Args: + file_path (str): File path to the configuration file. + + Returns: + list: 2-dim. list, consisting of the address and data values. + """ + with open(file_path, newline="") as clk_conf: + contents = clk_conf.read().splitlines() + contents = [row.split(",") for row in contents[10:]] + return contents + + def write_clock_conf(self, file_path: str) -> None: + """Writes clock configuration consecutivly in register. This takes a few seconds. + + Args: + file_path (str): File path to the clock configuration file. + """ + clock_conf = self.parse_clock_conf(file_path) + self.log.info("Writing clock configuration") + self.io_control.all_on("r") + for index, row in enumerate(clock_conf): + self.write_clock_register(int(row[0], 16), int(row[1], 16)) + # This is just fancy, show progress of clock configuration with LEDs. + if index % 10 == 0 and int((index / len(clock_conf) * 10 + 1)) != 5: + self.io_control.switch_led(int((index / len(clock_conf) * 10 + 1)), "b") + + self.log.success("Done writing clock configuration ") + self.io_control.all_off() + + def _set_page(self, page: int) -> None: + """Configures chip to perform operations on specific address page. + + Args: + page (int): Address page. + """ + self.i2c.write(self.i2c.modules["clk"], 0x01, page) + + def _get_page(self) -> int: + """Get the current address page. + + Returns: + int: Current address page + """ + return self.i2c.read(self.i2c.modules["clk"], 0x01) diff --git a/aidatlu/hardware/dac_controller.py b/aidatlu/hardware/dac_controller.py new file mode 100644 index 0000000..ec4f6aa --- /dev/null +++ b/aidatlu/hardware/dac_controller.py @@ -0,0 +1,172 @@ +from aidatlu.hardware.i2c import I2CCore +from aidatlu import logger + + +class DacControl(object): + """Control class for the three AD5665R. One controls the PMT control power (pwr_dac). + Two set the trigger input thresholds (dac_1, dac_2). + Each AD5665R has four parallel outputs. + """ + + def __init__(self, i2c: I2CCore, int_ref: bool = False) -> None: + self.log = logger.setup_derived_logger(__class__.__name__) + + self.log.info("Initializing DAC Control") + self.i2c = i2c + + self._set_dac_reference(int_ref, 0) + self._set_dac_reference(int_ref, 1) + self._set_dac_reference(int_ref, 2) + + def set_threshold( + self, trigger_channel: int, threshold_voltage: float, ref_v: float = 1.3 + ) -> None: + """Sets the Threshold voltage for the trigger input channel. Use channel = 7 to set threshold for all channels. + + Args: + trigger_channel (int): Trigger input channel. From 1 to 7, where 7 controlls all input channels. + threshold_voltage (float): Threshold voltage in volt. + ref_v (float): Reference voltage of the DAC. Defaults to the external reference voltage 1.3 V. + """ + + if threshold_voltage > ref_v: + self.log.warning( + "Threshold larger than %s V is not supported, Threshold will default to %s V " + % (ref_v, ref_v) + ) + threshold_voltage = ref_v + if threshold_voltage < -ref_v: + self.log.warning( + "Threshold smaller than %s V is not supported, Threshold will default to %s V " + % (-ref_v, -ref_v) + ) + threshold_voltage = -ref_v + if trigger_channel < 1 or trigger_channel > 7: + raise ValueError( + "Invalid trigger input channel. Channel has to be between 1 and 6. Or use channel = 7 for all channels." + ) + + channel = trigger_channel - 1 # shift channel number by 1 + # calculates the DAC value for the threshold DAC + v_dac = (threshold_voltage + ref_v) / 2 + dac_value = int(0xFFFF * v_dac / ref_v) + + # Sets threshold for the different channels. The different handling of the channels comes from the weird connections of the ADC. + if channel == 6: + self._set_dac_value(channel + 1, dac_value, 1) + self._set_dac_value(channel + 1, dac_value, 2) + # The DAC channels are connected in reverse order. The first two channels sit on DAC 1 in reverse order. + if channel < 2: + self._set_dac_value(1 - channel, dac_value, 1) + # The last 4 channels sit on DAC 2 in reverse order. + if channel > 1 and channel < 6: + self._set_dac_value(3 - (channel - 2), dac_value, 2) + self.log.info( + "Threshold of input %s set to %s V" % (trigger_channel, threshold_voltage) + ) + + def set_voltage(self, pmt_channel: int, voltage: float) -> None: + """Sets given PMT DAC to given output voltage. + + Args: + pmt_channel (int): DAC channel for the PMT from 1 to 5, where channel 5 sets the voltage of all PMT channels. + voltage (float): DAC output voltage + """ + + if pmt_channel < 1 or pmt_channel > 5: + raise ValueError("PMT Channel has to be between 1 and 5") + + if voltage < 0: + self.log.warning( + "A Voltage value smaller than 0 is not supported, Voltage will default to 0" + ) + voltage = 0 + + if voltage > 1: + self.log.warning( + "A Voltage value higher than 1 is not supported, Voltage will default to 1" + ) + voltage = 1 + + # Channel - PMT map [channel 2 -> PMT 4, channel 0 -> PMT 3, channel 1 -> PMT 2, channel 3 -> PMT 1] + if pmt_channel == 1: + channel_map = 3 + if pmt_channel == 2: + channel_map = 1 + if pmt_channel == 3: + channel_map = 0 + if pmt_channel == 4: + channel_map = 2 + + if pmt_channel == 5: + self._set_all_voltage(voltage) + else: + # 0xFFFF is max DAC value + self._set_dac_value(channel_map, int(voltage * 0xFFFF)) + self.log.info("PMT channel %s set to %s V" % (pmt_channel, voltage)) + + def _set_all_voltage(self, voltages: float) -> None: + """Sets the same Voltage for all PMT DACs. + + Args: + voltages (float): DAC voltages in volts. + """ + for channel in range(4): + self.set_voltage(channel + 1, voltages) + + def _set_dac_reference(self, internal: bool = False, dac: int = 0) -> None: + """Choose internal or external DAC reference + + Args: + internal (bool, optional): Defaults to False. + dac (int): 0 is the power dac, 1 and 2 are DAC 1 and DAC 2 for the thresholds. Defaults to 0. + """ + # There is a factor 2 in the output voltage between internal and external DAC reference. In general internal reference is a factor of 2 larger! + if internal: + chr = [0x00, 0x01] + else: + chr = [0x00, 0x00] + + if dac == 0: + self.i2c.write_array(self.i2c.modules["pwr_dac"], 0x38, chr) + if dac == 1: + self.i2c.write_array(self.i2c.modules["dac_1"], 0x38, chr) + if dac == 2: + self.i2c.write_array(self.i2c.modules["dac_2"], 0x38, chr) + self.log.info( + "Set %s DAC reference of DAC %s" + % (("internal" if internal else "external"), dac) + ) + + def _set_dac_value(self, channel: int, value: int, dac: int = 0) -> None: + """Set the output value of the power DAC + + Args: + channel (int): DAC channel + value (int): DAC output value + dac (int): 0 is the power dac, 1 and 2 are DAC 1 and DAC 2 for the thresholds. Defaults to 0. + """ + if channel < 0 or channel > 7: + raise ValueError("Channel has to be between 0 and 7") + + if value < 0x0000: + self.log.warning( + "DAC value < 0x0000 not supported, value will default to 0x0000" + ) + value = 0 + + if value > 0xFFFF: + self.log.warning( + "DAC value > 0xFFFF not supported, value will default to 0xFFFF" + ) + value = 0xFFFF + + chr = [(value >> 8) & 0xFF, value & 0xFF] + mem_addr = 0x18 + (channel & 0x7) + + if dac == 0: + self.i2c.write_array(self.i2c.modules["pwr_dac"], mem_addr, chr) + if dac == 1: + self.i2c.write_array(self.i2c.modules["dac_1"], mem_addr, chr) + if dac == 2: + self.i2c.write_array(self.i2c.modules["dac_2"], mem_addr, chr) diff --git a/aidatlu/hardware/dut_controller.py b/aidatlu/hardware/dut_controller.py new file mode 100644 index 0000000..5105509 --- /dev/null +++ b/aidatlu/hardware/dut_controller.py @@ -0,0 +1,113 @@ +from aidatlu import logger +from aidatlu.hardware.i2c import I2CCore + + +class DUTLogic(object): + def __init__(self, i2c: I2CCore): + self.log = logger.setup_derived_logger(__class__.__name__) + self.i2c = i2c + + def set_dut_mask(self, enable: int | str) -> None: + """Enables HDMI Outputs the enable is here an 4-bit WORD as integer or binary string to enable each HDMI channel. + With HDMI channel 1 = bit 0, channel 2 = bit 2, channel 3 = bit 3 and channel 4 = bit 4. + E.q. 0b0001 or '0001' enables HDMI channel 1, '0011' enables channel 1 and 2 and so on. + + Args: + value (int | str): 4-bit WORD to enable the the HDMI outputs. Can be an integer or binary string. + """ + if type(enable) == str: + enable = int(enable, 2) + + if enable > 0b1111 or enable < 0b0000: + raise ValueError("Enable has to be between 0 and 15 ('1111')") + + self.i2c.write_register("DUTInterfaces.DUTMaskW", enable & 0xF) + self.log.debug("DUT mask set to %s" % self.get_dut_mask()) + + def set_dut_mask_mode(self, mode: int | str) -> None: + """Sets the DUT interface mode. Mode consits of one 8-bit WORD or more specific 4 2-bit WORDs. + Each 2-bit WORD corresponds to one HDMI output and its mode. + With HDMI channel 1 = bit 0 and 1, channel 2 = bit 2 and 3, channel 3 = bit 4 and 5 and channel 4 = bit 6 and 7. + The mode is set with X0 = EUDET and X1 = AIDA. #TODO They mention the leading bit X can be used for future modes. Is this still up to date? + E.q. 0b00000011 sets HDMI channel 1 to AIDA mode and channels 2,3 and 4 to EUDET. + + Args: + mode (int | str): 8-bit WORD to set the mode for each DUT. Can be an integer or binary string. + """ + + if type(mode) == str: + mode = int(mode, 2) + + if mode > 0b11111111 or mode < 0b00000000: + raise ValueError("Mode has to be between 0 and 256 ('100000000').") + + self.i2c.write_register("DUTInterfaces.DUTInterfaceModeW", mode) + self.log.debug("DUT mask mode is set to %s" % self.get_dut_mask_mode()) + + def set_dut_mask_mode_modifier(self, value: int) -> None: + """#TODO Only affects the EUDET mode of operation, looks like some special EUDET configuration. + + Args: + value (int): _description_ #TODO + """ + self.i2c.write_register("DUTInterfaces.DUTInterfaceModeModifierW", value) + self.log.debug( + "DUT mask mode modifier is set to %s" % self.get_dut_mask_mode_modifier() + ) + + def set_dut_ignore_busy(self, channels: int | str) -> None: + """If set the TLU ignores the BUSY signal from a DUT in AIDA mode. + Channels consits of a 4-bit WORD describing the DUT interfaces. + With DUT interface 1 = bit 0, interface 2 = bit 1, interface 3 = bit 2 and interface 4 = bit 3. + #TODO not sure if this is true here. No answers in documentation. + + Args: + channels (int | str): _description_#TODO + """ + if type(channels) == str: + channels = int(channels, 2) + + if channels > 0b1111 or channels < 0b0000: + raise ValueError("Channels has to be between 0 and 16 ('10000').") + + self.i2c.write_register("DUTInterfaces.IgnoreDUTBusyW", channels) + self.log.debug("DUT ignore busy is set to %s" % self.get_dut_ignore_busy()) + + def get_dut_mask(self) -> int: + """Reads the contend in the register 'DUTMaskR'. + + Returns: + int: Integer content of the register. + """ + return self.i2c.read_register("DUTInterfaces.DUTMaskR") + + def get_dut_mask_mode(self) -> int: + """Reads the contend in the register 'DUTInterfaceModeR'. + + Returns: + int: Integer content of the register. + """ + return self.i2c.read_register("DUTInterfaces.DUTInterfaceModeR") + + def get_dut_mask_mode_modifier(self) -> int: + """Reads the content in the register 'DUTInterfaceModeModifierR'. + + Returns: + int: Integer content of the register. + """ + return self.i2c.read_register("DUTInterfaces.DUTInterfaceModeModifierR") + + def get_dut_ignore_busy(self) -> int: + """Reads the content in the register 'IgnoreDUTBusyR'. + + Returns: + int: Integer content of the register. + """ + return self.i2c.read_register("DUTInterfaces.IgnoreDUTBusyR") + + def set_dut_ignore_shutter(self, value: int) -> None: + self.i2c.write_register("DUTInterfaces.IgnoreShutterVetoW", value) + self.log.debug("DUT ignore shutter set to %s" % self.get_dut_ignore_shutter()) + + def get_dut_ignore_shutter(self): + return self.i2c.read_register("DUTInterfaces.IgnoreShutterVetoR") diff --git a/aidatlu/i2c.py b/aidatlu/hardware/i2c.py similarity index 73% rename from aidatlu/i2c.py rename to aidatlu/hardware/i2c.py index 19008e7..29c3a0e 100644 --- a/aidatlu/i2c.py +++ b/aidatlu/hardware/i2c.py @@ -1,7 +1,6 @@ import time from math import ceil - -import logger +from aidatlu import logger i2c_addr = { "core": 0x21, @@ -31,8 +30,8 @@ def init(self): self.set_i2c_control(0x80) self.write(i2c_addr["core"], 0x01, 0x7F) - if self.read(i2c_addr["core"], 0x01) & 0x80 != 0: - self.log.warn( + if self.read(i2c_addr["core"], 0x01) & 0x80 != 0x80: + self.log.warning( "Enabling Enclustra I2C bus might have failed. This could prevent from talking to the I2C slaves on the TLU." ) @@ -63,8 +62,8 @@ def init(self): def write_register(self, register: str, value: int) -> None: """ - register: str Name of node in address file - value: int Value to be written + register: str Name of node in address file + value: int Value to be written """ if type(value) != int: raise TypeError("Value must be integer") @@ -76,7 +75,7 @@ def write_register(self, register: str, value: int) -> None: def read_register(self, register: str) -> int: """ - register: str Name of node in address file + register: str Name of node in address file """ try: ret = self.i2c_hw.getNode(register).read() @@ -102,8 +101,8 @@ def set_i2c_command(self, value: int): def set_i2c_tx(self, value: int): self.write_register("i2c_master.i2c_rxtx", value & 0xFF) - def is_done(self): - return (self.get_i2c_status() >> 1) & 0x1 + def is_done(self) -> bool: + return bool((self.get_i2c_status() >> 1) & 0x1) def set_i2c_clock_prescale(self, value: int): self.write_register("i2c_master.i2c_pre_lo", value & 0xFF) @@ -126,6 +125,9 @@ def write(self, device_addr: int, mem_addr: int, value: int) -> None: self.set_i2c_command(0x10) self.set_i2c_tx(value & 0xFF) self.set_i2c_command(0x50) + self._compare_value_read_write( + value, self.read(device_addr, mem_addr), device_addr + ) def read(self, device_addr: int, mem_addr: int) -> int: self.set_i2c_tx((device_addr << 1) | 0x0) @@ -140,3 +142,33 @@ def read(self, device_addr: int, mem_addr: int) -> int: return self.read_register("i2c_master.i2c_rxtx") + def write_array(self, device_addr: int, mem_addr: int, values: list) -> None: + self.set_i2c_tx((device_addr << 1) | 0x0) + self.set_i2c_command(0x90) + + self.set_i2c_tx(mem_addr) + self.set_i2c_command(0x10) + + for i in range(len(values) - 1): + if i > 0xFF: + n_bytes_to_write = ceil(len(hex(i)[2:] / 2)) + for byte in range( + 8 * (n_bytes_to_write - 1), 0, -8 + ): # funky magic to write byte by byte + to_write = (i & (0xFF << byte)) >> byte + self.set_i2c_tx(to_write) + self.set_i2c_command(0x10) + self.set_i2c_tx(values[i] & 0xFF) + self.set_i2c_command(0x10) + + self.set_i2c_tx(values[-1] & 0xFF) + self.set_i2c_command(0x50) + + def _compare_value_read_write(self, written: int, read: int, function: str) -> None: + if written != read: + self.log.warning( + "Mismatch in register function %s. written value %s, recieved value: %s." + % (function, written, read) + ) + else: + pass diff --git a/aidatlu/hardware/ioexpander_controller.py b/aidatlu/hardware/ioexpander_controller.py new file mode 100644 index 0000000..4a8e042 --- /dev/null +++ b/aidatlu/hardware/ioexpander_controller.py @@ -0,0 +1,463 @@ +from aidatlu import logger +from aidatlu.hardware.i2c import I2CCore +from aidatlu.hardware.utils import _set_bit +import time + + +class IOControl(object): + """Main class for the control of the IO expander PCA9539PW. + Four I/O expanders are in use, two for the 11 front panel LEDs. and two + for the HDMI DUT interfaces. + """ + + def __init__(self, i2c: I2CCore) -> None: + self.log = logger.setup_derived_logger(__class__.__name__) + + self.log.info("Initializing IO expander") + self.i2c = i2c + + self.init_led_expander() + self.init_output_expander() + + def init_led_expander(self) -> None: + """Initialize LED expanders""" + self._set_ioexpander_polarity(1, exp_id=1, cmd_byte=4, polarity=False) + self._set_ioexpander_direction(1, exp_id=1, cmd_byte=6, direction="output") + self._set_ioexpander_output(1, exp_id=1, cmd_byte=2, value=0xFF) + + self._set_ioexpander_polarity(1, exp_id=1, cmd_byte=5, polarity=False) + self._set_ioexpander_direction(1, exp_id=1, cmd_byte=7, direction="output") + self._set_ioexpander_output(1, exp_id=1, cmd_byte=3, value=0xFF) + + self._set_ioexpander_polarity(1, exp_id=2, cmd_byte=4, polarity=False) + self._set_ioexpander_direction(1, exp_id=2, cmd_byte=6, direction="output") + self._set_ioexpander_output(1, exp_id=2, cmd_byte=2, value=0xFF) + + self._set_ioexpander_polarity(1, exp_id=2, cmd_byte=5, polarity=False) + self._set_ioexpander_direction(1, exp_id=2, cmd_byte=7, direction="output") + self._set_ioexpander_output(1, exp_id=2, cmd_byte=3, value=0xFF) + + def init_output_expander(self) -> None: + """Initialize output expanders""" + self._set_ioexpander_polarity(2, exp_id=1, cmd_byte=4, polarity=False) + self._set_ioexpander_direction(2, exp_id=1, cmd_byte=6, direction="output") + self._set_ioexpander_output(2, exp_id=1, cmd_byte=2, value=0xFF) + + self._set_ioexpander_polarity(2, exp_id=1, cmd_byte=5, polarity=False) + self._set_ioexpander_direction(2, exp_id=1, cmd_byte=7, direction="output") + self._set_ioexpander_output(2, exp_id=1, cmd_byte=3, value=0xFF) + + self._set_ioexpander_polarity(2, exp_id=2, cmd_byte=4, polarity=False) + self._set_ioexpander_direction(2, exp_id=2, cmd_byte=6, direction="output") + self._set_ioexpander_output(2, exp_id=2, cmd_byte=2, value=0x00) + + self._set_ioexpander_polarity(2, exp_id=2, cmd_byte=5, polarity=False) + self._set_ioexpander_direction(2, exp_id=2, cmd_byte=7, direction="output") + self._set_ioexpander_output(2, exp_id=2, cmd_byte=3, value=0xB0) + + """ LED Control """ + + def test_leds(self, single=True) -> None: + """Test the 11 LEDs + + Args: + single (bool, optional): Test all possible RGB combinations for all LEDs. Defaults to True. + """ + self.log.info("Testing LEDs colors") + if single: + for color in [ + [0, 1, 1], + [1, 0, 1], + [1, 1, 0], + [1, 0, 0], + [0, 1, 0], + [0, 0, 1], + [0, 0, 0], + ]: + for i in range(11): + if i + 1 == 5: + pass + else: + self._set_led(i + 1, color) + time.sleep(0.1) + self.all_off() + time.sleep(0.05) + for color in [[0, 0, 1], [0, 1, 1], [1, 0, 1]]: + self._set_led(5, color) + time.sleep(0.15) + self.all_off() + time.sleep(0.1) + + else: + for color in ["w", "r", "g", "b"]: + self.log.info("Testing LEDs color: %s" % color) + + self.all_on(color) + time.sleep(1) + self.all_off() + time.sleep(1) + + def all_on(self, color: str = "w") -> None: + """Set all LEDs to same color + + Args: + color (str, optional): Color code [white: "w", red: "r", green: "g", blue: "b"] Defaults to "w". + """ + if color not in ["w", "r", "g", "b"]: + raise ValueError("%s color not supported" % color) + + if color == "w": + self._set_ioexpander_output(io_exp=1, exp_id=1, cmd_byte=2, value=0x0) + self._set_ioexpander_output(io_exp=1, exp_id=1, cmd_byte=3, value=0x0) + self._set_ioexpander_output(io_exp=1, exp_id=2, cmd_byte=2, value=0x0) + self._set_ioexpander_output(io_exp=1, exp_id=2, cmd_byte=3, value=0x0) + + if color == "r": + self._set_ioexpander_output(io_exp=1, exp_id=1, cmd_byte=2, value=0xB5) + self._set_ioexpander_output(io_exp=1, exp_id=1, cmd_byte=3, value=0x6D) + self._set_ioexpander_output(io_exp=1, exp_id=2, cmd_byte=2, value=0xDB) + self._set_ioexpander_output(io_exp=1, exp_id=2, cmd_byte=3, value=0xB6) + + if color == "g": + self._set_ioexpander_output(io_exp=1, exp_id=1, cmd_byte=2, value=0xDA) + self._set_ioexpander_output(io_exp=1, exp_id=1, cmd_byte=3, value=0xB6) + self._set_ioexpander_output(io_exp=1, exp_id=2, cmd_byte=2, value=0x6D) + self._set_ioexpander_output(io_exp=1, exp_id=2, cmd_byte=3, value=0xDB) + + if color == "b": + self._set_ioexpander_output(io_exp=1, exp_id=1, cmd_byte=2, value=0x6F) + self._set_ioexpander_output(io_exp=1, exp_id=1, cmd_byte=3, value=0xDB) + self._set_ioexpander_output(io_exp=1, exp_id=2, cmd_byte=2, value=0xB6) + self._set_ioexpander_output(io_exp=1, exp_id=2, cmd_byte=3, value=0x6D) + + def all_off(self) -> None: + """Turn off all LEDs""" + self._set_ioexpander_output(io_exp=1, exp_id=1, cmd_byte=2, value=0xFF) + self._set_ioexpander_output(io_exp=1, exp_id=1, cmd_byte=3, value=0xFF) + self._set_ioexpander_output(io_exp=1, exp_id=2, cmd_byte=2, value=0xFF) + self._set_ioexpander_output(io_exp=1, exp_id=2, cmd_byte=3, value=0xFF) + + def switch_led(self, led_id: int, color: str = "off") -> None: + """changes LED with led_id to specific color + + Args: + led_id (int): ID for the 11 LEDs, led_id has to be between 1 and 11 + color (str, optional): Color code [white: "w", red: "r", green: "g", blue: "b", off: "off"] + for Clock LED only [red: "r", green: "g", off: "off"]. + Defaults to "off". + """ + + if led_id == 5 and color not in ["r", "g", "off"]: + raise ValueError("%s color not supported for Clock LED" % color) + + elif color not in ["w", "r", "g", "b", "off"]: + raise ValueError("%s color not supported for LED" % color) + + # Clock LED has only two LEDs + if led_id == 5: + if color == "r": + rgb = [0, 1, 1] + if color == "g": + rgb = [1, 0, 1] + if color == "off": + rgb = [1, 1, 1] + + else: + if color == "w": + rgb = [0, 0, 0] + if color == "r": + rgb = [0, 1, 1] + if color == "g": + rgb = [1, 0, 1] + if color == "b": + rgb = [1, 0, 0] + if color == "off": + rgb = [1, 1, 1] + + self._set_led(led_id, rgb) + + def _set_led(self, led_id: int, rgb: list) -> None: + """sets led to a rgb value + + Args: + led_id (int): Led id for the 11 LED, led_ id has to be between 1 and 11 + rgb (list): rgb value for the LED e.q. [0,0,0] + + """ + if led_id < 1 or led_id > 11: + raise ValueError("LED ID has to be between 1 and 11") + + # indicator map for LED positions notice the -1 for the clock led #TODO should this be global?? + indicator = [ + [30, 29, 31], + [27, 26, 28], + [24, 23, 25], + [21, 20, 22], + [18, 17, -1], + [15, 14, 16], + [12, 11, 13], + [9, 8, 10], + [6, 5, 7], + [3, 2, 4], + [1, 0, 19], + ] + + status_now = [] # status of all ioexpander now + status_next = [] # status of all ioexpander next + status_now.append(0xFF & self._get_ioexpander_output(1, 1, 2)) + status_now.append(0xFF & self._get_ioexpander_output(1, 1, 3)) + status_now.append(0xFF & self._get_ioexpander_output(1, 2, 2)) + status_now.append(0xFF & self._get_ioexpander_output(1, 2, 3)) + + word = 0x00000000 + word = word | status_now[0] + word = word | (status_now[1] << 8) + word = word | (status_now[2] << 16) + word = word | (status_now[3] << 24) + + for index in range(3): + if ( + led_id == 5 + ): # for clock led not all colors are allowed on clock [1,0,1] is green [0,1,1] is red the og eudaq indicator map produces here an error + # TODO some colors also switch on LED 11 + word = _set_bit(word, [18, 17, 19][index], rgb[index]) + else: + word = _set_bit(word, indicator[led_id - 1][index], rgb[index]) + + status_next.append(0xFF & word) + status_next.append(0xFF & (word >> 8)) + status_next.append(0xFF & (word >> 16)) + status_next.append(0xFF & (word >> 24)) + + if status_now[0] != status_next[0]: + self._set_ioexpander_output(1, 1, 2, status_next[0]) + + if status_now[1] != status_next[1]: + self._set_ioexpander_output(1, 1, 3, status_next[1]) + + if status_now[2] != status_next[2]: + self._set_ioexpander_output(1, 2, 2, status_next[2]) + + if status_now[3] != status_next[3]: + self._set_ioexpander_output(1, 2, 3, status_next[3]) + + """ Output Control """ + + def configure_hdmi(self, hdmi_channel: int, enable: int | str) -> None: + """This enables the pins of one HDMI channel as input (0) or output (1). + Enable is a 4-bit WORD for each pin as integer or binary string. With CONT = bit 0, SPARE = bit 1, TRIG = bit 2 and BUSY = bit 3. + E.q. 0b0111 or '0111' sets CONT, SPARE and TRIGGER as outputs and BUSY as input. '1100' sets CONT and SPARE as input and BUSY and TRIG as output. + The clock runs with the seperate function: clock_hdmi_output. + + Args: + hdmi_num (int): HDMI channels from 1 to 4 + enable (int | str, optional): 4-bit WORD to enable the 4 pins on the HDMI output. Can be an integer or binary string. + + """ + # TODO use DUT Interface or HDMI channel? + if hdmi_channel < 1 or hdmi_channel > 4: + raise ValueError("HDMI channel should be between 1 and 4") + + if type(enable) == str: + enable = int(enable, 2) + + if enable > 0b1111 or enable < 0b0000: + raise ValueError("Enable has to be between 0 and 16 ('10000').") + + expander_id = 1 + + # TODO what is the difference between nibble and bank and address? + hdmi_channel = hdmi_channel - 1 # shift channel + bank = ( + int(hdmi_channel / 2) + 2 + ) # DUT0 and DUT1 are on bank0. DUT2 and DUT 3 are on bank 1. Shift of +2 due to the command bytes. + nibble = ( + hdmi_channel % 2 + ) # DUT0 and DUT2 are on nibble 0. DUT1 and DUT3 are on nibble 1. + + # TODO what is happening here + old_status = self._get_ioexpander_output(2, expander_id, bank) + new_nibble = (enable & 0xF) << 4 * nibble + mask = 0xF << 4 * nibble + new_status = (old_status & (~mask)) | (new_nibble & mask) + + self._set_ioexpander_output(2, expander_id, bank, new_status) + self.log.debug("HDMI Channel %i set to %s" % (hdmi_channel + 1, str(enable))) + + def clock_hdmi_output(self, hdmi_channel: int, clock_source: str) -> None: + """Enables the Clock output for one HDMI channel. + Valid Clock sources are Si5453 clock chip 'chip' and FPGA 'fpga'. + #TODO does FPGA work? + + Args: + hdmi_channel (int): HDMI channels from 1 to 4 + clock_source (str): Clock source valid options are 'off', 'chip' and 'fpga'. + """ + if clock_source not in ["off", "chip", "fpga"]: + raise ValueError("Clock source has to be 'off', 'chip' or 'fpga'") + if hdmi_channel < 1 or hdmi_channel > 4: + raise ValueError("HDMI channel should be between 1 and 4") + + cmd_byte = 2 + expander_id = 2 + + hdmi_channel = hdmi_channel - 1 # shift channel + mask_low = 1 << (hdmi_channel) + mask_high = 1 << (hdmi_channel + 4) + mask = mask_low | mask_high + old_status = self._get_ioexpander_output(2, expander_id, cmd_byte) + + if clock_source == "off": + new_status = old_status & ~mask + elif clock_source == "chip": + new_status = (old_status | mask_high) & ~mask_low + elif clock_source == "fpga": # TODO nothing measurable here for now + new_status = (old_status | mask_low) & ~mask_high + else: + new_status = old_status + self._set_ioexpander_output(2, expander_id, cmd_byte, new_status) + self.log.info( + "Clock source of HDMI Channel %i set to %s." + % (hdmi_channel + 1, clock_source) + ) + + def clock_lemo_output(self, enable: bool = True) -> None: + """Enables the clock LEMO output. #TODO only with ~40MHz default clock + + Args: + enable (bool, optional): Enable clock LEMO output. Defaults to True. + """ + + cmd_byte = 3 # this is bank+2 in EUDAQ + mask = 0x10 + expander_id = 2 + + old_status = self._get_ioexpander_output(2, expander_id, cmd_byte) & 0xFF + new_status = old_status & (~mask) & 0xFF + if enable: + new_status = new_status | mask & 0xFF + + self._set_ioexpander_output(2, expander_id, cmd_byte, new_status) + if enable: + self.switch_led(5, "g") + else: + self.switch_led(5, "off") + self.log.info("Clock LEMO output %s" % ("enabled" if enable else "disabled")) + + """ General Expander Control """ + + def _set_ioexpander_polarity( + self, io_exp: int, exp_id: int, cmd_byte: int, polarity: bool = False + ) -> None: + """Set content of register 4 or 5 which determine polarity of ports. + A command byte of 4 or 5 determines the polarity of ports on the two different banks of the chip. + io_exp and exp_id control the 2 expander for the LEDs and 2 for the output control. + + Args: + io_exp (int): Expander (1 or 2). The LED expander on 1 the output expander on 2. + exp_id (int): ID of the Expander (1 or 2)) + cmd_byte (int): The Command byte is used as a pointer to a specific register see datasheet PC9539. + polarity (bool, optional): False (0) = normal, True (1) = inverted. Defaults to False. + """ + if io_exp not in [1, 2]: + raise ValueError("Expander should be 1 or 2") + if cmd_byte not in [4, 5]: + raise ValueError("Command byte should be 4 or 5") + if exp_id not in [1, 2]: + raise ValueError("Expander ID should be 1 or 2") + + if io_exp == 1: + exp = "led_expander" + else: + exp = "expander" + + self.i2c.write(self.i2c.modules["%s_%.1s" % (exp, exp_id)], cmd_byte, polarity) + + def _set_ioexpander_direction( + self, io_exp: int, exp_id: int, cmd_byte: int, direction: str = "input" + ) -> None: + """Set content of register 6 or 7 which determine direction of signal. + A command byte of 6 or 7 determines the direction of signal on the two different banks of the chip. + io_exp and exp_id control the 2 expander for the LEDs and 2 for the output control. + + Args: + io_exp (int): Expander (1 or 2). The LED expander on 1 the output expander on 2. + exp (int): ID of Expander (1 or 2)) + cmd_byte (int): The Command byte is used as a pointer to a specific register see datasheet PC9539. + direction (str, optional): "input or "output" direction of port. Defaults to "input". + """ + if io_exp not in [1, 2]: + raise ValueError("Expander should be 1 or 2") + if cmd_byte not in [6, 7]: + raise ValueError("Command byte should be 6 or 7") + if direction not in ["input", "output"]: + raise ValueError('Direction parameter must be "input" or "output"') + if exp_id not in [1, 2]: + raise ValueError("Expander ID should be 1 or 2") + + if io_exp == 1: + exp = "led_expander" + else: + exp = "expander" + + self.i2c.write( + self.i2c.modules["%s_%.1s" % (exp, exp_id)], + cmd_byte, + 1 if direction == "input" else 0, + ) + + def _set_ioexpander_output( + self, io_exp: int, exp_id: int, cmd_byte: int, value: int + ) -> None: + """Set content of register 2 or 3 which determine signal if direction is output + A command byte of 2 or 3 reflects the outgoing logic levels of the output pins on the two different banks of the chip. + io_exp and exp_id control the 2 expander for the LEDs and 2 for the output control. + + Args: + io_exp (int): Expander (1 or 2). The LED expander on 1 the output expander on 2. + exp (int): ID of Expander (1 or 2)) + cmd_byte (int): The Command byte is used as a pointer to a specific register see datasheet PC9539. + value (int): 8 bit value for the output + """ + if io_exp not in [1, 2]: + raise ValueError("Expander should be 1 or 2") + if cmd_byte not in [2, 3]: + raise ValueError("Command byte should be 2 or 3") + if exp_id not in [1, 2]: + raise ValueError("Expander ID should be 1 or 2") + + if io_exp == 1: + exp = "led_expander" + else: + exp = "expander" + + self.i2c.write( + self.i2c.modules["%s_%.1s" % (exp, exp_id)], cmd_byte, value & 0xFF + ) + + def _get_ioexpander_output(self, io_exp: int, exp_id: int, cmd_byte: int) -> int: + """Get content of register 2 or 3 + A command byte of 2 or 3 reflects the outgoing logic levels of the output pins on the two different banks of the chip. + io_exp and exp_id control the 2 expander for the LEDs and 2 for the output control. + + Args: + io_exp (int): Expander (1 or 2). The LED expander on 1 the output expander on 2. + exp_id (int): ID of Expander (1 or 2). + cmd_byte (int): The Command byte is used as a pointer to a specific register see datasheet PC9539. + Returns: + int: content of the ioexpander + """ + if io_exp not in [1, 2]: + raise ValueError("Expander should be 1 or 2") + if cmd_byte not in [2, 3]: + raise ValueError("Command byte should be 2 or 3") + if exp_id not in [1, 2]: + raise ValueError("Expander ID should be 1 or 2") + + if io_exp == 1: + exp = "led_expander" + else: + exp = "expander" + + output = self.i2c.read(self.i2c.modules["%s_%.1s" % (exp, exp_id)], cmd_byte) + return output diff --git a/aidatlu/hardware/trigger_controller.py b/aidatlu/hardware/trigger_controller.py new file mode 100644 index 0000000..f5d4dfd --- /dev/null +++ b/aidatlu/hardware/trigger_controller.py @@ -0,0 +1,180 @@ +from aidatlu.hardware.i2c import I2CCore +from aidatlu.hardware.utils import _pack_bits +from aidatlu import logger + + +class TriggerLogic(object): + def __init__(self, i2c: I2CCore) -> None: + self.log = logger.setup_derived_logger(__class__.__name__) + self.i2c = i2c + + """ Internal Trigger Generation """ + + def set_internal_trigger_frequency(self, frequency: int) -> None: + """Sets the internal trigger frequency. + The maximum allowed Frequency is 160 MHz. + + Args: + frequency (int): Frequency in Hz + """ + self.log.info("Set internal trigger frequency to: %i Hz" % frequency) + max_freq = 160000000 + + if frequency < 0: + raise ValueError("Frequency smaller 0 does not work") + if frequency > max_freq: + raise ValueError("Frequency larger %s Hz not supported" % max_freq) + if frequency == 0: + interval = frequency + else: + interval = int( + max_freq / frequency + ) # TODO here is a rounding error that comes from the interval calculations at ~10kHz. + self._set_internal_trigger_interval(interval) + new_freq = self.get_internal_trigger_frequency() + if new_freq != frequency: + self.log.warning( + "Frequency set to different value. Internal Trigger frequency: %i Hz" + % self.get_internal_trigger_frequency() + ) + + def get_internal_trigger_frequency(self) -> int: + """Reads the internal trigger frequency from the register. + + Returns: + int: Frequency in Hz + """ + max_freq = 160000000 + interval = self.i2c.read_register("triggerLogic.InternalTriggerIntervalR") + if interval == 0: + freq = 0 + else: + freq = int( + max_freq / interval + ) # TODO here is prob. a rounding error I should use a round function this would prob. prevent the warning at ~10kHz. + return freq + + def _set_internal_trigger_interval(self, interval: int) -> None: + """Number of internal clock cycles to be used as period for the internal trigger generator. + The period for the internal trigger generator is reduced by 2 prob. in some hardware configuration. + + Args: + interval (int): Number of internal clock cycles. + """ + self.i2c.write_register("triggerLogic.InternalTriggerIntervalW", interval) + + """ Trigger Logic """ + + def set_trigger_veto(self, veto: bool) -> None: + """Enables or disables new trigger. This can be used to reset the procession of new triggers. + Args: + veto (bool): Sets a veto to the trigger logic of the tlu. + """ + if type(veto) != bool: + raise TypeError("Veto must be type bool") + + self.i2c.write_register("triggerLogic.TriggerVetoW", int(veto)) + self.log.info("Trigger Veto set to: %s" % self.get_trigger_veto()) + + def set_trigger_polarity(self, value: int) -> int: + """Sets if the TLU triggers on rising or falling edge. + + Args: + value (int): 1 triggers on falling, 0 on rising. #TODO not tested + + """ + trigger_polarity = 0x3F & value + self.i2c.write_register("triggerInputs.InvertEdgeW", trigger_polarity) + self.log.info("Trigger on %s edge" % ("falling" if value == 1 else "rising")) + + def set_trigger_mask(self, mask_high: int, mask_low: int) -> None: + """Sets the trigger logic. Each of the 64 possible combination is divided into two 32-bit words mask high and mask low. + + Args: + mask_high (int): The most significant 32-bit word generated from the trigger configuration. + mask_low (int): The least significant 32-bit word generated from the trigger configuration. + """ + self.i2c.write_register("triggerLogic.TriggerPattern_lowW", mask_low) + self.i2c.write_register("triggerLogic.TriggerPattern_highW", mask_high) + self.log.debug("Trigger mask: %s" % self.get_trigger_mask()) + + def get_trigger_mask(self) -> int: + """Retrieves the trigger logic words from the registers. The trigger pattern represents one of the 64 possible logic combinations.""" + mask_low = self.i2c.read_register("triggerLogic.TriggerPattern_lowR") + mask_high = self.i2c.read_register("triggerLogic.TriggerPattern_highR") + trigger_pattern = (mask_high << 32) | mask_low + return trigger_pattern + + def get_trigger_veto(self) -> bool: + """Reads the trigger veto from the register.""" + veto_state = self.i2c.read_register("triggerLogic.TriggerVetoR") + return bool(veto_state) + + def get_post_veto_trigger(self) -> int: + """Gets the number of triggers recorded in the TLU after the veto is applied""" + return self.i2c.read_register("triggerLogic.PostVetoTriggersR") + + def get_pre_veto_trigger(self) -> int: + """Number of triggers recorded in the TLU before the veto is applied.""" + return self.i2c.read_register("triggerLogic.PreVetoTriggersR") + + def set_trigger_mask_from_full_word(self, value: int) -> None: + """Sets the trigger logic. Each of the 64 possible combination is divided into two 32-bit words mask high and mask low. + + Args: + value (int): Sets trigger logic from trigger logic combination word. + """ + mask_high = (value >> 32) & 0xFF + mask_low = value & 0xFF + self.i2c.write_register("triggerLogic.TriggerPattern_lowW", mask_low) + self.i2c.write_register("triggerLogic.TriggerPattern_highW", mask_high) + self.log.debug("Trigger mask: %s" % self.get_trigger_mask()) + + """ Trigger Pulse Length and Delay """ + + def set_pulse_stretch_pack(self, vector: list) -> None: + """Stretch word for trigger pulses. Each element of the input vector is stretched by N clock cycles. + The input vector should have 6 elements for the different inputs. + The vector is packed into a single word. + + Args: + vector (list): A vector containing six integers. Each trigger input is stretched by the integer number of clock cycles. + """ + packed = _pack_bits(vector) + self._set_pulse_stretch(packed) + self.log.debug("Pulse stretch is set to %s" % self.get_pulse_stretch_pack()) + + def set_pulse_delay_pack(self, vector: list) -> None: + """Delay word for trigger pulses. Each element of the input vector is delayed by N clock cycles. + The vector is packed into a single word. + + Args: + vector (list): A vector containing six integers. Each trigger input is delayed by the integer number of clock cycles. + """ + packed = _pack_bits(vector) + self._set_pulse_delay(packed) + self.log.debug("Pulse Delay is set to %s" % self.get_pulse_delay_pack()) + + def get_pulse_stretch_pack(self) -> int: + """Get packed word describing the input pulse stretch.""" + return self.i2c.read_register("triggerLogic.PulseStretchR") + + def get_pulse_delay_pack(self) -> int: + """Get packed word describing the input pulse stretch.""" + return self.i2c.read_register("triggerLogic.PulseDelayR") + + def _set_pulse_stretch(self, value: int) -> None: + """Writes the packed word into the pulse stretch register. + + Args: + value (int): The input vector packed to a single integer. + """ + self.i2c.write_register("triggerLogic.PulseStretchW", value) + + def _set_pulse_delay(self, value: int) -> None: + """Writes the packed word into the pulse delay register. + + Args: + value (int): The input vector packed to a single integer. + """ + self.i2c.write_register("triggerLogic.PulseDelayW", value) diff --git a/aidatlu/hardware/utils.py b/aidatlu/hardware/utils.py new file mode 100644 index 0000000..88df13c --- /dev/null +++ b/aidatlu/hardware/utils.py @@ -0,0 +1,51 @@ +def _set_bit(value: int, index: int, set: bool = True) -> int: + """sets bit at given index of given value to bool set + + Args: + value (int): input value + index (int): index where to change bit + set (bool, optional): change bit to bool + + Returns: + int: value with a set bit at index + """ + + if set: + return value | (1 << index) + else: + return value & ~(1 << index) + + +def _pack_bits(vector: list) -> int: + """Pack Vector of bits using 5-bits for each element. + + Args: + vector (list): Vector of bits with variable length. + + Returns: + int: 32-bit word representation of the input vector. + """ + packed_bits = 0 + temp_int = 0 + for channel in range(len(vector)): + temp_int = int(vector[channel]) << channel * 5 + packed_bits = packed_bits | temp_int + return packed_bits + + +from pathlib import Path + + +def find_latest_file(path: str, index: str): + """Find latest file that includes a given subset of strings called index in directory. + Args: + path (str): Path to directory. For same directory as python script use for e.q. './target_dir'. + index (str): (Optional) Find if specific characters are in Pathfile + Returns: + path: Path to file in target Director. Use str(find_path(.)) to obtain path as string. + """ + p = Path(path) + return max( + [x for x in p.iterdir() if x.is_file() and index in str(x)], + key=lambda item: item.stat().st_ctime, + ) diff --git a/aidatlu/led_controller.py b/aidatlu/led_controller.py deleted file mode 100644 index 029f89a..0000000 --- a/aidatlu/led_controller.py +++ /dev/null @@ -1,104 +0,0 @@ -import logger -from i2c import I2CCore, i2c_addr - - -class LEDControl(object): - def __init__(self, i2c: I2CCore, int_ref: bool = False) -> None: - self.log = logger.setup_derived_logger("LED Controller") - self.i2c = i2c - self._set_dac_reference(int_ref) - # TODO: WHY?! - self._set_ioexpander_polarity(exp=1, addr=4, polarity=False) - self._set_ioexpander_direction(exp=1, addr=6, direction="output") - self._set_ioexpander_output(exp=1, addr=2, value=0xFF) - self._set_ioexpander_polarity(exp=1, addr=5, polarity=False) - self._set_ioexpander_direction(exp=1, addr=7, direction="output") - self._set_ioexpander_output(exp=1, addr=3, value=0xFF) - self._set_ioexpander_polarity(exp=2, addr=4, polarity=False) - self._set_ioexpander_direction(exp=2, addr=6, direction="output") - self._set_ioexpander_output(exp=2, addr=2, value=0xFF) - self._set_ioexpander_polarity(exp=2, addr=5, polarity=False) - self._set_ioexpander_direction(exp=2, addr=7, direction="output") - self._set_ioexpander_output(exp=2, addr=3, value=0xFF) - - def test_leds(self) -> None: - pass - - def all_on(self, color: str = "w") -> None: - """Set all LEDs to same color - - Args: - color (str, optional): Color code, currently only white (w) supported. Defaults to "w". - """ - self._set_ioexpander_output(exp=1, addr=2, value=0x0) - self._set_ioexpander_output(exp=1, addr=3, value=0x0) - self._set_ioexpander_output(exp=2, addr=2, value=0x0) - self._set_ioexpander_output(exp=2, addr=3, value=0x0) - - def all_off(self) -> None: - """Turn off all LEDs - """ - self._set_ioexpander_output(exp=1, addr=2, value=0xFF) - self._set_ioexpander_output(exp=1, addr=3, value=0xFF) - self._set_ioexpander_output(exp=2, addr=2, value=0xFF) - self._set_ioexpander_output(exp=2, addr=3, value=0xFF) - - def _set_dac_reference(self, internal: bool = False) -> None: - """Choose internal or external DAC reference - - Args: - internal (bool, optional): Defaults to False. - """ - if internal: - self.i2c.write(self.i2c.modules["pwr_dac"], 0x38, 0x0001) - else: - self.i2c.write(self.i2c.modules["pwr_dac"], 0x38, 0x0001) - self.log.info( - "Set %s DAC reference for LEDs" % ("internal" if internal else "external") - ) - - def _set_ioexpander_polarity( - self, exp: int, addr: int, polarity: bool = False - ) -> None: - """Set content of register 4 or 5 which determine polarity of ports - - Args: - exp (int): ID of LED Expander (1 or 2)) - addr (int): # TODO, what is this?! - polarity (bool, optional): False (0) = normal, True (1) = inverted. Defaults to False. - """ - if addr not in [4, 5]: - raise ValueError("Address should be 4 or 5") - self.i2c.write(self.i2c.modules["led_expander_%.1s" % exp], addr, polarity) - - def _set_ioexpander_direction( - self, exp: int, addr: int, direction: str = "input" - ) -> None: - """Set content of register 6 or 7 which determine direction of signal - - Args: - exp (int): ID of LED Expander (1 or 2)) - addr (int): # TODO, what is this?! - direction (str, optional): "input or "output" direction of port. Defaults to "input". - """ - if addr not in [6, 7]: - raise ValueError("Address should be 6 or 7") - if direction not in ["input", "output"]: - raise ValueError('Direction parameter must be "input" or "output"') - self.i2c.write( - self.i2c.modules["led_expander_%.1s" % exp], - addr, - 1 if direction == "input" else 0, - ) - - def _set_ioexpander_output(self, exp: int, addr: int, value: int) -> None: - """Set content of register 2 or 3 which determine signal if direction is output - - Args: - exp (int): ID of LED Expander (1 or 2)) - addr (int): # TODO, what is this?! - value (int): 8 bit value for the output - """ - if addr not in [2, 3]: - raise ValueError("Address should be 6 or 7") - self.i2c.write(self.i2c.modules["led_expander_%.1s" % exp], addr, value & 0xFF) diff --git a/aidatlu/logger.py b/aidatlu/logger.py index 1221b3e..9fe919f 100644 --- a/aidatlu/logger.py +++ b/aidatlu/logger.py @@ -1,8 +1,8 @@ import logging - import coloredlogs +import argparse -FORMAT = "%(asctime)s [%(name)-14s] - %(levelname)-7s %(message)s" +FORMAT = "%(asctime)s [%(name)-18s] - %(levelname)-7s %(message)s" def setup_main_logger(name="AidaTLU", level=logging.INFO): diff --git a/packages/TLU_v1e/__init__.py b/aidatlu/main/__init__.py similarity index 100% rename from packages/TLU_v1e/__init__.py rename to aidatlu/main/__init__.py diff --git a/aidatlu/main/config_parser.py b/aidatlu/main/config_parser.py new file mode 100644 index 0000000..8f3b869 --- /dev/null +++ b/aidatlu/main/config_parser.py @@ -0,0 +1,266 @@ +import yaml +import logging +from aidatlu import logger + + +class TLUConfigure(object): + def __init__(self, TLU, io_control, config_path) -> None: + self.log = logger.setup_main_logger(__class__.__name__) + + self.tlu = TLU + self.io_control = io_control + + config_path = config_path + with open(config_path, "r") as file: + self.conf = yaml.full_load(file) + + def configure(self) -> None: + """Loads configuration file and configures the TLU accordingly.""" + self.conf_dut() + self.conf_trigger_inputs() + self.conf_trigger_logic() + self.tlu.io_controller.clock_lemo_output( + self.conf["clock_lemo"]["enable_clock_lemo_output"] + ) + [ + self.tlu.dac_controller.set_voltage( + i + 1, self.conf["pmt_control"]["pmt_%s" % (i + 1)] + ) + for i in range(len(self.conf["pmt_control"])) + ] + self.tlu.set_enable_record_data(1) + self.log.success("TLU configured") + + def get_configuration_table(self) -> list: + """Creates the configuration list to save in the data files + + Returns: + list: configuration list + """ + conf = [ + ( + "internal_trigger_rate", + self.conf["internal_trigger"]["internal_trigger_rate"], + ), + ("DUT_1", self.conf["dut_module"]["dut_1"]["mode"]), + ("DUT_2", self.conf["dut_module"]["dut_2"]["mode"]), + ("DUT_3", self.conf["dut_module"]["dut_3"]["mode"]), + ("DUT_4", self.conf["dut_module"]["dut_4"]["mode"]), + ("threshold_1", self.conf["trigger_inputs"]["threshold"]["threshold_1"]), + ("threshold_2", self.conf["trigger_inputs"]["threshold"]["threshold_2"]), + ("threshold_3", self.conf["trigger_inputs"]["threshold"]["threshold_3"]), + ("threshold_4", self.conf["trigger_inputs"]["threshold"]["threshold_4"]), + ("threshold_5", self.conf["trigger_inputs"]["threshold"]["threshold_3"]), + ("threshold_6", self.conf["trigger_inputs"]["threshold"]["threshold_4"]), + ( + "trigger_inputs_logic", + "%s" % (self.conf["trigger_inputs"]["trigger_inputs_logic"]), + ), + ( + "trigger_signal_shape_stretch", + "%s" + % str(self.conf["trigger_inputs"]["trigger_signal_shape"]["stretch"]), + ), + ( + "trigger_signal_shape_delay", + "%s" + % str(self.conf["trigger_inputs"]["trigger_signal_shape"]["delay"]), + ), + ( + "enable_clock_lemo_output", + self.conf["clock_lemo"]["enable_clock_lemo_output"], + ), + ("pmt_control_1", self.conf["pmt_control"]["pmt_1"]), + ("pmt_control_2", self.conf["pmt_control"]["pmt_2"]), + ("pmt_control_3", self.conf["pmt_control"]["pmt_3"]), + ("pmt_control_4", self.conf["pmt_control"]["pmt_4"]), + ("save_data", self.conf["save_data"]), + ("output_data_path", self.conf["output_data_path"]), + ("zmq_connection", self.conf["zmq_connection"]), + ] + return conf + + def get_data_handling(self) -> tuple: + """Information about data handling. + + Returns: + tuple: two bools, save and interpret data. + """ + + return self.conf["save_data"], self.conf["save_data"] + + def get_stop_condition(self) -> tuple: + """Information about tlu stop condition. + + Returns: + tuple: maximum trigger number and timeout in seconds. + """ + try: + max_number = int(self.conf["max_trigger_number"]) + self.log.info("Stop condition maximum triggers: %s" % max_number) + except: + max_number = None + try: + timeout = float(self.conf["timeout"]) + self.log.info("Stop condition timeout: %s s" % timeout) + except: + timeout = None + return max_number, timeout + + def get_output_data_path(self) -> str: + """Parses the output data path + + Returns: + str: output path + """ + return self.conf["output_data_path"] + + def get_zmq_connection(self) -> str: + """Information about the zmq Address + + Returns: + str: ZMQ Address + """ + return self.conf["zmq_connection"] + + def conf_dut(self) -> None: + """Parse the configuration for the DUT interface to the AIDATLU.""" + dut = [0, 0, 0, 0] + dut_mode = [0, 0, 0, 0] + for i in range(4): + if ( + self.tlu.config_parser.conf["dut_module"]["dut_%s" % (i + 1)]["mode"] + == "eudet" + ): + self.tlu.io_controller.switch_led(i + 1, "g") + dut[i] = 2**i + # Clock output needs to be disabled for EUDET mode. + self.tlu.io_controller.clock_hdmi_output(i + 1, "off") + if ( + self.tlu.config_parser.conf["dut_module"]["dut_%s" % (i + 1)]["mode"] + == "aidatrig" + ): + self.tlu.io_controller.switch_led(i + 1, "w") + dut[i] = 2**i + dut_mode[i] = 2 ** (2 * i) + # In AIDA mode the clock output is needed. + self.tlu.io_controller.clock_hdmi_output(i + 1, "chip") + if ( + self.tlu.config_parser.conf["dut_module"]["dut_%s" % (i + 1)]["mode"] + == "aida" + ): + self.tlu.io_controller.switch_led(i + 1, "b") + dut[i] = 2**i + dut_mode[i] = 3 * (2) ** (2 * i) + self.tlu.io_controller.clock_hdmi_output(i + 1, "chip") + self.tlu.io_controller.configure_hdmi(i + 1, "0111") + + [ + self.log.info( + "DUT %i configured in %s" + % ( + (i + 1), + self.tlu.config_parser.conf["dut_module"]["dut_%s" % (i + 1)][ + "mode" + ], + ) + ) + for i in range(4) + ] + + # This sets the right bits to the set dut mask registers according to the configuration parameter. + self.tlu.dut_logic.set_dut_mask(dut[0] | dut[1] | dut[2] | dut[3]) + self.tlu.dut_logic.set_dut_mask_mode( + dut_mode[0] | dut_mode[1] | dut_mode[2] | dut_mode[3] + ) + + # Special configs + self.tlu.dut_logic.set_dut_mask_mode_modifier(0) + self.tlu.dut_logic.set_dut_ignore_busy(0) + self.tlu.dut_logic.set_dut_ignore_shutter(0x1) + + def conf_trigger_logic(self) -> None: + """Configures the trigger logic. So the trigger polarity and the trigger pulse length and stretch.""" + + self.tlu.trigger_logic.set_trigger_polarity( + self.conf["trigger_inputs"]["trigger_polarity"]["polarity"] + ) + + self.tlu.trigger_logic.set_pulse_stretch_pack( + self.conf["trigger_inputs"]["trigger_signal_shape"]["stretch"] + ) + self.tlu.trigger_logic.set_pulse_delay_pack( + self.conf["trigger_inputs"]["trigger_signal_shape"]["delay"] + ) + self.log.info( + "Trigger input stretch: %s" + % self.conf["trigger_inputs"]["trigger_signal_shape"]["stretch"] + ) + self.log.info( + "Trigger input delay : %s" + % self.conf["trigger_inputs"]["trigger_signal_shape"]["delay"] + ) + + self.tlu.trigger_logic.set_internal_trigger_frequency( + self.conf["internal_trigger"]["internal_trigger_rate"] + ) + + def conf_trigger_inputs(self) -> None: + """Configures the trigger inputs. Each input can have a different threshold. + The two trigger words mask_low and mask_high are generated with the use of two support functions. + """ + [ + self.tlu.dac_controller.set_threshold( + i + 1, + self.conf["trigger_inputs"]["threshold"]["threshold_%s" % (i + 1)], + ) + for i in range(6) + ] + + trigger_configuration = self.conf["trigger_inputs"]["trigger_inputs_logic"] + + self.log.info("Trigger Configuration: %s" % (trigger_configuration)) + + # Sets the Trigger Leds to green if the Input is enabled and to red if the input is set to VETO. + # TODO this breaks when there are multiple enabled and veto statements. + if trigger_configuration != None: + for trigger_led in range(6): + if "~CH%i" % (trigger_led + 1) in trigger_configuration: + self.io_control.switch_led(trigger_led + 6, "r") + elif "CH%i" % (trigger_led + 1) in trigger_configuration: + self.io_control.switch_led(trigger_led + 6, "g") + + long_word = 0x0 + # Goes through all possible trigger combinations and checks if the combination is valid with the trigger logic. + # When the word is valid this is added to the longword. + for combination in range(64): + pattern_list = [(combination >> element) & 0x1 for element in range(6)] + CCH5 = pattern_list[5] + CCH4 = pattern_list[4] + CCH3 = pattern_list[3] + CCH2 = pattern_list[2] + CCH1 = pattern_list[1] + CCH0 = pattern_list[0] + valid = ( + lambda CH1, CH2, CH3, CH4, CH5, CH6: eval(trigger_configuration) + )(CCH0, CCH1, CCH2, CCH3, CCH4, CCH5) + long_word = (valid << combination) | long_word + + mask_low, mask_high = self._mask_words(long_word) + self.log.debug( + "mask high: %s, mask low: %s" % (hex(mask_high), hex(mask_low)) + ) + self.tlu.trigger_logic.set_trigger_mask(mask_high, mask_low) + + def _mask_words(self, word: int) -> tuple: + """Transforms the long word variant of the trigger word to the mask_low mask_high variant. + + Args: + word (int): Long word variant of the trigger word. + + Returns: + tuple: mask_low and mask_high trigger words + """ + mask_low = 0xFFFFFFFF & word + mask_high = word >> 32 + return (mask_low, mask_high) diff --git a/aidatlu/main/data_parser.py b/aidatlu/main/data_parser.py new file mode 100644 index 0000000..96351c1 --- /dev/null +++ b/aidatlu/main/data_parser.py @@ -0,0 +1,220 @@ +import numpy as np +import tables as tb +from aidatlu import logger +import logging +from tqdm import tqdm + + +class DataParser(object): + def __init__(self) -> None: + self.log = logger.setup_main_logger(__class__.__name__) + self.features = np.dtype( + [ + ("eventnumber", "u4"), + ("timestamp", "u8"), + ("overflow", "u8"), + ("eventtype", "u4"), + ("input1", "bool"), + ("input2", "bool"), + ("input3", "bool"), + ("input4", "bool"), + ("input5", "bool"), + ("input6", "bool"), + ("sc1", "u4"), + ("sc2", "u4"), + ("sc3", "u4"), + ("sc4", "u4"), + ("sc5", "u4"), + ("sc6", "u4"), + ] + ) + self.raw_features = np.dtype([("raw", "u4")]) + + def interpret_data( + self, filepath_in: str, filepath_out: str, chunk_size: int = 2000000 + ) -> None: + """Interprets raw tlu data. The data is interpreted in chunksizes. + The data is parsed form filepath_in to filepath_out. + An event consists of six consecutive raw data entries tha last entry should be a 0. + The raw data is sliced and the last data entry checked for corrupted data. + + Args: + filepath_in (str): raw data file path + filepath_out (str): output path of the interpreted data + """ + self.log.info("Interpreting Data") + chunk_size = chunk_size * 6 + with tb.open_file(filepath_in, "r") as file: + n_words = file.root.raw_data.shape[0] + self.conf = np.array(file.root.conf[:]) + + if n_words == 0: + self.log.warning("Data is empty. Skip analysis!") + return + + with tb.open_file( + filepath_out, mode="w", title="TLU_interpreted" + ) as h5_file: + data_table = self._create_table( + h5_file, name="interpreted_data", title="data", dtype=self.features + ) + for chunk in tqdm(range(0, n_words, chunk_size)): + chunk_offset = chunk + stop = chunk_offset + chunk_size + if chunk + chunk_size > n_words: + stop = n_words + table = file.root.raw_data[chunk_offset:stop] + raw_data = np.array(table[:], dtype=self.raw_features) + data = self._transform_data( + raw_data["raw"][::6], + raw_data["raw"][1::6], + raw_data["raw"][2::6], + raw_data["raw"][3::6], + raw_data["raw"][4::6], + raw_data["raw"][5::6], + ) + data_table.append(data) + + config = np.dtype( + [ + ("attribute", "S32"), + ("value", "S32"), + ] + ) + config_table = h5_file.create_table( + h5_file.root, + name="conf", + description=config, + ) + config_table.append(self.conf) + self.log.success('Data parsed from "%s" to "%s"' % (filepath_in, filepath_out)) + + def _create_table(self, out_file, name, title, dtype): + """Create hit table node for storage in out_file. + Copy configuration nodes from raw data file. + """ + table = out_file.create_table( + out_file.root, + name=name, + description=dtype, + title=title, + filters=tb.Filters(complib="blosc", complevel=5, fletcher32=False), + ) + + return table + + def _transform_data( + self, + w0: np.array, + w1: np.array, + w2: np.array, + w3: np.array, + w4: np.array, + w5: np.array, + ) -> np.array: + """Transforms raw data from the FIFO to a readable dataformat + + Args: + w0 (np.array): contains information which trigger input fired + w1 (np.array): contains timestamp information + w2 (np.array): trigger input information + w3 (np.array): eventnumber + w4 (np.array): trigger input information + w5 (np.array): this should always be 0. + + Returns: + np.array: array with coloumns + """ + if np.any(w5) != 0: + self.log.warning("Corrupted Data found") + out_array = np.zeros(len(w3), dtype=self.features) + out_array["eventnumber"] = w3 + out_array["timestamp"] = (w0 & 0x0000FFFF << 32) + w1 + out_array["overflow"] = w0 & 0xFFFF + # TODO not sure what this is per. mode? + out_array["eventtype"] = (w0 >> 28) & 0xF + # Which trigger input produced the event. + out_array["input1"] = (w0 >> 16) & 0x1 + out_array["input2"] = (w0 >> 17) & 0x1 + out_array["input3"] = (w0 >> 18) & 0x1 + out_array["input4"] = (w0 >> 19) & 0x1 + out_array["input5"] = (w0 >> 20) & 0x1 + out_array["input6"] = (w0 >> 21) & 0x1 + # TODO not sure what these are prob. something from the DACs + out_array["sc1"] = (w2 >> 24) & 0xFF + out_array["sc2"] = (w2 >> 16) & 0xFF + out_array["sc3"] = (w2 >> 8) & 0xFF + out_array["sc4"] = w2 & 0xFF + out_array["sc5"] = (w4 >> 24) & 0xFF + out_array["sc6"] = (w4 >> 16) & 0xFF + return out_array + + def _parse(self, filepath_in: str, filepath_out: str) -> None: + """Parse the data from filepath in readable form to filepath out + + Args: + filepath_in (str): Raw data file from TLU. + filepath_out (str): New interpreted data file. + """ + table = self.read_file(filepath_in) + data = self.transform_data( + table["raw"][::6], + table["raw"][1::6], + table["raw"][2::6], + table["raw"][3::6], + table["raw"][4::6], + table["raw"][5::6], + ) + self.write_data(filepath_out, data) + + self.log.info('Data parsed from "%s" to "%s"' % (filepath_in, filepath_out)) + + def _read_file(self, filepath: str) -> list: + """Reads raw data file of the TLU + + Args: + filepath (str): filepath to the data file + + Returns: + table: pytable of the raw data + """ + data = np.dtype([("raw", "u4")]) + with tb.open_file(filepath, "r") as file: + table = file.root.raw_data + raw_data = np.array(table[:], dtype=data) + self.conf = np.array(file.root.conf[:]) + return raw_data + + def _write_data(self, filepath: str, data: np.array) -> None: + """Analyzes the raw data table and writes it into a new .h5 file + + Args: + filepath (str): Path to the new .h5 file. + data (table): raw data + """ + config = np.dtype( + [ + ("attribute", "S32"), + ("value", "S32"), + ] + ) + with tb.open_file(filepath, mode="w", title="TLU_interpreted") as h5_file: + data_table = self._create_table( + h5_file, name="interpreted_data", title="data", dtype=self.features + ) + data_table.append(data) + config_table = h5_file.create_table( + h5_file.root, + name="conf", + description=config, + ) + config_table.append(self.conf) + + +if __name__ == "__main__": + path_in = "../tlu_data/tlu_raw" + ".h5" + path_out = "../tlu_data/tlu_interpreted" + ".h5" + + data_parser = DataParser() + + data_parser.interpret_data(path_in, path_out) diff --git a/aidatlu/main/tlu.py b/aidatlu/main/tlu.py new file mode 100644 index 0000000..e193e8a --- /dev/null +++ b/aidatlu/main/tlu.py @@ -0,0 +1,526 @@ +import logging +import uhal +import aidatlu.logger as logger +import numpy as np +import tables as tb +from datetime import datetime +import zmq +from pathlib import Path +import time +import threading + +from aidatlu.hardware.i2c import I2CCore +from aidatlu.hardware.clock_controller import ClockControl +from aidatlu.hardware.ioexpander_controller import IOControl +from aidatlu.hardware.dac_controller import DacControl +from aidatlu.hardware.trigger_controller import TriggerLogic +from aidatlu.hardware.dut_controller import DUTLogic +from aidatlu.main.config_parser import TLUConfigure +from aidatlu.main.data_parser import DataParser + + +class AidaTLU(object): + def __init__(self, hw, config_path, clock_config_path) -> None: + self.log = logger.setup_main_logger(__class__.__name__) + + self.i2c = I2CCore(hw) + self.i2c_hw = hw + self.log.info("Initializing IPbus interface") + self.i2c.init() + if self.i2c.modules["eeprom"]: + self.log.info("Found device with ID %s" % hex(self.get_device_id())) + + # TODO some configuration also sends out ~70 triggers. + self.io_controller = IOControl(self.i2c) + self.dac_controller = DacControl(self.i2c) + self.clock_controller = ClockControl(self.i2c, self.io_controller) + self.clock_controller.write_clock_conf(clock_config_path) + self.trigger_logic = TriggerLogic(self.i2c) + self.dut_logic = DUTLogic(self.i2c) + + self.reset_configuration() + self.config_parser = TLUConfigure(self, self.io_controller, config_path) + self.data_parser = DataParser() + + self.log.success("TLU initialized") + + def configure(self) -> None: + """loads the conf.yaml and configures the TLU accordingly.""" + self.config_parser.configure() + self.conf_list = self.config_parser.get_configuration_table() + self.get_event_fifo_fill_level() + self.get_event_fifo_csr() + self.get_scalar() + + def reset_configuration(self) -> None: + """Switch off all outputs, reset all counters and set threshold to 1.2V""" + # Disable all outputs + self.io_controller.clock_lemo_output(False) + for i in range(4): + self.io_controller.configure_hdmi(i + 1, 1) + self.dac_controller.set_voltage(5, 0) + self.io_controller.all_off() + # sets all thresholds to 1.2 V + for i in range(6): + self.dac_controller.set_threshold(i + 1, 0) + # Resets all internal counters and raise the trigger veto. + self.set_run_active(False) + self.reset_status() + self.reset_counters() + self.trigger_logic.set_trigger_veto(True) + self.reset_fifo() + self.reset_timestamp() + self.run_number = 0 + try: + self.h5_file.close() + except: + pass + + def get_device_id(self) -> int: + """Read back board id. Consists of six blocks of hex data + + Returns: + int: Board id as 48 bits integer + """ + id = [] + for addr in range(6): + id.append(self.i2c.read(self.i2c.modules["eeprom"], 0xFA + addr) & 0xFF) + return int("0x" + "".join(["{:x}".format(i) for i in id]), 16) & 0xFFFFFFFFFFFF + + def get_fw_version(self) -> int: + return self.i2c.read_register("version") + + def reset_timestamp(self) -> None: + """Sets bit to 'ResetTimestampW' register to reset the time stamp.""" + self.i2c.write_register("Event_Formatter.ResetTimestampW", 1) + + def reset_counters(self) -> None: + """Resets the trigger counters.""" + self.write_status(0x2) + self.write_status(0x0) + + def reset_status(self) -> None: + """Resets the complete status and all counters.""" + self.write_status(0x3) + self.write_status(0x0) + self.write_status(0x4) + self.write_status(0x0) + + def reset_fifo(self) -> None: + """Sets 0 to 'EventFifoCSR' this resets the FIFO.""" + self.set_event_fifo_csr(0x0) + + def set_event_fifo_csr(self, value: int) -> None: + """Sets value to the EventFifoCSR register. + + Args: + value (int): 0 resets the FIFO. #TODO can do other stuff that is not implemented + + """ + self.i2c.write_register("eventBuffer.EventFifoCSR", value) + + def write_status(self, value: int) -> None: + """Sets value to the 'SerdesRstW' register. + + Args: + value (int): Bit 0 resets the status, bit 1 resets trigger counters and bit 2 calibrates IDELAY. + """ + self.i2c.write_register("triggerInputs.SerdesRstW", value) + + def set_run_active(self, state: bool) -> None: + """Raises internal run active signal. + + Args: + state (bool): True sets run active, False disables it. + """ + if type(state) != bool: + raise TypeError("State has to be bool") + self.i2c.write_register("Shutter.RunActiveRW", int(state)) + self.log.info("Run active: %s" % self.get_run_active()) + + def get_run_active(self) -> bool: + """Reads register 'RunActiveRW' + + Returns: + bool: Returns bool of the run active register. + """ + return bool(self.i2c.read_register("Shutter.RunActiveRW")) + + def test_configuration(self) -> None: + """Configure DUT 1 to run in a default test configuration. + Runs in EUDET mode with internal generated triggers. + This is just for testing and bugfixing. + """ + self.log.info("Configure DUT 1 in EUDET test mode") + + test_stretch = [1, 1, 1, 1, 1, 1] + test_delay = [0, 0, 0, 0, 0, 0] + + self.io_controller.configure_hdmi(1, "0111") + self.io_controller.clock_hdmi_output(1, "off") + self.trigger_logic.set_pulse_stretch_pack(test_stretch) + self.trigger_logic.set_pulse_delay_pack(test_delay) + self.trigger_logic.set_trigger_mask(mask_high=0x00000000, mask_low=0x00000002) + self.trigger_logic.set_trigger_polarity(1) + self.dut_logic.set_dut_mask("0001") + self.dut_logic.set_dut_mask_mode("00000000") + self.trigger_logic.set_internal_trigger_frequency(500) + + def default_configuration(self) -> None: + """Default configuration. Configures DUT 1 to run in EUDET mode. + This is just for testing and bugfixing. + """ + test_stretch = [1, 1, 1, 1, 1, 1] + test_delay = [0, 0, 0, 0, 0, 0] + + self.io_controller.configure_hdmi(1, "0111") + self.io_controller.configure_hdmi(2, "0111") + self.io_controller.configure_hdmi(3, "0111") + self.io_controller.configure_hdmi(4, "0111") + self.io_controller.clock_hdmi_output(1, "off") + self.io_controller.clock_hdmi_output(2, "off") + self.io_controller.clock_hdmi_output(3, "off") + self.io_controller.clock_hdmi_output(4, "off") + self.io_controller.clock_lemo_output(False) + self.dac_controller.set_threshold(1, -0.04) + self.dac_controller.set_threshold(2, -0.04) + self.dac_controller.set_threshold(3, -0.04) + self.dac_controller.set_threshold(4, -0.04) + self.dac_controller.set_threshold(5, -0.2) + self.dac_controller.set_threshold(6, -0.2) + self.trigger_logic.set_pulse_stretch_pack(test_stretch) + self.trigger_logic.set_pulse_delay_pack(test_delay) + self.trigger_logic.set_trigger_mask(mask_high=0, mask_low=2) + self.trigger_logic.set_trigger_polarity(1) + self.dut_logic.set_dut_mask("0001") + self.dut_logic.set_dut_mask_mode("00000000") + self.dut_logic.set_dut_mask_mode_modifier(0) + self.dut_logic.set_dut_ignore_busy(0) + self.dut_logic.set_dut_ignore_shutter(0x1) + self.trigger_logic.set_internal_trigger_frequency(0) + + def start_run(self) -> None: + """Start run configurations""" + self.reset_counters() + self.reset_fifo() + self.set_run_active(True) + self.trigger_logic.set_trigger_veto(False) + + def stop_run(self) -> None: + """Stop run configurations""" + self.trigger_logic.set_trigger_veto(True) + self.set_run_active(False) + self.run_number += 1 + + def set_enable_record_data(self, value: int) -> None: + """#TODO not sure what this does. Looks like a seperate internal event buffer to the FIFO. + + Args: + value (int): #TODO I think this does not work + """ + self.i2c.write_register("Event_Formatter.Enable_Record_Data", value) + + def get_event_fifo_csr(self) -> int: + """Reads value from 'EventFifoCSR' + + Returns: + int: number of events + """ + return self.i2c.read_register("eventBuffer.EventFifoCSR") + + def get_event_fifo_fill_level(self) -> int: + """Reads value from 'EventFifoFillLevel' + + Returns: + int: buffer level of the fifi + """ + return self.i2c.read_register("eventBuffer.EventFifoFillLevel") + + def reset_timestamp(self) -> None: + """Resets the internal timestamp by asserting a bit in 'ResetTimestampW'.""" + self.i2c.write_register("Event_Formatter.ResetTimestampW", 1) + + def get_timestamp(self) -> int: + """Get current time stamp. + + Returns: + int: Time stamp is not formatted. + """ + time = self.i2c.read_register("Event_Formatter.CurrentTimestampHR") + time = time << 32 + time = time + self.i2c.read_register("Event_Formatter.CurrentTimestampLR") + return time + + def pull_fifo_event(self) -> list: + """Pulls event from the FIFO. This is needed in the run loop to prevent the buffer to get stuck. + if this register is full the fifo needs to be reset or new triggers are generated but not sent out. + #TODO check here if the FIFO is full and reset it if needed would prob. make sense. + + Returns: + list: 6 element long vector containing bitwords of the data. + """ + event_numb = self.get_event_fifo_fill_level() + if event_numb: + if event_numb * 6 == 0xFEA: + self.log.warning("FIFO is full") + fifo_content = self.i2c_hw.getNode("eventBuffer.EventFifoData").readBlock( + event_numb + ) + self.i2c_hw.dispatch() + return np.array(fifo_content) + pass + + def get_scalar(self): + s0 = self.i2c.read_register("triggerInputs.ThrCount0R") + s1 = self.i2c.read_register("triggerInputs.ThrCount1R") + s2 = self.i2c.read_register("triggerInputs.ThrCount2R") + s3 = self.i2c.read_register("triggerInputs.ThrCount3R") + s4 = self.i2c.read_register("triggerInputs.ThrCount4R") + s5 = self.i2c.read_register("triggerInputs.ThrCount5R") + return s0, s1, s2, s3, s4, s5 + + def init_raw_data_table(self) -> None: + """Initializes the raw data table, where the raw FIFO data is found.""" + self.data = np.dtype( + [ + ("raw", "u4"), + ] + ) + + config = np.dtype( + [ + ("attribute", "S32"), + ("value", "S32"), + ] + ) + + Path(self.path).mkdir(parents=True, exist_ok=True) + self.filter_data = tb.Filters(complib="blosc", complevel=5) + self.h5_file = tb.open_file(self.raw_data_path, mode="w", title="TLU") + self.data_table = self.h5_file.create_table( + self.h5_file.root, + name="raw_data", + description=self.data, + title="data", + filters=self.filter_data, + ) + config_table = self.h5_file.create_table( + self.h5_file.root, + name="conf", + description=config, + filters=self.filter_data, + ) + self.buffer = [] + config_table.append(self.conf_list) + + def handle_status(self) -> None: + t = threading.current_thread() + while getattr(t, "do_run", True): + time.sleep(0.5) + last_time = self.get_timestamp() + current_time = (last_time - self.start_time) * 25 / 1000000000 + # Logs and poss. sends status every 1s. + if current_time - self.last_time > 1: + self.log_sent_status(current_time) + # Stops the TLU after some time in seconds. + if self.timeout != None: + if current_time > self.timeout: + self.stop_condition = True + if self.max_trigger != None: + if self.trigger_logic.get_post_veto_trigger() > self.max_trigger: + self.stop_condition = True + + def log_sent_status(self, time: int) -> None: + """Logs the status of the TLU run with trigger number, runtime usw. + Also calculates the mean trigger frequency between function calls. + + Args: + time (int): current runtime of the TLU + """ + self.hit_rate = ( + self.trigger_logic.get_post_veto_trigger() - self.last_triggers_freq + ) / (time - self.last_time) + self.particle_rate = ( + self.trigger_logic.get_pre_veto_trigger() - self.last_particle_freq + ) / (time - self.last_time) + self.run_time = time + self.event_number = self.trigger_logic.get_post_veto_trigger() + self.total_trigger_number = self.trigger_logic.get_pre_veto_trigger() + s0, s1, s2, s3, s4, s5 = self.get_scalar() + + if self.zmq_address not in [None, "off"]: + self.socket.send_string( + str( + [ + self.run_time, + self.event_number, + self.total_trigger_number, + self.particle_rate, + self.hit_rate, + ] + ), + flags=zmq.NOBLOCK, + ) + + self.last_time = time + self.last_triggers_freq = self.trigger_logic.get_post_veto_trigger() + self.last_particle_freq = self.trigger_logic.get_pre_veto_trigger() + + self.log.info( + "Run time: %.3f s, Event: %s, Total trigger: %s, Trigger in freq: %.f Hz, Trigger out freq.: %.f Hz" + % ( + self.run_time, + self.event_number, + self.total_trigger_number, + self.particle_rate, + self.hit_rate, + ) + ) + + self.log.debug("Scalar %i:%i:%i:%i:%i:%i" % (s0, s1, s2, s3, s4, s5)) + self.log.debug("FIFO level: %s" % self.get_event_fifo_fill_level()) + self.log.debug("FIFO level 2: %s" % self.get_event_fifo_csr()) + self.log.debug( + "fifo csr: %s fifo fill level: %s" + % (self.get_event_fifo_csr(), self.get_event_fifo_csr()) + ) + self.log.debug( + "post: %s pre: %s" + % ( + self.trigger_logic.get_post_veto_trigger(), + self.trigger_logic.get_pre_veto_trigger(), + ) + ) + self.log.debug("time stamp: %s" % (self.get_timestamp())) + + def log_trigger_inputs(self, event_vector: list) -> None: + """Logs which inputs triggered the event corresponding to the event vector. + + Args: + event_vector (list): 6 data long event vector from the FIFO. + """ + w0 = event_vector[0] + input_1 = (w0 >> 16) & 0x1 + input_2 = (w0 >> 17) & 0x1 + input_3 = (w0 >> 18) & 0x1 + input_4 = (w0 >> 19) & 0x1 + input_5 = (w0 >> 20) & 0x1 + input_6 = (w0 >> 21) & 0x1 + self.log.info("Event triggered:") + self.log.info( + "Input 1: %s, Input 2: %s, Input 3: %s, Input 4: %s, Input 5: %s, Input 6: %s" + % (input_1, input_2, input_3, input_4, input_5, input_6) + ) + + def setup_zmq(self) -> None: + self.context = zmq.Context() + self.socket = self.context.socket(zmq.PUB) + self.socket.bind(self.zmq_address) + self.log.info("Connected ZMQ socket with address: %s" % self.zmq_address) + + def run(self) -> None: + """Start run of the TLU.""" + self.start_run() + self.get_fw_version() + self.get_device_id() + run_active = True + # reset starting parameter + self.start_time = self.get_timestamp() + self.last_time = 0 + self.last_triggers_freq = self.trigger_logic.get_post_veto_trigger() + self.last_particle_freq = self.trigger_logic.get_pre_veto_trigger() + first_event = True + self.stop_condition = False + # prepare data handling and zmq connection + save_data, interpret_data = self.config_parser.get_data_handling() + self.zmq_address = self.config_parser.get_zmq_connection() + self.max_trigger, self.timeout = self.config_parser.get_stop_condition() + + if save_data: + self.path = self.config_parser.get_output_data_path() + if self.path == None: + self.path = "tlu_data/" + if __name__ == "__main__": + self.path = "../tlu_data/" + self.raw_data_path = self.path + "tlu_raw_run%s_%s.h5" % ( + self.run_number, + datetime.now().strftime("%Y_%m_%d_%H_%M_%S"), + ) + self.interpreted_data_path = self.path + "tlu_interpreted_run%s_%s.h5" % ( + self.run_number, + datetime.now().strftime("%Y_%m_%d_%H_%M_%S"), + ) + self.init_raw_data_table() + + if self.zmq_address not in [None, "off"]: + self.setup_zmq() + + t = threading.Thread(target=self.handle_status) + t.start() + while run_active: + try: + time.sleep(0.000001) + current_event = self.pull_fifo_event() + try: + if save_data and np.size(current_event) > 1: + self.data_table.append(current_event) + if self.stop_condition == True: + raise KeyboardInterrupt + except: + if KeyboardInterrupt: + run_active = False + t.do_run = False + self.stop_run() + else: + # If this happens: poss. Hitrate to high for FIFO and or Data handling. + self.log.warning("Incomplete Event handling...") + + # This loop sents which inputs produced the trigger signal for the first event. + if ( + np.size(current_event) > 1 + ) and first_event: # TODO only first event? + self.log_trigger_inputs(current_event[0:6]) + first_event = False + + except: + KeyboardInterrupt + run_active = False + t.do_run = False + self.stop_run() + + # Cleanup of FIFO + try: + while np.size(current_event) > 1: + current_event = self.pull_fifo_event() + except: + KeyboardInterrupt + self.log.warning("Interupted FIFO cleanup") + + if self.zmq_address not in [None, "off"]: + self.socket.close() + + if save_data: + self.h5_file.close() + if interpret_data: + try: + self.data_parser.interpret_data( + self.raw_data_path, self.interpreted_data_path + ) + except: + self.log.warning("Cannot interpret data.") + self.log.success("Run finished") + + +if __name__ == "__main__": + uhal.setLogLevelTo(uhal.LogLevel.NOTICE) + manager = uhal.ConnectionManager("file://../misc/aida_tlu_connection.xml") + hw = uhal.HwInterface(manager.getDevice("aida_tlu.controlhub")) + + clock_path = "../misc/aida_tlu_clk_config.txt" + config_path = "../tlu_configuration.yaml" + + tlu = AidaTLU(hw, config_path, clock_path) + + tlu.configure() + + tlu.run() diff --git a/packages/__init__.py b/aidatlu/misc/__init__.py similarity index 100% rename from packages/__init__.py rename to aidatlu/misc/__init__.py diff --git a/EUDETdummy/scripts/EUDETdummyaddrmap.xml b/aidatlu/misc/aida_tlu_address-fw_version_0a.xml similarity index 90% rename from EUDETdummy/scripts/EUDETdummyaddrmap.xml rename to aidatlu/misc/aida_tlu_address-fw_version_0a.xml index 1d04eef..7408069 100644 --- a/EUDETdummy/scripts/EUDETdummyaddrmap.xml +++ b/aidatlu/misc/aida_tlu_address-fw_version_0a.xml @@ -1,28 +1,25 @@ - + - - @@ -32,25 +29,20 @@ - - - - - + - + + + + + @@ -93,4 +88,9 @@ + diff --git a/TLU_v1c/scripts/TLUaddrmap.xml b/aidatlu/misc/aida_tlu_address-fw_version_14.xml similarity index 76% rename from TLU_v1c/scripts/TLUaddrmap.xml rename to aidatlu/misc/aida_tlu_address-fw_version_14.xml index 65fb534..880d97c 100644 --- a/TLU_v1c/scripts/TLUaddrmap.xml +++ b/aidatlu/misc/aida_tlu_address-fw_version_14.xml @@ -3,25 +3,30 @@ - - + + - - - + + + - - - + + + + + + + + - + @@ -29,21 +34,21 @@ - + - + - + @@ -54,7 +59,7 @@ - + @@ -68,7 +73,7 @@ - + @@ -84,17 +89,17 @@ - + --> - + - + + + + diff --git a/aidatlu/misc/aida_tlu_test.conf b/aidatlu/misc/aida_tlu_test.conf new file mode 100644 index 0000000..051edcf --- /dev/null +++ b/aidatlu/misc/aida_tlu_test.conf @@ -0,0 +1,105 @@ +[Producer.aida_tlu] +## GENERAL PARAMETERS +verbose= 1 +skipconf= 0 +confid= 20180910 +delayStart= 200 + +## HDMI CONFIGURATION +# 4-bits to determine direction of HDMI pins +HDMI1_set= 0x7 +HDMI2_set= 0x7 +HDMI3_set= 0x7 +HDMI4_set= 0x7 +# Clock source (0= no clock, 1= Si5345, 2= FPGA) +HDMI1_clk = 1 +HDMI2_clk = 1 +HDMI3_clk = 1 +HDMI4_clk = 1 +# Enable/Disable clock on differential LEMO +LEMOclk = 0 + +## PMT POWER CONFIGURATION +PMT1_V= 0.1 +PMT2_V= 0.2 +PMT3_V= 0.4 +PMT4_V= 0.8 + +## TRIGGER CONFIGURATION +trigMaskHi = 0x00000000 +trigMaskLo = 0x00000002 +in0_STR = 1 +in0_DEL = 0 +in1_STR = 1 +in1_DEL = 0 +in2_STR = 1 +in2_DEL = 0 +in3_STR = 1 +in3_DEL = 0 +in4_STR = 1 +in4_DEL = 0 +in5_STR = 1 +in5_DEL = 0 +# Generate internal triggers (in Hz, 0= no triggers) +InternalTriggerFreq= 0 + +## DISCRIMINATOR THRESHOLDS +DACThreshold0 = -0.12 +DACThreshold1 = -0.12 +DACThreshold2 = -0.12 +DACThreshold3 = -0.12 +DACThreshold4 = -0.12 +DACThreshold5 = -0.12 + +## DUT CONFIGURATION + # DUTMask Which DUTs are on +DUTMask= 0x8 + # DUTMaskMode Define AIDA (11) or EUDET (00) mode (2 bits per DUT) +DUTMaskMode= 0xFC + # In EUDET mode: 0 = standard trigger/busy mode, 1 = raising BUSY outside handshake vetoes triggers (2 bits per DUT) +DUTMaskModeModifier= 0xC0 + # Ignore the BUSY signal for a DUT (0xF) +DUTIgnoreBusy= 0xF + # Rising shutter ignores triggers +DUTIgnoreShutterVeto= 0x1 +EnableRecordData= 1 + + +# EnableShutterMode: 0x1. If 1, shutter mode is enabled. If 0, shutter mode is disabled. +EnableShutterMode= 0x1 +# Define which input is used for shutter source [0 - 5] +ShutterSource = 5 +# 32-bit counter of clocks. Set to 0 to not use internal shutter generator. +InternalShutterInterval = 0 +# 32-bit counter of clocks +ShutterOnTime = 200 +# 32-bit counter of clocks +ShutterVetoOffTime = 300 +# 32-bit counter of clocks +ShutterOffTime = 400 + +## DATA COLLECTOR +EUDAQ_DC= my_dc + + +[LogCollector.log] +# Currently, all LogCollectors have a hardcoded runtime name: log +# nothing + + +[DataCollector.my_dc] +EUDAQ_MN=my_mon +# send assambled event to the monitor with runtime name my_mon; +EUDAQ_FW=native +# the format of data file +EUDAQ_FW_PATTERN=test_$12D_run$6R$X +# the name pattern of data file +# the $12D will be converted a data/time string with 12 digits. +# the $6R will be converted a run number string with 6 digits. +# the $X will be converted the suffix name of data file. + + +[Monitor.my_mon] +EX0_ENABLE_PRINT=0 +EX0_ENABLE_STD_PRINT=0 +EX0_ENABLE_STD_CONVERTER=1 diff --git a/TLU_v1e/scripts/localIni.ini b/aidatlu/misc/aida_tlu_test.ini similarity index 81% rename from TLU_v1e/scripts/localIni.ini rename to aidatlu/misc/aida_tlu_test.ini index 2c79f2a..4db65fc 100644 --- a/TLU_v1e/scripts/localIni.ini +++ b/aidatlu/misc/aida_tlu_test.ini @@ -1,9 +1,10 @@ -[Producer.fmctlu] -initid= 20170703 +[Producer.aida_tlu] +initid= 20180910 verbose = 1 -ConnectionFile= "file://./fmctlu_connection.xml" -DeviceName="fmctlu.udp" -TLUmod= "1e" +ConnectionFile= "file://./../user/eudet/misc/hw_conf/aida_tlu/aida_tlu_connection.xml" +DeviceName = "aida_tlu.controlhub" +#DeviceName = "aida_tlu.udp" +TLUmod = "1e" # number of HDMI inputs, leave 4 even if you only use fewer inputs nDUTs = 4 nTrgIn = 6 @@ -25,8 +26,6 @@ I2C_ID_Addr = 0x50 I2C_EXP1_Addr = 0x74 #I2C address of 2st expander PCA9539PW I2C_EXP2_Addr = 0x75 -#I2C address of EEPROM on powermodule -I2C_pwrId_Addr = 0x51 #I2C address of AD5665R on powermodule I2C_DACModule_Addr = 0x1C # Max value for control voltage on PMTs (usually 1 V) @@ -39,7 +38,7 @@ I2C_EXP2Module_Addr = 0x77 ##CONFCLOCK 0= skip clock configuration, 1= configure si5345 CONFCLOCK= 1 -CLOCK_CFG_FILE = /home/silab/git/aida-tlu/TLU_v1e/scripts/localClock.txt +CLOCK_CFG_FILE = "./../user/eudet/misc/hw_conf/aida_tlu/aida_tlu_clk_config.txt" [LogCollector.log] diff --git a/packages/TLU_v1e/output.csv b/aidatlu/online_monitor/__init__.py similarity index 100% rename from packages/TLU_v1e/output.csv rename to aidatlu/online_monitor/__init__.py diff --git a/aidatlu/online_monitor/configuration.yaml b/aidatlu/online_monitor/configuration.yaml new file mode 100644 index 0000000..ce50979 --- /dev/null +++ b/aidatlu/online_monitor/configuration.yaml @@ -0,0 +1,12 @@ + +converter : + AIDA_TLU_Converter : + kind : tlu_converter + frontend : tcp://127.0.0.1:6500 + backend : tcp://127.0.0.1:7501 + theshold: 10 +receiver : + AIDA_TLU : + kind : tlu_receiver + frontend : tcp://127.0.0.1:7501 + \ No newline at end of file diff --git a/aidatlu/online_monitor/tlu_converter.py b/aidatlu/online_monitor/tlu_converter.py new file mode 100644 index 0000000..05ed4a1 --- /dev/null +++ b/aidatlu/online_monitor/tlu_converter.py @@ -0,0 +1,29 @@ +from online_monitor.converter.transceiver import Transceiver +import zmq +from online_monitor.utils import utils + + +class AIDATLUConverter(Transceiver): + def deserialize_data(self, data): + m = data.decode() + m = "".join([i for i in m if i not in ["[", "]", " "]]) + m = m.split(" ") + m = list(filter(None, m)) + for i in range(len(m)): + m[i] = m[i].replace(",", "") + m = [float(i) for i in m] + return m + + def interpret_data(self, data): + interpreted_data = { + "Address": data[0][0], + "Run Time": data[0][1][0], + "Event Number": data[0][1][1], + "Total trigger numb": data[0][1][2], + "Particle Rate": data[0][1][3], + "Trigger freq": data[0][1][4], + } + return [interpreted_data] + + def serialize_data(self, data): + return utils.simple_enc(None, data) diff --git a/aidatlu/online_monitor/tlu_receiver.py b/aidatlu/online_monitor/tlu_receiver.py new file mode 100644 index 0000000..555a61c --- /dev/null +++ b/aidatlu/online_monitor/tlu_receiver.py @@ -0,0 +1,118 @@ +from online_monitor.receiver.receiver import Receiver + +import pyqtgraph as pg +from pyqtgraph.dockarea import DockArea, Dock +from PyQt5 import QtWidgets +import pyqtgraph as pg +from pyqtgraph.dockarea import DockArea, Dock +from online_monitor.utils import utils + + +class AIDATLUReciever(Receiver): + def setup_receiver(self): + # self.set_bidirectional_communication() # We want to change converter settings + self.hitrate_data = [] + self.runtime = [] + self.particlerate_data = [] + + def setup_widgets(self, parent, name): + dock_area = DockArea() + parent.addTab(dock_area, name) + # Docks + dock_rate = Dock("Particle rate (Trigger rate)", size=(400, 400)) + dock_status = Dock("Status", size=(800, 40)) + dock_area.addDock(dock_rate, "above") + dock_area.addDock(dock_status, "top") + + # Status dock on top + cw = QtWidgets.QWidget() + cw.setStyleSheet("QWidget {background-color:white}") + layout = QtWidgets.QGridLayout() + cw.setLayout(layout) + + self.hit_rate_label = QtWidgets.QLabel("Trigger Frequency\n0 Hz") + self.timestamp_label = QtWidgets.QLabel("Run Time\n0 s") + self.event_numb_label = QtWidgets.QLabel("Event Number\n0") + self.total_trig_numb = QtWidgets.QLabel("Total Trigger Number\n0") + self.particle_rate_label = QtWidgets.QLabel("Particle Rate\n0") + self.reset_button = QtWidgets.QPushButton("Reset") + layout.addWidget(self.timestamp_label, 0, 0, 0, 1) + layout.addWidget(self.event_numb_label, 0, 1, 0, 1) + layout.addWidget(self.hit_rate_label, 0, 6, 0, 1) + layout.addWidget(self.particle_rate_label, 0, 3, 0, 1) + layout.addWidget(self.total_trig_numb, 0, 2, 0, 1) + layout.addWidget(self.reset_button, 0, 7, 0, 1) + dock_status.addWidget(cw) + + self.reset_button.clicked.connect(lambda: self._reset()) + + # particle rate dock + trigger_rate_graphics = pg.GraphicsLayoutWidget() + trigger_rate_graphics.show() + plot_trigger_rate = pg.PlotItem( + labels={"left": "Rate / Hz", "bottom": "Run Time / s"} + ) + self.trigger_rate_acc_curve = pg.PlotCurveItem(pen="#B00B13") + self.particle_rate_acc_curve = pg.PlotCurveItem(pen="#0000FF") + + # add legend + legend_acc = pg.LegendItem(offset=(80, 10)) + legend_acc.setParentItem(plot_trigger_rate) + legend_acc.addItem(self.trigger_rate_acc_curve, "Accepted Trigger Rate") + legend_real = pg.LegendItem(offset=(80, 50)) + legend_real.setParentItem(plot_trigger_rate) + legend_real.addItem(self.particle_rate_acc_curve, "Particle Rate") + + # add items to plots and customize plots viewboxes + plot_trigger_rate.addItem(self.trigger_rate_acc_curve) + plot_trigger_rate.addItem(self.particle_rate_acc_curve) + + plot_trigger_rate.vb.setBackgroundColor("#E6E5F4") + # plot_trigger_rate.setXRange(0, 200) + plot_trigger_rate.getAxis("left").setZValue(0) + plot_trigger_rate.getAxis("left").setGrid(155) + + # add plots to graphicslayout and layout to dock + trigger_rate_graphics.addItem( + plot_trigger_rate, row=0, col=1, rowspan=1, colspan=2 + ) + dock_rate.addWidget(trigger_rate_graphics) + + # add dict of all used plotcurveitems for individual handling of each plot + self.plots = { + "trigger_rate_acc": self.trigger_rate_acc_curve, + "particle_rate_acc": self.particle_rate_acc_curve, + } + self.plot_delay = 0 + + def deserialize_data(self, data): + return utils.simple_dec(data)[1] + + def refresh_data(self): + if len(self.hitrate_data) > 0: + self.trigger_rate_acc_curve.setData(x=self.runtime, y=self.hitrate_data) + if len(self.particlerate_data) > 0: + self.particle_rate_acc_curve.setData( + x=self.runtime, y=self.particlerate_data + ) + + def handle_data(self, data): + self.hitrate_data.append(data["Trigger freq"]) + self.particlerate_data.append(data["Particle Rate"]) + self.runtime.append(data["Run Time"]) + self.timestamp_label.setText("Run Time\n%0.2f s" % data["Run Time"]) + self.event_numb_label.setText("Event Number\n%i" % data["Event Number"]) + self.total_trig_numb.setText( + "Total Trigger Number\n%i" % data["Total trigger numb"] + ) + self.particle_rate_label.setText( + "Particle Rate\n%0.2f Hz" % data["Particle Rate"] + ) + self.hit_rate_label.setText( + "Trigger Frequency\n%0.2f Hz" % data["Trigger freq"] + ) + + def _reset(self): + self.hitrate_data = [] + self.runtime = [] + self.particlerate_data = [] diff --git a/aidatlu/test/__init__.py b/aidatlu/test/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/aidatlu/test/hardware_test.py b/aidatlu/test/hardware_test.py new file mode 100644 index 0000000..f0015be --- /dev/null +++ b/aidatlu/test/hardware_test.py @@ -0,0 +1,212 @@ +from aidatlu.main.tlu import AidaTLU +from aidatlu.hardware.i2c import I2CCore +from aidatlu.hardware.ioexpander_controller import IOControl +from aidatlu.hardware.dac_controller import DacControl +from aidatlu.hardware.clock_controller import ClockControl +from aidatlu.hardware.dut_controller import DUTLogic +from aidatlu.hardware.trigger_controller import TriggerLogic +from aidatlu.main.config_parser import TLUConfigure + +import uhal +import time +import numpy as np + + +class Test_IOCControl: + uhal.setLogLevelTo(uhal.LogLevel.NOTICE) + manager = uhal.ConnectionManager("file://../misc/aida_tlu_connection.xml") + hw = uhal.HwInterface(manager.getDevice("aida_tlu.controlhub")) + + i2c = I2CCore(hw) + i2c.init() + ioexpander = IOControl(i2c) + + def test_ioexpander_led(self) -> None: + self.ioexpander.all_off() + self.ioexpander.test_leds(single=True) + self.ioexpander.all_off() + time.sleep(1) + self.ioexpander.all_on() + time.sleep(2) + self.ioexpander.all_off() + + def test_configure_hdmi(self) -> None: + for i in range(4): + self.ioexpander.configure_hdmi(i + 1, "1111") + self.ioexpander.clock_hdmi_output(i + 1, "chip") + time.sleep(1) + self.ioexpander.configure_hdmi(i + 1, "0000") + self.ioexpander.clock_hdmi_output(i + 1, "off") + + def test_clock_lemo_output(self): + self.ioexpander.clock_lemo_output(True) + time.sleep(1) + self.ioexpander.clock_lemo_output(False) + + +class Test_DacControl: + uhal.setLogLevelTo(uhal.LogLevel.NOTICE) + manager = uhal.ConnectionManager("file://../misc/aida_tlu_connection.xml") + hw = uhal.HwInterface(manager.getDevice("aida_tlu.controlhub")) + + i2c = I2CCore(hw) + i2c.init() + dac_true = DacControl(i2c, True) + dac_false = DacControl(i2c, False) + + def test_set_threshold(self) -> None: + for i in range(7): + for volts in np.arange(-1.3, 1.3, 1.3): + self.dac_true.set_threshold(i + 1, volts) + time.sleep(0.2) + self.dac_true.set_threshold(i + 1, 0) + time.sleep(0.5) + for i in range(7): + for volts in np.arange(-1.3, 1.3, 1.3): + self.dac_false.set_threshold(i + 1, volts) + time.sleep(0.2) + self.dac_false.set_threshold(i + 1, 0) + + def test_set_voltage(self) -> None: + for i in range(4): + for volts in np.arange(0, 1, 0.5): + self.dac_true.set_voltage(i + 1, volts) + time.sleep(0.2) + self.dac_true.set_voltage(5, 0) + + +class Test_ClockControl: + uhal.setLogLevelTo(uhal.LogLevel.NOTICE) + manager = uhal.ConnectionManager("file://../misc/aida_tlu_connection.xml") + hw = uhal.HwInterface(manager.getDevice("aida_tlu.controlhub")) + i2c = I2CCore(hw) + i2c.init() + ioexpander = IOControl(i2c) + clock = ClockControl(i2c, ioexpander) + + def test_device_info(self) -> None: + self.clock.log.info("Device Version: %i" % self.clock.get_device_version()) + self.clock.log.info("Design ID: %s" % self.clock.check_design_id()) + + def test_write_clock_register(self): + self.clock.write_clock_conf("../misc/aida_tlu_clk_config.txt") + + +class Test_DUTLogic: + uhal.setLogLevelTo(uhal.LogLevel.NOTICE) + manager = uhal.ConnectionManager("file://../misc/aida_tlu_connection.xml") + hw = uhal.HwInterface(manager.getDevice("aida_tlu.controlhub")) + + i2c = I2CCore(hw) + i2c.init() + dut = DUTLogic(i2c) + + def test_set_dut_mask(self) -> None: + time.sleep(1) + self.dut.set_dut_mask("1010") + time.sleep(1) + self.dut.set_dut_mask("0000") + + def test_set_dut_mask_mode(self): + self.dut.set_dut_mask_mode("00000000") + time.sleep(1) + self.dut.set_dut_mask_mode("11111111") + time.sleep(1) + self.dut.set_dut_mask_mode("01010101") + + def test_set_dut_mask_modifier(self) -> None: + # TODO What input here? + self.dut.set_dut_mask_mode_modifier(1) + time.sleep(1) + self.dut.set_dut_mask_mode_modifier(0) + + def test_set_dut_ignore_busy(self): + self.dut.set_dut_ignore_busy("1111") + time.sleep(1) + self.dut.set_dut_ignore_busy("0000") + + def test_set_dut_ignore_busy(self) -> None: + self.dut.set_dut_ignore_shutter(0) + + +class Test_TriggerLogic: + uhal.setLogLevelTo(uhal.LogLevel.NOTICE) + manager = uhal.ConnectionManager("file://../misc/aida_tlu_connection.xml") + hw = uhal.HwInterface(manager.getDevice("aida_tlu.controlhub")) + + i2c = I2CCore(hw) + trigger = TriggerLogic(i2c) + + def test_set_internal_trigger_frequency(self) -> None: + self.trigger.set_internal_trigger_frequency(0) + self.trigger.set_internal_trigger_frequency(10000) + self.trigger.set_internal_trigger_frequency(0) + + def test_set_trigger_veto(self) -> None: + self.trigger.set_trigger_veto(True) + time.sleep(1) + self.trigger.set_trigger_veto(False) + + def test_set_trigger_polarity(self): + self.trigger.set_trigger_polarity(1) + time.sleep(1) + self.trigger.set_trigger_polarity(0) + + def test_set_trigger_mask(self): + self.trigger.set_trigger_mask(0b0, 0b1) + time.sleep(1) + self.trigger.set_trigger_mask(0b0, 0b0) + + def test_set_pulse_stretch_pack(self) -> None: + self.trigger.set_pulse_stretch_pack([1, 1, 1, 1, 1, 1]) + time.sleep(1) + self.trigger.set_pulse_stretch_pack([2, 2, 2, 2, 2, 2]) + + def test_set_pulse_delay_pack(self) -> None: + self.trigger.set_pulse_delay_pack([0, 0, 0, 0, 0, 0]) + time.sleep(1) + self.trigger.set_pulse_delay_pack([1, 1, 1, 1, 1, 1]) + + +def test_run(): + uhal.setLogLevelTo(uhal.LogLevel.NOTICE) + manager = uhal.ConnectionManager("file://.././misc/aida_tlu_connection.xml") + hw = uhal.HwInterface(manager.getDevice("aida_tlu.controlhub")) + + config_path = "tlu_test_configuration.yaml" + clock_path = "../misc/aida_tlu_clk_config.txt" + tlu = AidaTLU(hw, config_path, clock_path) + + tlu.configure() + tlu.run() + + +if __name__ == "__main__": + test_io = Test_IOCControl() + test_io.test_clock_lemo_output() + test_io.test_configure_hdmi() + test_io.test_ioexpander_led() + + test_dac = Test_DacControl() + test_dac.test_set_threshold() + test_dac.test_set_threshold() + + test_dut = Test_DUTLogic() + test_dut.test_set_dut_ignore_busy() + test_dut.test_set_dut_mask() + test_dut.test_set_dut_mask_mode() + test_dut.test_set_dut_mask_modifier() + + test_clock = Test_ClockControl() + test_clock.test_device_info() + test_clock.test_write_clock_register() + + test_trigger = Test_TriggerLogic() + test_trigger.test_set_internal_trigger_frequency() + test_trigger.test_set_pulse_delay_pack() + test_trigger.test_set_pulse_stretch_pack() + test_trigger.test_set_trigger_mask() + test_trigger.test_set_trigger_polarity() + test_trigger.test_set_trigger_veto() + + test_run = test_run() diff --git a/aidatlu/test/interpreted_data.h5 b/aidatlu/test/interpreted_data.h5 new file mode 100644 index 0000000..f932b2a Binary files /dev/null and b/aidatlu/test/interpreted_data.h5 differ diff --git a/aidatlu/test/raw_data_test.h5 b/aidatlu/test/raw_data_test.h5 new file mode 100644 index 0000000..161a025 Binary files /dev/null and b/aidatlu/test/raw_data_test.h5 differ diff --git a/aidatlu/test/software_test.py b/aidatlu/test/software_test.py new file mode 100644 index 0000000..14b42b6 --- /dev/null +++ b/aidatlu/test/software_test.py @@ -0,0 +1,61 @@ +import numpy as np +import tables as tb +from aidatlu.main.data_parser import DataParser +from aidatlu.main.config_parser import TLUConfigure + + +def test_data_parser(): + data_parser = DataParser() + data_parser.interpret_data("raw_data_test.h5", "interpreted_data_test.h5") + + +def test_interpreted_data(): + features = np.dtype( + [ + ("eventnumber", "u4"), + ("timestamp", "u4"), + ("overflow", "u4"), + ("eventtype", "u4"), + ("input1", "u4"), + ("input2", "u4"), + ("input3", "u4"), + ("input4", "u4"), + ("inpu5", "u4"), + ("input6", "u4"), + ("sc1", "u4"), + ("sc2", "u4"), + ("sc3", "u4"), + ("sc4", "u4"), + ("sc5", "u4"), + ("sc6", "u4"), + ] + ) + + interpreted_data_path = "interpreted_data.h5" + interpreted_test_data_path = "interpreted_data_test.h5" + + with tb.open_file(interpreted_data_path, "r") as file: + table = file.root.interpreted_data + interpreted_data = np.array(table[:], dtype=features) + + with tb.open_file(interpreted_test_data_path, "r") as file: + table = file.root.interpreted_data + interpreted_test_data = np.array(table[:], dtype=features) + + assert np.array_equal(interpreted_data, interpreted_test_data) + + +def test_load_config(): + config_path = "../tlu_configuration.yaml" + config_parser = TLUConfigure(TLU=None, io_control=None, config_path=config_path) + _ = config_parser.get_configuration_table() + _ = config_parser.get_data_handling() + _ = config_parser.get_output_data_path() + _ = config_parser.get_stop_condition() + _ = config_parser.get_zmq_connection() + + +if __name__ == "__main__": + test_data_parser() + test_interpreted_data() + test_load_config() diff --git a/aidatlu/test/tlu_test_configuration.yaml b/aidatlu/test/tlu_test_configuration.yaml new file mode 100644 index 0000000..a5ebece --- /dev/null +++ b/aidatlu/test/tlu_test_configuration.yaml @@ -0,0 +1,59 @@ +################################################ +# +# This configuration is only used during tests +# +############################################### + + +internal_trigger: #Generate TLU internal trigger with given rate in Hz + internal_trigger_rate: 100000 + +dut_module: + dut_1: + mode: 'aida' # 'aida', 'aidatrig', 'eudet', 'any' + dut_2: + mode: 'off' # 'aida', 'aidatrig', 'eudet', 'any' + dut_3: + mode: 'off' # 'aida', 'aidatrig', 'eudet', 'any' + dut_4: + mode: 'off' # 'aida', 'aidatrig', 'eudet', 'any' + +trigger_inputs: #threshold voltages for the trigger inputs in V. + threshold: + threshold_1: -0.1 + threshold_2: -0.1 + threshold_3: -0.1 + threshold_4: -0.1 + threshold_5: -0.1 + threshold_6: -0.1 + + # Trigger Logic configuration accept a python expression for the trigger inputs. + # The logic is set by using the variables for the input channels 'CH1', 'CH2', 'CH3', 'CH4', 'CH5' and 'CH6' + # and the Python bitwise operators AND: '&', OR: '|', NOT: '~' and so on. Dont forget to use brackets... + trigger_inputs_logic: CH1 + + trigger_polarity: #TLU triggers on rising (0) or falling (1) edge + polarity: 1 + + trigger_signal_shape: #Stretches and delays each trigger input signal for an number of clock cycles, + stretch: [2, 2, 2, 2, 2, 2] + delay: [0, 0, 0, 0, 0, 0] + +clock_lemo: + enable_clock_lemo_output: True + +pmt_control: + #PMT control voltages in V + pmt_1: 0.8 + pmt_2: 0.8 + pmt_3: 0 + pmt_4: 0 + +#Save data and generate interpreted data from the raw data set. Set to 'True' or 'False'. +save_data: True +output_data_path: 'test_output_data/' + +#zmq connection leave it blank or set to 'off' if not needed +zmq_connection: 'off' #"tcp://:7500" + +timeout: 5 \ No newline at end of file diff --git a/aidatlu/tlu.py b/aidatlu/tlu.py deleted file mode 100644 index b9c711c..0000000 --- a/aidatlu/tlu.py +++ /dev/null @@ -1,38 +0,0 @@ -import logging - -import logger -from i2c import I2CCore, i2c_addr -from led_controller import LEDControl - - -class AidaTLU(object): - def __init__(self, hw) -> None: - self.log = logger.setup_main_logger(__class__.__name__, logging.DEBUG) - - self.i2c = I2CCore(hw) - self.i2c.init() - if self.i2c.modules["eeprom"]: - self.log.info("Found device with ID %s" % hex(self.get_device_id())) - self.led_controller = LEDControl(self.i2c) - - # init pwrled - - # if present, init display - - def get_device_id(self) -> int: - """Read back board id. Consists of six blocks of hex data - - Returns: - int: Board id as 48 bits integer - """ - id = [] - for addr in range(6): - id.append(self.i2c.read(self.i2c.modules["eeprom"], 0xFA + addr) & 0xFF) - - return int("0x" + "".join(["{:x}".format(i) for i in id]), 16) & 0xFFFFFFFFFFFF - - def get_fw_version(self) -> int: - return self.i2c.read_register("version") - - def init_power_leds(self) -> None: - raise NotImplementedError("TODO") diff --git a/aidatlu/tlu_configuration.yaml b/aidatlu/tlu_configuration.yaml new file mode 100644 index 0000000..ce9e432 --- /dev/null +++ b/aidatlu/tlu_configuration.yaml @@ -0,0 +1,49 @@ +internal_trigger: #Generate TLU internal trigger with given rate in Hz + internal_trigger_rate: 10000 + +dut_module: + dut_1: + mode: 'aida' # 'aida', 'aidatrig', 'eudet', 'any' + dut_2: + mode: 'aida' # 'aida', 'aidatrig', 'eudet', 'any' + dut_3: + mode: 'eudet' # 'aida', 'aidatrig', 'eudet', 'any' + dut_4: + mode: 'off' # 'aida', 'aidatrig', 'eudet', 'any' + +trigger_inputs: #threshold voltages for the trigger inputs in V. + threshold: + threshold_1: -0.1 + threshold_2: -0.1 + threshold_3: -0.1 + threshold_4: -0.1 + threshold_5: -0.1 + threshold_6: -0.1 + + # Trigger Logic configuration accept a python expression for the trigger inputs. + # The logic is set by using the variables for the input channels 'CH1', 'CH2', 'CH3', 'CH4', 'CH5' and 'CH6' + # and the Python bitwise operators AND: '&', OR: '|', NOT: '~' and so on. Dont forget to use brackets... + trigger_inputs_logic: CH2 & CH4 + + trigger_polarity: #TLU triggers on rising (0) or falling (1) edge + polarity: 1 + + trigger_signal_shape: #Stretches and delays each trigger input signal for an number of clock cycles, + stretch: [2, 2, 2, 2, 2, 2] + delay: [0, 0, 0, 0, 0, 0] + +clock_lemo: + enable_clock_lemo_output: True +pmt_control: + #PMT control voltages in V + pmt_1: 0.8 + pmt_2: 0.8 + pmt_3: 0 + pmt_4: 0 + +#Save data and generate interpreted data from the raw data set. Set to 'True' or 'False'. +save_data: True +output_data_path: '/media/data/ITK_DEBUG/tests_3/itk/chip_0/' + +#zmq connection leave it blank or set to 'off' if not needed +zmq_connection: 'off' #"tcp://127.0.0.1:6500" diff --git a/aidatlu/tlu_data/README.md b/aidatlu/tlu_data/README.md new file mode 100644 index 0000000..6e6cd5f --- /dev/null +++ b/aidatlu/tlu_data/README.md @@ -0,0 +1,2 @@ +Data folder to collect raw output data and interpreted data. +The data format is: tlu_raw_runnumber_date or tlu_interpreted_runnumber_date. \ No newline at end of file diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..d0c3cbf --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = source +BUILDDIR = build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000..747ffb7 --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=source +set BUILDDIR=build + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.https://www.sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "" goto help + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/docs/source/Configuration.rst b/docs/source/Configuration.rst new file mode 100644 index 0000000..57859d8 --- /dev/null +++ b/docs/source/Configuration.rst @@ -0,0 +1,7 @@ +.. mdinclude:: ../../aidatlu/README.md + +Configuration File +********************** + +.. literalinclude:: ../../aidatlu/tlu_configuration.yaml + :language: yaml \ No newline at end of file diff --git a/docs/source/Documentation.rst b/docs/source/Documentation.rst new file mode 100644 index 0000000..8b867f9 --- /dev/null +++ b/docs/source/Documentation.rst @@ -0,0 +1,353 @@ +Documentation +================== + +.. image:: img/structure.png + :width: 600 + +Introduction +************* + +The documentation presented here describes a newly adapted Python based control system for the AIDA-2020 Trigger Logic Unit (TLU). +This system is mostly based upon the EUDAQ2 TLU software (https://github.com/eudaq/eudaq/tree/master/user/tlu) +with some additional features for better usability and integration into the SiLab-Bonn infrastructure. +In the following the control of the different hardware components as well as additional features of the control software are described. +And a rough summary of the original documentation (https://ohwr.org/project/fmc-mtlu) is presented. +During developing the present software I stumbled over some technical details which are also shown below. + +Hardware +******************** + +Inter-Integrated Circuit I^2C +--------------------------------- + +The configuration of the different board features and hardware components goes via I^2C interface. +This interface is widely used as a serial communication bus and provides the protocol for the Ethernet communication driver. +IPbus (https://ipbus.web.cern.ch/doc/user/html/) allows the access to the FPGA hardware of the TLU. +The user interface uHAL (https://ipbus.web.cern.ch/doc/user/html/software/uhalQuickTutorial.html) is a C++/Python library +for all needed read/write hardware level functionality. +Each register has an identifying address. The addresses can be found in a yaml file (take a look at /misc). +The script i2c.py writes and reads bits to and from each of these registers. + +I/O Expander +--------------------------------- +The TLU uses four I/O expander PCA9539PW. +Each of these chips provide two 8-bit input output expansions and can be used in parallel. +The 11 front panel LEDs are controlled by two expanders where the other two configure the 4 HDMI inputs and/or outputs of the DUT interfaces. +To configure the chip and to set for e.q. the polarity of one of the 8-bit expansions a command byte is set to the register. +Afterwards the actual data follows. +The script ioexpander\_controller.py writes the command byte to the right expander. +To control the four expanders the script uses an identifier for the two +LED expanders (io\_exp = 1) and two output expanders (io\_exp = 2). +To further differentiate each of the two expanders another identifier is used (exp\_id). + +Clock Chip +--------------------------------- +A Si5345 is used for clock generation. +This clock is used internally in for e.q. the trigger generation, but can also be distributed to each of the DUT's for synchronous operating mode. +The chip allows the generation of internal triggers in principle up to 160 MHz. +The trigger rate is calculated from clock intervals this leads to a rounding error for higher trigger frequencies. +So higher trigger frequencies are shifted slightly. + +The clock chip needs to be configured. To do so a configuration file containing ~380 address-data pairs is written to the chip via I^2C. +This configuration file can be generated by software (https://www.skyworksinc.com/en/application-pages/clockbuilder-pro-software). +The default clock frequency using the default configuration file is 40 MHz. For now this frequency can not be changed. +The script clock\_controller.py configures the chip. +Most of the other functions are just used for bug fixing. + +Digital-Analog-Converter DAC +--------------------------------- +To transform the different output and input voltages from digital signals to analog signals (or the other way around), +three AD5665R DAC's are used. +Here one DAC's is used for the photomultiplier (PMT) power outputs the other two for the threshold of the trigger inputs. +According to the data sheet the DAC's have an internal reference voltage of 2.5 V. +Nevertheless an external voltage of 1.3 V is set as default for all implemented user cases. +Each DAC has four output pins that can be used in parallel. +Functions to control the DAC's can be found in voltage\_controller. + +Power DAC's ++++++++++++++++ +The four output channels of one DAC are dedicated to the control voltage of the four different PMT power outputs. +Each output has a range of 0 V to 1 V, using the external reference voltage. +Where an internal reference voltage leads to a possible output voltage of up to 2 V. + +Power Module ++++++++++++++++++ +Four 4-pin LEMO connectors not only deliver a control voltage but also distribute power in general to the PMT's. +The LEMO has the following pin connections. +Pin 1 is used for 12 V general power, pin 2 is not connected. +The control voltage is on pin 3 and has the range [0; 1] V. +At last pin 4 is connected to ground. + +.. image:: img/4_pin_lemo.png + :width: 300 + +Three green LEDs on the front panel indicate the correct functioning of the power module. +The POWER LED for 12 V supply voltage, the other two are for 5 V voltage regulators. + +Threshold DAC's ++++++++++++++++++++ +To transform the analog signals of the 6 trigger inputs to digital signals two DAC's are in use. +The first two inputs are connected to one DAC the last 4 to the other one. +Each input channel is connected in reverse to the DAC input. +A mapping in software corrects these connections. +To set the threshold of one input channel one uses the function set\_threshold with the trigger input from 1 to 6 +and set the threshold to Volt. The threshold range is [-1.3; 1.3] V. +The calculated voltage resolution is about 40 uV. +These values correspond to the external reference voltage, as the default. +Also some people say trigger input 2 has some glitches. + +DUT interfaces (HDMI connectors) +--------------------------------- +Four HDMI connectors are used as the interface between the TLU and the different DUT devices. +Each pin works bidirectional any two differential signal pairs can be set as output or input. +The direction of the HDMI pins is set by two I/O expanders with the following signal pins. +Where the first differential signal is a clock signal (CLK). +This clock signal can be enabled/disabled and is provided either by the Clock Chip or directly from the FPGA clock. +For now the clock from the FPGA does not work. +Depending on the operating mode also different trigger words are sent through the clock line (e.q. trigger number in EUDET mode). +The next signal is the content (CONT). This signal is used by the TLU to issue control commands. +The BUSY signal is usually set by the DUT and raises a VETO for the generation of new trigger depending on operating mode. +SPARE is only used by the AIDA mode and raises a reset signal at the start of runs and should also be driven by the TLU. +Trigger (TRIG) is set by the TLU at default. +Through the trigger line not only trigger signals are issued but also trigger words depending on the operating mode. +Setting the correct polarity to these pins is essential for correct operation working of the TLU. +One should also note that DUT interface should not be used in AIDA mode according to higher sources. + +.. image:: img/hdmi.png + :width: 400 + +.. table:: + :align: left + + +---------+------------------+ + |HDMI PIN | HDMI Signal Name | + +=========+==================+ + |1 | CLK | + +---------+------------------+ + |2 | GND | + +---------+------------------+ + |3 | CLK* | + +---------+------------------+ + |4 | CONT | + +---------+------------------+ + |5 | GND | + +---------+------------------+ + |6 | CONT* | + +---------+------------------+ + |7 | BUSY | + +---------+------------------+ + |8 | GND | + +---------+------------------+ + |9 | BUSY* | + +---------+------------------+ + |10 | SPARE | + +---------+------------------+ + |11 | GND | + +---------+------------------+ + |12 | SPARE* | + +---------+------------------+ + |13 | n.c. | + +---------+------------------+ + |14 | POWER | + +---------+------------------+ + |15 | TRIG | + +---------+------------------+ + |16 | TRIG* | + +---------+------------------+ + |17 | GND | + +---------+------------------+ + |18 | n.c. | + +---------+------------------+ + |19 | n.c. | + +---------+------------------+ + +DUT Logic +--------------------------------- +The DUT logic in dut\_controller.py sets the DUT operating modes. +Different DUT devices are enabled or disabled by the function set\_dut\_mask. +One important thing is to only enable DUT interfaces that are in use. +A not connected device configured in handshake mode blocks the working of the TLU. +The operating mode is set by the function set\_dut\_mask\_mode each DUT is controlled by two bits in an 8-bit WORD. +Bit 0 and 1 control DUT 1, bit 2 and 3 DUT 2 and so on. AIDA mode is set by setting the bits to 11 and EUDET mode by setting 00. +So to set DUT 1 to AIDA mode and the rest to EUDET mode one hast to set the bit-WORD '00000011' to the function. + +Trigger Logic +--------------------------------- +The TLU can produce valid triggers from six different trigger inputs. +Each input can accept or veto new triggers. +Between each trigger input there is also the possibility to set 'AND' or 'OR'. +This leads to 64 possible combinations of so-called trigger words. +Where each trigger word describes one specific trigger configuration. +One obtains the resulting trigger configuration to write into the trigger logic register by adding up all desired valid trigger configurations. +For example if one need triggers from input 1 or input 2. +Than all valid trigger combinations, ignoring the inputs channels 3-6 are: + +.. table:: + :align: left + + +--------+---------+ + |Input 1 | Input 2 | + +========+=========+ + |1 | 0 | + +--------+---------+ + |0 | 1 | + +--------+---------+ + |1 | 1 | + +--------+---------+ + +The software uses two different variants of these words. +A long word variant which is just the 64-bit trigger word. +For the second variant the long word is split into two 32-bit words (mask\_low and mask\_high). +To help with the generation of these trigger words, the software uses a specific function to translate +the trigger settings in the configuration file to these words. + +The trigger signals from the different trigger inputs can be stretched and delayed accounting for +different trigger hardware setups. +Also, the TLU can trigger on the rising or falling edge of incoming trigger signals. + +An additional feature of the trigger logic is the generation of internal triggers. +In the configuration file a specific trigger frequency can be set and the TLU will then generate triggers with said frequency. +The theoretical range of these triggers is between 0 Hz and 160 MHz. +Because the trigger frequency is calculated in reference to a clock interval, there is for now a +rounding error for higher frequency. This shifts the actual output trigger frequency. + +The number of triggers since the last trigger VETO is stored together with the +total number of triggers per run. +From these numbers general status messages for e.q. the trigger rate are generated. +These status messages can also be distributed over a ZMQ socket using the online monitor. + +Operating Modes +***************** +The TLU runs in different operating modes. This allows more flexibility for different DUT readout setups. +Different modes can provide clock synchronizations or distributes the trigger number together with the trigger signal. +Each DUT can be run in different operating modes where a single one vetos new triggers for all devices. +This vetoing for all devices can be disabled (but is not implemented). + +EUDET Handshake Mode +--------------------------- +The TLU sets TRIGGER to high for 1 clock cycles. Afterwards the DUT asserts BUSY and sends a clock to the TLU through CLOCK. +This clocks out the trigger number from the TLU to TRIGGER. +To set the software to the EUDET operating mode a 0b00 is set to the according DUT logic. +The clock output needs to be disabled for this mode to work. +If the clock output is enabled then the trigger number is not clocked out correctly. +Only the least significant 15 bit of the trigger word are sent out. + +AIDA Mode +----------- +In AIDA mode the clock of the TLU and the DUT is synchronized. +For this the TLU clock needs to be distributed. +The distribution of the clock via the LEMO has the problem that the clock signal form no longer arrives cleanly at the device. +So distributing the clock usign the HDMI connectors is advised. +An important step is to synchronize all delays (e.q. different cable length) of the clock signal with the trigger signal if encountered. + +At the start of a run the TLU sends out a RESET signal to the DUT. +This signal can then be used by the DUT to synchronize the timestamp of the device and the TLU. +Then the TLU sends triggers continuously to the DUT. +Where each trigger signal has a length of one clock cycle. +To generate a new trigger no answer of the DUT is needed. +But the DUT can veto new trigger signals at any time by asserting BUSY. +The following is a checklist for the working of the AIDA mode together with the (SiLab-Bonn) BDAQ board. + + * AIDA Mode BDAQ Firmware. Here the external trigger clock is used also internally. + * Changes in testbench yaml. + * Change Trigger Mode from 3 to 2. + * Change Trigger Handshake Wait Cycle from 5 to 1. + * Use special clock cable configuration. + So enable the clock LEMO output of the TLU + and connect the clock output to the BDAQ board. + Or use special HDMI RJ45 AIDA mode adapter. + * Check Cable lengths to synchronize clock and trigger signals. + * Note when starting triggering, + the DUT scan needs to be started before the TLU scan for the timestamp + RESET to arrive. + * For now also the AIDA mode needs to be enabled in the scan configurations. + This can for now only be found on a special TJ DAQ branch. + Or in the testbench yaml, depending on the setup there is to enable RESET option. + +If only one BDAQ board is used in AIDA mode there is a chance for two very fast trigger to occur right one after the other. +If the distance between the triggers is smaller than the distance between the first trigger signal and the BUSY signal. +Then the tlu sends out two triggers because no handshake is awaited. +This leads to an event number drift. +This can be prevented by stretching the trigger input signal by some clock cycles. +Another important thing is to follow the procedure for starting an AIDA run: + + * configure TLU + * start all DUT's, telescopes and time reference plane scans + * start TLU run + +AIDA Mode with Trigger Number +--------------------------------- +This operating mode is an extension of the AIDA mode. +The difference to the standard AIDA mode is, that additionally at each trigger +the trigger number is sent through RESET. + +Additional features +******************** + +Online Monitor +---------------- +The Online Monitor (https://github.com/SiLab-Bonn/online_monitor) creates real-time plots of a dataset. +This allows live observation of the trigger rate during operation. +The TLU scripts sends status information containing the trigger rate, event number, trigger number and run time to a converter script. +The converter script translates the data format and sends the data to a receiver script. +The online monitor uses a receiver script to create the real time data plots. +The Data is sent and received using ZMQ sockets (https://zeromq.org/). +The ZMQ connection can be enabled and disabled in the configuration file. +To start the online monitor one navigates to the directory and uses for e.q. the terminal command: + +.. code-block:: console + + start_online_monitor configuration.yaml + +Another command reliable stops all instances of the running online monitor: + +.. code-block:: console + + stop_online_monitor + +Tests +------ +With pytest (https://docs.pytest.org/en/7.4.x/) the AIDA TLU control program can be tested. +In the test directory different testing scripts can be found. +The easiest way to test the whole setup it to navigate to the directory and type pytest into the terminal. +This starts a series of testing functions that start and stop different aspects of the control software. +The test setup helps to find bugs when further developing the TLU program and also to check for depreciated functions. +For now this testing needs a functioning connection to a AIDA TLU. +The command: + +.. code-block:: console + + pytest + +executes the complete testing infrastructure. +But also the individual log outputs can be displayed. + +.. code-block:: console + + pytest -o log_cli=True + +Tests can be run individually. + +.. code-block:: console + + pytest software_test.py + +Log Level +------ +To set different log levels change the default log level in logger.py 'setup_main_logger' and 'setup_derived_logger'. + +Integration into EUDAQ2 +------------------------ +Due to the similarities of the python control software and the established EUDAQ TLU software +an integration into EUDAQ2 is possible. +The TLUPyProducer.py is an example skeleton of such integration. + +Testing setup +-------------------------- +A small test setup inside the lab is realized using a Pulse Generator. +With this pseudo scintillator pulses are generated. +The TLU then processes these pulses and sends them to one or multiple BDAQ boards. +One can then compare the Data recorded inside the TLU with the one recorded on the BDAQ boards. + +.. image:: img/test_setup_2.png + :width: 650 \ No newline at end of file diff --git a/docs/source/Introduction.rst b/docs/source/Introduction.rst new file mode 100644 index 0000000..fa518fc --- /dev/null +++ b/docs/source/Introduction.rst @@ -0,0 +1,9 @@ + + +.. mdinclude:: ../../README.md + +Structure and communications of the AIDA 202 TLU python control software. + +.. image:: img/structure_software.png + :width: 600 + diff --git a/docs/source/conf.py b/docs/source/conf.py new file mode 100644 index 0000000..8f0001a --- /dev/null +++ b/docs/source/conf.py @@ -0,0 +1,70 @@ +# Configuration file for the Sphinx documentation builder. +# +# For the full list of built-in configuration values, see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Project information ----------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information + + +with open("../../VERSION") as version_file: + version = version_file.read().strip() + +project = "AIDA-TLU" +copyright = "2023, SiLab, Institute of Physics, University of Bonn" +author = "Rasmus Partzsch" +release = version + +import sys +import os + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +sys.path.insert(0, os.path.abspath("../aidatlu")) +sys.path.insert(0, os.path.abspath("../aidatlu/hardware")) +sys.path.insert(0, os.path.abspath("../aidatlu/main")) + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +extensions = [ + "sphinx.ext.napoleon", + "sphinx.ext.doctest", + "sphinx.ext.autodoc", + "sphinx.ext.autosummary", + "sphinx.ext.todo", + "sphinx_mdinclude", + "sphinx.ext.viewcode", +] + +autosectionlabel_prefix_document = True + +templates_path = ["_templates"] +exclude_patterns = [] + + +source_suffix = { + ".rst": "restructuredtext", + ".txt": "markdown", + ".md": "markdown", +} + +autodoc_mock_imports = ["hardware", "DutLogic", "main", "uhal"] + +# -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output + +html_theme = "pydata_sphinx_theme" +html_static_path = ["_static"] + +html_theme_options = { + # [...] + # "show_toc_level": 2, + # "show_nav_level": 3, + "primary_sidebar_end": ["indices.html", "sidebar-ethical-ads.html"], + "secondary_sidebar_items": [], + # [...] +} + +html_sidebars = {"*": ["page-toc", "edit-this-page", "sourcelink"]} diff --git a/docs/source/hardware_code.rst b/docs/source/hardware_code.rst new file mode 100644 index 0000000..bccfdb3 --- /dev/null +++ b/docs/source/hardware_code.rst @@ -0,0 +1,40 @@ + +Hardware Level +======================== + +Clock Control +-------------------- + +.. autoclass:: aidatlu.hardware.clock_controller.ClockControl + :members: + +DAC Control +-------------------- + +.. autoclass:: aidatlu.hardware.dac_controller.DacControl + :members: + +DUT Control +-------------------- + +.. autoclass:: aidatlu.hardware.dut_controller.DUTLogic + :members: + +I2C +-------------------- + +.. autoclass:: aidatlu.hardware.i2c.I2CCore + :members: + +IO Expander Control +-------------------- + +.. autoclass:: aidatlu.hardware.ioexpander_controller.IOControl + :members: + +Trigger Control +-------------------- + +.. autoclass:: aidatlu.hardware.trigger_controller.TriggerLogic + :members: + diff --git a/docs/source/img/4_pin_lemo.png b/docs/source/img/4_pin_lemo.png new file mode 100644 index 0000000..9a97942 Binary files /dev/null and b/docs/source/img/4_pin_lemo.png differ diff --git a/docs/source/img/hdmi.png b/docs/source/img/hdmi.png new file mode 100644 index 0000000..ff7b6ac Binary files /dev/null and b/docs/source/img/hdmi.png differ diff --git a/docs/source/img/structure.png b/docs/source/img/structure.png new file mode 100644 index 0000000..17448ef Binary files /dev/null and b/docs/source/img/structure.png differ diff --git a/docs/source/img/structure_software.png b/docs/source/img/structure_software.png new file mode 100644 index 0000000..4cccd80 Binary files /dev/null and b/docs/source/img/structure_software.png differ diff --git a/docs/source/img/test_setup_2.png b/docs/source/img/test_setup_2.png new file mode 100644 index 0000000..8bd9d35 Binary files /dev/null and b/docs/source/img/test_setup_2.png differ diff --git a/docs/source/index.rst b/docs/source/index.rst new file mode 100644 index 0000000..e1cee5c --- /dev/null +++ b/docs/source/index.rst @@ -0,0 +1,26 @@ +.. AIDATLU documentation master file, created by + sphinx-quickstart on Mon Nov 20 13:34:00 2023. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to AIDA-TLU's documentation! +===================================== + +.. toctree:: + :maxdepth: 2 + + Introduction + Configuration + Documentation + +.. toctree:: + :maxdepth: 1 + + hardware_code + main_code + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`search` diff --git a/docs/source/main_code.rst b/docs/source/main_code.rst new file mode 100644 index 0000000..3d375c4 --- /dev/null +++ b/docs/source/main_code.rst @@ -0,0 +1,21 @@ + +Main Level +==================== + +Trigger Logic Unit +#################### + +.. autoclass:: aidatlu.main.tlu.AidaTLU + :members: + +Configuration Parser +#################### + +.. autoclass:: aidatlu.main.config_parser.TLUConfigure + :members: + +Data Parser +#################### + +.. autoclass:: aidatlu.main.data_parser.DataParser + :members: diff --git a/miniTLU/.ftpconfig b/miniTLU/.ftpconfig deleted file mode 100644 index 100a040..0000000 --- a/miniTLU/.ftpconfig +++ /dev/null @@ -1,20 +0,0 @@ -{ - "protocol": "sftp", - "host": "fortis.phy.bris.ac.uk", - "port": 22, - "user": "phpgb", - "pass": "", - "promptForPass": true, - "remote": "/users/phpgb/worklib/fmc-mtlu/firmware/scripts/", - "local": "", - "agent": "", - "privatekey": "", - "passphrase": "", - "hosthash": "", - "ignorehost": true, - "connTimeout": 10000, - "keepalive": 10000, - "keyboardInteractive": false, - "watch": [], - "watchTimeout": 500 -} diff --git a/miniTLU/FmcTluI2c.py b/miniTLU/FmcTluI2c.py deleted file mode 100644 index 04bf598..0000000 --- a/miniTLU/FmcTluI2c.py +++ /dev/null @@ -1,132 +0,0 @@ -import time -#from PyChipsUser import * -from I2cBusProperties import * -from RawI2cAccess import * - - -class FmcTluI2c: - - - ############################ - ### configure i2c connection - ############################ - def __init__(self,board): - self.board = board - i2cClockPrescale = 0x30 - self.i2cBusProps = I2cBusProperties(self.board, i2cClockPrescale) - return - - - ########################## - ### scan all i2c addresses - ########################## - def i2c_scan(self): - list=[] - for islave in range(128): - i2cscan = RawI2cAccess(self.i2cBusProps, islave) - try: - i2cscan.write([0x00]) - device="slave address "+hex(islave)+" " - if islave==0x1f: - device+="(DAC)" - elif islave==0x50: - device+="(serial number PROM)" - elif islave>=0x54 and islave<=0x57: - device+="(sp601 onboard EEPROM)" - else: - device+="(???)" - pass - list.append(device) - pass - except: - pass - pass - return list - - - ################### - ### write to EEPROM - ################### - def eeprom_write(self,address,value): - if address<0 or address>127: - print "eeprom_write ERROR: address",address,"not in range 0-127" - return - if value<0 or value>255: - print "eeprom_write ERROR: value",value,"not in range 0-255" - return - i2cSlaveAddr = 0x50 # seven bit address, binary 1010000 - prom = RawI2cAccess(self.i2cBusProps, i2cSlaveAddr) - prom.write([address,value]) - time.sleep(0.01) # write cycle time is 5ms. let's wait 10 to make sure. - return - - - #################### - ### read from EEPROM - #################### - def eeprom_read(self,address): - if address<0 or address>255: - print "eeprom_write ERROR: address",address,"not in range 0-127" - return - i2cSlaveAddr = 0x50 # seven bit address, binary 1010000 - prom = RawI2cAccess(self.i2cBusProps, i2cSlaveAddr) - prom.write([address]) - return prom.read(1)[0] - - - ###################### - ### read serial number - ###################### - def get_serial_number(self): - result="" - for iaddr in [0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff]: - result+="%02x "%(self.eeprom_read(iaddr)) - pass - return result - - - ################# - ### set DAC value - ################# - def set_dac(self,channel,value , vrefOn = 0 , i2cSlaveAddrDac = 0x1F): - if channel<0 or channel>7: - print "set_dac ERROR: channel",channel,"not in range 0-7 (bit mask)" - return -1 - if value<0 or value>0xFFFF: - print "set_dac ERROR: value",value,"not in range 0-0xFFFF" - return -1 - # AD5665R chip with A0,A1 tied to ground - #i2cSlaveAddrDac = 0x1F # seven bit address, binary 00011111 - print "I2C address of DAC = " , hex(i2cSlaveAddrDac) - dac = RawI2cAccess(self.i2cBusProps, i2cSlaveAddrDac) - # if we want to enable internal voltage reference: - if vrefOn: - # enter vref-on mode: - print "Turning internal reference ON" - dac.write([0x38,0x00,0x01]) - else: - print "Turning internal reference OFF" - dac.write([0x38,0x00,0x00]) - # now set the actual value - sequence=[( 0x18 + ( channel &0x7 ) ) , (value/256)&0xff , value&0xff] - print sequence - dac.write(sequence) - - - - ################################################## - ### convert required threshold voltage to DAC code - ################################################## - def convert_voltage_to_dac(self, desiredVoltage, Vref=1.300): - Vdaq = ( desiredVoltage + Vref ) / 2 - dacCode = 0xFFFF * Vdaq / Vref - return int(dacCode) - - - ################################################## - ### calculate the DAC code required and set DAC - ################################################## - def set_threshold_voltage(self, channel , voltage ): - dacCode = self.convert_voltage_to_dac(voltage) - print " requested voltage, calculated DAC code = " , voltage , dacCode - self.set_dac(channel , dacCode) diff --git a/miniTLU/I2CuHal.py b/miniTLU/I2CuHal.py deleted file mode 100644 index 694c9ef..0000000 --- a/miniTLU/I2CuHal.py +++ /dev/null @@ -1,1000 +0,0 @@ -""" -solidfpa.py provides functionality to control the front end boards currently -being prototyped. - -For the ADC: - One or more LTM9007 ADCs can be controlled via the IPbus SPI block. - Each chip is really two four channel ADCs, with each controlled with a - separate chip select line. Bank A is channels 1, 4, 5, 8. - Bank B is 2, 3, 6, 7. - - Control is via a simple SPI interface where 16 bits are transferred. - b0 is read/!write - b7:1 are the register address - b15:b8 are the data sent to/from the ADC - - If the ADC.cehckwrite flag is True then all write commands will immediately - be confirmed by a read command to the same address. -""" - -import time - -import uhal - -verbose = True -""" -class SoLidFPGA: - - def __init__(self, board, nadc=4, verbose=False, minversion=None): - cm = uhal.ConnectionManager("file://solidfpga.xml") - self.target = cm.getDevice(board) - #self.config() - self.offsets = TimingOffsets(self.target) - self.trigger = Trigger(self.target) - self.databuffer = OutputBuffer(self.target) - self.spi = SPICore(self.target, 31.25e6, 100e3) - self.clock_i2c = I2CCore(self.target, 31.25e6, 40e3, "io.clock_i2c") - self.analog_i2c = I2CCore(self.target, 31.25e6, 40e3, "io.analog_i2c") - self.clockchip = Si5326(self.clock_i2c) - self.adcs = [] - for i in range(1): - self.adcs.append(ADCLTM9007(self.spi, 2 * i, 2 * i + 1)) - # For board Wim sent to Bristol for testing the MCP4725 address seems - # to be 0b1100001, whereas for the first test board the address was - # 0b1100111. - self.gdac = DACMCP4725(self.analog_i2c, 0b1100001, 4.45) - self.trimdacs = [ - DACMCP4728(self.analog_i2c, 0b1100011, 4.45), - DACMCP4728(self.analog_i2c, 0b1100101, 4.45) - ] - self.temp = TempMCP9808(self.analog_i2c) - self.firmwareversion = None - self.minversion = minversion - self.config(7, 16) - - def config(self, slip, tap): - # check ID - boardid = self.target.getNode("ctrl_reg.id").read() - stat = self.target.getNode("ctrl_reg.stat").read() - self.target.dispatch() - if verbose: - print "ID = 0x%x, stat = 0x%x" % (boardid, stat) - self.id = (boardid & 0xffff0000) >> 16 - self.firmwareversion = boardid & 0x0000ffff - if self.minversion is not None: - msg = "Old version of firmware (v%d) running, require >= v%d." % ( - self.firmwareversion, self.minversion) - assert self.firmwareversion >= self.minversion, msg - self.spi.config() - self.clock_i2c.config() - self.analog_i2c.config() - # Check for 40 MHz clock lock - lock = self.target.getNode("ctrl_reg.stat.mmcm_locked").read() - self.target.dispatch() - #assert lock == 1, "No 40 MHz clock clock, code not yet moved to frontend.py" - if lock != 1: - # Config clock chip - self.clockchip.config("siclock/si5326.txt") - time.sleep(1.0) - lock = self.target.getNode("ctrl_reg.stat.mmcm_locked").read() - self.target.dispatch() - assert lock == 1, "No 40 MHz clock clock, Si53266 configuration must have failed." - # Reset clock - timing_rst = self.target.getNode("timing.csr.ctrl.rst") - timing_rst.write(0x1) - self.target.dispatch() - timing_rst.write(0x0) - self.target.dispatch() - lock = False - while not lock: - lock = self.target.getNode("ctrl_reg.stat.mmcm_locked").read() - self.target.dispatch() - clkcount = self.target.getNode("io.freq_ctr.freq.count").read() - self.target.dispatch() - freq = int(clkcount) / 8388.608 # not sure why, from Lukas - if verbose: - print "Frequency = %g MHz" % freq - assert freq > 39 and freq < 41 - # Configure trigger block - self.trigger.config() - # Set timing offset on inputs from ADC - self.offsets.setoffset(slip, tap) - for adc in self.adcs: - adc.config() - print "Analog board temperature = %g C." % self.temp.temp() - - def reset(self, slip=7, tap=16): - if verbose: - print "Resetting board." - # Soft reset - soft_rst = self.target.getNode("ctrl_reg.ctrl.soft_rst") - soft_rst.write(1) - soft_rst.write(0) - self.target.dispatch() - time.sleep(1.0) - if verbose: - print "Reset complete." - self.config(slip, tap) - - def readvoltages(self): - bias = self.gdac.readbias() - print "Global bias = %g V" % bias - trims = "Channel trims:\n" - ichan = 0 - for dac in self.trimdacs: - voltages = dac.readvoltages() - for v in voltages: - trims += " Chan %d, v = %g V\n" % (ichan, v) - ichan += 1 - print trims - - def bias(self, bias): - self.gdac.setbias(bias) - - def trim(self, trim): - for i in range(4): - for trimdac in self.trimdacs: - trimdac.setvoltage(i, trim) - - def trims(self, trims): - for chan in trims: - trim = trims[chan] - ndac = chan / 4 - nchan = chan % 4 - self.trimdacs[ndac].setvoltage(nchan, trim) - -# IPbus blocks -class TimingOffsets: - #Timing offsets for the ADC data deserialisation. - - def __init__(self, target): - self.target = target - - def setoffset(self, slip=7, tap=16): - if verbose: - print "Setting timing offset with channel slip = %d and %d taps." % (slip, tap) - chan_slip = self.target.getNode("timing.csr.ctrl.chan_slip") - for i in range(slip): - chan_slip.write(1) - self.target.dispatch() - chan_slip.write(0) - self.target.dispatch() - chan_inc = self.target.getNode("timing.csr.ctrl.chan_inc") - for i in range(tap): - chan_inc.write(1) - self.target.dispatch() - chan_inc.write(0) - self.target.dispatch() - -class Trigger: - - def __init__(self, target, nsamples=0x800): - self.target = target - self.nsamples = nsamples - self.capture = target.getNode("timing.csr.ctrl.chan_cap") - self.chanselect = target.getNode("ctrl_reg.ctrl.chan") - self.fifo = target.getNode("chan.fifo") - - def config(self): - # Set up channels - for i in range(8): - self.target.getNode("ctrl_reg.ctrl.chan").write(i) - self.target.getNode("chan.csr.ctrl.en_sync").write(1) - self.target.dispatch() - - def trigger(self): - data = [] - self.capture.write(1) - self.capture.write(0) - self.target.dispatch() - for i in range(8): - self.chanselect.write(i) - wf = self.fifo.readBlock(self.nsamples) - self.target.dispatch() - data.append(wf) - return data - -class OutputBuffer: - #Output data block. - - def __init__(self, target): - self.target = target -""" - - -################################################################################ -# /* -# I2C CORE -# */ -################################################################################ - - - -""" -I2C core XML: - - - - - - - - - -""" -class I2CCore: - """I2C communication block.""" - - # Define bits in cmd_stat register - startcmd = 0x1 << 7 - stopcmd = 0x1 << 6 - readcmd = 0x1 << 5 - writecmd = 0x1 << 4 - ack = 0x1 << 3 - intack = 0x1 - - recvdack = 0x1 << 7 - busy = 0x1 << 6 - arblost = 0x1 << 5 - inprogress = 0x1 << 1 - interrupt = 0x1 - - def __init__(self, target, wclk, i2cclk, name="i2c", delay=None): - self.target = target - self.name = name - self.delay = delay - self.prescale_low = self.target.getNode("%s.i2c_pre_lo" % name) - self.prescale_high = self.target.getNode("%s.i2c_pre_hi" % name) - self.ctrl = self.target.getNode("%s.i2c_ctrl" % name) - self.data = self.target.getNode("%s.i2c_rxtx" % name) - self.cmd_stat = self.target.getNode("%s.i2c_cmdstatus" % name) - self.wishboneclock = wclk - self.i2cclock = i2cclk - self.config() - - def state(self): - status = {} - status["ps_low"] = self.prescale_low.read() - status["ps_hi"] = self.prescale_high.read() - status["ctrl"] = self.ctrl.read() - status["data"] = self.data.read() - status["cmd_stat"] = self.cmd_stat.read() - self.target.dispatch() - status["prescale"] = status["ps_hi"] << 8 - status["prescale"] |= status["ps_low"] - for reg in status: - val = status[reg] - bval = bin(int(val)) - if verbose: - print "reg %s = %d, 0x%x, %s" % (reg, val, val, bval) - - def clearint(self): - self.ctrl.write(0x1) - self.target.dispatch() - - def config(self): - #INITIALIZATION OF THE I2S MASTER CORE - #Disable core - self.ctrl.write(0x0 << 7) - self.target.dispatch() - #Write pre-scale register - #prescale = int(self.wishboneclock / (5.0 * self.i2cclock)) - 1 - prescale = 0x30 #FOR NOW HARDWIRED, TO BE MODIFIED - self.prescale_low.write(prescale & 0xff) - self.prescale_high.write((prescale & 0xff00) >> 8) - #Enable core - self.ctrl.write(0x1 << 7) - self.target.dispatch() - - def checkack(self): - inprogress = True - ack = False - while inprogress: - cmd_stat = self.cmd_stat.read() - self.target.dispatch() - inprogress = (cmd_stat & I2CCore.inprogress) > 0 - ack = (cmd_stat & I2CCore.recvdack) == 0 - return ack - - def delayorcheckack(self): - ack = True - if self.delay is None: - ack = self.checkack() - else: - time.sleep(self.delay) - ack = self.checkack()#Remove this? - return ack - -################################################################################ -# /* -# I2C WRITE -# */ -################################################################################ - - - - def write(self, addr, data, stop=True): - """Write data to the device with the given address.""" - # Start transfer with 7 bit address and write bit (0) - nwritten = -1 - addr &= 0x7f - addr = addr << 1 - startcmd = 0x1 << 7 - stopcmd = 0x1 << 6 - writecmd = 0x1 << 4 - #Set transmit register (write operation, LSB=0) - self.data.write(addr) - #Set Command Register to 0x90 (write, start) - self.cmd_stat.write(I2CCore.startcmd | I2CCore.writecmd) - self.target.dispatch() - ack = self.delayorcheckack() - if not ack: - self.cmd_stat.write(I2CCore.stopcmd) - self.target.dispatch() - return nwritten - nwritten += 1 - for val in data: - val &= 0xff - #Write slave memory address - self.data.write(val) - #Set Command Register to 0x10 (write) - self.cmd_stat.write(I2CCore.writecmd) - self.target.dispatch() - ack = self.delayorcheckack() - if not ack: - self.cmd_stat.write(I2CCore.stopcmd) - self.target.dispatch() - return nwritten - nwritten += 1 - if stop: - self.cmd_stat.write(I2CCore.stopcmd) - self.target.dispatch() - return nwritten - -################################################################################ -# /* -# I2C READ -# */ -################################################################################ - - - - def read(self, addr, n): - """Read n bytes of data from the device with the given address.""" - # Start transfer with 7 bit address and read bit (1) - data = [] - addr &= 0x7f - addr = addr << 1 - addr |= 0x1 # read bit - self.data.write(addr) - self.cmd_stat.write(I2CCore.startcmd | I2CCore.writecmd) - self.target.dispatch() - ack = self.delayorcheckack() - if not ack: - self.cmd_stat.write(I2CCore.stopcmd) - self.target.dispatch() - return data - for i in range(n): - self.cmd_stat.write(I2CCore.readcmd) - self.target.dispatch() - ack = self.delayorcheckack() - val = self.data.read() - self.target.dispatch() - data.append(val & 0xff) - self.cmd_stat.write(I2CCore.stopcmd) - self.target.dispatch() - return data - -################################################################################ -# /* -# I2C WRITE-READ -# */ -################################################################################ - - - - def writeread(self, addr, data, n): - """Write data to device, then read n bytes back from it.""" - nwritten = self.write(addr, data, stop=False) - readdata = [] - if nwritten == len(data): - readdata = self.read(addr, n) - return nwritten, readdata - -""" -SPI core XML: - - - - - - - - - - -""" -class SPICore: - - go_busy = 0x1 << 8 - rising = 1 - falling = 0 - - - def __init__(self, target, wclk, spiclk, basename="io.spi"): - self.target = target - # Only a single data register is required since all transfers are - # 16 bit long - self.data = target.getNode("%s.d0" % basename) - self.control = target.getNode("%s.ctrl" % basename) - self.control_val = 0b0 - self.divider = target.getNode("%s.divider" % basename) - self.slaveselect = target.getNode("%s.ss" % basename) - self.divider_val = int(wclk / spiclk / 2.0 - 1.0) - self.divider_val = 0x7f - self.configured = False - - def config(self): - "Configure SPI interace for communicating with ADCs." - self.divider_val = int(self.divider_val) % 0xffff - if verbose: - print "Configuring SPI core, divider = 0x%x" % self.divider_val - self.divider.write(self.divider_val) - self.target.dispatch() - self.control_val = 0x0 - self.control_val |= 0x0 << 13 # Automatic slave select - self.control_val |= 0x0 << 12 # No interrupt - self.control_val |= 0x0 << 11 # MSB first - # ADC samples data on rising edge of SCK - self.control_val |= 0x1 << 10 # change ouput on falling edge of SCK - # ADC changes output shortly after falling edge of SCK - self.control_val |= 0x0 << 9 # read input on rising edge - self.control_val |= 0x10 # 16 bit transfers - if verbose: - print "SPI control val = 0x%x = %s" % (self.control_val, bin(self.control_val)) - self.configured = True - - def transmit(self, chip, value): - if not self.configured: - self.config() - assert chip >= 0 and chip < 8 - value &= 0xffff - self.data.write(value) - checkdata = self.data.read() - self.target.dispatch() - assert checkdata == value - self.control.write(self.control_val) - self.slaveselect.write(0xff ^ (0x1 << chip)) - self.target.dispatch() - self.control.write(self.control_val | SPICore.go_busy) - self.target.dispatch() - busy = True - while busy: - status = self.control.read() - self.target.dispatch() - busy = status & SPICore.go_busy > 0 - self.slaveselect.write(0xff) - data = self.data.read() - ss = self.slaveselect.read() - status = self.control.read() - self.target.dispatch() - #print "Received data: 0x%x, status = 0x%x, ss = 0x%x" % (data, status, ss) - return data -""" - print "Data to send: 0x%x = %s" % (checkdata, bin(int(checkdata))) - ss = 0x1 << chip - nss = ss ^ 0xffff - print "chip = %d, nSS = 0x%x = %s" % (chip, nss, bin(nss)) - ctrl = self.control.read() - self.target.dispatch() - busy = (ctrl & SPICore.go_busy) > 0 - while busy: - ctrl = self.control.read() - self.target.dispatch() - busy = (ctrl & SPICore.go_busy) > 0 - self.slaveselect.write(nss) - self.target.dispatch() - self.control.write(self.control_val) - self.target.dispatch() - self.control.write(self.control_val | SPICore.go_busy) - self.target.dispatch() - time.sleep(0.1) - ncheck = 0 - finished = False - while not finished: - ctrl = self.control.read() - self.target.dispatch() - # Check if transfer is complete by reading the GO_BSY bit of CTRL - finished = (ctrl & SPICore.go_busy) == 0 - ncheck += 1 - # assert ncheck < 10, "ctrl = 0x%x, %s finished = %s" % (ctrl, bin(int(ctrl)), str(finished)) - # time.sleep(0.1) - print "%d checks before busy not asserted." % ncheck - self.slaveselect.write(0xffff) - self.target.dispatch() - ss = self.slaveselect.read() - data = self.data.read() - self.target.dispatch() - print "After transmit, ss = 0x%x" % ss - print "Received 0x%x = %s" % (data, bin(int(data))) - time.sleep(0.1) - return data -""" - -# External chips - -class Si5326: - - def __init__(self, i2c, slaveaddr=0b1101000): - self.i2c = i2c - self.slaveaddr = slaveaddr - - def config(self, fn): - if verbose: - print "Loading Si5326 configuration from %s" % fn - inp = open(fn, "r") - inmap = False - regvals = {} - for line in inp: - if inmap: - if "END_REGISTER_MAP" in line: - inmap = False - continue - line = line.split(",") - reg = int(line[0]) - val = line[1].strip().replace("h", "") - val = int(val, 16) - regvals[reg] = val - if "#REGISTER_MAP" in line: - inmap = True - inp.close() - if verbose: - print "Register map: %s" % str(regvals) - for reg in regvals: - n = self.i2c.write(self.slaveaddr, [reg, regvals[reg]]) - assert n == 2, "Only wrote %d of 2 bytes over I2C." % n - if verbose: - print "Clock configured" - -lvdscurrents = { - 3.5: 0b000, - 4.0: 0b001, - 4.5: 0b010, - 3.0: 0b100, - 2.5: 0b101, - 2.1: 0b110, - 1.75: 0b111 -} - -napchannels = { - 1: 0b0001, - 2: 0b0001, - 3: 0b0010, - 4: 0b0010, - 5: 0b0100, - 6: 0b0100, - 7: 0b1000, - 8: 0b1000 -} - -class ADCLTM9007: - - def __init__(self, spicore, csA, csB, checkwrite=False): - self.checkwrite = checkwrite - self.spicore = spicore - self.csA = csA - self.csB = csB - - def config(self): - self.reset() - self.testpattern(False) - self.setoutputmode(3.5, False, True, 1, 14) - self.setformat(False, False) - - def writereg(self, bank, addr, data): - value = 0x0 - value |= 0x0 << 15 # write bit - value |= (addr & 0x7f) << 8 - value |= data & 0xff - #print "writereg sending 0x%x = %s" % (value, bin(value)) - assert bank in ["A", "B"] - if bank == "A": - reply = self.spicore.transmit(self.csA, value) - else: - reply = self.spicore.transmit(self.csB, value) - if self.checkwrite: - readdata = self.readreg(bank, addr) - msg = "Incorrect data from bank %s register 0x%x: " (bank, addr) - msg += " after writing 0x%x, read 0x%x.\n" % (data, readdata) - assert readdata == data, msg - - - def writerega(self, addr, data): - self.writereg("A", addr, data) - - def writeregb(self, addr, data): - self.writereg("B", addr, data) - - def readreg(self, bank, addr): - value = 0x0 - value |= 0x1 << 15 - value |= (addr & 0x7f) << 8 - #print "readreg sending 0x%x = %s" % (value, bin(value)) - assert bank in ["A", "B"] - if bank == "A": - reply = self.spicore.transmit(self.csA, value) - else: - reply = self.spicore.transmit(self.csB, value) - reply16 = 0xff & reply - #print "Reply = 0x%x -> 0x%x" % (reply, reply16) - return reply16 - - def readrega(self, addr): - return self.readreg("A", addr) - - def readregb(self, addr): - return self.readreg("B", addr) - - def reset(self, bank=None): - """Reset ADC bank(s).""" - if verbose: - print "Resetting ADC." - rstcmd = 0x1 << 7 - if bank == "A" or bank is None: - if verbose: - print "Reset A" - self.writerega(0x0, rstcmd) - time.sleep(0.5) - if bank == "B" or bank is None: - if verbose: - print "Reset B" - self.writeregb(0x0, rstcmd) - time.sleep(0.5) - - def testpattern(self, on, pattern=0x0, bank=None): - """Set bank(s)'s test pattern and en/disable it.""" - pattern = int(pattern) & 0x3fff - if verbose: - if on: - print "Setting ADC test pattern = 0x%x = %s." % (pattern, bin(pattern)) - else: - print "Setting ADC test pattern off." - msb = 0x0 - if on: - msb = 0x1 << 7 - msb |= ((pattern & 0x3f00) >> 8) - lsb = pattern & 0xff - if verbose: - print "msb = 0x%x = %s, lsb = 0x%x = %s" % (msb, bin(msb), lsb, bin(lsb)) - if bank is None or bank == "A": - self.writerega(0x4, lsb) - self.writerega(0x3, msb) - if bank is None or bank == "B": - self.writeregb(0x4, lsb) - self.writeregb(0x3, msb) - - def gettestpattern(self): - valA = self.readrega(0x3) << 8 - valA |= self.readrega(0x4) - print "Test pattern on bank A: 0x%x, %s" % (valA, bin(valA)) - valB = self.readregb(0x3) << 8 - valB |= self.readregb(0x4) - print "Test pattern on bank B: 0x%x, %s" % (valB, bin(valB)) - - def getstatus(self): - print "Bank A:" - for reg in range(5): - val = self.readrega(reg) - print " reg%d = 0x%x = %s" % (reg, val, bin(val)) - print "Bank B:" - for reg in range(5): - val = self.readregb(reg) - print " reg%d = 0x%x = %s" % (reg, val, bin(val)) - - def setoutputmode(self, lvdscurrent, lvdstermination, outenable, lanes, bits, bank=None): - """Configure bank(s)'s output mode.""" - if verbose: - print "Setting ADC output mode." - mode = 0x0 - assert lanes in [1, 2] and bits in [12, 14, 16] - if lanes == 1: - if bits == 12: - mode |= 0b110 - elif bits == 14: - mode |= 0b101 - else: # bits = 16 - mode |= 0b111 - else: # lanes = 2 - if bits == 12: - mode |= 0b010 - elif bits == 14: - mode |= 001 - else: # bits = 16 - mode |= 0b111 - if not outenable: - mode |= 0b1000 - if lvdstermination: - mode |= (0x1 << 4) - mode |= (lvdscurrents[lvdscurrent] << 5) - if bank is None or bank == "A": - self.writerega(0x2, mode) - if bank is None or bank == "B": - self.writeregb(0x2, mode) - - def setformat(self, randomiser, twoscomp, stabiliser=True, bank=None): - """Configure bank(s)'s output format.""" - if verbose: - print "Setting ADC format." - if bank is None or bank == "A": - data = self.readrega(0x1) - if twoscomp: - data |= (0x1 << 5) - else: - data &= 0xff ^ (0x1 << 5) - if randomiser: - data |= (0x1 << 6) - else: - data &= 0xff ^ (0x1 << 6) - if not stabiliser: - data |= (0x1 << 7) - else: - data &= 0xff ^ (0x1 << 7) - self.writerega(0x1, data) - if bank is None or bank == "B": - data = self.readregb(0x1) - if twoscomp: - data |= (0x1 << 5) - else: - data &= 0xff ^ (0x1 << 5) - if randomiser: - data |= (0x1 << 6) - else: - data &= 0xff ^ (0x1 << 6) - if not stabiliser: - data |= (0x1 << 7) - else: - data &= 0xff ^ (0x1 << 7) - self.writeregb(0x1, data) - - def setsleep(self, sleep, bank=None): - """Put ADC bank(s) to sleep.""" - if verbose: - print "Setting ADC sleep mode" - if bank is None or bank == "A": - data = self.readrega(0x1) - if sleep: - data |= (0x1 << 4) - else: - data &= 0xff ^ (0x1 << 4) - self.writerega(0x1, data) - if bank is None or bank == "B": - data = self.readregb(0x1) - if sleep: - data |= (0x1 << 4) - else: - data &= 0xff ^ (0x1 << 4) - self.writeregb(0x1, data) - - def nap(self, channels): - """Provide a list of channels to put down for a nap, all others will be not napping.""" - if verbose: - print "Setting ADC channel nap." - dataa = self.readrega(0x1) - dataa &= 0xf0 - datab = self.readregb(0x1) - datab &= 0xf0 - for chan in channels: - assert chan < 9 and chan > 0 - if chan in [1, 4, 5, 8]: - dataa |= napchannels[chan] - else: - datab |= napchannels[chan] - self.writerega(0x1, dataa) - self.writeregb(0x1, datab) - -class MCP472XPowerMode: - - on = 0b00 - off1k = 0b01 - off100k = 0b10 - off500k = 0b11 - -class DACMCP4725: - """Global trim DAC""" - - # Write modes - fast = 0b00 - writeDAC = 0b10 - writeDACEEPROM = 0b11 - - def __init__(self, i2ccore, addr=0b1100111, vdd=5.0): - self.i2ccore = i2ccore - self.slaveaddr = addr & 0x7f - self.vdd = float(vdd) - - def setbias(self, bias): - # DAC voltage goes through potential divider to HV chip, where it is scaled up - r1 = 1.0 - r2 = 2.4 - divider = r2 / (r1 + r2) - voltage = bias / 30.0 / divider - self.setvoltage(voltage) - - def setvoltage(self, voltage, powerdown=MCP472XPowerMode.on): - if voltage > self.vdd: - print "Overriding MCP4725 voltage: %g -> %g V (max of range)" % (voltage, self.vdd) - voltage = self.vdd - value = int(voltage / float(self.vdd) * 4096) - #print "%g -> %d" % (voltage, value) - self.setvalue(value, powerdown, self.writeDACEEPROM) - - def setvalue(self, value, powerdown, mode): - value = int(value) - value &= 0xfff - if mode == self.fast: - data = [] - data.append((powerdown << 4) | ((value & 0xf00) >> 8)) - data.append(value & 0x0ff) - self.i2ccore.write(self.slaveaddr, data) - else: - data = [] - data.append((mode << 5) | (powerdown << 1)) - data.append((value & 0xff0) >> 4) - data.append((value & 0x00f) << 4) - #print "Writing %s" % str(data) - self.i2ccore.write(self.slaveaddr, data) - - def status(self): - data = self.i2ccore.read(self.slaveaddr, 5) - assert len(data) == 5, "Only recieved %d of 5 expected bytes from MCP4725." % len(data) - dx = "0x" - db = "" - for val in data: - dx += "%02x" % val - db += "%s " % bin(val) - #print dx, db - ready = (data[0] & (0x1 << 7)) > 0 - por = (data[0] & (0x1 << 6)) > 0 # power on reset? - powerdown = (data[0] & 0b110) >> 1 - dacvalue = data[1] << 4 - dacvalue |= (data[2] & 0xf0) >> 4 - voltage = self.vdd * dacvalue / 2**12 - #print dacvalue, voltage - return dacvalue, voltage, ready, por, powerdown - - def readvoltage(self): - vals = self.status() - return vals[1] - - def readbias(self): - v = self.readvoltage() - r1 = 1.0 - r2 = 2.4 - divider = r2 / (r1 + r2) - bias = v * 30.0 * divider - return bias - -# class MCP4728ChanStatus: -# -# def __init__(self, data): -# assert len(data) == 3 -# s = "0x" -# for val in data: -# s += "%02x" % val -# #print data, s -# self.ready = (data[0] & (0x1 << 7)) > 0 -# self.por = (data[0] & (0x1 << 6)) > 0 -# self.chan = (data[0] & (0b11 << 4)) >> 4 -# self.addr = data[0] & 0x0f -# self.vref = (data[1] & (0b1 << 7)) > 0 -# self.powerdown = (data[1] & (0b11 << 5)) >> 5 -# self.gain = (data[1] & (0b1 << 4)) > 0 -# self.value = (data[1] & 0x0f) << 8 -# self.value |= data[2] -# -# def __repr__(self): -# return "chan %d: vref = %s, powerdown = %d, value = %d" % (self.chan, str(self.vref), self.powerdown, self.value) - -# class MCP4728Channel: -# -# def __init__(self, data): -# assert len(data) == 6 -# self.output = MCP4728ChanStatus(data[:3]) -# self.EEPROM = MCP4728ChanStatus(data[3:]) -# self.chan = self.EEPROM.chan -# #print self.output - -# class DACMCP4728: -# """Channel trim DAC""" -# -# # Commands -# writeDACEEPROM = 0b010 -# -# # write functions -# multiwrite = 0b00 -# sequentialwrite = 0b10 -# singlewrite = 0b11 -# -# # stuff -# vref = 0b0 << 7 # Uses external reference, ie Vdd -# -# def __init__(self, i2ccore, addr, vdd=5.0): -# self.i2ccore = i2ccore -# self.slaveaddr = addr & 0x7f -# self.vdd = float(vdd) -# -# def setvoltage(self, channel, voltage, powerdown=MCP472XPowerMode.on): -# value = int(voltage / self.vdd * 2**12) -# #print "%g V -> %d" % (voltage, value) -# self.setvalue(channel, value, powerdown) -# -# def setvalue(self, channel, value, powerdown=MCP472XPowerMode.on): -# value = int(value) & 0xfff -# data = [] # data is an empty array that gets filled as below -# cmd = DACMCP4728.writeDACEEPROM << 5 -# cmd |= DACMCP4728.singlewrite << 3 -# cmd |= (channel & 0b11) << 1 -# data.append(cmd) data gets appende the cmd string -# val = DACMCP4728.vref | ((powerdown & 0b11) << 5) -# val |= (value & 0xf00) >> 8 -# data.append(val) -# data.append(value & 0xff) -# sx = "0x" -# sb = "" -# for val in data: -# sx += "%02x" % val -# sb += "%s " % bin(val) -# #print "Writing data to %s value: " % bin(self.slaveaddr), data, sx, sb -# nwritten = self.i2ccore.write(self.slaveaddr, data) -# assert nwritten == len(data), "Only wrote %d of %d bytes setting MCP4728." % (nwritten, len(data)) -# time.sleep(0.2) -# -# def status(self): -# data = self.i2ccore.read(self.slaveaddr, 24) -# assert len(data) == 24, "Only read %d of 24 bytes getting MCP4728 status." % len(data) -# #print data -# chans = [] -# for chan in range(4): -# i = chan * 6 -# chans.append(MCP4728Channel(data[i:i+6])) -# return chans -# -# def readvoltages(self): -# chans = self.status() -# voltages = [] -# for chan in chans: -# value = float(chan.output.value) -# voltage = self.vdd * value / 2**12 -# voltages.append(voltage) -# return voltages - -class TempMCP9808: - """Temperture chip on analog board.""" - - regTemp = 0x5 - - def __init__(self, i2ccore, addr=0b0011000): - self.i2ccore = i2ccore - self.slaveaddr = addr & 0x7f -# Here the chip needs a specific register written as a command before it knows -# where to write to, which is the regaddr byte that is passed upself. - - def readreg(self, regaddr): - n, data = self.i2ccore.writeread(self.slaveaddr, [regaddr], 2) - assert n == 1 # this is the one byte address for the registry - assert len(data) == 2 # this is teh length of the data read from the chip - val = data[0] << 8 - val |= data[1] - return val - - def temp(self): - val = self.readreg(TempMCP9808.regTemp) - return self.u16todeg(val) - - def u16todeg(self, val): - val &= 0x1fff - neg = val & 0x1000 > 0 - val &= 0x0fff - if neg: - return -float(0xfff - val) / 16.0 - return float(val) / 16.0 diff --git a/miniTLU/I2cBusProperties.py b/miniTLU/I2cBusProperties.py deleted file mode 100644 index a23f30c..0000000 --- a/miniTLU/I2cBusProperties.py +++ /dev/null @@ -1,122 +0,0 @@ -########################################################## -# I2cBusProperties - simple encapsulation of all items -# required to control an I2C bus. -# -# Carl Jeske, July 2010 -# Refactored by Robert Frazier, May 2011 -########################################################## - - -class I2cBusProperties(object): - """Encapsulates details of an I2C bus master in the form of a host device, a clock prescale value, and seven I2C master registers - - Provide the ChipsBus instance to the device hosting your I2C core, a 16-bit clock prescaling - value for the Serial Clock Line (see I2C core docs for details), and the names of the seven - registers that define/control the bus (assuming these names are not the defaults specified - in the constructor below). The seven registers consist of the two clock pre-scaling - registers (PRElo, PREhi), and five bus master registers (CONTROL, TRANSMIT, RECEIVE, - COMMAND and STATUS). - - Usage: You'll need to create an instance of this class to give to a concrete I2C bus instance, such - as OpenCoresI2cBus. This I2cBusProperties class is simply a container to hold the properties - that define the bus; a class such as OpenCoresI2cBus will make use of these properties. - - Access the items stored by this class via these (deliberately compact) variable names: - - chipsBus -- the ChipsBus device hosting the I2C core - preHiVal -- the top byte of the clock prescale value - preLoVal -- the bottom byte of the clock prescale value - preHiReg -- the register the top byte of the clk prescale value (preHiVal) gets written to - preLoReg -- the register the bottom byte of the clk prescale value (preLoVal) gets written to - ctrlReg -- the I2C Control register - txReg -- the I2C Transmit register - rxReg -- the I2C Receive register - cmdReg -- the I2C Command register - statusReg -- the I2C Status register - - - Compatibility Notes: The seven register names are the registers typically required to operate an - OpenCores or similar I2C Master (Lattice Semiconductor's I2C bus master works - the same way as the OpenCores one). This software is not compatible with your - I2C bus master if it doesn't use this register interface. - """ - - def __init__(self, - chipsBusDevice, - clkPrescaleU16, - clkPrescaleLoByteReg = "i2c_pre_lo", - clkPrescaleHiByteReg = "i2c_pre_hi", - controlReg = "i2c_ctrl", - transmitReg = "i2c_tx", - receiveReg = "i2c_rx", - commandReg = "i2c_cmd", - statusReg = "i2c_status"): - - """Provide a host ChipsBus device that is controlling the I2C bus, and the names of five I2C control registers. - - chipsBusDevice: Provide a ChipsBus instance to the device where the I2C bus is being - controlled. The address table for this device must contain the five registers - that control the bus, as declared next... - - clkPrescaleU16: A 16-bit value used to prescale the Serial Clock Line based on the host - master-clock. This value gets split into two 8-bit values and ultimately will - get written to the two I2C clock-prescale registers as declared below. See - the OpenCores or Lattice Semiconductor I2C documentation for more details. - - clkPrescaleLoByteReg: The register where the lower byte of the clock prescale value is set. The default - name for this register is "i2c_pre_lo". - - clkPrescaleHiByteReg: The register where the higher byte of the clock prescale value is set. The default - name for this register is "i2c_pre_hi" - - controlReg: The CONTROL register, used for enabling/disabling the I2C core, etc. This register is - usually read and write accessible. The default name for this register is "i2c_ctrl". - - transmitReg: The TRANSMIT register, used for holding the data to be transmitted via I2C, etc. This - typically shares the same address as the RECEIVE register, but has write-only access. The default - name for this register is "i2c_tx". - - receiveReg: The RECEIVE register - allows access to the byte received over the I2C bus. This - typically shares the same address as the TRANSMIT register, but has read-only access. The - default name for this register is "i2c_rx". - - commandReg: The COMMAND register - stores the command for the next I2C operation. This typically - shares the same address as the STATUS register, but has write-only access. The default name for - this register is "i2c_cmd". - - statusReg: The STATUS register - allows monitoring of the I2C operations. This typically shares - the same address as the COMMAND register, but has read-only access. The default name for this - register is "i2c_status". - """ - - object.__init__(self) - self.chipsBus = chipsBusDevice - self.preHiVal = ((clkPrescaleU16 & 0xff00) >> 8) - self.preLoVal = (clkPrescaleU16 & 0xff) - - # Check to see all the registers are in the address table - registers = [clkPrescaleLoByteReg, clkPrescaleHiByteReg, controlReg, transmitReg, receiveReg, commandReg, statusReg] - for reg in registers: - if not self.chipsBus.addrTable.checkItem(reg): - raise ChipsException("I2cBusProperties error: register '" + reg + "' is not present in the address table of the device hosting the I2C bus master!") - - # Check that the registers we'll need to write to are indeed writable - writableRegisters = [clkPrescaleLoByteReg, clkPrescaleHiByteReg, controlReg, transmitReg, commandReg] - for wReg in writableRegisters: - if not self.chipsBus.addrTable.getItem(wReg).getWriteFlag(): - raise ChipsException("I2cBusProperties error: register '" + wReg + "' does not have the necessary write permission!") - - # Check that the registers we'll need to read from are indeed readable - readableRegisters = [clkPrescaleLoByteReg, clkPrescaleHiByteReg, controlReg, receiveReg, statusReg] - for rReg in readableRegisters: - if not self.chipsBus.addrTable.getItem(rReg).getReadFlag(): - raise ChipsException("I2cBusProperties error: register '" + rReg + "' does not have the necessary read permission!") - - # Store the various register name strings - self.preHiReg = clkPrescaleHiByteReg - self.preLoReg = clkPrescaleLoByteReg - self.ctrlReg = controlReg - self.txReg = transmitReg - self.rxReg = receiveReg - self.cmdReg = commandReg - self.statusReg = statusReg diff --git a/miniTLU/RawI2cAccess.py b/miniTLU/RawI2cAccess.py deleted file mode 100644 index 2846132..0000000 --- a/miniTLU/RawI2cAccess.py +++ /dev/null @@ -1,261 +0,0 @@ -# Created on Sep 10, 2012 -# @author: Kristian Harder, based on code by Carl Jeske - -from I2cBusProperties import I2cBusProperties -from ChipsBus import ChipsBus -from ChipsLog import chipsLog -from ChipsException import ChipsException - - -class RawI2cAccess: - - def __init__(self, i2cBusProps, slaveAddr): - - # For performing read/writes over an OpenCores-compatible I2C bus master - # - # An instance of this class is required to communicate with each - # I2C slave on the I2C bus. - # - # i2cBusProps: an instance of the class I2cBusProperties that contains - # the relevant ChipsBus host and the I2C bus-master registers (if - # they differ from the defaults specified by the I2cBusProperties - # class). - # - #slaveAddr: The address of the I2C slave you wish to communicate with. - # - - self._i2cProps = i2cBusProps # The I2C Bus Properties - self._slaveAddr = 0x7f & slaveAddr # 7-bit slave address - - - def resetI2cBus(self): - - # Resets the I2C bus - # - # This function does the following: - # 1) Disables the I2C core - # 2) Sets the clock prescale registers - # 3) Enables the I2C core - # 4) Sets all writable bus-master registers to default values - - try: - self._chipsBus().queueWrite(self._i2cProps.ctrlReg, 0x00) - #self._chipsBus().getNode(self._i2cProps.ctrlReg).write(0) - self._chipsBus().queueWrite(self._i2cProps.preHiReg, - self._i2cProps.preHiVal) - self._chipsBus().queueWrite(self._i2cProps.preLoReg, - self._i2cProps.preLoVal) - self._chipsBus().queueWrite(self._i2cProps.ctrlReg, 0x80) - self._chipsBus().queueWrite(self._i2cProps.txReg, 0x00) - self._chipsBus().queueWrite(self._i2cProps.cmdReg, 0x00) - self._chipsBus().queueRun() - except ChipsException, err: - raise ChipsException("I2C reset error:\n\t" + str(err)) - - - def read(self, numBytes): - - # Performs an I2C read. Returns the 8-bit read result(s). - # - # numBytes: number of bytes expected as response - # - - try: - result = self._privateRead(numBytes) - except ChipsException, err: - raise ChipsException("I2C read error:\n\t" + str(err)) - return result - - - def write(self, listDataU8): - - # Performs an 8-bit I2C write. - # - # listDataU8: The 8-bit data values to be written. - # - - try: - self._privateWrite(listDataU8) - except ChipsException, err: - raise ChipsException("I2C write error:\n\t" + str(err)) - return - - - def _chipsBus(self): - - # Returns the instance of the ChipsBus device that's hosting - # the I2C bus master - - return self._i2cProps.chipsBus - - - def _privateRead(self, numBytes): - - # I2C read implementation. - # - # Fast I2C read implementation, - # i.e. done with the fewest packets possible. - - - # transmit reg definitions - # bits 7-1: 7-bit slave address during address transfer - # or first 7 bits of byte during data transfer - # bit 0: RW flag during address transfer or LSB during data transfer. - # '1' = reading from slave - # '0' = writing to slave - - # command reg definitions - # bit 7: Generate start condition - # bit 6: Generate stop condition - # bit 5: Read from slave - # bit 4: Write to slave - # bit 3: 0 when acknowledgement is received - # bit 2:1: Reserved - # bit 0: Interrupt acknowledge. When set, clears a pending interrupt - - # Reset bus before beginning - self.resetI2cBus() - - # Set slave address in bits 7:1, and set bit 0 to zero - # (i.e. we're writing an address to the bus) - self._chipsBus().queueWrite(self._i2cProps.txReg, - (self._slaveAddr << 1) | 0x01) - # Set start and write bit in command reg - self._chipsBus().queueWrite(self._i2cProps.cmdReg, 0x90) - # Run the queue - self._chipsBus().queueRun() - # Wait for transaction to finish. - self._i2cWaitUntilFinished() - - result=[] - for ibyte in range(numBytes): - if ibyte==numBytes-1: - stop_bit=0x40 - ack_bit=0x08 - else: - stop_bit=0 - ack_bit=0 - pass - # Set read bit, acknowledge and stop bit in command reg - self._chipsBus().write(self._i2cProps.cmdReg, 0x20+ack_bit+stop_bit) - # Wait for transaction to finish. - # Don't expect an ACK, do expect bus free at finish. - if stop_bit: - self._i2cWaitUntilFinished(requireAcknowledgement = False, - requireBusIdleAtEnd = True) - else: - self._i2cWaitUntilFinished(requireAcknowledgement = False, - requireBusIdleAtEnd = False) - pass - result.append(self._chipsBus().read(self._i2cProps.rxReg)) - - return result - - - def _privateWrite(self, listDataU8): - - # I2C write implementation. - # - # Fast I2C write implementation, - # i.e. done with the fewest packets possible. - - # transmit reg definitions - # bits 7-1: 7-bit slave address during address transfer - # or first 7 bits of byte during data transfer - # bit 0: RW flag during address transfer or LSB during data transfer. - # '1' = reading from slave - # '0' = writing to slave - - # command reg definitions - # bit 7: Generate start condition - # bit 6: Generate stop condition - # bit 5: Read from slave - # bit 4: Write to slave - # bit 3: 0 when acknowledgement is received - # bit 2:1: Reserved - # bit 0: Interrupt acknowledge. When set, clears a pending interrupt - # Reset bus before beginning - self.resetI2cBus() - - # Set slave address in bits 7:1, and set bit 0 to zero (i.e. "write mode") - self._chipsBus().queueWrite(self._i2cProps.txReg, - (self._slaveAddr << 1) & 0xfe) - # Set start and write bit in command reg - self._chipsBus().queueWrite(self._i2cProps.cmdReg, 0x90) - # Run the queue - self._chipsBus().queueRun() - # Wait for transaction to finish. - self._i2cWaitUntilFinished() - - for ibyte in range(len(listDataU8)): - dataU8 = listDataU8[ibyte] - if ibyte==len(listDataU8)-1: - stop_bit=0x40 - else: - stop_bit=0x00 - pass - # Set data to be written in transmit reg - self._chipsBus().queueWrite(self._i2cProps.txReg, (dataU8 & 0xff)) - # Set write and stop bit in command reg - self._chipsBus().queueWrite(self._i2cProps.cmdReg, 0x10+stop_bit) - # Run the queue - self._chipsBus().queueRun() - # Wait for transaction to finish. - # Do expect an ACK and do expect bus to be free at finish - if stop_bit: - self._i2cWaitUntilFinished(requireAcknowledgement = True, - requireBusIdleAtEnd = True) - else: - self._i2cWaitUntilFinished(requireAcknowledgement = True, - requireBusIdleAtEnd = False) - pass - pass - - return - - - def _i2cWaitUntilFinished(self, requireAcknowledgement = True, - requireBusIdleAtEnd = False): - - # Ensures the current bus transaction has finished successfully - # before allowing further I2C bus transactions - - # This method monitors the status register - # and will not allow execution to continue until the - # I2C bus has completed properly. It will throw an exception - # if it picks up bus problems or a bus timeout occurs. - - maxRetry = 20 - attempt = 1 - while attempt <= maxRetry: - - # Get the status - i2c_status = self._chipsBus().read(self._i2cProps.statusReg) - - receivedAcknowledge = not bool(i2c_status & 0x80) - busy = bool(i2c_status & 0x40) - arbitrationLost = bool(i2c_status & 0x20) - transferInProgress = bool(i2c_status & 0x02) - interruptFlag = bool(i2c_status & 0x01) - - if arbitrationLost: # This is an instant error at any time - raise ChipsException("I2C error: Arbitration lost!") - - if not transferInProgress: - break # The transfer looks to have completed successfully, pending further checks - - attempt += 1 - - # At this point, we've either had too many retries, or the - # Transfer in Progress (TIP) bit went low. If the TIP bit - # did go low, then we do a couple of other checks to see if - # the bus operated as expected: - - if attempt > maxRetry: - raise ChipsException("I2C error: Transaction timeout - the 'Transfer in Progress' bit remained high for too long!") - - if requireAcknowledgement and not receivedAcknowledge: - raise ChipsException("I2C error: No acknowledge received!") - - if requireBusIdleAtEnd and busy: - raise ChipsException("I2C error: Transfer finished but bus still busy!") diff --git a/miniTLU/aida_mini_tlu_addr_map.txt b/miniTLU/aida_mini_tlu_addr_map.txt deleted file mode 100644 index 1f4693a..0000000 --- a/miniTLU/aida_mini_tlu_addr_map.txt +++ /dev/null @@ -1,72 +0,0 @@ -*RegName RegAddr RegMask R W -*------------------------------------------------------------- -FirmwareId 0x00000000 0xffffffff 1 0 -* -* DUT interfaces base = 0x020 -DUTMaskW 0x00000020 0xffffffff 0 1 -IgnoreDUTBusyW 0x00000021 0xffffffff 0 1 -IgnoreShutterVetoW 0x00000022 0xffffffff 0 1 -DUTInterfaceModeW 0x00000023 0xffffffff 0 1 -DUTInterfaceModeModifierW 0x00000024 0xffffffff 0 1 -DUTMaskR 0x00000028 0xffffffff 1 0 -IgnoreDUTBusyR 0x00000029 0xffffffff 1 0 -IgnoreShutterVetoR 0x0000002A 0xffffffff 1 0 -DUTInterfaceModeR 0x0000002B 0xffffffff 1 0 -DUTInterfaceModeModifierR 0x0000002C 0xffffffff 1 0 -* -* trigger inputs = 0x040 -SerdesRstW 0x00000040 0xffffffff 0 1 -SerdesRstR 0x00000048 0xffffffff 1 0 -ThrCount0R 0x00000049 0xffffffff 1 0 -ThrCount1R 0x0000004a 0xffffffff 1 0 -ThrCount2R 0x0000004b 0xffffffff 1 0 -ThrCount3R 0x0000004c 0xffffffff 1 0 -* -* trigger logic = 0x060 **Note the different read and write directions - -InternalTriggerIntervalW 0x00000062 0xffffffff 0 1 -TriggerPatternW 0x00000063 0xffffffff 0 1 -TriggerVetoW 0x00000064 0xffffffff 0 1 -PulseStretchW 0x00000066 0xffffffff 0 1 -PulseDelayW 0x00000067 0xffffffff 0 1 -TriggerHoldOffW 0x00000068 0xffffffff 0 1 - -PostVetoTriggersR 0x00000070 0xffffffff 1 0 -PreVetoTriggersR 0x00000071 0xffffffff 1 0 -InternalTriggerIntervalR 0x00000072 0xffffffff 1 0 -TriggerPatternR 0x00000073 0xffffffff 1 0 -TriggerVetoR 0x00000074 0xffffffff 1 0 -ExternalTriggerVetoR 0x00000075 0xffffffff 1 0 -PulseStretchR 0x00000076 0xffffffff 1 0 -PulseDelayR 0x00000077 0xffffffff 1 0 -TriggerHoldOffR 0x00000078 0xffffffff 1 0 -AuxTriggerCountR 0x00000079 0xffffffff 1 0 -* -* event buffer = 0x080 -EventFifoData 0x00000080 0xffffffff 1 0 -EventFifoFillLevel 0x00000081 0xffffffff 1 0 -EventFifoCSR 0x00000082 0xffffffff 1 1 -EventFifoFillLevelFlags 0x00000083 0xffffffff 1 0 -* -* logic clocks = 0x0A0 -LogicClocksCSR 0x000000A0 0xffffffff 1 1 -LogicRst 0x000000A1 0xffffffff 0 1 -* -* I2C = 0x0C0 -i2c_pre_lo 0x000000C0 0x000000ff 1 1 -i2c_pre_hi 0x000000C1 0x000000ff 1 1 -i2c_ctrl 0x000000C2 0x000000ff 1 1 -i2c_tx 0x000000C3 0x000000ff 0 1 -i2c_rx 0x000000C3 0x000000ff 1 0 -i2c_cmd 0x000000C4 0x000000ff 0 1 -i2c_status 0x000000C4 0x000000ff 1 0 -* -* Event formatter = 0x140 -Enable_Record_Data 0x00000140 0xffffffff 1 1 -ResetTimestampW 0x00000141 0xffffffff 0 1 -CurrentTimestampLR 0x00000142 0xffffffff 1 0 -CurrentTimestampHR 0x00000143 0xffffffff 1 0 -* -* Shutter/T0 control = 0x160 -ShutterStateW 0x00000160 0xffffffff 0 1 -PulseT0 0x00000161 0xffffffff 0 1 diff --git a/miniTLU/connection.xml b/miniTLU/connection.xml deleted file mode 100644 index 647c1ad..0000000 --- a/miniTLU/connection.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - diff --git a/miniTLU/initTLU.py b/miniTLU/initTLU.py deleted file mode 100644 index eb1ae65..0000000 --- a/miniTLU/initTLU.py +++ /dev/null @@ -1,184 +0,0 @@ -# -# Function to initialize TLU -# -# David Cussans, October 2015 -# -# Nasty hack - use both PyChips and uHAL ( for block read ... ) - -from PyChipsUser import * -from FmcTluI2c import * - -import uhal - -import sys -import time - -def startTLU( uhalDevice , pychipsBoard , writeTimestamps): - - print "RESETTING FIFO" - pychipsBoard.write("EventFifoCSR",0x2) - eventFifoFillLevel = pychipsBoard.read("EventFifoFillLevel") - print "FIFO FILL LEVEL AFTER RESET= " , eventFifoFillLevel - - - if writeTimestamps: - print "ENABLING DATA RECORDING" - pychipsBoard.write("Enable_Record_Data",1) - else: - print "Disabling data recording" - pychipsBoard.write("Enable_Record_Data",0) - - print "Pulsing T0" - pychipsBoard.write("PulseT0",1) - - print "Turning off software trigger veto" - pychipsBoard.write("TriggerVetoW",0) - - print "TLU is running" - - -def stopTLU( uhalDevice , pychipsBoard ): - - print "Turning on software trigger veto" - pychipsBoard.write("TriggerVetoW",1) - - print "TLU triggers are stopped" - -def initTLU( uhalDevice , pychipsBoard , listenForTelescopeShutter , pulseDelay , pulseStretch , triggerPattern , DUTMask , ignoreDUTBusy , triggerInterval , thresholdVoltage ): - - print "SETTING UP AIDA TLU" - - fwVersion = uhalDevice.getNode("version").read() - uhalDevice.dispatch() - print "\tVersion (uHAL)= " , hex(fwVersion) - - print "\tTurning on software trigger veto" - pychipsBoard.write("TriggerVetoW",1) - - # Check the bus for I2C devices - pychipsBoardi2c = FmcTluI2c(pychipsBoard) - - print "\tScanning I2C bus:" - scanResults = pychipsBoardi2c.i2c_scan() - #print scanResults - print '\t', ', '.join(scanResults), '\n' - - boardId = pychipsBoardi2c.get_serial_number() - print "\tFMC-TLU serial number= " , boardId - - resetClocks = 0 - resetSerdes = 0 - -# set DACs to -200mV - print "\tSETTING ALL DAC THRESHOLDS TO" , thresholdVoltage , "V" - pychipsBoardi2c.set_threshold_voltage(7, thresholdVoltage) - - clockStatus = pychipsBoard.read("LogicClocksCSR") - print "\tCLOCK STATUS (should be 3 if all clocks locked)= " , hex(clockStatus) - assert ( clockStatus == 3 ) , "Clocks in TLU FPGA are not locked. No point in continuing. Re-prgramme or power cycle board" - - if resetClocks: - print "Resetting clocks" - pychipsBoard.write("LogicRst", 1 ) - - clockStatus = pychipsBoard.read("LogicClocksCSR") - print "Clock status after reset = " , hex(clockStatus) - - inputStatus = pychipsBoard.read("SerdesRstR") - print "Input status = " , hex(inputStatus) - - if resetSerdes: - pychipsBoard.write("SerdesRstW", 0x00000003 ) - inputStatus = pychipsBoard.read("SerdesRstR") - print "Input status during reset = " , hex(inputStatus) - - pychipsBoard.write("SerdesRstW", 0x00000000 ) - inputStatus = pychipsBoard.read("SerdesRstR") - print "Input status after reset = " , hex(inputStatus) - - pychipsBoard.write("SerdesRstW", 0x00000004 ) - inputStatus = pychipsBoard.read("SerdesRstR") - print "Input status during calibration = " , hex(inputStatus) - - pychipsBoard.write("SerdesRstW", 0x00000000 ) - inputStatus = pychipsBoard.read("SerdesRstR") - print "Input status after calibration = " , hex(inputStatus) - - - inputStatus = pychipsBoard.read("SerdesRstR") - print "\tINPUT STATUS= " , hex(inputStatus) - - count0 = pychipsBoard.read("ThrCount0R") - print "\t Count 0= " , count0 - - count1 = pychipsBoard.read("ThrCount1R") - print "\t Count 1= " , count1 - - count2 = pychipsBoard.read("ThrCount2R") - print "\t Count 2= " , count2 - - count3 = pychipsBoard.read("ThrCount3R") - print "\t Count 3= " , count3 - -# Stop internal triggers until setup complete - pychipsBoard.write("InternalTriggerIntervalW",0) - - print "\tSETTING INPUT COINCIDENCE WINDOW TO",pulseStretch,"[Units= 160MHz clock cycles, Four 5-bit values (one per input) packed in to 32-bit word]" - pychipsBoard.write("PulseStretchW",int(pulseStretch)) - pulseStretchR = pychipsBoard.read("PulseStretchR") - print "\t Pulse stretch read back as:", hex(pulseStretchR) - # assert (int(pulseStretch) == pulseStretchR) , "Pulse stretch read-back doesn't equal written value" - - print "\tSETTING INPUT TRIGGER DELAY TO",pulseDelay , "[Units= 160MHz clock cycles, Four 5-bit values (one per input) packed in to 32-bit word]" - pychipsBoard.write("PulseDelayW",int(pulseDelay)) - pulseDelayR = pychipsBoard.read("PulseDelayR") - print "\t Pulse delay read back as:", hex(pulseDelayR) - - print "\tSETTING TRIGGER PATTERN (for external triggers) TO 0x%08X. Two 16-bit patterns packed into 32 bit word " %(triggerPattern) - pychipsBoard.write("TriggerPatternW",int(triggerPattern)) - triggerPatternR = pychipsBoard.read("TriggerPatternR") - print "\t Trigger pattern read back as: 0x%08X " % (triggerPatternR) - - print "\tENABLING DUT(s): Mask= " , hex(DUTMask) - pychipsBoard.write("DUTMaskW",int(DUTMask)) - DUTMaskR = pychipsBoard.read("DUTMaskR") - print "\t DUTMask read back as:" , hex(DUTMaskR) - - print "\tSETTING ALL DUTs IN AIDA MODE" - pychipsBoard.write("DUTInterfaceModeW", 0xFF) - DUTInterfaceModeR = pychipsBoard.read("DUTInterfaceModeR") - print "\t DUT mode read back as:" , DUTInterfaceModeR - - print "\tSET DUT MODE MODIFIER" - pychipsBoard.write("DUTInterfaceModeModifierW", 0xFF) - DUTInterfaceModeModifierR = pychipsBoard.read("DUTInterfaceModeModifierR") - print "\t DUT mode modifier read back as:" , DUTInterfaceModeModifierR - - if listenForTelescopeShutter: - print "\tSET IgnoreShutterVetoW TO LISTEN FOR VETO FROM SHUTTER" - pychipsBoard.write("IgnoreShutterVetoW",0) - else: - print "\tSET IgnoreShutterVetoW TO IGNORE VETO FROM SHUTTER" - pychipsBoard.write("IgnoreShutterVetoW",1) - IgnoreShutterVeto = pychipsBoard.read("IgnoreShutterVetoR") - print "\t IgnoreShutterVeto read back as:" , IgnoreShutterVeto - - print "\tSETTING IGNORE VETO BY DUT BUSY MASK TO" , hex(ignoreDUTBusy) - pychipsBoard.write("IgnoreDUTBusyW",int(ignoreDUTBusy)) - IgnoreDUTBusy = pychipsBoard.read("IgnoreDUTBusyR") - print "\t IgnoreDUTBusy read back as:" , hex(IgnoreDUTBusy) - -#print "Enabling handshake: No-handshake" -#board.write("HandshakeTypeW",1) - - - print "\tSETTING INTERNAL TRIGGER INTERVAL TO" , triggerInterval , "(zero= no internal triggers)" - if triggerInterval == 0: - internalTriggerFreq = 0 - else: - internalTriggerFreq = 160000.0/triggerInterval - print "\tINTERNAL TRIGGER FREQUENCY= " , internalTriggerFreq , " kHz" - pychipsBoard.write("InternalTriggerIntervalW",triggerInterval) #0->Internal pulse generator disabled. Any other value will generate pulses with a frequency of n*6.25ns - trigIntervalR = pychipsBoard.read("InternalTriggerIntervalR") - print "\t Trigger interval read back as:", trigIntervalR - print "AIDA TLU SETUP COMPLETED" diff --git a/miniTLU/miniTLU.py b/miniTLU/miniTLU.py deleted file mode 100644 index e874a6f..0000000 --- a/miniTLU/miniTLU.py +++ /dev/null @@ -1,462 +0,0 @@ -import uhal; -from FmcTluI2c import * -from I2CuHal import I2CCore - -class MiniTLU: - """docstring for miniTLU""" - def __init__(self, dev_name, man_file): - self.dev_name = dev_name - self.manager= uhal.ConnectionManager(man_file) - self.hw = self.manager.getDevice(self.dev_name) - self.nChannels= 4 - self.VrefInt= 2.5 #Internal DAC voltage reference - self.VrefExt= 1.3 #External DAC voltage reference - self.intRefOn= False #Internal reference is OFF by default - - self.fwVersion = self.hw.getNode("version").read() - self.hw.dispatch() - print "uHAL VERSION= " , hex(self.fwVersion) - - # Instantiate a I2C core to configure the DACs - self.TLU_I2C= I2CCore(self.hw, 10, 5, "i2c_master", None) - self.TLU_I2C.state() - - - def initialize(self): - print "miniTLU INITIALIZING..." - # We need to pass it listenForTelescopeShutter , pulseDelay , pulseStretch , triggerPattern , DUTMask , ignoreDUTBusy , triggerInterval , thresholdVoltage - - print "\tTurning on software trigger veto" - cmd = int("0x1",16) - self.setTriggerVetoStatus(cmd) - - #READ CONTENT OF EPROM VIA I2C - self.getSN() - - #SET DACs - targetV= 1.1 - intRef= False - self.setDACintRef(intRef) - DACchannel= 7 - self.writeThreshold(targetV, DACchannel) - - #Check clock status - self.checkClkStatus() - - resetClocks = 0 - resetSerdes = 0 - if resetClocks: - self.resetClocks() - if resetSerdes: - self.resetSerdes() - - # Get inputs status and counters - self.getChStatus() - self.getAllChannelsCounts() - - # Stop internal triggers until setup complete - cmd = int("0x0",16) - self.setInternalTrg(cmd) - - # Set pulse stretch - pulseStretch= 0x000FFFFF - self.setPulseStretch(pulseStretch) - - # Set pulse delay - pulseDelay= 0x0 - #self.setPulseDelay(pulseDelay) #NEED TO FIX ADDRESS TABLE - - # Set trigger pattern - triggerPattern= 0x0 - self.setTrgPattern(triggerPattern) - - # Set DUTs - DUTMask= 0x1 - self.setDUTmask(DUTMask) - - # # Set mode - DUTMode= 0x0 - self.setMode(DUTMode) - - # # Set modifier - modifier = int("0xFF",16) - self.setModeModifier(modifier) - - # Set veto shutter - setVetoShutters=0 - self.setVetoShutters(setVetoShutters) - - # Set veto by DUT - ignoreDUTBusy=0x0 - self.setVetoDUT(ignoreDUTBusy) - - # Set trigger interval (use 0 to disable internal triggers) - triggerInterval=0 - self.setInternalTrg(triggerInterval) - - print "miniTLU INITIALIZED" - - def setModeModifier(self, modifier): - print "\tDUT MODE MODIFIER:",modifier - self.hw.getNode("DUTInterfaces.DUTInterfaceModeModifierW").write(modifier) - self.hw.dispatch() - self.getModeModifier() - - def getModeModifier(self): - DUTInterfaceModeModifierR = self.hw.getNode("DUTInterfaces.DUTInterfaceModeModifierR").read() - self.hw.dispatch() - print "\t DUT mode modifier read back as:" , hex(DUTInterfaceModeModifierR) - return DUTInterfaceModeModifierR - - def resetClock(self): - print "\tClocks reset" - cmd = int("0x1",16) - self.hw.getNode("logic_clocks.LogicRst").write(cmd) - self.hw.dispatch() - - def getClockStatus(self): - clockStatus = self.hw.getNode("logic_clocks.LogicClocksCSR").read() - self.hw.dispatch() - print "\t Clock status=" , hex(clockStatus) - return clockStatus - - def readEEPROM(self, startadd, bytes): - mystop= 1 - time.sleep(0.1) - myaddr= [startadd]#0xfa - self.TLU_I2C.write( 0x50, [startadd], mystop) - res= self.TLU_I2C.read( 0x50, bytes) - return res - - def getSN(self): - epromcontent=self.readEEPROM(0xfa, 6) - print "\tFMC-TLU serial number (EEPROM):" - result="\t " - for iaddr in epromcontent: - result+="%02x "%(iaddr) - print result - return epromcontent - - def writeThreshold(self, Vtarget, channel): - #Writes the threshold. The DAC voltage differs from the threshold voltage because - #the range is shifted to be symmetrical around 0V. - - #Check if the DACs are using the internal reference - if (self.intRefOn): - Vref= self.VrefInt - else: - Vref= self.VrefExt - - #Calculate offset voltage (because of the following shifter) - Vdac= ( Vtarget + Vref ) / 2 - print"\tTHRESHOLD setting:" - if channel==7: - print "\t CH: ALL" - else: - print "\t CH:", channel - print "\t Target V:", Vtarget - dacValue = 0xFFFF * Vtarget / Vref - self.writeDAC(int(dacValue), channel) - - def writeDAC(self, dacCode, channel): - #Vtarget is the required voltage, channel is the DAC channel to target - #intRef indicates whether to use the external voltage reference (True) - #or the internal one (False). - - i2cSlaveAddrDac = 0x1F - - print "\t DAC value:" , dacCode - if channel<0 or channel>7: - print "writeDAC ERROR: channel",channel,"not in range 0-7 (bit mask)" - ##return -1 - if dacCode<0: - print "writeDAC ERROR: value",dacCode,"<0. Default to 0" - dacCode=0 - elif dacCode>0xFFFF : - print "writeDAC ERROR: value",dacCode,">0xFFFF. Default to 0xFFFF" - dacCode=0xFFFF - - sequence=[( 0x18 + ( channel &0x7 ) ) , int(dacCode/256)&0xff , int(dacCode)&0xff] - print "\t Writing DAC string:", sequence - self.TLU_I2C.write( i2cSlaveAddrDac, sequence, 0) - - # def readDAC(self, channel): - # #TO BE DONE - # i2cSlaveAddrDac = 0x1F - # bytes= 3 - # if channel<0 or channel>7: - # print "writeDAC ERROR: channel",channel,"not in range 0-7 (bit mask)" - # ##return -1 - # cmdDAC=[( 0x18 + ( channel &0x7 ) ) ] - # self.TLU_I2C.write( i2cSlaveAddrDac, cmdDAC, 0) - # res= self.TLU_I2C.read( i2cSlaveAddrDac, bytes) - # print res - - def setDACintRef(self, intRef=False): - i2cSlaveAddrDac = 0x1F - self.intRefOn= intRef - if intRef: - print "\tDAC internal reference ON" - cmdDAC= [0x38,0x00,0x01] - else: - print "\tDAC internal reference OFF" - cmdDAC= [0x38,0x00,0x00] - self.TLU_I2C.write( i2cSlaveAddrDac, cmdDAC, 0) - - # def getDACintRef(self): - # #TO BE FIXED! - # bytes= 3 - # i2cSlaveAddrDac = 0x1F - # cmdDAC= [0x78] - # self.TLU_I2C.write( i2cSlaveAddrDac, cmdDAC, 0) - # res= self.TLU_I2C.read( i2cSlaveAddrDac, bytes) - # print res - - def setTrgPattern(self, triggerPattern): - triggerPattern &= 0xffffffff - print "\tTRIGGER PATTERN (for external triggers) SET TO 0x%08X. Two 16-bit patterns packed into 32 bit word " %(triggerPattern) - self.hw.getNode("triggerLogic.TriggerPatternW").write(triggerPattern) - self.hw.dispatch() - self.getTrgPattern() - - def getTrgPattern(self): - triggerPatternR = self.hw.getNode("triggerLogic.TriggerPatternR").read() - self.hw.dispatch() - print "\t Trigger pattern read back as: 0x%08X " % (triggerPatternR) - return triggerPatternR - - def setDUTmask(self, DUTMask): - print "\tDUT MASK ENABLING: Mask= " , hex(DUTMask) - self.hw.getNode("DUTInterfaces.DutMaskW").write(DUTMask) - self.hw.dispatch() - self.getDUTmask() - - def getDUTmask(self): - DUTMaskR = self.hw.getNode("DUTInterfaces.DutMaskR").read() - self.hw.dispatch() - print "\t DUTMask read back as:" , hex(DUTMaskR) - return DUTMaskR - - def setVetoShutters(self, newState): - if newState: - print "\tIgnoreShutterVetoW SET TO LISTEN FOR VETO FROM SHUTTER" - cmd= int("0x0",16) - else: - print "\tIgnoreShutterVetoW SET TO IGNORE VETO FROM SHUTTER" - cmd= int("0x1",16) - self.hw.getNode("DUTInterfaces.IgnoreShutterVetoW").write(cmd) - self.hw.dispatch() - self.getVetoShutters() - - def getVetoShutters(self): - IgnoreShutterVeto = self.hw.getNode("DUTInterfaces.IgnoreShutterVetoR").read() - self.hw.dispatch() - print "\t IgnoreShutterVeto read back as:" , IgnoreShutterVeto - return IgnoreShutterVeto - - def setVetoDUT(self, ignoreDUTBusy): - print "\tVETO IGNORE BY DUT BUSY MASK SET TO" , hex(ignoreDUTBusy) - self.hw.getNode("DUTInterfaces.IgnoreDUTBusyW").write(ignoreDUTBusy) - self.hw.dispatch() - self.getVetoDUT() - - def getVetoDUT(self): - IgnoreDUTBusyR = self.hw.getNode("DUTInterfaces.IgnoreDUTBusyR").read() - self.hw.dispatch() - print "\t IgnoreDUTBusy read back as:" , hex(IgnoreDUTBusyR) - return IgnoreDUTBusyR - - def setInternalTrg(self, triggerInterval): - print "\tTRIGGERS INTERNAL:" - if triggerInterval == 0: - internalTriggerFreq = 0 - print "\t disabled" - else: - internalTriggerFreq = 160000.0/triggerInterval - print "\t Setting:", internalTriggerFreq, "Hz" - self.hw.getNode("triggerLogic.InternalTriggerIntervalW").write(int(internalTriggerFreq)) - self.hw.dispatch() - self.getInternalTrg() - - def getInternalTrg(self): - trigIntervalR = self.hw.getNode("triggerLogic.InternalTriggerIntervalR").read() - self.hw.dispatch() - print "\t Trigger frequency read back as:", trigIntervalR, "Hz" - return trigIntervalR - - def checkClkStatus(self): - clockStatus = self.hw.getNode("logic_clocks.LogicClocksCSR").read() - self.hw.dispatch() - print "\tCLOCK STATUS [expected 3]" - print "\t ", hex(clockStatus) - assert ( clockStatus == 3 ) , "Clocks in TLU FPGA are not locked. No point in continuing. Re-prgramme or power cycle board" - return clockStatus - - def setPulseStretch(self, pulseStretch): - print "\tINPUT COINCIDENCE WINDOW SET TO", hex(pulseStretch) ,"[Units= 160MHz clock cycles, Four 5-bit values (one per input) packed in to 32-bit word]" - self.hw.getNode("triggerLogic.InternalTriggerIntervalW").write(pulseStretch) - self.hw.dispatch() - self.getPulseStretch() - - def getPulseStretch(self): - pulseStretchR = self.hw.getNode("triggerLogic.InternalTriggerIntervalR").read() - self.hw.dispatch() - print "\t Pulse stretch read back as:", hex(pulseStretchR) - return pulseStretchR - - def getChCount(self, channel): - regString= "triggerInputs.ThrCount"+ str(channel)+"R" - count = self.hw.getNode(regString).read() - self.hw.dispatch() - print "\t Ch", channel, "Count:" , count - return count - - def getChStatus(self): - inputStatus= self.hw.getNode("triggerInputs.SerdesRstR").read() - self.hw.dispatch() - print "\t Input status= " , hex(inputStatus) - return inputStatus - - def setChStatus(self, cmd): - self.hw.getNode("triggerInputs.SerdesRstW").write(cmd) - inputStatus= self.hw.getNode("triggerInputs.SerdesRstR").read() - self.hw.dispatch() - print "\tINPUT STATUS SET TO= " , hex(inputStatus) - - def resetSerdes(self): - cmd = int("0x3",16) - self.setChStatus(cmd) - inputStatus= self.getChStatus() - print "\t Input status during reset = " , hex(inputStatus) - - cmd = int("0x0",16) - self.setChStatus(cmd) - inputStatus= self.getChStatus() - print "\t Input status after reset = " , hex(inputStatus) - - cmd = int("0x4",16) - self.setChStatus(cmd) - inputStatus= self.getChStatus() - print "\t Input status during calibration = " , hex(inputStatus) - - cmd = int("0x0",16) - self.setChStatus(cmd) - inputStatus= self.getChStatus() - print "\t Input status after calibration = " , hex(inputStatus) - - def resetClocks(self): - #Reset clocks - self.resetClock() - #Get clock status after reset - self.getClockStatus() - #Get serdes status - self.getChStatus() - - def getAllChannelsCounts(self): - chCounts=[] - for ch in range (0,self.nChannels): - chCounts.append(int(self.getChCount(ch))) - return chCounts - - def setPulseDelay(self, pulseDelay): - print "\tTRIGGER DELAY SET TO", pulseDelay, "[Units= 160MHz clock, Four 5-bit values (one per input) packed in to 32-bit word]" - self.hw.getNode("triggerLogic.PulseDelayW").write(pulseDelay) - self.hw.dispatch() - self.getPulseDelay() - - def getPulseDelay(self): - pulseDelayR = self.hw.getNode("triggerLogic.PulseDelayR").read() - self.hw.dispatch() - print "\t Pulse delay read back as:", hex(pulseDelayR) - return pulseDelayR - - def setMode(self, mode): - print "\tDUT MODE SET TO: ", mode - self.hw.getNode("DUTInterfaces.DUTInterfaceModeW").write(mode) - self.hw.dispatch() - self.getMode() - - def getMode(self): - DUTInterfaceModeR = self.hw.getNode("DUTInterfaces.DUTInterfaceModeR").read() - self.hw.dispatch() - print "\t DUT mode read back as:" , DUTInterfaceModeR - return DUTInterfaceModeR - - def setFifoCSR(self, cmd): - self.hw.getNode("eventBuffer.EventFifoCSR").write(cmd) - self.hw.dispatch() - self.getFifoCSR() - - def getFifoCSR(self): - FifoCSR= self.hw.getNode("eventBuffer.EventFifoCSR").read() - self.hw.dispatch() - print "\t FIFO CSR read back as:", hex(FifoCSR) - return FifoCSR - - def getFifoLevel(self): - FifoFill= self.hw.getNode("eventBuffer.EventFifoFillLevel").read() - self.hw.dispatch() - print "\t FIFO level read back as:", hex(FifoFill) - return FifoFill - - def setRecordDataStatus(self, status=False): - self.hw.getNode("Event_Formatter.Enable_Record_Data").write(status) - self.hw.dispatch() - self.getRecordDataStatus() - - def getRecordDataStatus(self): - RecordStatus= self.hw.getNode("Event_Formatter.Enable_Record_Data").read() - self.hw.dispatch() - print "\t Data recording:", RecordStatus - return RecordStatus - - def pulseT0(self): - cmd = int("0x1",16) - self.hw.getNode("Shutter.PulseT0").write(cmd) - self.hw.dispatch() - print "\tPulsing T0" - - def setTriggerVetoStatus(self, status=False): - self.hw.getNode("triggerLogic.TriggerVetoW").write(status) - self.hw.dispatch() - self.getTriggerVetoStatus() - - def getTriggerVetoStatus(self): - trgVetoStatus= self.hw.getNode("triggerLogic.TriggerVetoR").read() - self.hw.dispatch() - print "\t Trigger veto status read back as:", trgVetoStatus - return trgVetoStatus - - def start(self, logtimestamps=False): - print "miniTLU STARTING..." - - print "\tFIFO RESET:" - FIFOcmd= 0x2 - self.setFifoCSR(FIFOcmd) - - eventFifoFillLevel= self.getFifoLevel() - - if logtimestamps: - print "\tData recording set: ON" - self.setRecordDataStatus(True) - else: - print "\tData recording set: OFF" - self.setRecordDataStatus(False) - - # Pulse T0 - self.pulseT0() - - print "\tTurning off software trigger veto" - cmd = int("0x0",16) - self.setTriggerVetoStatus(cmd) - - print "miniTLU RUNNING" - - def stop(self): - print "miniTLU STOPPING..." - - print "\tTurning on software trigger veto" - cmd = int("0x1",16) - self.setTriggerVetoStatus(cmd) - - print "miniTLU STOPPED" diff --git a/miniTLU/miniTLU.xml b/miniTLU/miniTLU.xml deleted file mode 100644 index 78196f0..0000000 --- a/miniTLU/miniTLU.xml +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/miniTLU/miniTLU_old.xml b/miniTLU/miniTLU_old.xml deleted file mode 100644 index ec0373c..0000000 --- a/miniTLU/miniTLU_old.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/miniTLU/startTLU_v6.py b/miniTLU/startTLU_v6.py deleted file mode 100644 index b7948f2..0000000 --- a/miniTLU/startTLU_v6.py +++ /dev/null @@ -1,232 +0,0 @@ -# -# Script to setup AIDA TLU for TPix3 telescope <--> TORCH synchronization -# -# David Cussans, December 2012 -# -# Nasty hack - use both PyChips and uHAL ( for block read ... ) - -from PyChipsUser import * -from FmcTluI2c import * - -import uhal - -import sys - -import time - -from datetime import datetime - -from optparse import OptionParser - -# For single character non-blocking input: -import select -import tty -import termios - -from initTLU import * - -def isData(): - return select.select([sys.stdin], [], [], 0) == ([sys.stdin], [], []) - -now = datetime.now().strftime('%Y-%m-%dT%H_%M_%S') -default_filename = 'tluData_' + now + '.root' -parser = OptionParser() - -parser.add_option('-r','--rootFname',dest='rootFname', - default=default_filename,help='Path of output file') -parser.add_option('-o','--writeTimestamps',dest='writeTimestamps', - default="True",help='Set True to write timestamps to ROOT file') -parser.add_option('-p','--printTimestamps',dest='printTimestamps', - default="True",help='Set True to print timestamps to screen (nothing printed unless also output to file) ') -parser.add_option('-s','--listenForTelescopeShutter',dest='listenForTelescopeShutter', - default=False,help='Set True to veto triggers when shutter goes high') -parser.add_option('-d','--pulseDelay',dest='pulseDelay', type=int, - default=0x00,help='Delay added to input triggers. Four 5-bit numbers packed into 32-bt word, Units of 6.125ns') -parser.add_option('-w','--pulseStretch',dest='pulseStretch',type=int, - default=0x00,help='Width added to input triggers. Four 5-bit numbers packed into 32-bt word. Units of 6.125ns') -parser.add_option('-t','--triggerPattern',dest='triggerPattern',type=int, - default=0xFFFEFFFE,help='Pattern match to generate trigger. Two 16-bit words packed into 32-bit word.') -parser.add_option('-m','--DUTMask',dest='DUTMask',type=int, - default=0x01,help='Three-bit mask selecting which DUTs are active.') -parser.add_option('-y','--ignoreDUTBusy',dest='ignoreDUTBusy',type=int, - default=0x0F,help='Three-bit mask selecting which DUTs can veto triggers by setting BUSY high. Low = can veto, high = ignore busy.') -parser.add_option('-i','--triggerInterval',dest='triggerInterval',type=int, - default=0,help='Interval between internal trigers ( in units of 6.125ns ). Set to zero to turn off internal triggers') -parser.add_option('-v','--thresholdVoltage',dest='thresholdVoltage',type=float, - default=-0.2,help='Threshold voltage for TLU inputs ( units of volts)') - -(options, args) = parser.parse_args(sys.argv[1:]) - -from ROOT import TFile, TTree -from ROOT import gROOT - -print "SETTING UP AIDA TLU TO SUPPLY CLOCK AND TRIGGER TO TORCH READOUT\n" - -# Point to board in uHAL -manager = uhal.ConnectionManager("file://./connection.xml") -hw = manager.getDevice("minitlu") -device_id = hw.id() - -# Point to TLU in Pychips -bAddrTab = AddressTable("./aida_mini_tlu_addr_map.txt") - -# Assume DIP-switch controlled address. Switches at 2 -board = ChipsBusUdp(bAddrTab,"192.168.200.32",50001) - -# Open Root file -print "OPENING ROOT FILE:", options.rootFname -f = TFile( options.rootFname, 'RECREATE' ) - -# Create a root "tree" -tree = TTree( 'T', 'TLU Data' ) -highWord =0 -lowWord =0 -evtNumber=0 -timeStamp=0 -evtType=0 -trigsFired=0 -bufPos = 0 - -# Create a branch for each piece of data -tree.Branch( 'tluHighWord' , highWord , "HighWord/l") -tree.Branch( 'tluLowWord' , lowWord , "LowWord/l") -tree.Branch( 'tluTimeStamp' , timeStamp , "TimeStamp/l") -tree.Branch( 'tluBufPos' , bufPos , "Bufpos/s") -tree.Branch( 'tluEvtNumber' , evtNumber , "EvtNumber/i") -tree.Branch( 'tluEvtType' , evtType , "EvtType/b") -tree.Branch( 'tluTrigFired' , trigsFired, "TrigsFired/b") - -# Initialize TLU registers -initTLU( uhalDevice = hw, pychipsBoard = board, listenForTelescopeShutter = options.listenForTelescopeShutter, pulseDelay = options.pulseDelay, pulseStretch = options.pulseStretch, triggerPattern = options.triggerPattern , DUTMask = options.DUTMask, ignoreDUTBusy = options.ignoreDUTBusy , triggerInterval = options.triggerInterval, thresholdVoltage = options.thresholdVoltage ) - -loopWait = 0.1 -oldEvtNumber = 0 - -oldPreVetotriggerCount = board.read("PreVetoTriggersR") -oldPostVetotriggerCount = board.read("PostVetoTriggersR") - -oldThresholdCounter0 =0 -oldThresholdCounter1 =0 -oldThresholdCounter2 =0 -oldThresholdCounter3 =0 - -print "STARTING POLLING LOOP" - -eventFifoFillLevel = 0 -loopRunning = True -runStarted = False - -oldTime = time.time() - -# Save old terminal settings -oldTermSettings = termios.tcgetattr(sys.stdin) -tty.setcbreak(sys.stdin.fileno()) - -while loopRunning: - - if isData(): - c = sys.stdin.read(1) - print "\tGOT INPUT:", c - if c == 't': - loopRunning = False - print "\tTERMINATING LOOP" - elif c == 'c': - runStarted = True - print "\tSTARTING RUN" - startTLU( uhalDevice = hw, pychipsBoard = board, writeTimestamps = ( options.writeTimestamps == "True" ) ) - elif c == 'f': - # runStarted = True - print "\tSTOPPING TRIGGERS" - stopTLU( uhalDevice = hw, pychipsBoard = board ) - - - if runStarted: - - eventFifoFillLevel = hw.getNode("eventBuffer.EventFifoFillLevel").read() - - preVetotriggerCount = hw.getNode("triggerLogic.PreVetoTriggersR").read() - postVetotriggerCount = hw.getNode("triggerLogic.PostVetoTriggersR").read() - - timestampHigh = hw.getNode("Event_Formatter.CurrentTimestampHR").read() - timestampLow = hw.getNode("Event_Formatter.CurrentTimestampLR").read() - - thresholdCounter0 = hw.getNode("triggerInputs.ThrCount0R").read() - thresholdCounter1 = hw.getNode("triggerInputs.ThrCount1R").read() - thresholdCounter2 = hw.getNode("triggerInputs.ThrCount2R").read() - thresholdCounter3 = hw.getNode("triggerInputs.ThrCount3R").read() - - hw.dispatch() - - newTime = time.time() - timeDelta = newTime - oldTime - oldTime = newTime - #print "time delta = " , timeDelta - preVetoFreq = (preVetotriggerCount-oldPreVetotriggerCount)/timeDelta - postVetoFreq = (postVetotriggerCount-oldPostVetotriggerCount)/timeDelta - oldPreVetotriggerCount = preVetotriggerCount - oldPostVetotriggerCount = postVetotriggerCount - - deltaCounts0 = thresholdCounter0 - oldThresholdCounter0 - oldThresholdCounter0 = thresholdCounter0 - deltaCounts1 = thresholdCounter1 - oldThresholdCounter1 - oldThresholdCounter1 = thresholdCounter1 - deltaCounts2 = thresholdCounter2 - oldThresholdCounter2 - oldThresholdCounter2 = thresholdCounter2 - deltaCounts3 = thresholdCounter3 - oldThresholdCounter3 - oldThresholdCounter3 = thresholdCounter3 - - print "pre , post veto triggers , pre , post frequency = " , preVetotriggerCount , postVetotriggerCount , preVetoFreq , postVetoFreq - - print "CURRENT TIMESTAMP HIGH, LOW (hex) = " , hex(timestampHigh) , hex(timestampLow) - - print "Input counts 0,1,2,3 = " , thresholdCounter0 , thresholdCounter1 , thresholdCounter2 , thresholdCounter3 - print "Input freq (Hz) 0,1,2,3 = " , deltaCounts0/timeDelta , deltaCounts1/timeDelta , deltaCounts2/timeDelta , deltaCounts3/timeDelta - - nEvents = int(eventFifoFillLevel)//4 # only read out whole events ( 4 x 32-bit words ) - wordsToRead = nEvents*4 - - print "FIFO FILL LEVEL= " , eventFifoFillLevel - - print "# EVENTS IN FIFO = ",nEvents - print "WORDS TO READ FROM FIFO = ",wordsToRead - - # get timestamp data and fifo fill in same outgoing packet. - timestampData = hw.getNode("eventBuffer.EventFifoData").readBlock(wordsToRead) - - hw.dispatch() - - # print timestampData - for bufPos in range (0, nEvents ): - lowWord = timestampData[bufPos*4 + 1] + 0x100000000* timestampData[ (bufPos*4) + 0] # timestamp - - highWord = timestampData[bufPos*4 + 3] + 0x100000000* timestampData[ (bufPos*4) + 2] # evt number - evtNumber = timestampData[bufPos*4 + 3] - - if evtNumber != ( oldEvtNumber + 1 ): - print "***WARNING *** Non sqeuential event numbers *** , evt,oldEvt = ", evtNumber , oldEvtNumber - - oldEvtNumber = evtNumber - - timeStamp = lowWord & 0xFFFFFFFFFFFF - - evtType = timestampData[ (bufPos*4) + 0] >> 28 - - trigsFired = (timestampData[ (bufPos*4) + 0] >> 16) & 0xFFF - - if (options.printTimestamps == "True" ): - print "bufferPos, highWord , lowWord , event-number , timestamp , evtType = %x %016x %016x %08x %012x %01x %03x" % ( bufPos , highWord , lowWord, evtNumber , timeStamp , evtType , trigsFired) - - # Fill root branch - see example in http://wlav.web.cern.ch/wlav/pyroot/tpytree.html : write raw data and decoded data for now. - tree.Fill() - - time.sleep( loopWait) - -# Fixme - at the moment infinite loop. -preVetotriggerCount = board.read("PreVetoTriggersR") -postVetotriggerCount = board.read("PostVetoTriggersR") -print "EXIT POLLING LOOP" -print "\nTRIGGER COUNT AT THE END OF RUN [pre, post]:" , preVetotriggerCount , postVetotriggerCount - -termios.tcsetattr(sys.stdin, termios.TCSADRAIN, oldTermSettings) -f.Write() -f.Close() diff --git a/miniTLU/startTLU_v6.sh b/miniTLU/startTLU_v6.sh deleted file mode 100755 index beef09b..0000000 --- a/miniTLU/startTLU_v6.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -echo "==========================" -CURRENT_DIR=${0%/*} -echo "CURRENT DIRECTORY: " $CURRENT_DIR - -echo "============" -echo "SETTING PATHS" -#export PYTHONPATH=$CURRENT_DIR/../../../../PyChips_1_5_0_pre2A/src -export PYTHONPATH=$CURRENT_DIR/../../../../Python_Scripts/PyChips_1_5_0_pre2A/src:$PYTHONPATH -echo "PYTHON PATH= " $PYTHONPATH -export LD_LIBRARY_PATH=/opt/cactus/lib:$LD_LIBRARY_PATH -echo "LD_LIBRARY_PATH= " $LD_LIBRARY_PATH -export PATH=/usr/bin/:/opt/cactus/bin:$PATH -echo "PATH= " $PATH - -cd $CURRENT_DIR - -echo "============" -echo "STARTING PYTHON SCRIPT" -#python $CURRENT_DIR/startTLU_v8.py $@ - -python startTLU_v8.py $@ -#python testTLU_script.py diff --git a/miniTLU/startTLU_v8.py b/miniTLU/startTLU_v8.py deleted file mode 100644 index 2ad4aac..0000000 --- a/miniTLU/startTLU_v8.py +++ /dev/null @@ -1,70 +0,0 @@ -# miniTLU test script - -#from PyChipsUser import * -from FmcTluI2c import * -import uhal -import sys -import time -# from ROOT import TFile, TTree -# from ROOT import gROOT -from datetime import datetime - -from miniTLU import MiniTLU -# Use to have interactive shell -import cmd - -class MyPrompt(cmd.Cmd): - - - def do_startRun(self, args): - """Starts the TLU run""" - print "COMMAND RECEIVED: STARTING TLU RUN" - startTLU( uhalDevice = self.hw, pychipsBoard = self.board, writeTimestamps = ( options.writeTimestamps == "True" ) ) - #print self.hw - - def do_stopRun(self, args): - """Stops the TLU run""" - print "COMMAND RECEIVED: STOP TLU RUN" - #stopTLU( uhalDevice = hw, pychipsBoard = board ) - - def do_quit(self, args): - """Quits the program.""" - print "COMMAND RECEIVED: QUITTING SCRIPT." - #raise SystemExit - return True - -# # Override methods in Cmd object ## -# def preloop(self): -# """Initialization before prompting user for commands. -# Despite the claims in the Cmd documentaion, Cmd.preloop() is not a stub. -# """ -# cmd.Cmd.preloop(self) # # sets up command completion -# self._hist = [] # # No history yet -# self._locals = {} # # Initialize execution namespace for user -# self._globals = {} -# print "\nINITIALIZING" -# now = datetime.now().strftime('%Y-%m-%dT%H_%M_%S') -# default_filename = './rootfiles/tluData_' + now + '.root' -# print "SETTING UP AIDA TLU TO SUPPLY CLOCK AND TRIGGER TO TORCH READOUT\n" -# self.manager = uhal.ConnectionManager("file://./connection.xml") -# self.hw = self.manager.getDevice("minitlu") -# self.device_id = self.hw.id() -# -# # Point to TLU in Pychips -# self.bAddrTab = AddressTable("./aida_mini_tlu_addr_map.txt") -# -# # Assume DIP-switch controlled address. Switches at 2 -# self.board = ChipsBusUdp(self.bAddrTab,"192.168.200.32",50001) - - -################################################# -if __name__ == "__main__": - miniTLU= MiniTLU("minitlu", "file://./connection.xml") - miniTLU.initialize() - - logdata= False - miniTLU.start(logdata) - miniTLU.stop() - # prompt = MyPrompt() - # prompt.prompt = '>> ' - # prompt.cmdloop("Welcome to miniTLU test console.\nType HELP for a list of commands.") diff --git a/miniTLU/testTLU_script.py b/miniTLU/testTLU_script.py deleted file mode 100644 index 9d8b334..0000000 --- a/miniTLU/testTLU_script.py +++ /dev/null @@ -1,79 +0,0 @@ -# miniTLU test script - -from FmcTluI2c import * -import uhal -import sys -import time -from I2CuHal import I2CCore -from miniTLU import MiniTLU -from datetime import datetime - -if __name__ == "__main__": - print "\tTEST TLU SCRIPT" - miniTLU= MiniTLU("minitlu", "file://./connection.xml") - #(self, target, wclk, i2cclk, name="i2c", delay=None) - TLU_I2C= I2CCore(miniTLU.hw, 10, 5, "i2c_master", None) - TLU_I2C.state() - - - #READ CONTENT OF EEPROM ON 24AA02E48 (0xFA - 0XFF) - mystop= 1 - time.sleep(0.1) - myaddr= [0xfa] - TLU_I2C.write( 0x50, myaddr, mystop) - res=TLU_I2C.read( 0x50, 6) - print "Checkin EEPROM:" - result="\t" - for iaddr in res: - result+="%02x "%(iaddr) - print result - - #SCAN I2C ADDRESSES - #WRITE PROM - #WRITE DAC - - - #Convert required threshold voltage to DAC code - #def convert_voltage_to_dac(self, desiredVoltage, Vref=1.300): - print("Writing DAC setting:") - Vref= 1.300 - desiredVoltage= 3.3 - channel= 0 - i2cSlaveAddrDac = 0x1F - vrefOn= 0 - Vdaq = ( desiredVoltage + Vref ) / 2 - dacCode = 0xFFFF * Vdaq / Vref - dacCode= 0x391d - print "\tVreq:", desiredVoltage - print "\tDAC code:" , dacCode - print "\tCH:", channel - print "\tIntRef:", vrefOn - - #Set DAC value - #def set_dac(self,channel,value , vrefOn = 0 , i2cSlaveAddrDac = 0x1F): - if channel<0 or channel>7: - print "set_dac ERROR: channel",channel,"not in range 0-7 (bit mask)" - ##return -1 - if dacCode<0 or dacCode>0xFFFF: - print "set_dac ERROR: value",dacCode ,"not in range 0-0xFFFF" - ##return -1 - # AD5665R chip with A0,A1 tied to ground - #i2cSlaveAddrDac = 0x1F # seven bit address, binary 00011111 - - # print "I2C address of DAC = " , hex(i2cSlaveAddrDac) - # dac = RawI2cAccess(self.i2cBusProps, i2cSlaveAddrDac) - # # if we want to enable internal voltage reference: - - if vrefOn: - # enter vref-on mode: - print "\tTurning internal reference ON" - #dac.write([0x38,0x00,0x01]) - TLU_I2C.write( i2cSlaveAddrDac, [0x38,0x00,0x01], 0) - else: - print "\tTurning internal reference OFF" - #dac.write([0x38,0x00,0x00]) - TLU_I2C.write( i2cSlaveAddrDac, [0x38,0x00,0x00], 0) - # Now set the actual value - sequence=[( 0x18 + ( channel &0x7 ) ) , int(dacCode/256)&0xff , int(dacCode)&0xff] - print "\tWriting byte sequence:", sequence - TLU_I2C.write( i2cSlaveAddrDac, sequence, 0) diff --git a/miniTLU/test_T0.py b/miniTLU/test_T0.py deleted file mode 100644 index cf81b33..0000000 --- a/miniTLU/test_T0.py +++ /dev/null @@ -1,92 +0,0 @@ -# -# Script to exercise AIDA mini-TLU -# -# David Cussans, December 2012 -# -# Nasty hack - use both PyChips and uHAL ( for block read ... ) - -from PyChipsUser import * -from FmcTluI2c import * - -import sys -import time - - -# Point to TLU in Pychips -bAddrTab = AddressTable("./aida_mini_tlu_addr_map.txt") -# Assume DIP-switch controlled address. Switches at 2 -board = ChipsBusUdp(bAddrTab,"192.168.200.32",50001) - -# Check the bus for I2C devices -boardi2c = FmcTluI2c(board) - -firmwareID=board.read("FirmwareId") - -print "Firmware (from PyChips) = " , hex(firmwareID) - -print "Scanning I2C bus:" -scanResults = boardi2c.i2c_scan() -print scanResults - -boardId = boardi2c.get_serial_number() -print "FMC-TLU serial number = " , boardId - -resetClocks = 0 - - - -clockStatus = board.read("LogicClocksCSR") -print "Clock status = " , hex(clockStatus) - -if resetClocks: - print "Resetting clocks" - board.write("LogicRst", 1 ) - - clockStatus = board.read("LogicClocksCSR") - print "Clock status after reset = " , hex(clockStatus) - - -board.write("InternalTriggerIntervalW",0) - -print "Enabling DUT 0 and 1" -board.write("DUTMaskW",3) -DUTMask = board.read("DUTMaskR") -print "DUTMaskR = " , DUTMask - -print "Ignore veto on DUT 0 and 1" -board.write("IgnoreDUTBusyW",3) -IgnoreDUTBusy = board.read("IgnoreDUTBusyR") -print "IgnoreDUTBusyR = " , IgnoreDUTBusy - -print "Turning off software trigger veto" -board.write("TriggerVetoW",0) - -print "Reseting FIFO" -board.write("EventFifoCSR",0x2) -eventFifoFillLevel = board.read("EventFifoFillLevel") -print "FIFO fill level after resetting FIFO = " , eventFifoFillLevel - -print "Enabling data recording" -board.write("Enable_Record_Data",1) - -#print "Enabling handshake: No-handshake" -#board.write("HandshakeTypeW",1) - -#TriggerInterval = 400000 -TriggerInterval = 0 -print "Setting internal trigger interval to " , TriggerInterval -board.write("InternalTriggerIntervalW",TriggerInterval) #0->Internal pulse generator disabled. Any other value will generate pulses with a frequency of n*6.25ns -trigInterval = board.read("InternalTriggerIntervalR") -print "Trigger interval read back as ", trigInterval - -print "Setting TPix_maskexternal to ignore external shutter and T0" -board.write("TPix_maskexternal",0x0003) - -numLoops = 500000 -oldEvtNumber = 0 - -for iLoop in range(0,numLoops): - - board.write("TPix_T0", 0x0001) - -# time.sleep( 1.0) diff --git a/packages/AD5665R.py b/packages/AD5665R.py deleted file mode 100644 index b377183..0000000 --- a/packages/AD5665R.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- -import uhal -from packages.I2CuHal import I2CCore - - -class AD5665R: - #Class to configure the DAC modules - - def __init__(self, i2c, slaveaddr=0x1F): - self.i2c = i2c - self.slaveaddr = slaveaddr - - - def setIntRef(self, intRef=False, verbose=False): - mystop=True - if intRef: - cmdDAC= [0x38,0x00,0x01] - else: - cmdDAC= [0x38,0x00,0x00] - self.i2c.write( self.slaveaddr, cmdDAC, mystop) - if verbose: - print(" AD5665R") - print("\tDAC int ref:", intRef) - - - def writeDAC(self, dacCode, channel, verbose=False): - #Vtarget is the required voltage, channel is the DAC channel to target - #intRef indicates whether to use the external voltage reference (True) - #or the internal one (False). - - print("\tDAC value:" , hex(dacCode)) - if channel<0 or channel>7: - print("writeDAC ERROR: channel",channel,"not in range 0-7 (bit mask)") - return -1 - if dacCode<0: - print("writeDAC ERROR: value",dacCode,"<0. Default to 0") - dacCode=0 - elif dacCode>0xFFFF : - print("writeDAC ERROR: value",dacCode,">0xFFFF. Default to 0xFFFF") - dacCode=0xFFFF - - sequence=[( 0x18 + ( channel &0x7 ) ) , int(dacCode/256)&0xff , int(dacCode)&0xff] - print("\tWriting DAC string:", sequence) - mystop= False - self.i2c.write( self.slaveaddr, sequence, mystop) diff --git a/packages/ADN2814ACPZ.py b/packages/ADN2814ACPZ.py deleted file mode 100644 index 31b3dc6..0000000 --- a/packages/ADN2814ACPZ.py +++ /dev/null @@ -1,144 +0,0 @@ -# -*- coding: utf-8 -*- -import uhal -from I2CuHal import I2CCore -import StringIO -import math - -class ADN2814ACPZ: - #Class to configure the ADN2814 clock and data recovery chip (CDR) - # The I2C address can either be 0x40 or 0x60 - - def __init__(self, i2c, slaveaddr=0x40): - self.i2c = i2c - self.slaveaddr = slaveaddr - self.regDictionary= {'freq0': 0x0, 'freq1': 0x1, 'freq2': 0x2, 'rate': 0x3, 'misc': 0x4, 'ctrla': 0x8, 'ctrlb': 0x9, 'ctrlc': 0x11} - - def writeReg(self, regN, regContent, verbose=False): - #Basic functionality to write to register. - regContent= regContent & 0xFF - mystop=True - cmd= [regN, regContent] - self.i2c.write( self.slaveaddr, cmd, mystop) - - - def readReg(self, regN, nwords, verbose=False): - #Basic functionality to read from register. - mystop=False - self.i2c.write( self.slaveaddr, [regN], mystop) - res= self.i2c.read( self.slaveaddr, nwords) - return res - - def readf0(self, verbose=False): - res= self.readReg(self.regDictionary['freq0'], 1, False) - if verbose: - print "\tfreq0 is", res[0] - return res[0] - - def readf1(self, verbose=False): - res= self.readReg(self.regDictionary['freq1'], 1, False) - if verbose: - print "\tfreq1 is", res[0] - return res[0] - - def readf2(self, verbose=False): - res= self.readReg(self.regDictionary['freq2'], 1, False) - if verbose: - print "\tfreq2 is", res[0] - return res[0] - - def readFrequency(self, verbose=False): - # write 1 to CTRLA[1] - # reset MISC[2] by writing a 1 followed by a 0 to CTRLB[3] - # read back MISC[2], if 0 the measurement is not complete (typ 80 ms). If 1 the data rate can be read by reading FREQ[22:0] - # read FREQ2, FREQ1, FREQ0 - # rate= (FREQ[22:0]xFrefclk)/2^(14+SEL_RATE) - - return - - def readLOLstatus(self, verbose=False): - # return the status of the LOL bit MISC[3] and the STATIC LOL MISC[4] - # the STATIC LOL is asserted if a LOL condition occurred and remains asserted - # until cleared by writing 1 followed by 0 to the CTRLB[6] bit - misc= self.readReg(self.regDictionary['misc'], 1, False)[0] - staticLOL= (misc & 0x10000) >> 4 - LOL= (misc & 0x1000) >> 3 - if verbose: - print "MISC=", misc, "LOL=", LOL, "StaticLOL=", staticLOL - return [LOL, staticLOL] - - def readRate(self, verbose=False): - rate_msb= self.readReg(self.regDictionary['rate'], 1, False)[0] - rate_lsb= self.readReg(self.regDictionary['misc'], 1, False)[0] - rate_lsb= 0x1 & rate_lsb - rate= (rate_msb << 1) | rate_lsb - if verbose: - print "\tcoarse rate is", rate - return rate - - def _writeCTRLA(self, fRef, dataRatio, measureDataRate, lockToRef, verbose=False): - #write content to register CTRLA: - # fRef: reference frequency in MHz; range is [10 : 160] - # dataRatio: integer in range [0 : 8] equal to Data Rate/Div_FREF Ratio - # measureDataRate: set to 1 to measure data rate - # lockToRef= 0 > lock to input data; 1 > lock to reference clock - regContent= 0x0 - if fRef < 10: - print "fRef must be comprised between 10 and 160. Coherced to 10" - fRef = 10 - if fRef > 160: - print "fRef must be comprised between 10 and 160. Coherced to 160" - fRef = 160 - fRefRange={ - 10<= fRef <20 : 0x00, - 20<= fRef <40 : 0x01, - 40<= fRef <80 : 0x02, - 80<= fRef <=160 : 0x03, - }[1] - fRefRange= fRefRange << 6 - regContent= regContent | fRefRange - - if ((1 <= dataRatio <= 256) & (isinstance(dataRatio, (int, long) )) ): - ratioValue= math.log(dataRatio, 2) - ratioValue= int(ratioValue) - else: - print " dataRatio should be an integer in the form 2^n with 0<= n <= 8. Coherced to 0" - ratioValue= 0 - if verbose: - print "\tratioValue=", ratioValue - ratioValue = ratioValue << 2 - regContent= regContent | ratioValue - - measureDataRate= (measureDataRate & 0x1) << 1 - lockToRef= lockToRef & 0x1 - regContent= regContent | measureDataRate | lockToRef - - self.writeReg( self.regDictionary['ctrla'], regContent, verbose=False) - return - - def _writeCTRLB(self, confLOL, rstMisc4, systemReset, rstMisc2, verbose=False): - #write content to register CTRLB: - # confLOL=0 > LOL pin normal operation; 1 > LOL pin is static LOL - # rstMisc4= Write a 1 followed by 0 to reset MISC[4] (staticLOL) - # systemReset= Write 1 followed by 0 to reset ADN2814 - # rsttMisc2= Write a 1 followed by 0 to reset MISC[2] (data read measure complete) - regContent= 0x0 - confLOL= (confLOL & 0x1) << 7 - rstMisc4= (rstMisc4 & 0x1) << 6 - systemReset= (systemReset & 0x1) << 5 - rstMisc2= (rstMisc2 & 0x1) << 3 - regContent= regContent | confLOL | rstMisc4 | systemReset | rstMisc2 - self.writeReg( self.regDictionary['ctrlb'], regContent, verbose=False) - return - - def _writeCTRLC(self, confLOS, squelch, outBoost, verbose=False): - #write content to register CTRLC: - # confLOS= 0 > active high LOS; 1 > active low LOS - # squelch= 0 > squelch CLK and DATA; 1 > squelch CLK or DATA - # outBoost= 0 > default swing; boost output swing - regContent= 0x0 - confLOS= (confLOS & 0x1) << 2 - squelch= (squelch & 0x1) << 1 - outBoost= (outBoost & 0x1) - regContent= regContent | confLOS | squelch | outBoost - self.writeReg( self.regDictionary['ctrlc'], regContent, verbose=False) - return diff --git a/packages/ATSHA204A.py b/packages/ATSHA204A.py deleted file mode 100644 index 32ec5ae..0000000 --- a/packages/ATSHA204A.py +++ /dev/null @@ -1,114 +0,0 @@ -# -*- coding: utf-8 -*- -import uhal -from packages.I2CuHal import I2CCore -import numpy as np - - -class ATSHA204A: - #Class for Atmel ATSHA204A eeprom - - def __init__(self, i2c, slaveaddr= 0x64): - self.i2c = i2c - self.slaveaddr = slaveaddr - - #Slot size, in bytes. - self.SLOT_SIZE_BYTES = 32; - #Word size, in bytes. This is the base unit for all reads and writes. - self.WORD_SIZE_BYTES = 4; - #Maximum word offset per slot - self.MAX_WORD_OFFSET = 7; - #Size of the configuration zone, in bytes - self.CONFIGURATION_ZONE_SIZE_BYTES = 88; - #Number of slots in the configuration zone - self.CONFIGURATION_ZONE_SIZE_SLOTS = 3; - #Slot 3 in the configuration zone is only 24 bytes rather than 32, so the max word offset is limited to 5. - self.CONFIGURATION_ZONE_SLOT_2_MAX_WORD_OFFSET = 5; - #Size of the OTP zone, in bytes - self.OTP_ZONE_SIZE_BYTES = 64; - #Number of slots in the OTP zone - self.OTP_ZONE_SIZE_SLOTS = 2; - #Size of the data zone, in bytes - self.DATA_ZONE_SIZE_BYTES = 512; - #Number of slots in the data zone - self.DATA_ZONE_SIZE_SLOTS = 16; - #The data slot used for module configuration data - self.DATA_ZONE_SLOT_MODULE_CONFIGURATION = 0; - #Byte index of the OTP mode byte within its configuration word. - self.OTP_MODE_WORD_BYTE_INDEX = 2; - -#------------------------------------------------------------------------------------------------- -# Command packets and I/O -#------------------------------------------------------------------------------------------------- - #Command execution status response block size - self.STATUS_RESPONSE_BLOCK_SIZE_BYTES = 4; - #Byte index of count in response block - self.STATUS_RESPONSE_COUNT_BYTE_INDEX = 0; - #Byte index of status code in response block - self.STATUS_RESPONSE_STATUS_BYTE_INDEX = 1; - #Checksum size - self.CHECKSUM_LENGTH_BYTES = 2; - #Index of the count byte in a command packet - self.COMMAND_PACKET_COUNT_BYTE_INDEX = 0; - #Size of count in a command packet - self.COMMAND_PACKET_COUNT_SIZE_BYTES = 1; - #Index of the opcode byte in a command packet - self.COMMAND_PACKET_OPCODE_BYTE_INDEX = 1; - #Size of the opcode byte in a command packet - self.COMMAND_PACKET_OPCODE_LENGTH_BYTES = 1; - #Index of param 1 in a command packet - self.COMMAND_PACKET_PARAM1_BYTE_INDEX = 2; - #Size of param 1 in a command packet - self.COMMAND_PACKET_PARAM1_SIZE_BYTES = 1; - #Index of param 2 in a command packet - self.COMMAND_PACKET_PARAM2_BYTE_INDEX = 3; - #Size of param 2 in a command packet - self.COMMAND_PACKET_PARAM2_SIZE_BYTES = 2; - - def _CalculateCrc(self, pData, dataLengthBytes): - # Calculate a CRC-16 used when communicating with the device. Code taken from Atmel's library. - #The Atmel documentation only specifies that the CRC algorithm used on the ATSHA204A is CRC-16 with polynomial - #0x8005; compared to a standard CRC-16, however, the used algorithm doesn't use remainder reflection. - #@param pData The data to calculate the CRC for - #@param dataLengthBytes The number of bytes to process - #@return The CRC - polynomial = 0x8005 - crcRegister = 0 - if not pData: - print("_CalculateCrc: No data to process") - return 0 - for counter in range(0, dataLengthBytes): - shiftRegister= 0x01 - for iShift in range(0, 8): - if (pData[counter] & shiftRegister) : - dataBit= 1 - else: - dataBit=0 - crcBit= ((crcRegister) >> 15) - crcRegister <<= 1 - crcRegister= crcRegister & 0xffff - #print shiftRegister, "\t", dataBit, "\t", crcBit, "\t", crcRegister - shiftRegister= shiftRegister << 1 - if (dataBit != crcBit): - #print "poly" - crcRegister ^= polynomial; - return crcRegister - - def _wake(self, verifyDeviceIsAtmelAtsha204a, debug): - dummyWriteData = 0x00 - mystop=True - self.i2c.write( self.slaveaddr, [dummyWriteData], mystop) - - if (verifyDeviceIsAtmelAtsha204a): - expectedStatusBlock= [ 0x04, 0x11, 0x33, 0x43 ]; - nwords= 4 - res= self.i2c.read( self.slaveaddr, nwords) - if (res != expectedStatusBlock): - print("Attempt to awake Atmel ATSHA204A failed") - print(res) - - def _GetCommandPacketSize(self, additionalDataLengthBytes): - packetSizeBytes = self.COMMAND_PACKET_COUNT_SIZE_BYTES + self.COMMAND_PACKET_OPCODE_LENGTH_BYTES \ - + self.COMMAND_PACKET_PARAM1_SIZE_BYTES + self.COMMAND_PACKET_PARAM2_SIZE_BYTES \ - + additionalDataLengthBytes + self.CHECKSUM_LENGTH_BYTES; - - return packetSizeBytes diff --git a/packages/E24AA025E48T.py b/packages/E24AA025E48T.py deleted file mode 100644 index 32cc429..0000000 --- a/packages/E24AA025E48T.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -import uhal -from I2CuHal import I2CCore -import StringIO - -class E24AA025E48T: - #Class to configure the EEPROM - - def __init__(self, i2c, slaveaddr=0x50): - self.i2c = i2c - self.slaveaddr = slaveaddr - - - def readEEPROM(self, startadd, nBytes): - #Read EEPROM memory locations - mystop= False - myaddr= [startadd]#0xfa - self.i2c.write( self.slaveaddr, [startadd], mystop) - res= self.i2c.read( self.slaveaddr, nBytes) - return res diff --git a/packages/FmcTluI2c.py b/packages/FmcTluI2c.py deleted file mode 100644 index 04bf598..0000000 --- a/packages/FmcTluI2c.py +++ /dev/null @@ -1,132 +0,0 @@ -import time -#from PyChipsUser import * -from I2cBusProperties import * -from RawI2cAccess import * - - -class FmcTluI2c: - - - ############################ - ### configure i2c connection - ############################ - def __init__(self,board): - self.board = board - i2cClockPrescale = 0x30 - self.i2cBusProps = I2cBusProperties(self.board, i2cClockPrescale) - return - - - ########################## - ### scan all i2c addresses - ########################## - def i2c_scan(self): - list=[] - for islave in range(128): - i2cscan = RawI2cAccess(self.i2cBusProps, islave) - try: - i2cscan.write([0x00]) - device="slave address "+hex(islave)+" " - if islave==0x1f: - device+="(DAC)" - elif islave==0x50: - device+="(serial number PROM)" - elif islave>=0x54 and islave<=0x57: - device+="(sp601 onboard EEPROM)" - else: - device+="(???)" - pass - list.append(device) - pass - except: - pass - pass - return list - - - ################### - ### write to EEPROM - ################### - def eeprom_write(self,address,value): - if address<0 or address>127: - print "eeprom_write ERROR: address",address,"not in range 0-127" - return - if value<0 or value>255: - print "eeprom_write ERROR: value",value,"not in range 0-255" - return - i2cSlaveAddr = 0x50 # seven bit address, binary 1010000 - prom = RawI2cAccess(self.i2cBusProps, i2cSlaveAddr) - prom.write([address,value]) - time.sleep(0.01) # write cycle time is 5ms. let's wait 10 to make sure. - return - - - #################### - ### read from EEPROM - #################### - def eeprom_read(self,address): - if address<0 or address>255: - print "eeprom_write ERROR: address",address,"not in range 0-127" - return - i2cSlaveAddr = 0x50 # seven bit address, binary 1010000 - prom = RawI2cAccess(self.i2cBusProps, i2cSlaveAddr) - prom.write([address]) - return prom.read(1)[0] - - - ###################### - ### read serial number - ###################### - def get_serial_number(self): - result="" - for iaddr in [0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff]: - result+="%02x "%(self.eeprom_read(iaddr)) - pass - return result - - - ################# - ### set DAC value - ################# - def set_dac(self,channel,value , vrefOn = 0 , i2cSlaveAddrDac = 0x1F): - if channel<0 or channel>7: - print "set_dac ERROR: channel",channel,"not in range 0-7 (bit mask)" - return -1 - if value<0 or value>0xFFFF: - print "set_dac ERROR: value",value,"not in range 0-0xFFFF" - return -1 - # AD5665R chip with A0,A1 tied to ground - #i2cSlaveAddrDac = 0x1F # seven bit address, binary 00011111 - print "I2C address of DAC = " , hex(i2cSlaveAddrDac) - dac = RawI2cAccess(self.i2cBusProps, i2cSlaveAddrDac) - # if we want to enable internal voltage reference: - if vrefOn: - # enter vref-on mode: - print "Turning internal reference ON" - dac.write([0x38,0x00,0x01]) - else: - print "Turning internal reference OFF" - dac.write([0x38,0x00,0x00]) - # now set the actual value - sequence=[( 0x18 + ( channel &0x7 ) ) , (value/256)&0xff , value&0xff] - print sequence - dac.write(sequence) - - - - ################################################## - ### convert required threshold voltage to DAC code - ################################################## - def convert_voltage_to_dac(self, desiredVoltage, Vref=1.300): - Vdaq = ( desiredVoltage + Vref ) / 2 - dacCode = 0xFFFF * Vdaq / Vref - return int(dacCode) - - - ################################################## - ### calculate the DAC code required and set DAC - ################################################## - def set_threshold_voltage(self, channel , voltage ): - dacCode = self.convert_voltage_to_dac(voltage) - print " requested voltage, calculated DAC code = " , voltage , dacCode - self.set_dac(channel , dacCode) diff --git a/packages/I2CDISP.py b/packages/I2CDISP.py deleted file mode 100644 index 06ac0d8..0000000 --- a/packages/I2CDISP.py +++ /dev/null @@ -1,248 +0,0 @@ -# -*- coding: utf-8 -*- -import uhal -from packages.I2CuHal2 import I2CCore -import time - -import math -import numpy as np - -####################################################################################### -class CFA632: - #Class to configure the CFA632 display - - def __init__(self, i2c, slaveaddr=0x2A): - self.i2c = i2c - self.slaveaddr = slaveaddr - - def test(self): - print("Testing the display") - return - - def writeSomething(self, i2ccmd): - mystop= True - print("Write to CFA632") - print("\t", i2ccmd) - #myaddr= [int(i2ccmd)] - self.i2c.write( self.slaveaddr, i2ccmd, mystop) - return - -####################################################################################### -class LCD_ada: - def __init__(self, i2c, slaveaddr=0x20): - self.i2c = i2c - self.slaveaddr = slaveaddr - self.nRows= 2 - self.nCols= 16 - - def test(self): - mystop= True - i2ccmd= [] - print("Write to LCD_ada") - print("\t", i2ccmd) - #myaddr= [int(i2ccmd)] - self.getIOdir() - self.setIOdir(0x7F) - self.getIOdir() - self.setGPIO(0x80) - self.i2c.write( self.slaveaddr, i2ccmd, mystop) - - def getGPIO(self): - # Read port (if configured as inputs) - mystop=False - regN= 0x09 - nwords= 1 - self.i2c.write( self.slaveaddr, [regN], mystop) - res= self.i2c.read( self.slaveaddr, nwords) - print("MCP23008 IOdir", res) - return res - - def setGPIO(self, gpio): - # Sets the output latch - mystop= True - i2ccmd= [9, gpio] - print("Write GPIO to MCP23008") - self.i2c.write( self.slaveaddr, i2ccmd, mystop) - - def getIOdir(self): - mystop=False - regN= 0x00 - nwords= 1 - self.i2c.write( self.slaveaddr, [regN], mystop) - res= self.i2c.read( self.slaveaddr, nwords) - print("MCP23008 IOdir", res) - return res - - def setIOdir(self, iodir): - # 1 indicates the port is an input - # 0 indicates the port is an output - mystop= True - i2ccmd= [0, iodir] - print("Write IODIR to MCP23008") - self.i2c.write( self.slaveaddr, i2ccmd, mystop) - -####################################################################################### -class LCD09052: - #Class to configure the LCD09052 display - - def __init__(self, i2c, slaveaddr=0x3A): - self.i2c = i2c - self.slaveaddr = slaveaddr - self.nRows= 2 - self.nCols= 16 - self.setLCDtype(self.nRows, self.nCols) - - def test(self): - print("\tTesting display (LCD09052)") - self.clear() - self.setBrightness(0) - time.sleep(0.2) - self.setBrightness(250) - time.sleep(0.2) - self.setBrightness(0) - time.sleep(0.2) - self.setBrightness(250) - for ipos in range(1, 17): - self.writeChar(33) - self.posCursor(1, ipos-1) - time.sleep(0.1) - self.writeChar(254) - self.posCursor(2, 1) - for ipos in range(1, 17): - self.writeChar(33) - self.posCursor(2, ipos-1) - time.sleep(0.1) - self.writeChar(254) - self.clear - self.clearLine(1) - self.writeChar(33) - time.sleep(0.1) - self.writeChar(33) - time.sleep(0.1) - self.writeChar(33) - time.sleep(0.1) - self.writeChar(33) - time.sleep(0.1) - self.writeChar(33) - time.sleep(0.1) - self.clearLine(1) - self.writeString([80, 81, 80, 81, 82]) - return - - def test2(self, myString1= "", myString2= ""): - #myString= [80, 81, 80, 81, 82] - self.clear() - self.dispString(myString1) - self.posCursor(2, 1) - self.dispString(myString2) - self.pulseLCD(1) - time.sleep(0.3) - myChar= [0, 17, 0, 0, 17, 14, 0, 0] - #self.writeChar(1) - #time.sleep(1) - #self.createChar(1, [31, 31, 31, 0, 17, 14, 0, 0]) - #self.createChar(2, [0, 0, 17, 0, 0, 17, 14, 0]) - #time.sleep(1) - #self.writeChar(1) - return - - def dispString(self, myString): - ### Writes the string on the display - myInts=[] - for iChar in list(myString): - myInts.append(ord(iChar)) - self.writeString(myInts) - return - - def writeString(self, myChars): - ### Writes a list of chars from the current position of the cursor - ## NOTE: myChars is a list of integers corresponding to the ASCII code of each - ## character to be printed. Use "dispString" to input an actual string. - #i2ccmd= [1, myChars] - myChars.insert(0, 1) - mystop= True - self.i2c.write( self.slaveaddr, myChars, mystop) - - def posCursor(self, line, pos): - ### Position the cursor on a specific location - ## line can be 1 (top) or 2 (bottom) - ## pos can be [1, 16} - if ( ((line==1) or (line==2)) and (1 <= pos <= self.nCols)): - i2ccmd= [2, line, pos] - mystop= True - self.i2c.write( self.slaveaddr, i2ccmd, mystop) - else: - print("Cursor line can only be 1 or 2, position must be in range [1,", self.nCols, "]") - - def clearLine(self, iLine): - ### Clear line. Place cursor at beginning of line. - if ((iLine==1) or (iLine==2)): - i2ccmd= [3, iLine] - mystop= True - self.i2c.write( self.slaveaddr, i2ccmd, mystop) - - def clear(self): - ### Clears the display and locates the curson on position (1,1), i.e. top left - i2ccmd= [4] - mystop= True - self.i2c.write( self.slaveaddr, i2ccmd, mystop) - - def setLCDtype(self, nLines, nColumns): - ### Specifies the number of lines and columns in the display. - ## This does not seem to do much but we use it anyway. - ## NOTE: no check is performed on the nLines and nColumns parameters so be - ## carefuls in using this function. - i2ccmd= [5, nLines, nColumns] - mystop= True - self.i2c.write( self.slaveaddr, i2ccmd, mystop) - - def setBrightness(self, value= 250): - ### Sets the brightness level of the backlight. - ## Value is an integer in range [0, 250]. 0= no light, 250= maximum light. - if value < 0: - print("setBrightness: minimum value= 0. Coherced to 0") - value = 0 - if value > 250: - print("setBrightness: maximum value= 250. Coherced to 250") - value = 250 - i2ccmd= [7, value] - mystop= True - self.i2c.write( self.slaveaddr, i2ccmd, mystop) - - def writeChar(self, value): - ### Writes a char in the current cursor position - ## The cursor is then shifted right one position - ## value must be an integer corresponding to the ascii code of the character - i2ccmd= [10, value] - mystop= True - self.i2c.write( self.slaveaddr, i2ccmd, mystop) - return - - def createChar(self, pos=1, myChar=[]): - ### Define a personalized character and stores it in position "pos" - ## NOTE: This is not working yet. - mystop= True - myChar= [0, 17, 0, 0, 17, 14, 0, 0] - myChar.insert(0, 64) - self.i2c.write( self.slaveaddr, myChar, mystop) - return - - def writeSomething(self, i2ccmd): - mystop= True - print("Write to LCD09052") - print("\t", i2ccmd) - #myaddr= [int(i2ccmd)] - self.i2c.write( self.slaveaddr, i2ccmd, mystop) - return - - def pulseLCD(self, nCycles): - ### Sets the backlight to pulse for N cycles. - ## Each cycle lasts approximately 1.5 s and start/stop on full brightness - ## The light varies according to a sinusoidal wave - startP= 0 - endP= nCycles*(math.pi) - nPoints= 15*nCycles - myList= np.linspace(startP, endP, nPoints).tolist() - for iPt in myList: - iBright= int(250*abs(math.cos(iPt))) - self.setBrightness(iBright) - time.sleep(0.1) diff --git a/packages/I2CuHal.py b/packages/I2CuHal.py deleted file mode 100644 index 434cec1..0000000 --- a/packages/I2CuHal.py +++ /dev/null @@ -1,282 +0,0 @@ -# -*- coding: utf-8 -*- -""" - -""" - -import time - -import uhal - -verbose = True - - - -################################################################################ -# /* -# I2C CORE -# */ -################################################################################ - - - - -class I2CCore: - """I2C communication block.""" - - # Define bits in cmd_stat register - startcmd = 0x1 << 7 - stopcmd = 0x1 << 6 - readcmd = 0x1 << 5 - writecmd = 0x1 << 4 - ack = 0x1 << 3 - intack = 0x1 - - recvdack = 0x1 << 7 - busy = 0x1 << 6 - arblost = 0x1 << 5 - inprogress = 0x1 << 1 - interrupt = 0x1 - - def __init__(self, target, wclk, i2cclk, name="i2c", delay=None): - self.target = target - self.name = name - self.delay = delay - self.prescale_low = self.target.getNode("%s.i2c_pre_lo" % name) - self.prescale_high = self.target.getNode("%s.i2c_pre_hi" % name) - self.ctrl = self.target.getNode("%s.i2c_ctrl" % name) - self.data = self.target.getNode("%s.i2c_rxtx" % name) - self.cmd_stat = self.target.getNode("%s.i2c_cmdstatus" % name) - self.wishboneclock = wclk - self.i2cclock = i2cclk - self.config() - - def state(self): - status = {} - status["ps_low"] = self.prescale_low.read() - status["ps_hi"] = self.prescale_high.read() - status["ctrl"] = self.ctrl.read() - status["data"] = self.data.read() - status["cmd_stat"] = self.cmd_stat.read() - self.target.dispatch() - status["prescale"] = status["ps_hi"] << 8 - status["prescale"] |= status["ps_low"] - for reg in status: - val = status[reg] - bval = bin(int(val)) - if verbose: - print("\treg %s = %d, 0x%x, %s" % (reg, val, val, bval)) - - def clearint(self): - self.ctrl.write(0x1) - self.target.dispatch() - - def config(self): - #INITIALIZATION OF THE I2S MASTER CORE - #Disable core - self.ctrl.write(0x0 << 7) - self.target.dispatch() - #Write pre-scale register - #prescale = int(self.wishboneclock / (5.0 * self.i2cclock)) - 1 - #prescale = int(self.wishboneclock / (5.0 * self.i2cclock)) - prescale = 0x0100 #FOR NOW HARDWIRED, TO BE MODIFIED - self.prescale_low.write(prescale & 0xff) - self.prescale_high.write((prescale & 0xff00) >> 8) - #Enable core - self.ctrl.write(0x1 << 7) - self.target.dispatch() - - def checkack(self): - inprogress = True - ack = False - while inprogress: - cmd_stat = self.cmd_stat.read() - self.target.dispatch() - inprogress = (cmd_stat & I2CCore.inprogress) > 0 - ack = (cmd_stat & I2CCore.recvdack) == 0 - return ack - - def delayorcheckack(self): - ack = True - if self.delay is None: - ack = self.checkack() - else: - time.sleep(self.delay) - ack = self.checkack()#Remove this? - return ack - -################################################################################ -# /* -# I2C WRITE -# */ -################################################################################ - - - - def write(self, addr, data, stop=True): - """Write data to the device with the given address.""" - # Start transfer with 7 bit address and write bit (0) - nwritten = -1 - addr &= 0x7f - addr = addr << 1 - startcmd = 0x1 << 7 - stopcmd = 0x1 << 6 - writecmd = 0x1 << 4 - #Set transmit register (write operation, LSB=0) - self.data.write(addr) - #Set Command Register to 0x90 (write, start) - self.cmd_stat.write(I2CCore.startcmd | I2CCore.writecmd) - self.target.dispatch() - ack = self.delayorcheckack() - if not ack: - self.cmd_stat.write(I2CCore.stopcmd) - self.target.dispatch() - print("no ack from I2C address", hex(addr>>1)) - return nwritten - nwritten += 1 - for val in data: - val &= 0xff - #Write slave memory address - self.data.write(val) - #Set Command Register to 0x10 (write) - self.cmd_stat.write(I2CCore.writecmd) - self.target.dispatch() - ack = self.delayorcheckack() - if not ack: - self.cmd_stat.write(I2CCore.stopcmd) - self.target.dispatch() - return nwritten - nwritten += 1 - if stop: - self.cmd_stat.write(I2CCore.stopcmd) - self.target.dispatch() - return nwritten - -################################################################################ -# /* -# I2C READ -# */ -################################################################################ - def read(self, addr, n): - """Read n bytes of data from the device with the given address.""" - # Start transfer with 7 bit address and read bit (1) - data = [] - addr &= 0x7f - addr = addr << 1 - addr |= 0x1 # read bit - self.data.write(addr) - self.cmd_stat.write(I2CCore.startcmd | I2CCore.writecmd) - self.target.dispatch() - ack = self.delayorcheckack() - if not ack: - self.cmd_stat.write(I2CCore.stopcmd) - self.target.dispatch() - return data - for i in range(n): - if i < (n-1): - self.cmd_stat.write(I2CCore.readcmd) # <--- - else: - self.cmd_stat.write(I2CCore.readcmd | I2CCore.ack | I2CCore.stopcmd) # <--- This tells the slave that it is the last word - self.target.dispatch() - ack = self.delayorcheckack() - val = self.data.read() - self.target.dispatch() - data.append(val & 0xff) - #self.cmd_stat.write(I2CCore.stopcmd) - #self.target.dispatch() - return data - -################################################################################ -# /* -# I2C WRITE-READ -# */ -################################################################################ - - - - # def writeread(self, addr, data, n): - # """Write data to device, then read n bytes back from it.""" - # nwritten = self.write(addr, data, stop=False) - # readdata = [] - # if nwritten == len(data): - # readdata = self.read(addr, n) - # return nwritten, readdata - -""" -SPI core XML: - - - - - - - - - - -""" -class SPICore: - - go_busy = 0x1 << 8 - rising = 1 - falling = 0 - - - def __init__(self, target, wclk, spiclk, basename="io.spi"): - self.target = target - # Only a single data register is required since all transfers are - # 16 bit long - self.data = target.getNode("%s.d0" % basename) - self.control = target.getNode("%s.ctrl" % basename) - self.control_val = 0b0 - self.divider = target.getNode("%s.divider" % basename) - self.slaveselect = target.getNode("%s.ss" % basename) - self.divider_val = int(wclk / spiclk / 2.0 - 1.0) - self.divider_val = 0x7f - self.configured = False - - def config(self): - "Configure SPI interace for communicating with ADCs." - self.divider_val = int(self.divider_val) % 0xffff - if verbose: - print("Configuring SPI core, divider = 0x%x" % self.divider_val) - self.divider.write(self.divider_val) - self.target.dispatch() - self.control_val = 0x0 - self.control_val |= 0x0 << 13 # Automatic slave select - self.control_val |= 0x0 << 12 # No interrupt - self.control_val |= 0x0 << 11 # MSB first - # ADC samples data on rising edge of SCK - self.control_val |= 0x1 << 10 # change ouput on falling edge of SCK - # ADC changes output shortly after falling edge of SCK - self.control_val |= 0x0 << 9 # read input on rising edge - self.control_val |= 0x10 # 16 bit transfers - if verbose: - print("SPI control val = 0x%x = %s" % (self.control_val, bin(self.control_val))) - self.configured = True - - def transmit(self, chip, value): - if not self.configured: - self.config() - assert chip >= 0 and chip < 8 - value &= 0xffff - self.data.write(value) - checkdata = self.data.read() - self.target.dispatch() - assert checkdata == value - self.control.write(self.control_val) - self.slaveselect.write(0xff ^ (0x1 << chip)) - self.target.dispatch() - self.control.write(self.control_val | SPICore.go_busy) - self.target.dispatch() - busy = True - while busy: - status = self.control.read() - self.target.dispatch() - busy = status & SPICore.go_busy > 0 - self.slaveselect.write(0xff) - data = self.data.read() - ss = self.slaveselect.read() - status = self.control.read() - self.target.dispatch() - #print "Received data: 0x%x, status = 0x%x, ss = 0x%x" % (data, status, ss) - return data diff --git a/packages/I2CuHal2.py b/packages/I2CuHal2.py deleted file mode 100644 index bf9f325..0000000 --- a/packages/I2CuHal2.py +++ /dev/null @@ -1,282 +0,0 @@ -# -*- coding: utf-8 -*- -""" - -""" - -import time - -import uhal - -verbose = True - - - -################################################################################ -# /* -# I2C CORE -# */ -################################################################################ - -### Same as the class defined in I2CuHal.py but the register names are changed to -### comply with D. Newbold's notation. To be used in the Dune SFP Fanout (pc059a) - -class I2CCore: - """I2C communication block.""" - - # Define bits in cmd_stat register - startcmd = 0x1 << 7 - stopcmd = 0x1 << 6 - readcmd = 0x1 << 5 - writecmd = 0x1 << 4 - ack = 0x1 << 3 - intack = 0x1 - - recvdack = 0x1 << 7 - busy = 0x1 << 6 - arblost = 0x1 << 5 - inprogress = 0x1 << 1 - interrupt = 0x1 - - def __init__(self, target, wclk, i2cclk, name="i2c", delay=None): - self.target = target - self.name = name - self.delay = delay - self.prescale_low = self.target.getNode("%s.ps_lo" % name) - self.prescale_high = self.target.getNode("%s.ps_hi" % name) - self.ctrl = self.target.getNode("%s.ctrl" % name) - self.data = self.target.getNode("%s.data" % name) - self.cmd_stat = self.target.getNode("%s.cmd_stat" % name) - self.wishboneclock = wclk - self.i2cclock = i2cclk - self.config() - - def state(self): - status = {} - status["ps_low"] = self.prescale_low.read() - status["ps_hi"] = self.prescale_high.read() - status["ctrl"] = self.ctrl.read() - status["data"] = self.data.read() - status["cmd_stat"] = self.cmd_stat.read() - self.target.dispatch() - status["prescale"] = status["ps_hi"] << 8 - status["prescale"] |= status["ps_low"] - for reg in status: - val = status[reg] - bval = bin(int(val)) - if verbose: - print("\treg %s = %d, 0x%x, %s" % (reg, val, val, bval)) - - def clearint(self): - self.ctrl.write(0x1) - self.target.dispatch() - - def config(self): - #INITIALIZATION OF THE I2S MASTER CORE - #Disable core - self.ctrl.write(0x0 << 7) - self.target.dispatch() - #Write pre-scale register - #prescale = int(self.wishboneclock / (5.0 * self.i2cclock)) - 1 - #prescale = int(self.wishboneclock / (5.0 * self.i2cclock)) - prescale = 0x0100 #FOR NOW HARDWIRED, TO BE MODIFIED - self.prescale_low.write(prescale & 0xff) - self.prescale_high.write((prescale & 0xff00) >> 8) - #Enable core - self.ctrl.write(0x1 << 7) - self.target.dispatch() - - def checkack(self): - inprogress = True - ack = False - while inprogress: - cmd_stat = self.cmd_stat.read() - self.target.dispatch() - inprogress = (cmd_stat & I2CCore.inprogress) > 0 - ack = (cmd_stat & I2CCore.recvdack) == 0 - return ack - - def delayorcheckack(self): - ack = True - if self.delay is None: - ack = self.checkack() - else: - time.sleep(self.delay) - ack = self.checkack()#Remove this? - return ack - -################################################################################ -# /* -# I2C WRITE -# */ -################################################################################ - - - - def write(self, addr, data, stop=True): - """Write data to the device with the given address.""" - # Start transfer with 7 bit address and write bit (0) - nwritten = -1 - addr &= 0x7f - addr = addr << 1 - startcmd = 0x1 << 7 - stopcmd = 0x1 << 6 - writecmd = 0x1 << 4 - #Set transmit register (write operation, LSB=0) - self.data.write(addr) - #Set Command Register to 0x90 (write, start) - self.cmd_stat.write(I2CCore.startcmd | I2CCore.writecmd) - self.target.dispatch() - ack = self.delayorcheckack() - if not ack: - self.cmd_stat.write(I2CCore.stopcmd) - self.target.dispatch() - print("no ack from I2C address", hex(addr>>1)) - return nwritten - nwritten += 1 - for val in data: - val &= 0xff - #Write slave memory address - self.data.write(val) - #Set Command Register to 0x10 (write) - self.cmd_stat.write(I2CCore.writecmd) - self.target.dispatch() - ack = self.delayorcheckack() - if not ack: - self.cmd_stat.write(I2CCore.stopcmd) - self.target.dispatch() - return nwritten - nwritten += 1 - if stop: - self.cmd_stat.write(I2CCore.stopcmd) - self.target.dispatch() - return nwritten - -################################################################################ -# /* -# I2C READ -# */ -################################################################################ - def read(self, addr, n): - """Read n bytes of data from the device with the given address.""" - # Start transfer with 7 bit address and read bit (1) - data = [] - addr &= 0x7f - addr = addr << 1 - addr |= 0x1 # read bit - self.data.write(addr) - self.cmd_stat.write(I2CCore.startcmd | I2CCore.writecmd) - self.target.dispatch() - ack = self.delayorcheckack() - if not ack: - self.cmd_stat.write(I2CCore.stopcmd) - self.target.dispatch() - return data - for i in range(n): - if i < (n-1): - self.cmd_stat.write(I2CCore.readcmd) # <--- - else: - self.cmd_stat.write(I2CCore.readcmd | I2CCore.ack | I2CCore.stopcmd) # <--- This tells the slave that it is the last word - self.target.dispatch() - ack = self.delayorcheckack() - val = self.data.read() - self.target.dispatch() - data.append(val & 0xff) - #self.cmd_stat.write(I2CCore.stopcmd) - #self.target.dispatch() - return data - -################################################################################ -# /* -# I2C WRITE-READ -# */ -################################################################################ - - - - # def writeread(self, addr, data, n): - # """Write data to device, then read n bytes back from it.""" - # nwritten = self.write(addr, data, stop=False) - # readdata = [] - # if nwritten == len(data): - # readdata = self.read(addr, n) - # return nwritten, readdata - -""" -SPI core XML: - - - - - - - - - - -""" -class SPICore: - - go_busy = 0x1 << 8 - rising = 1 - falling = 0 - - - def __init__(self, target, wclk, spiclk, basename="io.spi"): - self.target = target - # Only a single data register is required since all transfers are - # 16 bit long - self.data = target.getNode("%s.d0" % basename) - self.control = target.getNode("%s.ctrl" % basename) - self.control_val = 0b0 - self.divider = target.getNode("%s.divider" % basename) - self.slaveselect = target.getNode("%s.ss" % basename) - self.divider_val = int(wclk / spiclk / 2.0 - 1.0) - self.divider_val = 0x7f - self.configured = False - - def config(self): - "Configure SPI interace for communicating with ADCs." - self.divider_val = int(self.divider_val) % 0xffff - if verbose: - print("Configuring SPI core, divider = 0x%x" % self.divider_val) - self.divider.write(self.divider_val) - self.target.dispatch() - self.control_val = 0x0 - self.control_val |= 0x0 << 13 # Automatic slave select - self.control_val |= 0x0 << 12 # No interrupt - self.control_val |= 0x0 << 11 # MSB first - # ADC samples data on rising edge of SCK - self.control_val |= 0x1 << 10 # change ouput on falling edge of SCK - # ADC changes output shortly after falling edge of SCK - self.control_val |= 0x0 << 9 # read input on rising edge - self.control_val |= 0x10 # 16 bit transfers - if verbose: - print("SPI control val = 0x%x = %s" % (self.control_val, bin(self.control_val))) - self.configured = True - - def transmit(self, chip, value): - if not self.configured: - self.config() - assert chip >= 0 and chip < 8 - value &= 0xffff - self.data.write(value) - checkdata = self.data.read() - self.target.dispatch() - assert checkdata == value - self.control.write(self.control_val) - self.slaveselect.write(0xff ^ (0x1 << chip)) - self.target.dispatch() - self.control.write(self.control_val | SPICore.go_busy) - self.target.dispatch() - busy = True - while busy: - status = self.control.read() - self.target.dispatch() - busy = status & SPICore.go_busy > 0 - self.slaveselect.write(0xff) - data = self.data.read() - ss = self.slaveselect.read() - status = self.control.read() - self.target.dispatch() - #print "Received data: 0x%x, status = 0x%x, ss = 0x%x" % (data, status, ss) - return data diff --git a/packages/I2cBusProperties.py b/packages/I2cBusProperties.py deleted file mode 100644 index a23f30c..0000000 --- a/packages/I2cBusProperties.py +++ /dev/null @@ -1,122 +0,0 @@ -########################################################## -# I2cBusProperties - simple encapsulation of all items -# required to control an I2C bus. -# -# Carl Jeske, July 2010 -# Refactored by Robert Frazier, May 2011 -########################################################## - - -class I2cBusProperties(object): - """Encapsulates details of an I2C bus master in the form of a host device, a clock prescale value, and seven I2C master registers - - Provide the ChipsBus instance to the device hosting your I2C core, a 16-bit clock prescaling - value for the Serial Clock Line (see I2C core docs for details), and the names of the seven - registers that define/control the bus (assuming these names are not the defaults specified - in the constructor below). The seven registers consist of the two clock pre-scaling - registers (PRElo, PREhi), and five bus master registers (CONTROL, TRANSMIT, RECEIVE, - COMMAND and STATUS). - - Usage: You'll need to create an instance of this class to give to a concrete I2C bus instance, such - as OpenCoresI2cBus. This I2cBusProperties class is simply a container to hold the properties - that define the bus; a class such as OpenCoresI2cBus will make use of these properties. - - Access the items stored by this class via these (deliberately compact) variable names: - - chipsBus -- the ChipsBus device hosting the I2C core - preHiVal -- the top byte of the clock prescale value - preLoVal -- the bottom byte of the clock prescale value - preHiReg -- the register the top byte of the clk prescale value (preHiVal) gets written to - preLoReg -- the register the bottom byte of the clk prescale value (preLoVal) gets written to - ctrlReg -- the I2C Control register - txReg -- the I2C Transmit register - rxReg -- the I2C Receive register - cmdReg -- the I2C Command register - statusReg -- the I2C Status register - - - Compatibility Notes: The seven register names are the registers typically required to operate an - OpenCores or similar I2C Master (Lattice Semiconductor's I2C bus master works - the same way as the OpenCores one). This software is not compatible with your - I2C bus master if it doesn't use this register interface. - """ - - def __init__(self, - chipsBusDevice, - clkPrescaleU16, - clkPrescaleLoByteReg = "i2c_pre_lo", - clkPrescaleHiByteReg = "i2c_pre_hi", - controlReg = "i2c_ctrl", - transmitReg = "i2c_tx", - receiveReg = "i2c_rx", - commandReg = "i2c_cmd", - statusReg = "i2c_status"): - - """Provide a host ChipsBus device that is controlling the I2C bus, and the names of five I2C control registers. - - chipsBusDevice: Provide a ChipsBus instance to the device where the I2C bus is being - controlled. The address table for this device must contain the five registers - that control the bus, as declared next... - - clkPrescaleU16: A 16-bit value used to prescale the Serial Clock Line based on the host - master-clock. This value gets split into two 8-bit values and ultimately will - get written to the two I2C clock-prescale registers as declared below. See - the OpenCores or Lattice Semiconductor I2C documentation for more details. - - clkPrescaleLoByteReg: The register where the lower byte of the clock prescale value is set. The default - name for this register is "i2c_pre_lo". - - clkPrescaleHiByteReg: The register where the higher byte of the clock prescale value is set. The default - name for this register is "i2c_pre_hi" - - controlReg: The CONTROL register, used for enabling/disabling the I2C core, etc. This register is - usually read and write accessible. The default name for this register is "i2c_ctrl". - - transmitReg: The TRANSMIT register, used for holding the data to be transmitted via I2C, etc. This - typically shares the same address as the RECEIVE register, but has write-only access. The default - name for this register is "i2c_tx". - - receiveReg: The RECEIVE register - allows access to the byte received over the I2C bus. This - typically shares the same address as the TRANSMIT register, but has read-only access. The - default name for this register is "i2c_rx". - - commandReg: The COMMAND register - stores the command for the next I2C operation. This typically - shares the same address as the STATUS register, but has write-only access. The default name for - this register is "i2c_cmd". - - statusReg: The STATUS register - allows monitoring of the I2C operations. This typically shares - the same address as the COMMAND register, but has read-only access. The default name for this - register is "i2c_status". - """ - - object.__init__(self) - self.chipsBus = chipsBusDevice - self.preHiVal = ((clkPrescaleU16 & 0xff00) >> 8) - self.preLoVal = (clkPrescaleU16 & 0xff) - - # Check to see all the registers are in the address table - registers = [clkPrescaleLoByteReg, clkPrescaleHiByteReg, controlReg, transmitReg, receiveReg, commandReg, statusReg] - for reg in registers: - if not self.chipsBus.addrTable.checkItem(reg): - raise ChipsException("I2cBusProperties error: register '" + reg + "' is not present in the address table of the device hosting the I2C bus master!") - - # Check that the registers we'll need to write to are indeed writable - writableRegisters = [clkPrescaleLoByteReg, clkPrescaleHiByteReg, controlReg, transmitReg, commandReg] - for wReg in writableRegisters: - if not self.chipsBus.addrTable.getItem(wReg).getWriteFlag(): - raise ChipsException("I2cBusProperties error: register '" + wReg + "' does not have the necessary write permission!") - - # Check that the registers we'll need to read from are indeed readable - readableRegisters = [clkPrescaleLoByteReg, clkPrescaleHiByteReg, controlReg, receiveReg, statusReg] - for rReg in readableRegisters: - if not self.chipsBus.addrTable.getItem(rReg).getReadFlag(): - raise ChipsException("I2cBusProperties error: register '" + rReg + "' does not have the necessary read permission!") - - # Store the various register name strings - self.preHiReg = clkPrescaleHiByteReg - self.preLoReg = clkPrescaleLoByteReg - self.ctrlReg = controlReg - self.txReg = transmitReg - self.rxReg = receiveReg - self.cmdReg = commandReg - self.statusReg = statusReg diff --git a/packages/NHDC0220Biz.py b/packages/NHDC0220Biz.py deleted file mode 100644 index acb265b..0000000 --- a/packages/NHDC0220Biz.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- -import uhal -from I2CuHal import I2CCore -import StringIO - -class NHDC0220Biz: - #Class to configure the EEPROM - - def __init__(self, i2c, slaveaddr=0x3c): - self.i2c = i2c - self.slaveaddr = 0x2a#slaveaddr - - def test(self): - print "Testing the display" - return - - def writeSomething(self): - mystop= True - print "Write random stuff" - myaddr= [0x08, 0x38] - self.i2c.write( self.slaveaddr, myaddr, mystop) - - return diff --git a/packages/PCA9539PW.py b/packages/PCA9539PW.py deleted file mode 100644 index b387b80..0000000 --- a/packages/PCA9539PW.py +++ /dev/null @@ -1,94 +0,0 @@ -# -*- coding: utf-8 -*- -import uhal -from packages.I2CuHal import I2CCore - - -class PCA9539PW: - #Class to configure the expander modules - - def __init__(self, i2c, slaveaddr=0x74): - self.i2c = i2c - self.slaveaddr = slaveaddr - - - def writeReg(self, regN, regContent, verbose=False): - #Basic functionality to write to register. - if (regN < 0) | (regN > 7): - print("PCA9539PW - ERROR: register number should be in range [0:7]") - return - regContent= regContent & 0xFF - mystop=True - cmd= [regN, regContent] - self.i2c.write( self.slaveaddr, cmd, mystop) - - - def readReg(self, regN, nwords, verbose=False): - #Basic functionality to read from register. - if (regN < 0) | (regN > 7): - print("PCA9539PW - ERROR: register number should be in range [0:7]") - return - mystop=False - self.i2c.write( self.slaveaddr, [regN], mystop) - res= self.i2c.read( self.slaveaddr, nwords) - return res - - - def setInvertReg(self, regN, polarity= 0x00): - #Set the content of register 4 or 5 which determine the polarity of the - #ports (0= normal, 1= inverted). - if (regN < 0) | (regN > 1): - print("PCA9539PW - ERROR: regN should be 0 or 1") - return - polarity = polarity & 0xFF - self.writeReg(regN+4, polarity) - - def getInvertReg(self, regN): - #Read the content of register 4 or 5 which determine the polarity of the - #ports (0= normal, 1= inverted). - if (regN < 0) | (regN > 1): - print("PCA9539PW - ERROR: regN should be 0 or 1") - return - res= self.readReg(regN+4, 1) - return res - - def setIOReg(self, regN, direction= 0xFF): - #Set the content of register 6 or 7 which determine the direction of the - #ports (0= output, 1= input). - if (regN < 0) | (regN > 1): - print("PCA9539PW - ERROR: regN should be 0 or 1") - return - direction = direction & 0xFF - self.writeReg(regN+6, direction) - - def getIOReg(self, regN): - #Read the content of register 6 or 7 which determine the polarity of the - #ports (0= normal, 1= inverted). - if (regN < 0) | (regN > 1): - print("PCA9539PW - ERROR: regN should be 0 or 1") - return - res= self.readReg(regN+6, 1) - return res - - def getInputs(self, bank): - #Read the incoming values of the pins for one of the two 8-bit banks. - if (bank < 0) | (bank > 1): - print("PCA9539PW - ERROR: bank should be 0 or 1") - return - res= self.readReg(bank, 1) - return res - - def setOutputs(self, bank, values= 0x00): - #Set the content of the output flip-flops. - if (bank < 0) | (bank > 1): - print("PCA9539PW - ERROR: bank should be 0 or 1") - return - values = values & 0xFF - self.writeReg(bank+2, values) - - def getOutputs(self, bank): - #Read the state of the outputs (i.e. what value is being written to them) - if (bank < 0) | (bank > 1): - print("PCA9539PW - ERROR: bank should be 0 or 1") - return - res= self.readReg(bank+2, 1) - return res diff --git a/packages/PCA9548ADW.py b/packages/PCA9548ADW.py deleted file mode 100644 index adb6742..0000000 --- a/packages/PCA9548ADW.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -import uhal -from I2CuHal import I2CCore -import StringIO - - -class PCA9548ADW: - #Class to configure the I2C multiplexer - - def __init__(self, i2c, slaveaddr=0x74): - self.i2c = i2c - self.slaveaddr = slaveaddr - - def disableAllChannels(self, verbose=False): - #Disable all channels so that none of the MUX outputs is visible - # to the upstream I2C bus - mystop=True - cmd= [0x0] - self.i2c.write( self.slaveaddr, cmd, mystop) - - def getChannelStatus(self, verbose=False): - #Basic functionality to read the status of the control register and determine - # which channel is currently enabled. - mystop=False - cmd= [] - self.i2c.write( self.slaveaddr, cmd, mystop) - res= self.i2c.read( self.slaveaddr, 1) - return res[0] - - def setActiveChannel(self, channel, verbose=False): - #Basic functionality to activate one channel - # In principle multiple channels can be active at the same time (see - # function "setMultipleChannels") - if (channel < 0) | (channel > 7): - print "PCA9539PW - ERROR: channel number should be in range [0:7]" - return - mystop=True - cmd= [0x1 << channel] - #print "\tChannel is ", channel, "we write ", cmd - self.i2c.write( self.slaveaddr, cmd, mystop) - - def setMultipleChannels(self, channels, verbose=False): - #Basic functionality to activate multiple channels - # channels is a byte: each bit set to one will set the corresponding channels - # as active. The slave connected to that channel will be visible on the I2C bus. - # NOTE: this can lead to address clashes! - channels = channels & 0xFF - mystop=True - cmd= [channels] - #print "\tChannel is ", channel, "we write ", cmd - self.i2c.write( self.slaveaddr, cmd, mystop) diff --git a/packages/RawI2cAccess.py b/packages/RawI2cAccess.py deleted file mode 100644 index 2846132..0000000 --- a/packages/RawI2cAccess.py +++ /dev/null @@ -1,261 +0,0 @@ -# Created on Sep 10, 2012 -# @author: Kristian Harder, based on code by Carl Jeske - -from I2cBusProperties import I2cBusProperties -from ChipsBus import ChipsBus -from ChipsLog import chipsLog -from ChipsException import ChipsException - - -class RawI2cAccess: - - def __init__(self, i2cBusProps, slaveAddr): - - # For performing read/writes over an OpenCores-compatible I2C bus master - # - # An instance of this class is required to communicate with each - # I2C slave on the I2C bus. - # - # i2cBusProps: an instance of the class I2cBusProperties that contains - # the relevant ChipsBus host and the I2C bus-master registers (if - # they differ from the defaults specified by the I2cBusProperties - # class). - # - #slaveAddr: The address of the I2C slave you wish to communicate with. - # - - self._i2cProps = i2cBusProps # The I2C Bus Properties - self._slaveAddr = 0x7f & slaveAddr # 7-bit slave address - - - def resetI2cBus(self): - - # Resets the I2C bus - # - # This function does the following: - # 1) Disables the I2C core - # 2) Sets the clock prescale registers - # 3) Enables the I2C core - # 4) Sets all writable bus-master registers to default values - - try: - self._chipsBus().queueWrite(self._i2cProps.ctrlReg, 0x00) - #self._chipsBus().getNode(self._i2cProps.ctrlReg).write(0) - self._chipsBus().queueWrite(self._i2cProps.preHiReg, - self._i2cProps.preHiVal) - self._chipsBus().queueWrite(self._i2cProps.preLoReg, - self._i2cProps.preLoVal) - self._chipsBus().queueWrite(self._i2cProps.ctrlReg, 0x80) - self._chipsBus().queueWrite(self._i2cProps.txReg, 0x00) - self._chipsBus().queueWrite(self._i2cProps.cmdReg, 0x00) - self._chipsBus().queueRun() - except ChipsException, err: - raise ChipsException("I2C reset error:\n\t" + str(err)) - - - def read(self, numBytes): - - # Performs an I2C read. Returns the 8-bit read result(s). - # - # numBytes: number of bytes expected as response - # - - try: - result = self._privateRead(numBytes) - except ChipsException, err: - raise ChipsException("I2C read error:\n\t" + str(err)) - return result - - - def write(self, listDataU8): - - # Performs an 8-bit I2C write. - # - # listDataU8: The 8-bit data values to be written. - # - - try: - self._privateWrite(listDataU8) - except ChipsException, err: - raise ChipsException("I2C write error:\n\t" + str(err)) - return - - - def _chipsBus(self): - - # Returns the instance of the ChipsBus device that's hosting - # the I2C bus master - - return self._i2cProps.chipsBus - - - def _privateRead(self, numBytes): - - # I2C read implementation. - # - # Fast I2C read implementation, - # i.e. done with the fewest packets possible. - - - # transmit reg definitions - # bits 7-1: 7-bit slave address during address transfer - # or first 7 bits of byte during data transfer - # bit 0: RW flag during address transfer or LSB during data transfer. - # '1' = reading from slave - # '0' = writing to slave - - # command reg definitions - # bit 7: Generate start condition - # bit 6: Generate stop condition - # bit 5: Read from slave - # bit 4: Write to slave - # bit 3: 0 when acknowledgement is received - # bit 2:1: Reserved - # bit 0: Interrupt acknowledge. When set, clears a pending interrupt - - # Reset bus before beginning - self.resetI2cBus() - - # Set slave address in bits 7:1, and set bit 0 to zero - # (i.e. we're writing an address to the bus) - self._chipsBus().queueWrite(self._i2cProps.txReg, - (self._slaveAddr << 1) | 0x01) - # Set start and write bit in command reg - self._chipsBus().queueWrite(self._i2cProps.cmdReg, 0x90) - # Run the queue - self._chipsBus().queueRun() - # Wait for transaction to finish. - self._i2cWaitUntilFinished() - - result=[] - for ibyte in range(numBytes): - if ibyte==numBytes-1: - stop_bit=0x40 - ack_bit=0x08 - else: - stop_bit=0 - ack_bit=0 - pass - # Set read bit, acknowledge and stop bit in command reg - self._chipsBus().write(self._i2cProps.cmdReg, 0x20+ack_bit+stop_bit) - # Wait for transaction to finish. - # Don't expect an ACK, do expect bus free at finish. - if stop_bit: - self._i2cWaitUntilFinished(requireAcknowledgement = False, - requireBusIdleAtEnd = True) - else: - self._i2cWaitUntilFinished(requireAcknowledgement = False, - requireBusIdleAtEnd = False) - pass - result.append(self._chipsBus().read(self._i2cProps.rxReg)) - - return result - - - def _privateWrite(self, listDataU8): - - # I2C write implementation. - # - # Fast I2C write implementation, - # i.e. done with the fewest packets possible. - - # transmit reg definitions - # bits 7-1: 7-bit slave address during address transfer - # or first 7 bits of byte during data transfer - # bit 0: RW flag during address transfer or LSB during data transfer. - # '1' = reading from slave - # '0' = writing to slave - - # command reg definitions - # bit 7: Generate start condition - # bit 6: Generate stop condition - # bit 5: Read from slave - # bit 4: Write to slave - # bit 3: 0 when acknowledgement is received - # bit 2:1: Reserved - # bit 0: Interrupt acknowledge. When set, clears a pending interrupt - # Reset bus before beginning - self.resetI2cBus() - - # Set slave address in bits 7:1, and set bit 0 to zero (i.e. "write mode") - self._chipsBus().queueWrite(self._i2cProps.txReg, - (self._slaveAddr << 1) & 0xfe) - # Set start and write bit in command reg - self._chipsBus().queueWrite(self._i2cProps.cmdReg, 0x90) - # Run the queue - self._chipsBus().queueRun() - # Wait for transaction to finish. - self._i2cWaitUntilFinished() - - for ibyte in range(len(listDataU8)): - dataU8 = listDataU8[ibyte] - if ibyte==len(listDataU8)-1: - stop_bit=0x40 - else: - stop_bit=0x00 - pass - # Set data to be written in transmit reg - self._chipsBus().queueWrite(self._i2cProps.txReg, (dataU8 & 0xff)) - # Set write and stop bit in command reg - self._chipsBus().queueWrite(self._i2cProps.cmdReg, 0x10+stop_bit) - # Run the queue - self._chipsBus().queueRun() - # Wait for transaction to finish. - # Do expect an ACK and do expect bus to be free at finish - if stop_bit: - self._i2cWaitUntilFinished(requireAcknowledgement = True, - requireBusIdleAtEnd = True) - else: - self._i2cWaitUntilFinished(requireAcknowledgement = True, - requireBusIdleAtEnd = False) - pass - pass - - return - - - def _i2cWaitUntilFinished(self, requireAcknowledgement = True, - requireBusIdleAtEnd = False): - - # Ensures the current bus transaction has finished successfully - # before allowing further I2C bus transactions - - # This method monitors the status register - # and will not allow execution to continue until the - # I2C bus has completed properly. It will throw an exception - # if it picks up bus problems or a bus timeout occurs. - - maxRetry = 20 - attempt = 1 - while attempt <= maxRetry: - - # Get the status - i2c_status = self._chipsBus().read(self._i2cProps.statusReg) - - receivedAcknowledge = not bool(i2c_status & 0x80) - busy = bool(i2c_status & 0x40) - arbitrationLost = bool(i2c_status & 0x20) - transferInProgress = bool(i2c_status & 0x02) - interruptFlag = bool(i2c_status & 0x01) - - if arbitrationLost: # This is an instant error at any time - raise ChipsException("I2C error: Arbitration lost!") - - if not transferInProgress: - break # The transfer looks to have completed successfully, pending further checks - - attempt += 1 - - # At this point, we've either had too many retries, or the - # Transfer in Progress (TIP) bit went low. If the TIP bit - # did go low, then we do a couple of other checks to see if - # the bus operated as expected: - - if attempt > maxRetry: - raise ChipsException("I2C error: Transaction timeout - the 'Transfer in Progress' bit remained high for too long!") - - if requireAcknowledgement and not receivedAcknowledge: - raise ChipsException("I2C error: No acknowledge received!") - - if requireBusIdleAtEnd and busy: - raise ChipsException("I2C error: Transfer finished but bus still busy!") diff --git a/packages/SFPI2C.py b/packages/SFPI2C.py deleted file mode 100644 index 2dad8d4..0000000 --- a/packages/SFPI2C.py +++ /dev/null @@ -1,91 +0,0 @@ -# -*- coding: utf-8 -*- -import uhal -from I2CuHal import I2CCore -import StringIO - -class SFPI2C: - #Class to configure the EEPROM - - def __init__(self, i2c, slaveaddr=0x50): - self.i2c = i2c - self.slaveaddr = slaveaddr - - """def readEEPROM(self, startadd, nBytes): - #Read EEPROM memory locations - mystop= False - myaddr= [startadd]#0xfa - self.i2c.write( self.slaveaddr, [startadd], mystop) - res= self.i2c.read( self.slaveaddr, nBytes) - return res""" - - def _listToString(self, mylist): - mystring= "" - for iChar in mylist: - mystring= mystring + str(unichr(iChar)) - return mystring - - def writeReg(self, regN, regContent, verbose=False): - #Basic functionality to write to register. - if (regN < 0) | (regN > 7): - print "PCA9539PW - ERROR: register number should be in range [0:7]" - return - regContent= regContent & 0xFF - mystop=True - cmd= [regN, regContent] - self.i2c.write( self.slaveaddr, cmd, mystop) - - def readReg(self, regN, nwords, verbose=False): - #Basic functionality to read from register. - mystop=False - self.i2c.write( self.slaveaddr, [regN], mystop) - res= self.i2c.read( self.slaveaddr, nwords) - return res - - def getConnector(self): - """Code for connector type (table 3.4)""" - conntype= self.readReg(2, 1, False)[0] - print "Connector type:", hex(conntype) - return conntype - - def getDiagnosticsType(self): - """Types of diagnostics available (table 3.9)""" - diaType= self.readReg(92, 1, False)[0] - print "Available Diagnostics:", hex(diaType) - return diaType - - def getEncoding(self): - encoding= self.readReg(11, 1, False)[0] - print "Encoding", encoding - return encoding - - def getEnhancedOpt(self): - enOpt= self.readReg(93, 1, False)[0] - print "Enhanced Options:", enOpt - return enOpt - - def getTransceiver(self): - res= self.readReg(3, 8, False) - return res - - def getVendorId(self): - """ Returns the OUI vendor id""" - vendID= self.readReg(37, 3, False) - return vendID - - def getVendorName(self): - res= self.readReg( 20 , 16, False) - mystring= self._listToString(res) - return mystring - - def getVendorPN(self): - """ Returns the part number defined by the vendor""" - pn=[] - mystring= "" - res= self.readReg( 40 , 16, False) - mystring= self._listToString(res) - return mystring - - def scanI2C(self): - mystop=True - for iAddr in range (0, 128): - self.i2c.write( iAddr, [], mystop) diff --git a/packages/TLU_powermodule.py b/packages/TLU_powermodule.py deleted file mode 100644 index 5eb9757..0000000 --- a/packages/TLU_powermodule.py +++ /dev/null @@ -1,339 +0,0 @@ -# -*- coding: utf-8 -*- -import uhal -from packages.I2CuHal import I2CCore -#import StringIO -from packages.AD5665R import AD5665R # Library for DAC -from packages.PCA9539PW import PCA9539PW # Library for serial line expander -import time - -class PWRLED: - #Class to configure the EEPROM - - def __init__(self, i2ccore, DACaddr=0x1C, PMTmaxV= 1, Exp1Add= 0x76, Exp2Add= 0x77): - print(" TLU POWERMODULE Initializing...") - self.TLU_I2C = i2ccore - self.pwraddr = DACaddr - self.exp1addr= Exp1Add - self.exp2addr= Exp2Add - self.intRefOn= 0 - self.vCtrlMax= PMTmaxV - self.verbose= True - - ## Identify the type of power board by trying to read the EEPROM (if fail, it is an old one): - res= self.readEEPROM() - if (len(res) != 0): - self.bdType= 1 - else: - self.bdType= 0 - print("\tPOWERMODULE type:", self.bdType) - self.assignMapping() - - - self.zeDAC_pwr=AD5665R(self.TLU_I2C, self.pwraddr) - self.zeDAC_pwr.setIntRef(self.intRefOn, self.verbose) - self.zeDAC_pwr.writeDAC(int(0), 7, self.verbose) - - self.ledExp1=PCA9539PW(self.TLU_I2C, self.exp1addr) - self.ledExp1.setInvertReg(0, 0x00)# 0= normal, 1= inverted - self.ledExp1.setIOReg(0, 0x00)# 0= output, 1= input - self.ledExp1.setOutputs(0, 0xDA)# If output, set to XX - - self.ledExp1.setInvertReg(1, 0x00)# 0= normal, 1= inverted - self.ledExp1.setIOReg(1, 0x00)# 0= output, 1= input - self.ledExp1.setOutputs(1, 0xB6)# If output, set to XX - - self.ledExp2=PCA9539PW(self.TLU_I2C, self.exp2addr) - self.ledExp2.setInvertReg(0, 0x00)# 0= normal, 1= inverted - self.ledExp2.setIOReg(0, 0x00)# 0= output, 1= input - self.ledExp2.setOutputs(0, 0x6D)# If output, set to XX - - self.ledExp2.setInvertReg(1, 0x00)# 0= normal, 1= inverted - self.ledExp2.setIOReg(1, 0x00)# 0= output, 1= input - self.ledExp2.setOutputs(1, 0xDB)# If output, set to XX - print(" TLU POWERMODULE Ready") - return - - def readEEPROM(self): - ## Read content of EEPROM. New power modules host a 24AA025E48T, similar - # to the one on the TLU but at address 0x50. Old modules will fail to ACKNOWLEDGE. - eepromadd= 0x51 - bytes= 6 - startadd= 0xfa - mystop= 1 - time.sleep(0.1) - myaddr= [startadd]#0xfa - self.TLU_I2C.write( eepromadd, [startadd], mystop) - res= self.TLU_I2C.read( eepromadd, bytes) - print(" POWERMODULE serial number (EEPROM):") - result="\t" - for iaddr in res: - result+="%02x "%(iaddr) - print(result) - return res - - def assignMapping(self): - ## Map indicator color based on their position on the expanders: - # 0-15 are on expander 2 - # 16 to 31 on expander 1. - # One indicator is missing the blue component, hence - # the "-1" value. - if (self.bdType==0): - # Old board (with misplaced LED connection) - self.indicatorXYZ= [(30, 29, 31), (27, 26, 28), (24, 23, 25), (21, 20, 22), (18, 17, 19), (15, 14, 16), (12, 11, 13), (9, 8, 10), (6, 5, 7), (3, 2, 4), (1, 0, -1)] - else: - # New board (with correct LED and EEPROM) - self.indicatorXYZ= [(30, 29, 31), (27, 26, 28), (24, 23, 25), (21, 20, 22), (18, 17, -1), (15, 14, 16), (12, 11, 13), (9, 8, 10), (6, 5, 7), (3, 2, 4), (1, 0, 19)] - - def setVch(self, channel, voltage, verbose=False): - # Note: the channel here is the DAC channel. - # The mapping with the power module is not one-to-one - if (verbose): - print(" PWRModule: CONFIGURING VOLTAGE FOR PMT", channel+1) - print("\tVcontrol=", voltage) - if ((channel < 0) | (3 < channel )): - print("\tPWRModule: channel should be comprised between 0 and 3") - else: - if (voltage < 0): - print("\tPWRModule: voltage cannot be negative. Coherced to 0 V.") - voltage = 0 - if (voltage > self.vCtrlMax): - print("\tPWRModule: voltage cannot exceed vCtrlMax. Coherced to vCtrlMax.") - print("\tPWRModule: vCtrlMax=", self.vCtrlMax, "V. See config file to change this value.") - voltage = self.vCtrlMax - dacValue= voltage*65535/self.vCtrlMax - self.zeDAC_pwr.writeDAC(int(dacValue), channel, verbose) - return - - def setIndicatorRGB(self, indicator, RGB=[0, 0, 0], verbose=False): - # Indicator is one of the 11 LEDs on the front panels, labeled from 0 to 10 - # RGB allows to switch on (True) or off (False) the corresponding component for that Led - # Note that one LED only has 2 components connected - #print self.indicatorXYZ[indicator-1][2] - if (1 <= indicator <= 11): - nowStatus= [] - nowStatus.extend(self.ledExp1.getOutputs(0)) - nowStatus.extend(self.ledExp1.getOutputs(1)) - nowStatus.extend(self.ledExp2.getOutputs(0)) - nowStatus.extend(self.ledExp2.getOutputs(1)) - nowWrd= 0x00000000 - nowWrd= nowWrd | nowStatus[0] - nowWrd= nowWrd | (nowStatus[1] << 8) - nowWrd= nowWrd | (nowStatus[2] << 16) - nowWrd= nowWrd | (nowStatus[3] << 24) - nextWrd= nowWrd - for iComp in range(0,3): - indexComp= self.indicatorXYZ[indicator-1][iComp] - valueComp= not bool(RGB[iComp]) - nextWrd= self._set_bit(nextWrd, indexComp, int(valueComp), False) - if verbose: - print("n=", iComp, "INDEX=", indexComp, "VALUE=", int(valueComp), "NEXTWORD=", bin(nextWrd)) - if verbose: - print("NOW ", bin(nowWrd)) - print("NEXT ", bin(nextWrd)) - nextStatus= [0xFF & nextWrd, 0xFF & (nextWrd >> 8), 0xFF & (nextWrd >> 16), 0xFF & (nextWrd >> 24) ] - #print " NOW", nowStatus - #print " NEXT ", nextStatus - if nowStatus[0] != nextStatus[0]: - self.ledExp1.setOutputs(0, nextStatus[0]) - if nowStatus[1] != nextStatus[1]: - self.ledExp1.setOutputs(1, nextStatus[1]) - if nowStatus[2] != nextStatus[2]: - self.ledExp2.setOutputs(0, nextStatus[2]) - if nowStatus[3] != nextStatus[3]: - self.ledExp2.setOutputs(1, nextStatus[3]) - - return - - - def _set_bit(self, v, index, x, verbose= False): - """Set the index:th bit of v to 1 if x is truthy, else to 0, and return the new value.""" - if (index == -1): - if (verbose): - print(" SETBIT: Index= -1 will be ignored") - else: - mask = 1 << index # Compute mask, an integer with just bit 'index' set. - v &= ~mask # Clear the bit indicated by the mask (if x is False) - if x: - v |= mask # If x was True, set the bit indicated by the mask. - return v - - def allGreen(self): - #self.setIndicatorRGB(1, [0, 1, 0]) - #self.setIndicatorRGB(2, [0, 1, 0]) - #self.setIndicatorRGB(3, [0, 1, 0]) - #self.setIndicatorRGB(4, [0, 1, 0]) - #self.setIndicatorRGB(5, [0, 1, 0]) - #self.setIndicatorRGB(6, [0, 1, 0]) - #self.setIndicatorRGB(7, [0, 1, 0]) - #self.setIndicatorRGB(8, [0, 1, 0]) - #self.setIndicatorRGB(9, [0, 1, 0]) - #self.setIndicatorRGB(10, [0, 1, 0]) - #self.setIndicatorRGB(11, [0, 1, 0]) - self.ledExp1.setOutputs(0, 218) - self.ledExp1.setOutputs(1, 182) - self.ledExp2.setOutputs(0, 109) - self.ledExp2.setOutputs(1, 219) - - def allRed(self): - self.ledExp1.setOutputs(0, 181) - self.ledExp1.setOutputs(1, 109) - self.ledExp2.setOutputs(0, 219) - self.ledExp2.setOutputs(1, 182) - - def allBlue(self): - self.ledExp1.setOutputs(0, 111) - self.ledExp1.setOutputs(1, 219) - self.ledExp2.setOutputs(0, 182) - self.ledExp2.setOutputs(1, 109) - - def allBlack(self): - self.ledExp1.setOutputs(0, 255) - self.ledExp1.setOutputs(1, 255) - self.ledExp2.setOutputs(0, 255) - self.ledExp2.setOutputs(1, 255) - - def allWhite(self): - self.ledExp1.setOutputs(0, 0) - self.ledExp1.setOutputs(1, 0) - self.ledExp2.setOutputs(0, 0) - self.ledExp2.setOutputs(1, 0) - - def kitt(self): - self.allBlack() - print("\tWait while LEDs are tested...") - self.setIndicatorRGB(1, [1, 0, 0]) - self.setIndicatorRGB(2, [0, 0, 0]) - - self.setIndicatorRGB(1, [1, 0, 0]) - self.setIndicatorRGB(2, [1, 0, 0]) - - self.setIndicatorRGB(1, [0, 0, 0]) - #self.setIndicatorRGB(2, [1, 0, 0]) - self.setIndicatorRGB(3, [1, 0, 0]) - - self.setIndicatorRGB(2, [0, 0, 0]) - #self.setIndicatorRGB(3, [1, 0, 0]) - self.setIndicatorRGB(4, [1, 0, 0]) - - self.setIndicatorRGB(3, [0, 0, 0]) - #self.setIndicatorRGB(4, [1, 0, 0]) - self.setIndicatorRGB(5, [1, 0, 0]) - - #self.setIndicatorRGB(3, [0, 0, 0]) - self.setIndicatorRGB(4, [1, 0, 0]) - #self.setIndicatorRGB(5, [1, 0, 0]) - self.setIndicatorRGB(6, [1, 0, 0]) - - self.setIndicatorRGB(4, [0, 0, 0]) - #self.setIndicatorRGB(5, [1, 0, 0]) - #self.setIndicatorRGB(6, [1, 0, 0]) - self.setIndicatorRGB(7, [1, 0, 0]) - - self.setIndicatorRGB(5, [0, 0, 0]) - #self.setIndicatorRGB(6, [1, 0, 0]) - #self.setIndicatorRGB(7, [1, 0, 0]) - self.setIndicatorRGB(8, [1, 0, 0]) - - self.setIndicatorRGB(6, [0, 0, 0]) - #self.setIndicatorRGB(7, [1, 0, 0]) - #self.setIndicatorRGB(8, [1, 0, 0]) - self.setIndicatorRGB(9, [1, 0, 0]) - - self.setIndicatorRGB(7, [0, 0, 0]) - #self.setIndicatorRGB(8, [1, 0, 0]) - #self.setIndicatorRGB(9, [1, 0, 0]) - self.setIndicatorRGB(10, [1, 0, 0]) - - self.setIndicatorRGB(8, [0, 0, 0]) - #self.setIndicatorRGB(9, [1, 0, 0]) - #self.setIndicatorRGB(10, [1, 0, 0]) - self.setIndicatorRGB(11, [1, 0, 0]) - - self.setIndicatorRGB(9, [0, 0, 0]) - #self.setIndicatorRGB(10, [1, 0, 0]) - self.setIndicatorRGB(11, [1, 0, 0]) - - #mid point - #self.setIndicatorRGB(9, [0, 0, 0]) - self.setIndicatorRGB(10, [0, 0, 0]) - self.setIndicatorRGB(11, [1, 0, 0]) - - #self.setIndicatorRGB(9, [0, 0, 0]) - self.setIndicatorRGB(10, [1, 0, 0]) - self.setIndicatorRGB(11, [1, 0, 0]) - - self.setIndicatorRGB(9, [1, 0, 0]) - #self.setIndicatorRGB(10, [1, 0, 0]) - self.setIndicatorRGB(11, [1, 0, 0]) - - self.setIndicatorRGB(8, [1, 0, 0]) - #self.setIndicatorRGB(9, [1, 0, 0]) - #self.setIndicatorRGB(10, [1, 0, 0]) - self.setIndicatorRGB(11, [0, 0, 0]) - - self.setIndicatorRGB(7, [1, 0, 0]) - #self.setIndicatorRGB(8, [1, 0, 0]) - #self.setIndicatorRGB(9, [1, 0, 0]) - self.setIndicatorRGB(10, [0, 0, 0]) - - self.setIndicatorRGB(6, [1, 0, 0]) - #self.setIndicatorRGB(7, [1, 0, 0]) - #self.setIndicatorRGB(8, [1, 0, 0]) - self.setIndicatorRGB(9, [0, 0, 0]) - - self.setIndicatorRGB(5, [1, 0, 0]) - #self.setIndicatorRGB(6, [1, 0, 0]) - #self.setIndicatorRGB(7, [1, 0, 0]) - self.setIndicatorRGB(8, [0, 0, 0]) - - self.setIndicatorRGB(4, [1, 0, 0]) - #self.setIndicatorRGB(5, [1, 0, 0]) - #self.setIndicatorRGB(6, [1, 0, 0]) - self.setIndicatorRGB(7, [0, 0, 0]) - - self.setIndicatorRGB(4, [1, 0, 0]) - #self.setIndicatorRGB(5, [1, 0, 0]) - self.setIndicatorRGB(6, [0, 0, 0]) - - self.setIndicatorRGB(3, [1, 0, 0]) - #self.setIndicatorRGB(4, [1, 0, 0]) - self.setIndicatorRGB(5, [0, 0, 0]) - - self.setIndicatorRGB(2, [1, 0, 0]) - #self.setIndicatorRGB(3, [1, 0, 0]) - self.setIndicatorRGB(4, [0, 0, 0]) - - self.setIndicatorRGB(1, [1, 0, 0]) - #self.setIndicatorRGB(2, [1, 0, 0]) - self.setIndicatorRGB(3, [0, 0, 0]) - - self.setIndicatorRGB(1, [1, 0, 0]) - self.setIndicatorRGB(2, [0, 0, 0]) - - self.setIndicatorRGB(1, [1, 0, 0]) - self.setIndicatorRGB(2, [0, 0, 0]) - print("\tLED test completed") - - def test(self): - print(" Testing the powermodule") - self.allBlack() - # loop over red - for iLED in range(0, 12): - self.setIndicatorRGB(iLED, [1, 0, 0]) - self.setIndicatorRGB(iLED-1, [0, 0, 0]) - time.sleep(0.1) - self.allBlack() - # loop over green - for iLED in range(0, 12): - self.setIndicatorRGB(iLED, [0, 1, 0]) - self.setIndicatorRGB(iLED-1, [0, 0, 0]) - time.sleep(0.1) - self.allBlack() - # loop over blue (one will be missing) - for iLED in range(0, 12): - self.setIndicatorRGB(iLED, [0, 0, 1]) - self.setIndicatorRGB(iLED-1, [0, 0, 0]) - time.sleep(0.1) - self.allBlack() - print(" Powermodule test done") - return diff --git a/packages/TLUaddrmap_BKP.xml b/packages/TLUaddrmap_BKP.xml deleted file mode 100644 index 65fb534..0000000 --- a/packages/TLUaddrmap_BKP.xml +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/TLUconnection_BKP.xml b/packages/TLUconnection_BKP.xml deleted file mode 100644 index fca67f5..0000000 --- a/packages/TLUconnection_BKP.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - diff --git a/packages/si5345.py b/packages/si5345.py deleted file mode 100644 index eedf85d..0000000 --- a/packages/si5345.py +++ /dev/null @@ -1,152 +0,0 @@ -import time -import uhal -from packages.I2CuHal import I2CCore -import io -import csv -import sys - -class si5345: - #Class to configure the Si5344 clock generator - - def __init__(self, i2c, slaveaddr=0x68): - self.i2c = i2c - self.slaveaddr = slaveaddr - #self.configList= - - #def writeReg(self, address, data): - - def readRegister(self, myaddr, nwords, verbose= False): - ### Read a specific register on the Si5344 chip. There is not check on the validity of the address but - ### the code sets the correct page before reading. - - #First make sure we are on the correct page - currentPg= self.getPage() - requirePg= (myaddr & 0xFF00) >> 8 - if verbose: - print("REG", hex(myaddr), "CURR PG" , hex(currentPg[0]), "REQ PG", hex(requirePg)) - if currentPg[0] != requirePg: - self.setPage(requirePg) - #Now read from register. - addr=[] - addr.append(myaddr) - mystop=False - self.i2c.write( self.slaveaddr, addr, mystop) - # time.sleep(0.1) - res= self.i2c.read( self.slaveaddr, nwords) - return res - - def writeRegister(self, myaddr, data, verbose=False): - ### Write a specific register on the Si5344 chip. There is not check on the validity of the address but - ### the code sets the correct page before reading. - ### myaddr is an int - ### data is a list of ints - - #First make sure we are on the correct page - myaddr= myaddr & 0xFFFF - currentPg= self.getPage() - requirePg= (myaddr & 0xFF00) >> 8 - #print "REG", hex(myaddr), "CURR PG" , currentPg, "REQ PG", hex(requirePg) - if currentPg[0] != requirePg: - self.setPage(requirePg) - #Now write to register. - data.insert(0, myaddr) - if verbose: - print(" Writing: ") - result="\t " - for iaddr in data: - result+="%#02x "%(iaddr) - print(result) - self.i2c.write( self.slaveaddr, data) - #time.sleep(0.01) - - def setPage(self, page, verbose=False): - #Configure the chip to perform operations on the specified address page. - mystop=True - myaddr= [0x01, page] - self.i2c.write( self.slaveaddr, myaddr, mystop) - #time.sleep(0.01) - if verbose: - print(" Si5345 Set Reg Page:", page) - - def getPage(self, verbose=False): - #Read the current address page - mystop=False - myaddr= [0x01] - self.i2c.write( self.slaveaddr, myaddr, mystop) - rPage= self.i2c.read( self.slaveaddr, 1) - #time.sleep(0.1) - if verbose: - print("\tPage read:", rPage) - return rPage - - def getDeviceVersion(self): - #Read registers containing chip information - mystop=False - nwords=2 - myaddr= [0x02 ]#0xfa - self.setPage(0) - self.i2c.write( self.slaveaddr, myaddr, mystop) - #time.sleep(0.1) - res= self.i2c.read( self.slaveaddr, nwords) - print(" Si5345 EEPROM: ") - result="\t" - for iaddr in reversed(res): - result+="%#02x "%(iaddr) - print(result) - return res - - def parse_clk(self, filename, verbose= False): - #Parse the configuration file produced by Clockbuilder Pro (Silicon Labs) - deletedcomments="""""" - if verbose: - print("\tParsing file", filename) - with open(filename, 'r') as configfile: - for i, line in enumerate(configfile): - if not line[0] == '#' : - if not line[0:3] == 'Add': - deletedcomments+=line - csvfile = io.StringIO(deletedcomments) - cvr= csv.reader(csvfile, delimiter=',', quotechar='|') - #print "\tN elements parser:", sum(1 for row in cvr) - #return [addr_list,data_list] - # for item in cvr: - # print "rere" - # regAddr= int(item[0], 16) - # regData[0]= int(item[1], 16) - # print "\t ", hex(regAddr), hex(regData[0]) - #self.configList= cvr - regSettingList= list(cvr) - if verbose: - print("\t ", len(regSettingList), "elements") - return regSettingList - - def writeConfiguration(self, regSettingList, verbose= 0): - print(" Si5345 Writing configuration:") - toolbar_width = 38 - if (verbose==1): - sys.stdout.write(" [%s]" % (" " * toolbar_width)) - sys.stdout.flush() - sys.stdout.write("\b" * (toolbar_width+1)) # return to start of line, after '[' - #regSettingList= list(regSettingCsv) - counter=0 - for item in regSettingList: - regAddr= int(item[0], 16) - regData=[0] - regData[0]= int(item[1], 16) - if (verbose > 1): - print("\t", counter, "Reg:", hex(regAddr), "Data:", regData) - counter += 1 - self.writeRegister(regAddr, regData, False) - if (not(counter % 10) and (verbose==1)): - sys.stdout.write("-") - sys.stdout.flush() - sys.stdout.write("\n") - print("\tSi5345 configuration done") - - def checkDesignID(self): - regAddr= 0x026B - res= self.readRegister(regAddr, 8) - result= " Si5345 design Id:\n\t" - for iaddr in res: - result+=chr(iaddr) - print(result) diff --git a/setup.py b/setup.py index 6b5577c..b14fb3a 100644 --- a/setup.py +++ b/setup.py @@ -1,19 +1,30 @@ from setuptools import setup from setuptools import find_packages -author = 'Christian Bespin' -author_email = 'bespin@physik.uni-bonn.de' +author = "Christian Bespin, Rasmus Partzsch" +author_email = "bespin@physik.uni-bonn.de, rasmus.partzsch@uni-bonn.de" # Requirements -install_requires = [''] +install_requires = [ + "pytest", + "numpy", + "tables", + "coloredlogs", + "pyzmq", + "online_monitor", + "tqdm", +] + +with open("VERSION") as version_file: + version = version_file.read().strip() setup( - name='aidatlu', - version='0.1.0', - description='Control software for AIDA-2020 TLU', - url='https://github.com/Silab-Bonn/aidatlu', - license='', - long_description='', + name="aidatlu", + version=version, + description="Control software for AIDA-2020 TLU", + url="https://github.com/Silab-Bonn/aidatlu", + license="License AGPL-3.0 license", + long_description="Repository for controlling the AIDA-2020 Trigger Logic Unit (TLU) with Python using uHAL bindings from IPbus.", author=author, maintainer=author, author_email=author_email, @@ -22,5 +33,5 @@ python_requires=">=3.8", packages=find_packages(), include_package_data=True, - platforms='posix', + platforms="posix", )