cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
david12341234
Explorer
Explorer
941 Views
Registered: ‎11-29-2015

Is there a way to instantiate an entity based on a constant value?

Jump to solution

I have a constant that I use to dictate whether I am testing or not. I have an entity that is only used for validation during testing. Instead of commenting it out over and over so that vivado doesn't waste time going through it during synthesis, only to realize that it isn't used, is there any syntactical VHDL magic that can be used to do something like the code below is implying?

 

if testing_is_going_on then
    some_entity: entity work.some_entity
        port map(
            clk => clk,
            a   => a,
            b   => b,
            c   => c
        );
end if;
0 Kudos
1 Solution

Accepted Solutions
dm78
Adventurer
Adventurer
933 Views
Registered: ‎03-15-2012

what you are looking for is the

{label}: if {condition} generate
[optional declaration]
[begin]
{statements}
end generate;

View solution in original post

2 Replies
dm78
Adventurer
Adventurer
934 Views
Registered: ‎03-15-2012

what you are looking for is the

{label}: if {condition} generate
[optional declaration]
[begin]
{statements}
end generate;

View solution in original post

david12341234
Explorer
Explorer
926 Views
Registered: ‎11-29-2015

Oh, it is called an 'if generate'.

https://www.ics.uci.edu/~jmoorkan/vhdlref/generate.html

 

some_label: if testing_is_going_on generate
    some_entity: entity work.some_entity
        port map(
            clk => clk,
            a   => a,
            b   => b,
            c   => c
        );
end generate some_label;

 

0 Kudos