shaiko
Advanced Member level 5
I have a synthesizable VHDL function called - "do_something"
it works on 2 signals and returns a result :
The problem is that it has a combinatorial delay of many system clocks.
Will the following work:
Assuming "do_something" takes 10 system clocks to complete, and "enough_cycles" is a constant that equals 20.
If we read the "result" signal when "ready" is '1' - will we read a valid value of "result" ?
it works on 2 signals and returns a result :
Code:
result <= do_something ( x , y ) ;
The problem is that it has a combinatorial delay of many system clocks.
Will the following work:
Code:
process ( clock , reset ) is
begin
if reset = '1' then
result <= ( others => '0' ) ;
ready <= '0' ;
elsif rising_edge ( clock ) then
if delay < enough_cycles then
result <= do_something ( x , y ) ;
delay <= delay + 1 ;
else
ready <= '1' ;
end if ;
end if ;
end process ;
Assuming "do_something" takes 10 system clocks to complete, and "enough_cycles" is a constant that equals 20.
If we read the "result" signal when "ready" is '1' - will we read a valid value of "result" ?