Vous êtes sur la page 1sur 3

5/30/2016

WritingMoreCompactEncounterScriptswithdbGetExpressionsDigitalImplementationCadenceBlogsCadenceCommunity

Home>Community>Blogs>DigitalImplementation>WritingMoreCompactEncounterScriptswithdbGetExpre

WritingMoreCompactEncounterScriptswithdbGetExpressions
Comments(5)
QueryingtheEncounterdatabasewithdbGetistypicallyprettyconcisetobeginwith.Butyoumightnotbeawareofits
supportforexpressionbasedmatching,whichenablesevenmorecompactscripting.
Let'stakeaverysimplebutcommonscriptingchallenge:Findingallofthehighfanoutnetsinthedesign.
Thenlet'stakethisalittlefurther.Howwouldwewriteascripttofindallnetswithfanoutgreaterthan"n"whicharenot
clocknets?
Historicallywe'ddothisbyiteratingthroughallofthenetsinthedesign,checkingwhethertheirfanoutisgreaterthan
"n",checkingwhetheritismarkedasaclocknet,andifsoaddittoalistofnetsthatmeetthecriteria.Thiswouldtake
aboutahalfdozenlinesofcode.
ButbyusingdbGet'ssupportforexpressionbasedmatching,wecanmakethisscriptmorecompact.Here'showit
works.
First,let'slookathowwe'dwritethisscriptwithoutexpressions:
sethigh_fanout_nets{}
foreachnet[dbGettop.nets]{
if{[dbGet$net.numInputTerms]>32}{
if{![dbGet$net.isClock]}{
lappendhigh_fanout_nets$net
}
}
}
return$high_fanout_nets
Here'showwe'dwritethesamefunctionalityusingdbGet'sexpressionbasedmatching:
encounter1>dbGettop.nets{.numInputTerms>32&&.isClock==0}
Muchmorecompact,right?
Sohere'showitworks,stepbystep.Theattribute".numInputTerms"givesus,effectively,thefanoutforeachnet.Ifwe
weretoquerythatattributeforeachnetwe'dgetalistofnumbersrepresentingthefanoutofeachnetinthedesign:
encounter2>dbGettop.nets.numInputTerms
55116323216331917182120212020711717816163216
Wemorecommonlyuse"simple"matchingtofindthingswe'relookingforlikeobjectnames,andtestingfor1'sand
0's.Andwecouldcertainlydothatwiththe.numInputTermsattribute:
encounter3>dbGettop.nets.numInputTerms32
3232323232323232
http://community.cadence.com/cadence_blogs_8/b/di/archive/2012/05/30/writingmorecompactencounterscriptswithdbgetexpressions

1/3

5/30/2016

WritingMoreCompactEncounterScriptswithdbGetExpressionsDigitalImplementationCadenceBlogsCadenceCommunity

