Skip to content
Snippets Groups Projects
Select Git revision
  • f3296289fb89342db4aad904dc27e4e31a42e3b4
  • develop default protected
  • feature-ibs-suggestions-from-salah
  • syntax-typehints
  • feature-ExponentialDumper-bugfix
  • Resisitve_wall_eff_radius_yokoya
  • feature-feedback-IQ-damper0
  • 18-synchrotron-object-string-representation
  • stable protected
  • feature-particle-in-cell
  • feature-quad_wakes_LongRangeResistiveWall
  • feature-iqdamper0
  • feature-read_wakis
  • use-one-bin
  • RF-FBv0.6
  • RF-FBv0.5
  • faster_pytorch
  • RF-FB
  • util
  • RFBucket
  • Long-range_wakepotential
  • 0.9.0
  • 0.8.0
  • 0.7.0
  • 0.6.0
  • 0.5.0
  • 0.4
  • 0.3
  • 0.2
  • 0.1
30 results

impedance_model.py

  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    lvl_threshold.vhd 1.80 KiB
    library ieee;
    use ieee.std_logic_1164.all;
    use ieee.numeric_std.all;
    use ieee.std_logic_misc.and_reduce;
    use ieee.std_logic_misc.or_reduce;
    
    use work.pkg_corr_matrix.all;
    
    entity lvl_threshold is
        generic(
            G_N_BTH             : natural
        );
        port(
            clk                 : in std_logic;
            rst_n               : in std_logic;
    
            s_axis_tdata_cor    : in std_logic_vector(C_W_COR-1 downto 0);
            s_axis_tvalid       : in std_logic;
    
            enable_thresh       : in std_logic;
            rst_thresh          : in std_logic;
            thresh_reached      : out std_logic
        );
    end entity lvl_threshold;
    
    
    architecture rtl of lvl_threshold is
    
        signal sign         : std_logic;
        signal thresh_and   : std_logic;
        signal thresh_nor   : std_logic;
    
    begin
    
        sign        <= s_axis_tdata_cor(C_W_COR-1);
        thresh_and  <= and_reduce(s_axis_tdata_cor(C_W_COR-2 downto C_W_COR-G_N_BTH-1));
        thresh_nor  <= not or_reduce(s_axis_tdata_cor(C_W_COR-2 downto C_W_COR-G_N_BTH-1));
    
        p_main:process(clk, rst_n)
        begin
    
            if rst_n = '0' then
                thresh_reached <= '0';
    
            elsif rising_edge(clk) then
                if rst_thresh = '1' then
                    thresh_reached <= '0';
                else
                    if s_axis_tvalid = '1' and enable_thresh = '1' then
                        if  sign = '1'then
                            -- negative
                            if thresh_nor = '1' then
                                thresh_reached <= '1';
                            end if;
                        else
                            -- positive
                            if thresh_and = '1' then
                                thresh_reached <= '1';
                            end if;
                        end if;
                    end if;
                end if;
            end if;
        end process;
    
    end architecture;