Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
16642 Discussions

TCL scripting in quartus 23p3

Avinash201040
Beginner
574 Views
Hii,

i am a beginner in tcl scripting and came across a design problem.

Of multiple qsys present in my project, i want to select a particular qsys and then select a particular ip in that qsys and then i want to enable/disable it based on user input. this i want to do using tcl script. i got some suggestion to do it using ELABORATION CALLBACK. i have no idea how this tcl script will execute in quartus elaboration process. do i need to update qsf for that. please provide some suggestion. also i request to please provide some script for reference, if possible.
thanks.
0 Kudos
4 Replies
SyafieqS
Moderator
514 Views

We dont have any reference directly related you requirement. But below are flow how you can achieve that that I could think of and snippet example.


1. enable_disable_ip_callback is the procedure that gets executed during the elaboration phase.

2. qsys_instance_name and ip_name variables are set to the names of your Qsys instance and IP, respectively.

3. The user input is simulated with the variable user_input. You should replace it with your actual user input handling mechanism.

4. The set_property commands enable or disable the IP based on the user input.

5. Finally, the add_elaboration_callback command registers the elaboration callback procedure.


You can integrate this script into your Quartus project and execute it during synthesis/elaboration. Make sure to replace "my_qsys_instance" and "my_ip" with your actual Qsys instance and IP names, respectively, and modify the user input handling according to your requirements.


# Define elaboration callback procedure

proc enable_disable_ip_callback { args } {

  set qsys_instance_name "my_qsys_instance"

  set ip_name "my_ip"


  # Check if the current instance is the desired Qsys instance

  if {[lindex $args 0] eq $qsys_instance_name} {

    # Get the handle to the desired IP

    set ip_handle [lindex $args 1]


    # Check user input (0 for disable, 1 for enable)

    set user_input 1 ;# For demonstration, set it to enable by default

    # You can replace this with your actual user input handling mechanism


    if {$user_input == 0} {

      # Disable IP

      set_property -dict [list CONFIG.enabled 0] $ip_handle

      puts "Disabled $ip_name in $qsys_instance_name"

    } elseif {$user_input == 1} {

      # Enable IP

      set_property -dict [list CONFIG.enabled 1] $ip_handle

      puts "Enabled $ip_name in $qsys_instance_name"

    } else {

      puts "Invalid user input!"

    }

  }

}


# Register the elaboration callback

add_elaboration_callback enable_disable_ip_callback



0 Kudos
Avinash201040
Beginner
499 Views
Thanks for ur reply
How can I integrate this script into my Quartus project and execute it during synthesis/elaboration.
Also, if I enable the ip , will the rtl be generated corresponding to that ip because ip generation happens initially and script will execute in elaboration process right?
Will correct me if I am wrong.
Thanks
0 Kudos
SyafieqS
Moderator
439 Views

I believe there is function to disable the IP generation for every compilation. Thus you may run you script right away without IP generation.


0 Kudos
SyafieqS
Moderator
387 Views

 As we do not receive any response from you on the previous question/reply/answer that we have provided. Please login to https://supporttickets.intel.com/, view details of the desire request, and post a feed/response within the next 15 days to allow me to continue to support you. After 15 days, this thread will be transitioned to community support. The community users will be able to help you on your follow-up questions.


p/s: If any answer from community or Intel support are helpful, please feel free to mark as solution, give Kudos and rate 5/5 survey


0 Kudos
Reply