shaiko
Advanced Member level 5
Hello,
I want to design a chain of 'n' number DFFs to delay an input signal.
Instead of using a shift register - I want to use the loop statement.
This is what I wrote:
Will it work?
I want to design a chain of 'n' number DFFs to delay an input signal.
Instead of using a shift register - I want to use the loop statement.
This is what I wrote:
Code:
signal dff_chain : std_logic_vector ( n - 1 downto 0 ) ;
process ( clock ) is
begin
if reset = '1' then
dff_chain <= ( others => '0' ) ;
elsif rising_edge ( clock ) then
dff_chain ( 0 ) <= input ;
for index in dff_chain ' range
loop
dff_chain ( index + 1 ) <= dff_chain ( index ) ;
end loop ;
end if ;
end process ;
delayed_input <= dff_chain ( dff_chain ' high ) ;
Will it work?