How to add more widgets to the generated IP with Vivado IP Integrator? - tcl

I'm developing an IP for Vivado. I have the VHDL sources and I want generate the IP. I know how to create the IP with basic parameters such as input integer values, radio buttons, lists... These widget are provided by default in the Vivado IP integrator tool, but I Want add it more funcionalities to my IP. This funcionalities can be acomplished using other widgets such as buttons to select a file, make external simulations via Matlab or Python, plot graphs... also infer IPs such as DSPs or RAMS.
I know I can achieve the generation of files, simulations, infering IPs... etc with tcl commands and using the Xilinx templates, but I don't know how to connect this funcionalities with the IPGui.
Looking at the .tcl files generated for an IP generated by me, I can see how to add pages, something params... etc
# Definitional proc to organize widgets for parameters.
proc init_gui { IPINST } {
ipgui::add_param $IPINST -name "Component_Name"
#Adding Page
set Page_0000 [ipgui::add_page $IPINST -name "Page 0000"]
# I think here I should to change the type of widget
ipgui::add_param $IPINST -name "Pruebas_Botones" -parent ${Page_0000} -widget comboBox
ipgui::add_param $IPINST -name "Another" -parent ${Page_0000}
ipgui::add_param $IPINST -name "Prueba_butt_1" -parent ${Page_0000}
ipgui::add_param $IPINST -name "CLK_IN1_Freq" -parent ${Page_0000}
}
proc update_PARAM_VALUE.Another { PARAM_VALUE.Another } {
# Procedure called to update Another when any of the dependent parameters in the arguments change
}
My question is: where can I find doc or examples about ipgui to create an IP using my own code?
I have the TCL files for the Vivado repository, but TCL files are encoding in TCL bytecode. Also I've seen other questions but nothing that works, and, changing the code for the TCL generate by Vivado IP Integrator, the IP GUI can't regenerate the IP if the properties are not the specified and are seleccioable in the tool.

Related

In webMethods, Apart from Global Variable feature, Is there any other option to configure desired values?

Example:
Assume that there is a string variable called "passcode" .
I have to fetch value for the variable passcode at runtime based on the environments
Environments
Value
DEV
abc123
SIT
def321
QA
S1O8F9
PROD
3a2b1c
In webMethods, Are there any alternate solutions to configure and fetch the value at each environment level apart from Global variable option?
Can configure environment variable in db or extended settings --> based on environment options DEV, SIT...
Logic can be written in service for different values or can read configuration from any properties file...

Parsing terraform plan output to check for module vs resource block usage

I wanted to add a check to an existing terraform build and deployment pipeline to check that the configuration being written by devs is properly formatted and in line with company syntax
Specifically I want to check to make sure they are not using plain resource blocks in thier config as opposed to module blocks
For example I want to I want to make sure they are using
Module “eks_dev_wus2_app_cluster”
And not
Resource “aws_kubernetes_cluster” “eks_dev_wus2_App_cluster”
Current approach
As I understand it I would need to first convert to json to parse through it
terraform show -no-color -json output.tfplan > output.json
Then I should use the jq tool to parse through the output per this article
https://linuxconfig.org/how-to-parse-a-json-file-from-linux-command-line-using-jq
A little fuzzy on how I would go about specifically checking the blocks in the terraform config to confirm whether or not they are resource or module.
Can anyone point me in the right direction?
Is there a better way to get output values? Don’t need an entire solution, just looking to clarify some of the fogginess of approaching this problem
Under the output format, there is a list called resource_changes. Each change has an address field. To meet your requirement, each address should start with module. This makes the developer responsible only for the modules that they are changing with this terraform plan.
Assuming you already have output.json in place, you could do it like this:
LIST=$(cat output.json| jq -r ".resource_changes[].address")
for ADDRESS in $LIST
do
if [[ $ADDRESS != "module."* ]]; then
echo "$ADDRESS is outside of a module"
exit 1
fi
done

Redirect the stdout when loading package in Tcl

