- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm trying to do something similar to the example in Quartus 9.0 Handbook, Volume 3 Chapter 17: Design Debugging Using In-System Sources and Probes - Example 17–1. Tcl Script Procedures for Reading and Writing to the...
I'm having problems related to the int2bits procedure When I first tried to run it, I got invalid command name "int2bits", as if the proc is undefined I found this at http://wiki.tcl.tk, so I added it: proc int2bits {i} { # returns a bitslist, e.g. int2bits 10 => {1 0 1 0} set res "" while {$i>0} { set res [expr {$i%2}]$res set i [expr {$i/2}] } if {$res==""} {set res 0} split $res "" } Now the problem seems to be that int2bits returns something like 1 0 1 0, when it appears that the proper form needed in the write would be 1010 e.g. this form works write_source_data -instance_index 0 -value [0010001000100010001000] where this doesn't (it writes to the source, but something other than what I want) write_source_data -instance_index 0 -value [0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0] nor write_source_data -instance_index 0 -value [int2bits 0x88888] What is the proper form of the int2bits proc needed to make this work correctly? Or is there an alternative to int2bits to get the binary form needed?Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
See http://tmml.sourceforge.net/doc/tcl/expr.html. As you can see expr adds a space to produce a list as a result. Check http://tcl.projectforum.com/young/251 for tips about handling strings and the difference with lists in TCL.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OK, so this works:
write_source_data -instance_index 0 -value [regsub -all " " [int2bits 0x88888] ""] So does modifying int2bits to do the regsub after the split. I still think the example in the Quartus manual is confusing at best, and probably wrong. Thanks for the help. :)
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page