Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

tcl : for {for} loops to extract array information

Status
Not open for further replies.

pierre13

Junior Member level 3
Junior Member level 3
Joined
Aug 9, 2012
Messages
27
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,725
Hello !!

I would need some help regarding a tcl script.
I would like to create different strings from an array such as :

string0 : parameters Rright=9.325k wneqi=50n Rleft=4.65k lneqi=50n wpen=5e-08 wndiff=50n lpen=50n lndiff=50n
srting1 : parameters Rright=9.325k wneqi=50n Rleft=4.65k lneqi=50n wpen=2.875e-07 wndiff=50n lpen=50n lndiff=50n
string2 : parameters Rright=9.325k wneqi=50n Rleft=4.65k lneqi=50n wpen=5.25e-07 wndiff=50n lpen=50n lndiff=50n
string3 : parameters Rright=9.325k wneqi=50n Rleft=4.65k lneqi=50n wpen=2.875e-07 wndiff=50n lpen=60n lndiff=50n

I have, as far as now the following code :

----------------
essai.tcl :

#!/usr/bin/tclsh

set paramTab(wndiff) 50n
set paramTab(lndiff) 50n
set paramTab(wneqi) 50n
set paramTab(lneqi) 50n
set paramTab(wpen) {5e-08 2.875e-07 5.25e-07}
set paramTab(lpen) {50n 60n}
set paramTab(Rleft) 4.65k
set paramTab(Rright) 9.325k


set list_built ""
foreach {element} [array names paramTab] {
set list_value_element_array $paramTab($element)
set length_list_value_element_array [llength $list_value_element_array]
for {set i 0} {$i < $length_list_value_element_array} {incr i} {
set string_example "$element=[lindex $list_value_element_array $i]"
puts "parameters $string_example"
}
}

----------------

> tclsh essai.tcl
parameters Rright=9.325k
parameters wneqi=50n
parameters Rleft=4.65k
parameters lneqi=50n
parameters wpen=5e-08
parameters wpen=2.875e-07
parameters wpen=5.25e-07
parameters wndiff=50n
parameters lpen=50n
parameters lpen=60n
parameters lndiff=50n


The goal is to write the different strings in a cadence netlist for example.

I feel I should play with the loop indexes, but I made different attemps with no success.
Does someone can give me a hint ??

Many thanks.

P.
 
Last edited:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top