假设我有一个信号,我可以指定初始值为零或者我可以在RESET时将其设置为零.我看到我的同事可以互换地使用这两种方法.我只想看到别人对此的看法.
示例(使用初始值):
architecture arch of xxx is
signal flag : STD_LOGIC := 0;
begin
process (clk) begin
if rising_edge(clk) then
-- do something
end if;
end process;
end arch;
Run Code Online (Sandbox Code Playgroud)
示例(使用重置值):
architecture arch of xxx is
signal flag : STD_LOGIC;
begin
process (clk,rst) begin
if (rst = '1') then
flag <= '0';
elsif rising_edge(clk) then
-- do something
end if;
end process;
end arch;
Run Code Online (Sandbox Code Playgroud) vhdl ×1