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

Qsys: what version of Tcl?

Altera_Forum
Honored Contributor II
2,157 Views

I stumbled on the following: 

In a _hw.tcl file I have the following code: 

proc elaborate {} { send_message info "Tcl Command: Version: Patchlevel " add_interface_port slave A address Input ]] } proc widthu { v } { set r if { != $v} { incr r } return $r } proc widthr { v } { return + 1 ] } proc log2 { v } { set log2 0 if { $v == 1} { return 0 } else { return ] + 1] } } 

Yesterday I wanted to include the module in a Qsys project, but I got this error: 

 

--- Quote Start ---  

Error: System.I2CMMSlave_0: syntax error in expression "2 ** 14" 

while executing 

"expr 2 ** $r" 

("if" test expression) 

invoked from within 

"if { [expr 2 ** $r] != $v} { 

incr r 

}" 

(procedure "widthu" line 3) 

invoked from within 

"widthu [get_parameter_value ADDRESS_SIZE] " 

invoked from within 

"expr [widthu [get_parameter_value ADDRESS_SIZE] " 

invoked from within 

"add_interface_port slave A address Input [expr [widthu [get_parameter_value ADDRESS_SIZE] ]]" 

(procedure "elaborate" line 3) 

invoked from within 

"elaborate" 

--- Quote End ---  

 

I then added the " send_message info "Tcl Command: Version: [info tclversion] Patchlevel [info patchlevel]" " to the elaborate procedure and was very surprised to get the following: 

 

--- Quote Start ---  

Info: System.I2CMMSlave_0: Tcl Command: Version: 8.0 Patchlevel 8.0 

 

--- Quote End ---  

 

As I was expecting to see version 8.5 or 8.6. 

 

I did the exercise for Quartus 12.0, 13.0 SP1 and 14.1, and get the same error. 

 

Any clues why Qsys is reporting 8.0? 

 

Is Altera emulating Tcl 8.0 in its Java code? 

 

http://www.alteraforum.com/forum/attachment.php?attachmentid=9916&stc=1
0 Kudos
6 Replies
Altera_Forum
Honored Contributor II
1,302 Views

No takers?

0 Kudos
Altera_Forum
Honored Contributor II
1,302 Views

 

--- Quote Start ---  

 

No takers? 

 

--- Quote End ---  

 

Nope, just interested viewers :) 

 

Its a bit weird that both the version and patchlevel are the same. I wonder if those commands are just broken in Altera's implementation.  

 

In my Tcl testing of quartus_stp and SystemConsole I found lots of inconsistencies. One would hope that Qsys Java Tcl (Jacl?) and SystemConsole Java Tcl are the same. Try running the info commands under SystemConsole and see if you get different results. 

 

Cheers, 

Dave
0 Kudos
Altera_Forum
Honored Contributor II
1,302 Views

 

--- Quote Start ---  

Nope, just interested viewers :) 

 

Its a bit weird that both the version and patchlevel are the same. I wonder if those commands are just broken in Altera's implementation.  

 

In my Tcl testing of quartus_stp and SystemConsole I found lots of inconsistencies. One would hope that Qsys Java Tcl (Jacl?) and SystemConsole Java Tcl are the same. Try running the info commands under SystemConsole and see if you get different results. 

 

Cheers, 

Dave 

--- Quote End ---  

 

 

I don't have a cable at home, so it'll have to wait. I just wrote a workaround for the failing '**' operator, but I made that file almost 2 years ago and did use the module in Qsys. 

But I just found the reason: initially I wrote the module under QII 12.1: 

package require -exact qsys 12.1 which I later downgraded to 12.0 (sweeping over all _hw.tcl in a bulk operation ...). I put the 12.1 back and, yes, out comes 8.6 

 

--- Quote Start ---  

Info: cam.EEpromSensor: Tcl Command: Version: 8.6 Patchlevel 8.6.1 

 

--- Quote End ---  

 

 

Thanks again, for being the sounding board. 

 

Regards, 

Josy
0 Kudos
Altera_Forum
Honored Contributor II
1,302 Views

Hi Josy, 

 

 

--- Quote Start ---  

I just wrote a workaround for the failing '**' operator 

 

--- Quote End ---  

 

The following should be equivalent ... 

set c expr {$a**$b)} set c expr {int(pow($a,$b))}  

 

 

--- Quote Start ---  

 

But I just found the reason: initially I wrote the module under QII 12.1: 

package require -exact qsys 12.1 which I later downgraded to 12.0 (sweeping over all _hw.tcl in a bulk operation ...). I put the 12.1 back and, yes, out comes 8.6 

 

--- Quote End ---  

 

Ah, yes, I could see how that would downgrade Tcl. 

 

Recently I have been using the construct 

set qsys_version  

So that I can use $qsys_version to add/remove Qsys version dependencies, eg.,  

 

# Allow mixed-language simulation# * invalid option in 12.1, 13.0sp1, but ok in 13.1 and 14.0 if {$qsys_version >= 13.1} { set_module_property PREFERRED_SIMULATION_LANGUAGE VHDL }  

 

Unfortunately when running under 13.0sp1, qsys_version is 13.1, which totally defeats this logic ... $::quartus(version) has the correct value, so I'll probably have to change the logic to use that. 

 

Another case of Altera Tcl inconsistency ...  

 

I even made sure to start Quartus from a 13.0sp1 NIOS II IDE shell, so the environment should not have picked up the tool from another installation, but I plan on trying this test on a VirtualBox install with only one version of the tool installed to check. 

 

 

--- Quote Start ---  

 

Thanks again, for being the sounding board. 

 

--- Quote End ---  

 

Likewise! 

 

Cheers, 

Dave
0 Kudos
Altera_Forum
Honored Contributor II
1,302 Views

 

--- Quote Start ---  

Hi Josy, 

 

 

The following should be equivalent ... 

set c expr {$a**$b)} set c expr {int(pow($a,$b))}  

 

 

--- Quote End ---  

 

I have a penchant for recursive functions so I wrote: 

proc widthu { v } { set r if { != $v } { incr r } return $r } proc exp2 { v } { if { $v == 1 } { return 2 } else { return ]] } } 

Beware of zeroes :)  

So i'll have to change it to: 

proc exp2 { v } { if { $v == 0 } { return 1 } else { return ]] } } 

 

Regards, 

Josy
0 Kudos
Altera_Forum
Honored Contributor II
1,302 Views

 

--- Quote Start ---  

I have a penchant for recursive functions so I wrote: 

 

--- Quote End ---  

 

I'm sure there is medication for coders who wrote code for no good reason :) 

 

Cheers, 

Dave
0 Kudos
Reply