Ignore:
Timestamp:
01/27/11 08:32:16 (13 years ago)
Author:
neise
Message:
synchronous trigger handling added
continous soft trigger generation.
---> control frequency via 'send 0x21??'
each step increases trigger delay by 12.5ms
0x2100 = 40Hz
0x21FF = 0.3Hz
File:
1 edited

Legend:

Unmodified
Added
Removed
  • firmware/FAD/FACT_FAD_20MHz_VAR_PS/FACT_FAD_lib/hdl/fad_main_struct.vhd

    r10081 r10121  
    33-- Created:
    44--          by - dneise.UNKNOWN (E5B-LABOR6)
    5 --          at - 17:46:33 05.01.2011
     5--          at - 16:46:18 26.01.2011
    66--
    77-- Generated by Mentor Graphics' HDL Designer(TM) 2009.2 (Build 10)
     
    1818   );
    1919   PORT(
    20       CLK             : IN     std_logic;
    21       SROUT_in_0      : IN     std_logic;
    22       SROUT_in_1      : IN     std_logic;
    23       SROUT_in_2      : IN     std_logic;
    24       SROUT_in_3      : IN     std_logic;
    25       adc_data_array  : IN     adc_data_array_type;
    26       adc_otr_array   : IN     std_logic_vector (3 DOWNTO 0);
    27       board_id        : IN     std_logic_vector (3 DOWNTO 0);
    28       crate_id        : IN     std_logic_vector (1 DOWNTO 0);
    29       trigger         : IN     std_logic;
    30       wiz_int         : IN     std_logic;
    31       CLK25_OUT       : OUT    std_logic;
    32       CLK25_PSOUT     : OUT    std_logic;
    33       CLK50_OUT       : OUT    std_logic;
    34       CLK_25_PS       : OUT    std_logic;
    35       CLK_50          : OUT    std_logic;
    36       DCM_locked      : OUT    std_logic;
    37       LOCKED_extraOUT : OUT    std_logic;
    38       PSCLK_OUT       : OUT    std_logic;
    39       PSDONE_extraOUT : OUT    std_logic;
    40       PSEN_OUT        : OUT    std_logic;
    41       PSINCDEC_OUT    : OUT    std_logic;
    42       PS_DIR_IN       : OUT    std_logic;
    43       PS_DO_IN        : OUT    std_logic;
    44       RSRLOAD         : OUT    std_logic                     := '0';
    45       SRCLK           : OUT    std_logic                     := '0';
    46       SRIN_out        : OUT    std_logic                     := '0';
    47       adc_clk_en      : OUT    std_logic                     := '0';
    48       adc_oeb         : OUT    std_logic                     := '1';
    49       amber           : OUT    std_logic;
    50       dac_cs          : OUT    std_logic;
    51       denable         : OUT    std_logic                     := '0';              -- default domino wave off
    52       drs_channel_id  : OUT    std_logic_vector (3 DOWNTO 0) := (others => '0');
    53       drs_dwrite      : OUT    std_logic                     := '1';
    54       green           : OUT    std_logic;
    55       led             : OUT    std_logic_vector (7 DOWNTO 0) := (OTHERS => '0');
    56       mosi            : OUT    std_logic                     := '0';
    57       offset          : OUT    std_logic_vector (7 DOWNTO 0) := (OTHERS => '0');
    58       ready           : OUT    std_logic                     := '0';
    59       red             : OUT    std_logic;
    60       sclk            : OUT    std_logic;
    61       sensor_cs       : OUT    std_logic_vector (3 DOWNTO 0);
     20      CLK                    : IN     std_logic;
     21      SROUT_in_0             : IN     std_logic;
     22      SROUT_in_1             : IN     std_logic;
     23      SROUT_in_2             : IN     std_logic;
     24      SROUT_in_3             : IN     std_logic;
     25      adc_data_array         : IN     adc_data_array_type;
     26      adc_otr_array          : IN     std_logic_vector (3 DOWNTO 0);
     27      board_id               : IN     std_logic_vector (3 DOWNTO 0);
     28      crate_id               : IN     std_logic_vector (1 DOWNTO 0);
     29      trigger                : IN     std_logic;
     30      wiz_int                : IN     std_logic;
     31      CLK25_OUT              : OUT    std_logic;
     32      CLK25_PSOUT            : OUT    std_logic;
     33      CLK50_OUT              : OUT    std_logic;
     34      CLK_25_PS              : OUT    std_logic;
     35      CLK_50                 : OUT    std_logic;
     36      DCM_locked             : OUT    std_logic;
     37      LOCKED_extraOUT        : OUT    std_logic;
     38      PSCLK_OUT              : OUT    std_logic;
     39      PSDONE_extraOUT        : OUT    std_logic;
     40      PSINCDEC_OUT           : OUT    std_logic;
     41      PS_DIR_IN              : OUT    std_logic;
     42      RSRLOAD                : OUT    std_logic                     := '0';
     43      SRCLK                  : OUT    std_logic                     := '0';
     44      SRIN_out               : OUT    std_logic                     := '0';
     45      adc_clk_en             : OUT    std_logic                     := '0';
     46      adc_oeb                : OUT    std_logic                     := '1';
     47      additional_flasher_out : OUT    std_logic;
     48      amber                  : OUT    std_logic;
     49      dac_cs                 : OUT    std_logic;
     50      denable                : OUT    std_logic                     := '0';              -- default domino wave off
     51      drs_channel_id         : OUT    std_logic_vector (3 DOWNTO 0) := (others => '0');
     52      drs_dwrite             : OUT    std_logic                     := '1';
     53      green                  : OUT    std_logic;
     54      led                    : OUT    std_logic_vector (7 DOWNTO 0) := (OTHERS => '0');
     55      mosi                   : OUT    std_logic                     := '0';
     56      offset                 : OUT    std_logic_vector (7 DOWNTO 0) := (OTHERS => '0');
     57      ready                  : OUT    std_logic                     := '0';
     58      red                    : OUT    std_logic;
     59      sclk                   : OUT    std_logic;
     60      sensor_cs              : OUT    std_logic_vector (3 DOWNTO 0);
    6261      -- status:
    63       shifting        : OUT    std_logic                     := '0';
    64       wiz_addr        : OUT    std_logic_vector (9 DOWNTO 0);
    65       wiz_cs          : OUT    std_logic                     := '1';
    66       wiz_rd          : OUT    std_logic                     := '1';
    67       wiz_reset       : OUT    std_logic                     := '1';
    68       wiz_wr          : OUT    std_logic                     := '1';
    69       sio             : INOUT  std_logic;
    70       wiz_data        : INOUT  std_logic_vector (15 DOWNTO 0)
     62      shifting               : OUT    std_logic                     := '0';
     63      wiz_addr               : OUT    std_logic_vector (9 DOWNTO 0);
     64      wiz_cs                 : OUT    std_logic                     := '1';
     65      wiz_rd                 : OUT    std_logic                     := '1';
     66      wiz_reset              : OUT    std_logic                     := '1';
     67      wiz_wr                 : OUT    std_logic                     := '1';
     68      sio                    : INOUT  std_logic;
     69      wiz_data               : INOUT  std_logic_vector (15 DOWNTO 0)
    7170   );
    7271
     
    8079-- Created:
    8180--          by - dneise.UNKNOWN (E5B-LABOR6)
    82 --          at - 17:46:34 05.01.2011
     81--          at - 16:46:19 26.01.2011
    8382--
    8483-- Generated by Mentor Graphics' HDL Designer(TM) 2009.2 (Build 10)
     
    9392
    9493library UNISIM;
    95 use UNISIM.VComponents.all;
     94--use UNISIM.VComponents.all;
    9695USE IEEE.NUMERIC_STD.all;
    9796USE IEEE.std_logic_signed.all;
     
    109108   SIGNAL adc_otr                : std_logic_vector(3 DOWNTO 0);
    110109   SIGNAL addr_out               : std_logic_vector(RAMADDRWIDTH64b-1 DOWNTO 0);
     110   SIGNAL c_trigger_enable       : std_logic                                    := '0';
     111   SIGNAL c_trigger_mult         : std_logic_vector(7 DOWNTO 0)                 := (OTHERS => '1');    --subject to changes
    111112   SIGNAL config_addr            : std_logic_vector(7 DOWNTO 0);
    112113   SIGNAL config_busy            : std_logic;
     
    131132   SIGNAL dac_array              : dac_array_type;
    132133   SIGNAL data_out               : std_logic_vector(63 DOWNTO 0);
     134   SIGNAL dout                   : std_logic;
     135   SIGNAL dout1                  : std_logic;
    133136   SIGNAL drs_address            : std_logic_vector(3 DOWNTO 0)                 := (others => '0');
    134137   SIGNAL drs_address_mode       : std_logic;
     
    137140   SIGNAL drs_read_s_cell        : std_logic                                    := '0';
    138141   SIGNAL drs_read_s_cell_ready  : std_logic;
     142   -- --
     143--      drs_dwrite : out std_logic := '1';
     144   SIGNAL drs_readout_ready      : std_logic                                    := '0';
     145   SIGNAL drs_readout_ready_ack  : std_logic;
    139146   SIGNAL drs_readout_started    : std_logic;
    140147   SIGNAL drs_s_cell_array       : drs_s_cell_array_type;
     
    157164   SIGNAL roi_max                : roi_max_type;
    158165   SIGNAL s_trigger              : std_logic;
     166   SIGNAL s_trigger_0            : std_logic;
    159167   SIGNAL sclk1                  : std_logic;
    160168   SIGNAL sclk_enable            : std_logic;
     
    167175   SIGNAL srin_write_ready       : std_logic                                    := '0';
    168176   SIGNAL start_srin_write_8b    : std_logic;
     177   SIGNAL trigger1               : std_logic;
     178   SIGNAL trigger_enable         : std_logic;
    169179   SIGNAL trigger_id             : std_logic_vector(47 DOWNTO 0);
    170180   SIGNAL trigger_out            : std_logic;
     
    207217      PSCLK_OUT       : OUT    std_logic ;
    208218      PSDONE_extraOUT : OUT    std_logic ;
    209       PSEN_OUT        : OUT    std_logic ;
    210219      PSINCDEC_OUT    : OUT    std_logic ;
    211220      offset          : OUT    std_logic_vector (7 DOWNTO 0) := (OTHERS => '0');
     
    213222      -- status:
    214223      shifting        : OUT    std_logic                     := '0'
     224   );
     225   END COMPONENT;
     226   COMPONENT continous_pulser
     227   GENERIC (
     228      MINIMAL_TRIGGER_WAIT_TIME : integer := 250000
     229   );
     230   PORT (
     231      CLK        : IN     std_logic;
     232      enable     : IN     std_logic;
     233      multiplier : IN     std_logic_vector (7 DOWNTO 0);
     234      trigger    : OUT    std_logic
    215235   );
    216236   END COMPONENT;
     
    291311      adc_otr               : IN     std_logic_vector (3 DOWNTO 0);
    292312      drs_channel_id        : OUT    std_logic_vector (3 DOWNTO 0) := (others => '0');
    293       drs_dwrite            : OUT    std_logic                     := '1';
     313      -- --
     314      --      drs_dwrite : out std_logic := '1';
     315      drs_readout_ready     : OUT    std_logic                     := '0';
     316      drs_readout_ready_ack : IN     std_logic ;
     317      -- --
    294318      drs_clk_en            : OUT    std_logic                     := '0';
     319      -- --
    295320      drs_read_s_cell       : OUT    std_logic                     := '0';
    296321      drs_srin_write_8b     : OUT    std_logic                     := '0';
     
    300325      drs_read_s_cell_ready : IN     std_logic ;
    301326      drs_s_cell_array      : IN     drs_s_cell_array_type ;
    302       drs_readout_started   : OUT    std_logic
     327      drs_readout_started   : OUT    std_logic                     := '0'
    303328   );
    304329   END COMPONENT;
     
    325350   COMPONENT led_controller
    326351   GENERIC (
    327       HEARTBEAT_PWM_DIVIDER : integer := 500;           -- 1kHz @ 50 MHz
    328       MAX_DELAY             : integer := 100;
    329       WAITING_DIVIDER       : integer := 500000000      -- 1Hz @ 50 MHz
    330    );
    331    PORT (
    332       CLK             : IN     std_logic;
    333       socks_connected : IN     std_logic;
    334       socks_waiting   : IN     std_logic;
    335       trigger         : IN     std_logic;
    336       amber           : OUT    std_logic;
    337       green           : OUT    std_logic;
    338       red             : OUT    std_logic
     352      HEARTBEAT_PWM_DIVIDER : integer := 500;
     353      MAX_DELAY             : integer := 100;      --not used anymore at all :-(
     354      WAITING_DIVIDER       : integer := 500000000
     355   );
     356   PORT (
     357      CLK                    : IN     std_logic;
     358      socks_connected        : IN     std_logic;
     359      socks_waiting          : IN     std_logic;
     360      trigger                : IN     std_logic;
     361      additional_flasher_out : OUT    std_logic;
     362      amber                  : OUT    std_logic;
     363      green                  : OUT    std_logic;
     364      red                    : OUT    std_logic
    339365   );
    340366   END COMPONENT;
     
    389415      trigger    : IN     std_logic ;
    390416      clk        : IN     std_logic
     417   );
     418   END COMPONENT;
     419   COMPONENT trigger_manager
     420   PORT (
     421      clk                   : IN     std_logic;
     422      drs_readout_ready     : IN     std_logic;
     423      trigger_in            : IN     std_logic;
     424      drs_readout_ready_ack : OUT    std_logic  := '0';
     425      drs_write             : OUT    std_logic  := '1';
     426      trigger_out           : OUT    std_logic  := '0'
    391427   );
    392428   END COMPONENT;
     
    415451      write_end_flag    : IN     std_logic ;
    416452      fifo_channels     : IN     std_logic_vector (3 DOWNTO 0);
     453      -- softtrigger:
    417454      s_trigger         : OUT    std_logic                      := '0';
     455      c_trigger_enable  : OUT    std_logic                      := '0';
     456      c_trigger_mult    : OUT    std_logic_vector (7 DOWNTO 0)  := (OTHERS => '1'); --subject TO changes
     457      --
    418458      new_config        : OUT    std_logic                      := '0';
    419459      config_started    : IN     std_logic ;
     
    428468      -- --
    429469      config_busy       : IN     std_logic ;
    430       denable           : OUT    std_logic                      := '0';           -- default domino wave off
    431       dwrite_enable     : OUT    std_logic                      := '0';           -- default DWRITE low.
    432       sclk_enable       : OUT    std_logic                      := '1';           -- default DWRITE HIGH.
    433       ps_direction      : OUT    std_logic                      := '1';           -- default phase shift upwards
    434       ps_do_phase_shift : OUT    std_logic                      := '0';           --pulse this TO phase shift once
    435       ps_reset          : OUT    std_logic                      := '0';           -- pulse this TO reset the variable phase shift
    436       srclk_enable      : OUT    std_logic                      := '1';           -- default SRCLK on.
     470      denable           : OUT    std_logic                      := '0';             -- default domino wave off
     471      dwrite_enable     : OUT    std_logic                      := '0';             -- default DWRITE low.
     472      sclk_enable       : OUT    std_logic                      := '1';             -- default DWRITE HIGH.
     473      ps_direction      : OUT    std_logic                      := '1';             -- default phase shift upwards
     474      ps_do_phase_shift : OUT    std_logic                      := '0';             --pulse this TO phase shift once
     475      ps_reset          : OUT    std_logic                      := '0';             -- pulse this TO reset the variable phase shift
     476      srclk_enable      : OUT    std_logic                      := '1';             -- default SRCLK on.
     477      trigger_enable    : OUT    std_logic                      := '0';             -- default triggers are NOT accepted
    437478      socks_waiting     : OUT    std_logic ;
    438479      socks_connected   : OUT    std_logic
     
    444485   FOR ALL : adc_buffer USE ENTITY FACT_FAD_lib.adc_buffer;
    445486   FOR ALL : clock_generator_var_ps USE ENTITY FACT_FAD_lib.clock_generator_var_ps;
     487   FOR ALL : continous_pulser USE ENTITY FACT_FAD_lib.continous_pulser;
    446488   FOR ALL : control_unit USE ENTITY FACT_FAD_lib.control_unit;
    447489   FOR ALL : dataRAM_64b_16b_width14_5 USE ENTITY FACT_FAD_lib.dataRAM_64b_16b_width14_5;
     
    452494   FOR ALL : spi_interface USE ENTITY FACT_FAD_lib.spi_interface;
    453495   FOR ALL : trigger_counter USE ENTITY FACT_FAD_lib.trigger_counter;
     496   FOR ALL : trigger_manager USE ENTITY FACT_FAD_lib.trigger_manager;
    454497   FOR ALL : w5300_modul USE ENTITY FACT_FAD_lib.w5300_modul;
    455498   -- pragma synthesis_on
     
    467510   sclk <= sclk_enable AND sclk1;
    468511
    469    -- ModuleWare code(v1.9) for instance 'U_3' of 'assignment'
    470    PS_DO_IN <= ps_do_phase_shift;
     512   -- ModuleWare code(v1.9) for instance 'U_11' of 'and'
     513   dout1 <= dout AND trigger_enable;
    471514
    472515   -- ModuleWare code(v1.9) for instance 'U_5' of 'assignment'
     
    494537
    495538   -- ModuleWare code(v1.9) for instance 'U_9' of 'or'
    496    trigger_out <= s_trigger OR trigger;
     539   dout <= s_trigger OR trigger;
     540
     541   -- ModuleWare code(v1.9) for instance 'U_13' of 'or'
     542   s_trigger <= s_trigger_0 OR trigger1;
    497543
    498544   -- Instance port mappings.
     
    518564         PSCLK_OUT       => PSCLK_OUT,
    519565         PSDONE_extraOUT => PSDONE_extraOUT,
    520          PSEN_OUT        => PSEN_OUT,
    521566         PSINCDEC_OUT    => PSINCDEC_OUT,
    522567         offset          => offset,
    523568         ready           => ready,
    524569         shifting        => shifting
     570      );
     571   U_3 : continous_pulser
     572      GENERIC MAP (
     573         MINIMAL_TRIGGER_WAIT_TIME => 250000
     574      )
     575      PORT MAP (
     576         CLK        => CLK_25,
     577         enable     => c_trigger_enable,
     578         multiplier => c_trigger_mult,
     579         trigger    => trigger1
    525580      );
    526581   I_main_control_unit : control_unit
     
    590645         adc_otr               => adc_otr,
    591646         drs_channel_id        => drs_channel_internal,
    592          drs_dwrite            => dwrite,
     647         drs_readout_ready     => drs_readout_ready,
     648         drs_readout_ready_ack => drs_readout_ready_ack,
    593649         drs_clk_en            => drs_clk_en,
    594650         drs_read_s_cell       => drs_read_s_cell,
     
    627683      )
    628684      PORT MAP (
    629          CLK             => CLK_50_internal,
    630          green           => green,
    631          amber           => amber,
    632          red             => red,
    633          trigger         => drs_readout_started,
    634          socks_waiting   => socks_waiting,
    635          socks_connected => socks_connected
     685         CLK                    => CLK_50_internal,
     686         green                  => green,
     687         amber                  => amber,
     688         red                    => red,
     689         additional_flasher_out => additional_flasher_out,
     690         trigger                => drs_readout_started,
     691         socks_waiting          => socks_waiting,
     692         socks_connected        => socks_connected
    636693      );
    637694   I_main_memory_manager : memory_manager
     
    682739         clk        => CLK_25_PS_internal
    683740      );
     741   U_12 : trigger_manager
     742      PORT MAP (
     743         clk                   => CLK_25,
     744         trigger_in            => dout1,
     745         trigger_out           => trigger_out,
     746         drs_write             => dwrite,
     747         drs_readout_ready     => drs_readout_ready,
     748         drs_readout_ready_ack => drs_readout_ready_ack
     749      );
    684750   I_main_ethernet : w5300_modul
    685751      GENERIC MAP (
     
    706772         write_end_flag    => wiz_write_end,
    707773         fifo_channels     => wiz_number_of_channels,
    708          s_trigger         => s_trigger,
     774         s_trigger         => s_trigger_0,
     775         c_trigger_enable  => c_trigger_enable,
     776         c_trigger_mult    => c_trigger_mult,
    709777         new_config        => new_config,
    710778         config_started    => config_started,
     
    723791         ps_reset          => ps_reset,
    724792         srclk_enable      => srclk_enable,
     793         trigger_enable    => trigger_enable,
    725794         socks_waiting     => socks_waiting,
    726795         socks_connected   => socks_connected
Note: See TracChangeset for help on using the changeset viewer.