看到以下示例代码:
architecture arch of disp_mux is
constant N:integer :=18;
signal q_reg, q_next: unsigned(N-1 downto 0);
signal sel: std_logic_vector(1 downto 0);
begin
process(clk, reset)
begin
if reset='1' then
q_reg <= (others=>'0');
elsif (clk'event and clk='1') then
q_reg <= q_next;
end if;
end process;
q_next <= q_reg + 1;
sel <= std_logic_vector(q_reg(N-1 downto N-2));
process(sel, ...)
begin
case sel is...
end case;
end process;
end arch;
如果您从未将1
写入reset
,q_reg
的价值是多少?如果q_next <= q_reg + 1;
是q_reg
UUUUUUUUUUUUUUUUUU
,a.nav-toggle
会发生什么,这是我怀疑的。
答案 0 :(得分:1)
如果您从未向reset
写1,则q_reg
为"UUUUUUUUUUUUUUUUUU"
,执行q_next <= q_reg + 1
后q_next
成为"XXXXXXXXXXXXXXXXXX"
。