Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
21584 Discussions

If generate statement in vhdl for enabling and disabling hardware

Altera_Forum
Honored Contributor II
2,686 Views

I want to enable or disable logic using en_logic from external environment  

 

en_logic is defined as a std_logic input signal from external environment  

 

not_gen_logic : if (en_logic = '0') generate 

 

in1 <= rx_inp1; 

in2 <= rx_inp2; 

in3 <= rx_inp3; 

in4<= rx_inp4; 

 

end generate; 

 

gen_logic : if (en_logic = '1') generate 

 

in1 <= rx_inp5; 

in2 <= rx_inp6; 

in3 <= rx_inp7; 

in4 <= rx_inp8; 

 

end generate; 

 

but strangely i see an error pointed by quartus  

 

 

--- Quote Start ---  

"Error 10807 VHDL error : condition in generation scheme must be a static expression" 

--- Quote End ---  

but if i define en_logic as a constant i dont see this error  

 

Please guide me how can we use if generate statement to enable or disable a desired logic
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
1,785 Views

Generate statements are used to create different static implementations. 

 

What you are really after is using en_logic as a multiplexer control. 

 

in(1 to 4) <= rx_inp(1 to 4) when (en_logic = '0') else rx_inp(5 to 8); Cheers, 

Dave
0 Kudos
Reply