shaiko
Advanced Member level 5
- Joined
- Aug 20, 2011
- Messages
- 2,644
- Helped
- 303
- Reputation
- 608
- Reaction score
- 297
- Trophy points
- 1,363
- Activity points
- 18,302
if x = "correct_condition" generate
In case an input port to an entity has a constant value, can we use the "if generate" command using on it ?
for exampe:
suppose x is an input to our entity and is defined as type string - will the following synthesize:
Code:if x = "correct_condition" generate
surely it would work if x was a generic - but if x is an input port to an entity, is this still considered correct syntax ?
the if..generate condition needs to be constant at elaboration time
entity memory is
port
(
IN_READ : in std_logic ;
IN_WRITE : in std_logic ;
IN_DATA : in std_logic_vector ( 31 downto 0 ) ;
IN_CLOCK : in std_logic ;
IN_RESET : in std_logic ;
OUT_DATA : out std_logic_vector ( 31 downto 0 )
) ;
end entity memory ;
process ( IN_CLOCK , IN_RESET ) is
begin
if IN_RESET = '1' = then
OUT_DATA <= ( others => '0' ) ;
elsif rising_edge ( IN_CLOCK ) then
if IN_WRITE = '1' then
OUT_DATA <= IN_DATA ;
end if ;
end if ;
end process ;
process ( IN_CLOCK ) is
begin
if rising_edge ( IN_CLOCK ) then
if IN_WRITE = '1' then
OUT_DATA <= IN_DATA ;
end if ;
end if ;
end process ;
YES...If I understand the example right, you mean that the synthesis tool is intelligent enough to remove logic which is driven by constant signals.
Which is the behaviour of RAM !Code:process ( IN_CLOCK ) is begin if rising_edge ( IN_CLOCK ) then if IN_WRITE = '1' then OUT_DATA <= IN_DATA ; end if ; end if ; end process ;
The synthesisor will do boolean reduction after everything is connected
The synthesis will implement RAM if you code it according to the tools recognizable constructs that infer a RAM. Just having a clock and data with an enable doesn't result in a RAM it will usually end up a DFF. You also need an address and what you are writing to better be an array, only then you might get a RAM.shaiko;1346360 3. The optimization products [U said:aren't[/U] used to reevaluate the decisions made during elaboration.
In other words - it doesn't say: "Wow, after I optimized all this stuff away, I see that I should have use RAM instead of DFFs."
In case an input port to an entity has a constant value, can we use the "if generate" command using on it ?
for example:
suppose x is an input to our entity and is defined as type string - will the following synthesize:
Code:if x = "correct_condition" generate
surely it would work if x was a generic - but if x is an input port to an entity, is this still considered correct syntax ?
Is the following correct?
1. During the elaboration process, the synthesizer makes up its mind about the exact logic to use for the job (DFF/RAM/MUX/etc..) and how to connect it.
2. During optimization, the synthesizer evaluates what of the elaborated logic to implement and what to eliminate (based solely on Boolean reduction).
3. The optimization products aren't used to reevaluate the decisions made during elaboration.
In other words - it doesn't say: "Wow, after I optimized all this stuff away, I see that I should have use RAM instead of DFFs."
Do I understand the process correctly ?
I don't...I wrote the word "doesn't" at the third part of post #11.It sounds like you're trying to get a positive answer to your question
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?