Forum Discussion
Altera_Forum
Honored Contributor
9 years agoI fixed it :). super. this is what made me realize :
--- Quote Start --- thats because your enable isnt acting as an enable. cnt_out is a combinatorial version of cnt+1 or cnt, using the enable bit to select. --- Quote End --- it works both with signals and variables, have a look : process(clk, rst)
variable sig_pc : unsigned(n downto 0);
begin
if rst = '0' then
sig_pc := (others => '1');
elsif falling_edge(clk) then
if pc_en = '1' then
sig_pc := sig_pc +1;
if pc_ld = '1' then
sig_pc := unsigned(pc_new);
end if;
end if;
end if;
pc_out <= std_logic_vector(sig_pc);
end process; awesome. thanks all. great