- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all.
I try to write a validation callback for a component I just wrote. I get a weird TCL issue (that I don't get in a classical TCL script, I checked) Here is my code: --- Quote Start --- ... set_module_property NAME pio ... set_module_property VALIDATION_CALLBACK validate ... add_parameter PORT_31_TRISTATE BOOLEAN false set_parameter_property PORT_31_TRISTATE DEFAULT_VALUE false set_parameter_property PORT_31_TRISTATE DISPLAY_NAME PORT_31_TRISTATE set_parameter_property PORT_31_TRISTATE UNITS None set_parameter_property PORT_31_TRISTATE DISPLAY_HINT "" set_parameter_property PORT_31_TRISTATE AFFECTS_GENERATION false set_parameter_property PORT_31_TRISTATE HDL_PARAMETER true ... add_parameter PORT_31_INIT STRING TIE_DOWN set_parameter_property PORT_31_INIT DEFAULT_VALUE TIE_DOWN set_parameter_property PORT_31_INIT DISPLAY_NAME PORT_31_INIT set_parameter_property PORT_31_INIT UNITS None set_parameter_property PORT_31_INIT ALLOWED_RANGES {"TIE_UP" "TIE_DOWN" "HIGH_Z" "INPUT" "INPUT_n"} set_parameter_property PORT_31_INIT DISPLAY_HINT radio set_parameter_property PORT_31_INIT AFFECTS_GENERATION false set_parameter_property PORT_31_INIT HDL_PARAMETER true ... proc validate {} { if {(![get_parameter_value PORT_31_TRISTATE]) && ([get_parameter_value PORT_31_INIT] == "HIGH_Z")} { send_message error "PORT_31_INIT cannot be set to 'HIGH_Z' as PORT_31_TRISTATE has been set to false" }[/INDENT] } ... --- Quote End --- Then I get the following error message at SOPC Builder startup, when the code is sourced: --- Quote Start --- Error: pio_0: can't use non-numeric string as operand of "!" ("if" test expression) invoked from within "if {(![get_parameter_value PORT_31_TRISTATE]) && ([get_parameter_value PORT_31_INIT] == "HIGH_Z")} { send_message error "PORT_31_INIT cannot be set ..." (procedure "validate" line 2) invoked from within "validate" --- Quote End --- Can you tell me what is wrong??? ThxLink Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What is the issue you are seeing?
Moving to the general nios forum section.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Oooops I totally forgot to quote the error message.
I just edited my original post... So it seems to be a TCL syntax error but I can't get it...- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try comparing it to be equal to 0 instead of inverting it. If you look at the read or write masters in this design you'll see some boolean comparisons in the validation callback similar to what you are doing: http://www.altera.com/support/examples/nios2/exm-modular-scatter-gather-dma.html
There might be cleaner ways to code it..... I wouldn't know since I only know enough .tcl to get my job done :)- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the reply.
Unfortunatly, there are no boolean parameters in the _hw.tcl you provided. Maybe you can find another one with actual boolean parameters? Thx a lot. Julien- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you search through the ip folder for .tcl files you might find one that uses HDL boolean parameters. I was lazy and just used a regular integer parameter in the HDL and then made it appear as a boolean (checkbox) in the GUI by setting the display hint to boolean. By using a display hint of boolean it can only get set to 0 or 1 so you might be able to do the same.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'll do that if I really can solve this issue, but it ****es me off as it's only tcl syntax! :D
I looked in the IP folder and could not find any boolean parameter in any _hw.tcl file...- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
problem solved
--- Quote Start --- proc validate {} { if {([get_parameter_value PORT_31_TRISTATE] == "false") && ([get_parameter_value PORT_31_INIT] == "HIGH_Z")} { send_message error "PORT_31_INIT cannot be set to 'HIGH_Z' as PORT_31_TRISTATE has been set to false" }[/INDENT] } --- Quote End --- I had tried that before but I forgot the double quotes around 'false'...- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page