Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
8 years ago

Qsys disable interface based on parameter

Hi,

I have a VHDL component packed as Qsys Component Editor and I need to disable interface based on parameter set by user.

I have used naive approach and have this in TCL:


add_parameter C_MDIO BOOLEAN false
set_parameter_property C_MDIO DEFAULT_VALUE false
set_parameter_property C_MDIO DISPLAY_NAME C_MDIO
set_parameter_property C_MDIO TYPE BOOLEAN
set_parameter_property C_MDIO UNITS None
set_parameter_property C_MDIO DESCRIPTION "Enables MDIO Controller"
set_parameter_property C_MDIO HDL_PARAMETER true
...
#  #  connection point MDIO_MASTER#  
add_interface MDIO_MASTER conduit end
set_interface_property MDIO_MASTER associatedClock MDIO_CLK
set_interface_property MDIO_MASTER associatedReset ""
set_interface_property MDIO_MASTER ENABLED 
set_interface_property MDIO_MASTER EXPORT_OF ""
set_interface_property MDIO_MASTER PORT_NAME_MAP ""
set_interface_property MDIO_MASTER CMSIS_SVD_VARIABLES ""
set_interface_property MDIO_MASTER SVD_ADDRESS_GROUP ""
add_interface_port MDIO_MASTER MDIO_IN mdioin Input 1
add_interface_port MDIO_MASTER MDIO_OUT mdioout Output 1
add_interface_port MDIO_MASTER MDIO_T mdiot Output 1

This causes following error:

Error: get_parameter_value not allowed during GLOBAL
    while executing
"get_parameter_value C_MDIO "
    invoked from within
"set_interface_property MDIO_MASTER ENABLED "

I kinda get why it isn't allowed (so that's not my question).

What I'd like to know is how should I do it when I want to enable/disable certain interfaces based on user's choice in component configuration in Qsys..

Thanks for any help :)

1 Reply

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    OK, I've solved it.

    You need to create an elaboration callback and change the property there:

    
    set_module_property ELABORATION_CALLBACK elaborate
    proc elaborate {} {
    	set_interface_property MDIO_MASTER ENABLED 
    }