I would like to redirect the stdout to null when loading package in Windows Tcl. (Redirect the wording of "Quality Windows Audio/Video Experience (qWAVE) support is available." to null)
Is their any way to solve this or any idea for this ?? Thank you so much.
C:\Users\Tester>tclsh
% set ixchariot_installation_dir "C:/Program Files x86)/Ixia/IxChariot"
C:/Program Files (x86)/Ixia/IxChariot
% cd $ixchariot_installation_dir
% load ChariotExt
Quality Windows Audio/Video Experience (qWAVE) support is available.
If the library is using Tcl channels to write its message, and you're using Tcl 8.6, it's pretty easy. You just push a transform on the stdout channel that swallows all bytes.
# Most of this is boiler-plate stuff...
namespace eval swallow {
proc initialize {handle mode} {
return {initialize clear finalize write flush}
}
proc clear {handle} {}
proc finalize {handle} {}
proc flush {handle} {}
# The important one; do nothing to throw away bytes
proc write {handle buffer} {}
# Export as an ensemble
namespace export *
namespace ensemble create
}
# Start dropping output
chan push stdout swallow
load ChariotExt
# Stop dropping output
chan pop stdout
That only works if the library is using Tcl channels to write it's message. If it is using a direct write (the more likely case) it won't. You can instead try a full redirect, but these are not easily undone.
close stdout
open NUL
load ChariotExt
I know that'd work on POSIX systems (except with /dev/null instead of NUL). Not sure on Windows. And it can't be easily undone; the old standard output stream is gone.
And in any case, it's possible that the library is using a direct write to the console; those aren't blockable, and you might just have to live with that irritating message.

Behavioral simulation in TCL Batch Mode

I have a behavioral simulation, which stores all needed information after simulation in a .txt file. I need to run this simulation about 8000 + times with different parameters, which are generated in MATLAB. I would like to run a TCL script with different parameters. What I have so far:
From MATLAB I call Vivado in batch mode with following parameters:
system('C:/Xilinx/Vivado/2015.4/bin/vivado -mode batch -nojournal -nolog -notrace -source E:/Projects/Vivado/Test_Files/VivTCLstim.txt -tclargs 256 32 15 25790');
The TCL script looks as follows:
open_project E:/Projects/Vivado/THD/THD_VHDL.xpr
set_property top tb_THD [get_filesets sim_1]
set_property top_lib xil_defaultlib [get_filesets sim_1]
set_property generic N=[lindex $argv 0] [get_filesets sim_1]
set_property generic DWIDTH=[lindex $argv 1] [get_filesets sim_1]
set_property generic ITER =[lindex $argv 2] [get_filesets sim_1]
launch_simulation
run [lindex $argv 3] ns
close_sim
However, it seems that Vivado does not change the values. It always runs simulation for 1000 ns (default set up) and uses generic parameters which are set by default in .vhd file. I’ve also tried to set generic parameters through GUI as shown here http://www.xilinx.com/support/answers/64118.html (this is where I got the TCL commands from), but the simulation parameters don’t change. What can be the cause? And is my script and the way to do the simulation in the batch mode right or not?
You don't need to run the simulation through Vivado. Vivado has command line tools for each step in a simulation:
VHDL source file compilation => xvhcomp
elaboration => xelab and
simulation run => xsim
The first step can be skipped, because xelab can also trigger the compile steps. You just need to provide a *.prj file containing all needed VHDL source file.
vhdl mylib my/source/file1.vhdl
vhdl mylib my/source/file2.vhdl
vhdl test my/source/testbench.vhdl
You can provide top-level generics to the simulation and of cause, you can provide your own Tcl file for xsim in batch mode. I wrote a Python wrapper around these tools to control all steps in the simulation run, and it works fine :).

Call a function in another script when executing using 'Run With PowerShell'

I have functions in a 'library' file to be called from my 'worker' script.
Library File
function ShowMessage($AValue)
{
$a = new-object -comobject wscript.shell
$b = $a.popup( $AValue )
}
Worker File
. {c:\scratch\b.ps1}
ShowMessage "Hello"
Running the 'worker' script works fine when in the PowerShell IDE but when I right-click the worker file and choose 'Run with PowerShell' it cannot find the function 'ShowMessage'. Both files are in the same folder. What might be happening?
In the worker file change to this:
. "c:\scratch\b.ps1"
ShowMessage "Hello"
As #RoiDanton mentioned below:
Attention when using relative pathing: Don't forget to prepend a dot
before the path . ".\b.ps1".
The first dot is an operator used to modify the scope and in that context it has nothing to do with paths. See Dot Source Notation.
In your worker file, dot-source the library file, this will load all content (functions, variables, etc) to the global scope, and then you'll be able to call functions from the library file.
=================== Worker file ==========================
# dot-source library script
# notice that you need to have a space
# between the dot and the path of the script
. c:\library.ps1
ShowMessage -AValue Hello
=================== End Worker file ======================