这个变量什么时候赋值?

When will this variable be assigned?

代码如下:

process(SRSTN, CSN, WRN,AB) is
begin  
    if SRSTN = '0' then
        WR0 <= (OTHERS => '0');
    elsif CSN = '0' then
        if WRN = '0' then
            case AB(15 downto 0) is
                when "0101000100010000" =>
                    WR0(15 downto 0) <= DB(15 downto 0);
                when OTHERS   =>    NULL;
                     WR0(15 downto 8) <= "00000000" ;
                end case;
        end if;
    end if;
end process;

我想知道什么时候 WR0(15 downto 8) <= "00000000"被执行。除了 AB 等于 0101000100010000 之外,它是否每次都分配?

您必须使用 signalvariable(在进程内)。一个可能的解决方案是:

architecture Beh of Test is
    signal temp : std_logic_vector((WR0'LENGTH - 1) downto 0) := (others => '0');
 begin
 
    WR0 <= std_logic_vector(temp);
 
    process(SRSTN, CSN, WRN,AB) is
    begin  
        if SRSTN = '0' then
            temp <= (OTHERS => '0');
        elsif CSN = '0' then
            if WRN = '0' then
                case AB(15 downto 0) is
                    when "0101000100010000" =>
                        temp(15 downto 0) <= DB(15 downto 0);
                    when OTHERS   =>
                        temp(15 downto 8) <= "00000000" ;
                    end case;
            end if;
        end if;
    end process;
end Beh;

The WR0 output will be imediatly assigned if one of the inputs SRSTN, CSN, WRN, AB is changing.