Generated by EASE/HDL for peterj on Mon Jul 02 11:00:49 2007

Documentation for architecture GOL/TrigCnt/a0

Contents Side Data Generated HDL

VHDL Contents

    1  -- EASE/HDL begin --------------------------------------------------------------
    2  -- 
    3  -- Architecture 'a0' of entity 'TrigCnt'.
    4  -- 
    5  --------------------------------------------------------------------------------
    6  -- 
    7  -- Copy of the interface declaration:
    8  -- 
    9  --   port(
   10  --     ECR       : in     std_logic;
   11  --     EndEvt    : in     std_logic;
   12  --     ForceIdle : out    std_logic;
   13  --     GTMode    : in     std_logic_Vector(2 downto 0);
   14  --     Rst_n     : in     std_logic;
   15  --     SClk      : in     std_logic;
   16  --     Trigger   : in     std_logic);
   17  -- 
   18  -- EASE/HDL end ----------------------------------------------------------------
   19  
   20  architecture a0 of TrigCnt is
   21  
   22    signal TCnt       : std_logic_vector(7 downto 0) ;
   23    signal Busy       : std_logic ;
   24    signal CntFull    : std_logic ;
   25    signal CntLast    : std_logic ;
   26    signal IdleRMode  : std_logic;
   27    signal EventDone  : std_logic;
   28  
   29    --GTMode(0) : 1/0 : enable / disable CSM testrun
   30    --GTMode(1) : 1/0 : circulate fifo / fill fifo from SHARC (replace BOT+EOT)
   31    --GTMode(2) : 1/0 : triggered / untriggered test mode
   32  
   33  begin
   34  
   35    -- IdleRMode<='1';    -- stop running mode (possibly finishing last event)
   36    -- EventDone<='1';    -- finished last event (in circulate mode)
   37    -- ForceIdle<='1';    -- both flags set: force MGT transmitter into Idle.
   38  
   39    ForceIdle <= '1' when (IdleRMode = '1' and EventDone = '1') else '0';
   40  
   41    Busy    <= '1' when (TCnt /= "00000000") else '0';
   42    CntFull <= '1' when (TCnt  = "11111111") else '0';
   43    CntLast <= '1' when (TCnt  = "00000001") else '0';
   44  
   45    prCnt:
   46    process (SClk, Rst_n, ECR)
   47      variable count: unsigned(7 downto 0);
   48    begin
   49      if (Rst_n = '0' or ECR = '1') then
   50        IdleRMode <= '1';                 -- stop running mode
   51        EventDone <= '1';                 -- last event done
   52        count := (others => '0');         -- trigger counter
   53      elsif (rising_edge(SClk)) then
   54        case GTMode is
   55        when "000" => 
   56          EventDone <= '1';               -- last event done
   57          IdleRMode <= '1';               -- stop running mode
   58        when "001" | "011" =>
   59          EventDone <= '0';               --
   60          IdleRMode <= '0';               -- run
   61        when "110" | "010"  =>
   62          -- triggered and untriggered mode, circulate events:
   63          if (EndEvt = '1') then
   64            EventDone <= '1';             -- last event done: really stop
   65            count := (others => '0');
   66          end if;
   67          IdleRMode <= '1';               -- stop running (finishing last event)
   68        when "111" =>
   69          if (Trigger = '1' and EndEvt = '1') then
   70            null;
   71          elsif (Trigger = '1') then
   72            if (CntFull = '0') then
   73              count := count + 1;
   74            end if;
   75          elsif (EndEvt = '1') then
   76            if (Busy = '1') then
   77              count := count - 1;
   78            end if;
   79          end if;
   80          if (EndEvt = '1' and Busy = '1' and CntLast = '1') then
   81            IdleRMode <= '1';         -- stop when last event done
   82            EventDone <= '1';         --
   83          else
   84            IdleRMode <= not Busy;    -- idle when not busy (tcnt/=0)
   85            EventDone <= not Busy;    -- clear this flag
   86          end if;
   87        when others =>
   88          -- "100"|"101": triggered mode, transparent data is impractical.
   89          IdleRMode <= '1';               -- stop running mode
   90          EventDone <= '1';               -- last event done
   91        end case;
   92      end if;
   93      TCnt <= std_logic_vector(count);
   94    end process;
   95  
   96  end architecture a0 ; -- of TrigCnt
   97  
   98