I stumbled on the following:
In a _hw.tcl file I have the following code:
Yesterday I wanted to include the module in a Qsys project, but I got this error:
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"
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:
Info: System.I2CMMSlave_0: Tcl Command: Version: 8.0 Patchlevel 8.0
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?
![]()
In a _hw.tcl file I have the following code:
Code:
proc elaborate {} {
send_message info "Tcl Command: Version: [info tclversion] Patchlevel [info patchlevel]"
add_interface_port slave A address Input [expr [widthu [get_parameter_value ADDRESS_SIZE] ]]
}
proc widthu { v } {
set r [log2 $v]
if { [expr 2 ** $r] != $v} {
incr r
}
return $r
}
proc widthr { v } {
return [expr [log2 $v] + 1 ]
}
proc log2 { v } {
set log2 0
if { $v == 1} {
return 0
} else {
return [expr [log2 [expr $v >> 1]] + 1]
}
}
Quote:
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:
Info: System.I2CMMSlave_0: Tcl Command: Version: 8.0 Patchlevel 8.0
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?