Andifwewantedtogetthepointerstothosenetswecoulddoitlikethis:
encounter4>dbGettop.nets.numInputTerms32p
0x2aaab4252f380x2aaab20acbe80x2aaab20acf300x2aaab215fc880x2aaab21600780x2aaab21faa00
0x2aaab21faca00x2aaab21fcab8
Andifwewantedtogettheirnameswecoulddoitlikethis:
encounter5>dbGet[dbGettop.nets.numInputTerms32p].name
DTMF_INST/TDSP_CORE_INST/ALU_32_INST/n_3062DTMF_INST/TDSP_CORE_INST/EXECUTE_INST/n_896
{DTMF_INST/TDSP_CORE_INST/EXECUTE_INST/nbus_426[0]}
DTMF_INST/TDSP_CORE_INST/TDSP_CORE_GLUE_INST/n_1213
DTMF_INST/TDSP_CORE_INST/TDSP_CORE_GLUE_INST/n_1357DTMF_INST/RESULTS_CONV_INST/n_2516
DTMF_INST/RESULTS_CONV_INST/n_2521DTMF_INST/RESULTS_CONV_INST/n_2512
ButifwewanttogetmoresophisticatedwecanusedbGetexpressionmatching.Thefirstthingtonoticeistheunique
syntaxtheseexpressionsuse.Ifwewanttodothesameaswedidacoupleexamplesbackie,getthepointerstoall
netswithafanoutof32here'showwedoitwithexpressionmatching:
encounter6>dbGettop.nets{.numInputTerms==32}
0x2aaab4252f380x2aaab20acbe80x2aaab20acf300x2aaab215fc880x2aaab21600780x2aaab21faa00
0x2aaab21faca00x2aaab21fcab8
Noticethatweselecttheattributetomatchonwith".numInputTerms",thenthecriteria("=="inthiscase),thenthe
value.Andwewrapitallin"{}".NotealsothatdbGetautomaticallyreturnspointersinthismodeanddoesn'trequirea
"p".
Fromtherewecanmakeitmorecomplex,withagreaterthanratherthanequal:
encounter7>dbGettop.nets{.numInputTerms>32}
0x2aaab3c5c9280x2aaab3c5c9d00x2aaab3cf78980x2aaab3cf8c480x2aaab40e58900x2aaab42533d0
0x2aaab4253a600x2aaab44474b00x2aaab20ad0800x2aaab20adc380x2aaab20c41800x2aaab20c44c8
0x2aaab21fb2880x2aaab21fbfa8
Orcombinetwoexpressionstomatchthenetswithfanoutgreaterthan"n"whicharenotmarkedasclocknets:
encounter8>dbGettop.nets{.numInputTerms>32&&.isClock==0}
0x2aaab3c5c9280x2aaab3c5c9d00x2aaab40e58900x2aaab42533d00x2aaab4253a600x2aaab44474b0
0x2aaab20ad0800x2aaab20adc380x2aaab20c41800x2aaab20c44c80x2aaab21fb2880x2aaab21fbfa8
IfwewantedtogetthenamesofthesenetswecouldwrapitwithinanothercalltodbGet:
encounter9>dbGet[dbGettop.nets{.numInputTerms>32&&.isClock==0}].name
test_modeIscan_enI{DTMF_INST/TDSP_CORE_INST/alu_cmd[1]}
DTMF_INST/TDSP_CORE_INST/ALU_32_INST/n_1716DTMF_INST/TDSP_CORE_INST/ALU_32_INST/n_1738
DTMF_INST/TDSP_CORE_INST/MPY_32_INST/n_268
{DTMF_INST/TDSP_CORE_INST/EXECUTE_INST/nbus_440[0]}
DTMF_INST/TDSP_CORE_INST/EXECUTE_INST/n_4221DTMF_INST/TDSP_CORE_INST/DECODE_INST/n_4475
DTMF_INST/TDSP_CORE_INST/DECODE_INST/n_181DTMF_INST/RESULTS_CONV_INST/n_2509
DTMF_INST/RESULTS_CONV_INST/n_6011
IhopethisishelpfulinmakingyourscriptingwithinEncountermorecompact.CheckbacknexttimeandI'llshowhow
towritethesenetstoafile,onenetnameperlinebyusingredirectandacoupleoftricks.
I'dloveitifyousubscribedtotheCadenceDigitalImplementationblogsfornotificationofnewposts.
http://community.cadence.com/cadence_blogs_8/b/di/archive/2012/05/30/writingmorecompactencounterscriptswithdbgetexpressions

2/3

5/30/2016

WritingMoreCompactEncounterScriptswithdbGetExpressionsDigitalImplementationCadenceBlogsCadenceCommunity

QuestionoftheDay:HaveyoufoundcaseswheredbGet'sexpressionbasedmatchingisparticularlyuseful?
BobDwyer

dbGet

EDI

Encounterscripts

expressionbasedmatching

encounter

encounterdigitalimplementationsystem
DigitalImplementation

scripting

ICdesign

tcl

Anonymous Veryuseful.........
TooGood
_temp_50c8d92e04c04e1a8619c0037056f8a1 AfterexecutingthescriptofdbGet
[dbGettop.nets{.numInputTerms>32&&.isClock==0}].name,Iamnotabletogetthe
namesofthenets.ThisiserrorIamgettingextracharactersaftercloebrace.
RobertDwyer I'dcheckthe.isClockand.isCTSClockmarkingsononeofthenets:
dbGet[dbGetptop.nets.nameclk_net_name].??
.isClockdescribeswhetheranetisaclockfromatiminganalysisperspectiveandisn't
populateduntiltiminganalysishasbeenrun,and.isCTSClockdescribeswhetheranetis
foundtobeaclocknetsaccordingtoclocktreespecfileloadingandtracing.
Anonymous verynice~~~
_temp_8c3eb14d4b2840faae75d63adaee1b73 Irunthescriptwithmyedidatabase,
andfoundthattheresultscontainthenetsofclocktreeIfIdon'twanttheclocktreenet,
Howtomodifythescript?thanks~

Post

http://community.cadence.com/cadence_blogs_8/b/di/archive/2012/05/30/writingmorecompactencounterscriptswithdbgetexpressions

3/3

Vous aimerez peut-être aussi