I am working on coding a Regsiter a1
with input signals b1,rst
and wra1
the register a1
is initialized to a specific value at reset.
a1
only changes its value to b1
when wra1
is 1
else it keeps the old value
process(clk,regrst)
begin
if(regrst='1')then
a1 <= (others =>'0');
elsif(clk'event and clk='1') then
if(wra1='1')then
a1 <= b1;
end if;
end if;
end process;
In this statement I have written the register process to update on the needed wra1 signal but I am confused on how to make it keep the old value of the output in case this write signal is 0 does this concept generate unintended latches to store the previous value? if so what can I add as a default register assignment in the begning of the process ? and should I include the else statement with
a1<=a1;
Thank you