shaiko
Advanced Member level 5
This question is about writing "optimization friendly" VHDL code.
Suppose my application requires adding 2 numbers and then using the result for another 2 seperate additions.
Possible ways to write the code:
Method 1:
Method 2:
Logically, both methods describe the same functionality.
But given everything else equal - will they ALWAYS synthesize the same way ?
If not, which is preferable ?
Suppose my application requires adding 2 numbers and then using the result for another 2 seperate additions.
Possible ways to write the code:
Method 1:
Code:
signal a,b,c, d, result1, result2 : ( 7 downto 0 ) ;
begin
result1 <= c + a+b ;
result2 <= d + a+b ;
Code:
signal a, b, c, d, result1, result2 : ( 7 downto 0 ) ;
signal a_plus_b : ( 7 downto 0 ) ;
begin
a_plus_b <= a + b ; -- a_plus_b will explicitly drive the following adders.
result1 <= c + a_plus_b ;
result2 <= d + a_plus_b ;
But given everything else equal - will they ALWAYS synthesize the same way ?
If not, which is preferable ?