<!DOCTYPE html>
<html lang='en'>
<head>
<title>xen/xen - xen</title>
<meta name='generator' content='cgit v1.2.3'/>
<meta name='robots' content='index, nofollow'/>
<link rel='stylesheet' type='text/css' href='/cgit.css'/>
<link rel='shortcut icon' href='/favicon.ico'/>
<link rel='alternate' title='Atom feed' href='http://git.panaceas.org/cgit.cgi/xen/xen/atom/tools/ioemu/keymaps/ja?h=master' type='application/atom+xml'/>
<link rel='vcs-git' href='git://git.panaceas.org/xen/xen' title='xen/xen Git repository'/>
<link rel='vcs-git' href='ssh://git@git.panaceas.org/git/xen/xen' title='xen/xen Git repository'/>
</head>
<body>
<div id='cgit'><table id='header'>
<tr>
<td class='logo' rowspan='2'><a href='/cgit.cgi/'><img src='/cgit.png' alt='cgit logo'/></a></td>
<td class='main'><a href='/cgit.cgi/'>index</a> : <a title='xen/xen' href='/cgit.cgi/xen/xen/'>xen/xen</a></td><td class='form'><form method='get'>
<input type='hidden' name='id' value='26937cc1116c56f405640e6988f64089fd260cdb'/><select name='h' onchange='this.form.submit();'>
<option value='master' selected='selected'>master</option>
<option value='stable-4.0'>stable-4.0</option>
<option value='stable-4.1'>stable-4.1</option>
<option value='stable-4.2'>stable-4.2</option>
<option value='stable-4.3'>stable-4.3</option>
<option value='staging'>staging</option>
<option value='staging-4.0'>staging-4.0</option>
<option value='staging-4.1'>staging-4.1</option>
<option value='staging-4.2'>staging-4.2</option>
<option value='staging-4.3'>staging-4.3</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>xen</td><td class='sub right'>James</td></tr></table>
<table class='tabs'><tr><td>
<a href='/cgit.cgi/xen/xen/about/'>about</a><a href='/cgit.cgi/xen/xen/'>summary</a><a href='/cgit.cgi/xen/xen/refs/?id=26937cc1116c56f405640e6988f64089fd260cdb'>refs</a><a href='/cgit.cgi/xen/xen/log/tools/ioemu/keymaps/ja'>log</a><a href='/cgit.cgi/xen/xen/tree/tools/ioemu/keymaps/ja?id=26937cc1116c56f405640e6988f64089fd260cdb'>tree</a><a class='active' href='/cgit.cgi/xen/xen/commit/tools/ioemu/keymaps/ja?id=26937cc1116c56f405640e6988f64089fd260cdb'>commit</a><a href='/cgit.cgi/xen/xen/diff/tools/ioemu/keymaps/ja?id=26937cc1116c56f405640e6988f64089fd260cdb'>diff</a><a href='/cgit.cgi/xen/xen/stats/tools/ioemu/keymaps/ja'>stats</a></td><td class='form'><form class='right' method='get' action='/cgit.cgi/xen/xen/log/tools/ioemu/keymaps/ja'>
<input type='hidden' name='id' value='26937cc1116c56f405640e6988f64089fd260cdb'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/cgit.cgi/xen/xen/commit/?id=26937cc1116c56f405640e6988f64089fd260cdb'>root</a>/<a href='/cgit.cgi/xen/xen/commit/tools?id=26937cc1116c56f405640e6988f64089fd260cdb'>tools</a>/<a href='/cgit.cgi/xen/xen/commit/tools/ioemu?id=26937cc1116c56f405640e6988f64089fd260cdb'>ioemu</a>/<a href='/cgit.cgi/xen/xen/commit/tools/ioemu/keymaps?id=26937cc1116c56f405640e6988f64089fd260cdb'>keymaps</a>/<a href='/cgit.cgi/xen/xen/commit/tools/ioemu/keymaps/ja?id=26937cc1116c56f405640e6988f64089fd260cdb'>ja</a></div><div class='content'><div class='cgit-panel'><b>diff options</b><form method='get'><input type='hidden' name='id' value='26937cc1116c56f405640e6988f64089fd260cdb'/><table><tr><td colspan='2'/></tr><tr><td class='label'>context:</td><td class='ctrl'><select name='context' onchange='this.form.submit();'><option value='1'>1</option><option value='2'>2</option><option value='3' selected='selected'>3</option><option value='4'>4</option><option value='5'>5</option><option value='6'>6</option><option value='7'>7</option><option value='8'>8</option><option value='9'>9</option><option value='10'>10</option><option value='15'>15</option><option value='20'>20</option><option value='25'>25</option><option value='30'>30</option><option value='35'>35</option><option value='40'>40</option></select></td></tr><tr><td class='label'>space:</td><td class='ctrl'><select name='ignorews' onchange='this.form.submit();'><option value='0' selected='selected'>include</option><option value='1'>ignore</option></select></td></tr><tr><td class='label'>mode:</td><td class='ctrl'><select name='dt' onchange='this.form.submit();'><option value='0' selected='selected'>unified</option><option value='1'>ssdiff</option><option value='2'>stat only</option></select></td></tr><tr><td/><td class='ctrl'><noscript><input type='submit' value='reload'/></noscript></td></tr></table></form></div><table summary='commit info' class='commit-info'>
<tr><th>author</th><td>dan@localhost.localdomain &lt;dan@localhost.localdomain&gt;</td><td class='right'>2005-11-20 15:01:15 +0100</td></tr>
<tr><th>committer</th><td>dan@localhost.localdomain &lt;dan@localhost.localdomain&gt;</td><td class='right'>2005-11-20 15:01:15 +0100</td></tr>
<tr><th>commit</th><td colspan='2' class='sha1'><a href='/cgit.cgi/xen/xen/commit/tools/ioemu/keymaps/ja?id=26937cc1116c56f405640e6988f64089fd260cdb'>26937cc1116c56f405640e6988f64089fd260cdb</a> (<a href='/cgit.cgi/xen/xen/patch/tools/ioemu/keymaps/ja?id=26937cc1116c56f405640e6988f64089fd260cdb'>patch</a>)</td></tr>
<tr><th>tree</th><td colspan='2' class='sha1'><a href='/cgit.cgi/xen/xen/tree/?id=26937cc1116c56f405640e6988f64089fd260cdb'>a3af80e1cdd11fcea7eab8bad55ce23066904a7a</a> /<a href='/cgit.cgi/xen/xen/tree/tools/ioemu/keymaps/ja?id=26937cc1116c56f405640e6988f64089fd260cdb'>tools/ioemu/keymaps/ja</a></td></tr>
<tr><th>parent</th><td colspan='2' class='sha1'><a href='/cgit.cgi/xen/xen/commit/tools/ioemu/keymaps/ja?id=72af5fff3bc759b7c9446982ca739d5465ea3918'>72af5fff3bc759b7c9446982ca739d5465ea3918</a> (<a href='/cgit.cgi/xen/xen/diff/tools/ioemu/keymaps/ja?id=26937cc1116c56f405640e6988f64089fd260cdb&amp;id2=72af5fff3bc759b7c9446982ca739d5465ea3918'>diff</a>)</td></tr><tr><th>download</th><td colspan='2' class='sha1'><a href='/cgit.cgi/xen/xen/snapshot/xen-26937cc1116c56f405640e6988f64089fd260cdb.tar.gz'>xen-26937cc1116c56f405640e6988f64089fd260cdb.tar.gz</a><br/><a href='/cgit.cgi/xen/xen/snapshot/xen-26937cc1116c56f405640e6988f64089fd260cdb.tar.bz2'>xen-26937cc1116c56f405640e6988f64089fd260cdb.tar.bz2</a><br/><a href='/cgit.cgi/xen/xen/snapshot/xen-26937cc1116c56f405640e6988f64089fd260cdb.zip'>xen-26937cc1116c56f405640e6988f64089fd260cdb.zip</a><br/></td></tr></table>
<div class='commit-subject'>First stab at a xend-config.sxp man page.</div><div class='commit-msg'></div><div class='diffstat-header'><a href='/cgit.cgi/xen/xen/diff/?id=26937cc1116c56f405640e6988f64089fd260cdb'>Diffstat</a> (limited to 'tools/ioemu/keymaps/ja')</div><table summary='diffstat' class='diffstat'></table><div class='diffstat-summary'>0 files changed, 0 insertions, 0 deletions</div><table summary='diff' class='diff'><tr><td></td></tr></table></div> <!-- class=content -->
<div class='footer'>generated by <a href='https://git.zx2c4.com/cgit/about/'>cgit v1.2.3</a> (<a href='https://git-scm.com/'>git 2.25.1</a>) at 2025-07-02 23:19:31 +0000</div>
</div> <!-- id=cgit -->
</body>
</html>
n130' href='#n130'>130</a>
<a id='n131' href='#n131'>131</a>
<a id='n132' href='#n132'>132</a>
<a id='n133' href='#n133'>133</a>
<a id='n134' href='#n134'>134</a>
<a id='n135' href='#n135'>135</a>
<a id='n136' href='#n136'>136</a>
<a id='n137' href='#n137'>137</a>
<a id='n138' href='#n138'>138</a>
<a id='n139' href='#n139'>139</a>
<a id='n140' href='#n140'>140</a>
<a id='n141' href='#n141'>141</a>
<a id='n142' href='#n142'>142</a>
<a id='n143' href='#n143'>143</a>
<a id='n144' href='#n144'>144</a>
<a id='n145' href='#n145'>145</a>
<a id='n146' href='#n146'>146</a>
<a id='n147' href='#n147'>147</a>
<a id='n148' href='#n148'>148</a>
<a id='n149' href='#n149'>149</a>
<a id='n150' href='#n150'>150</a>
<a id='n151' href='#n151'>151</a>
<a id='n152' href='#n152'>152</a>
<a id='n153' href='#n153'>153</a>
<a id='n154' href='#n154'>154</a>
<a id='n155' href='#n155'>155</a>
<a id='n156' href='#n156'>156</a>
<a id='n157' href='#n157'>157</a>
<a id='n158' href='#n158'>158</a>
<a id='n159' href='#n159'>159</a>
<a id='n160' href='#n160'>160</a>
<a id='n161' href='#n161'>161</a>
<a id='n162' href='#n162'>162</a>
<a id='n163' href='#n163'>163</a>
<a id='n164' href='#n164'>164</a>
<a id='n165' href='#n165'>165</a>
<a id='n166' href='#n166'>166</a>
<a id='n167' href='#n167'>167</a>
<a id='n168' href='#n168'>168</a>
<a id='n169' href='#n169'>169</a>
<a id='n170' href='#n170'>170</a>
<a id='n171' href='#n171'>171</a>
<a id='n172' href='#n172'>172</a>
<a id='n173' href='#n173'>173</a>
<a id='n174' href='#n174'>174</a>
<a id='n175' href='#n175'>175</a>
<a id='n176' href='#n176'>176</a>
<a id='n177' href='#n177'>177</a>
<a id='n178' href='#n178'>178</a>
<a id='n179' href='#n179'>179</a>
<a id='n180' href='#n180'>180</a>
<a id='n181' href='#n181'>181</a>
<a id='n182' href='#n182'>182</a>
<a id='n183' href='#n183'>183</a>
<a id='n184' href='#n184'>184</a>
<a id='n185' href='#n185'>185</a>
<a id='n186' href='#n186'>186</a>
<a id='n187' href='#n187'>187</a>
<a id='n188' href='#n188'>188</a>
<a id='n189' href='#n189'>189</a>
<a id='n190' href='#n190'>190</a>
<a id='n191' href='#n191'>191</a>
<a id='n192' href='#n192'>192</a>
<a id='n193' href='#n193'>193</a>
<a id='n194' href='#n194'>194</a>
<a id='n195' href='#n195'>195</a>
<a id='n196' href='#n196'>196</a>
<a id='n197' href='#n197'>197</a>
<a id='n198' href='#n198'>198</a>
<a id='n199' href='#n199'>199</a>
<a id='n200' href='#n200'>200</a>
<a id='n201' href='#n201'>201</a>
<a id='n202' href='#n202'>202</a>
<a id='n203' href='#n203'>203</a>
<a id='n204' href='#n204'>204</a>
<a id='n205' href='#n205'>205</a>
<a id='n206' href='#n206'>206</a>
<a id='n207' href='#n207'>207</a>
<a id='n208' href='#n208'>208</a>
<a id='n209' href='#n209'>209</a>
<a id='n210' href='#n210'>210</a>
<a id='n211' href='#n211'>211</a>
<a id='n212' href='#n212'>212</a>
<a id='n213' href='#n213'>213</a>
<a id='n214' href='#n214'>214</a>
<a id='n215' href='#n215'>215</a>
<a id='n216' href='#n216'>216</a>
<a id='n217' href='#n217'>217</a>
<a id='n218' href='#n218'>218</a>
<a id='n219' href='#n219'>219</a>
<a id='n220' href='#n220'>220</a>
<a id='n221' href='#n221'>221</a>
<a id='n222' href='#n222'>222</a>
<a id='n223' href='#n223'>223</a>
<a id='n224' href='#n224'>224</a>
<a id='n225' href='#n225'>225</a>
<a id='n226' href='#n226'>226</a>
<a id='n227' href='#n227'>227</a>
<a id='n228' href='#n228'>228</a>
<a id='n229' href='#n229'>229</a>
<a id='n230' href='#n230'>230</a>
<a id='n231' href='#n231'>231</a>
<a id='n232' href='#n232'>232</a>
<a id='n233' href='#n233'>233</a>
<a id='n234' href='#n234'>234</a>
<a id='n235' href='#n235'>235</a>
<a id='n236' href='#n236'>236</a>
<a id='n237' href='#n237'>237</a>
<a id='n238' href='#n238'>238</a>
<a id='n239' href='#n239'>239</a>
<a id='n240' href='#n240'>240</a>
<a id='n241' href='#n241'>241</a>
<a id='n242' href='#n242'>242</a>
<a id='n243' href='#n243'>243</a>
<a id='n244' href='#n244'>244</a>
<a id='n245' href='#n245'>245</a>
<a id='n246' href='#n246'>246</a>
<a id='n247' href='#n247'>247</a>
<a id='n248' href='#n248'>248</a>
<a id='n249' href='#n249'>249</a>
<a id='n250' href='#n250'>250</a>
<a id='n251' href='#n251'>251</a>
<a id='n252' href='#n252'>252</a>
<a id='n253' href='#n253'>253</a>
<a id='n254' href='#n254'>254</a>
<a id='n255' href='#n255'>255</a>
<a id='n256' href='#n256'>256</a>
<a id='n257' href='#n257'>257</a>
<a id='n258' href='#n258'>258</a>
<a id='n259' href='#n259'>259</a>
<a id='n260' href='#n260'>260</a>
<a id='n261' href='#n261'>261</a>
<a id='n262' href='#n262'>262</a>
<a id='n263' href='#n263'>263</a>
<a id='n264' href='#n264'>264</a>
<a id='n265' href='#n265'>265</a>
<a id='n266' href='#n266'>266</a>
<a id='n267' href='#n267'>267</a>
<a id='n268' href='#n268'>268</a>
<a id='n269' href='#n269'>269</a>
<a id='n270' href='#n270'>270</a>
<a id='n271' href='#n271'>271</a>
<a id='n272' href='#n272'>272</a>
<a id='n273' href='#n273'>273</a>
<a id='n274' href='#n274'>274</a>
<a id='n275' href='#n275'>275</a>
<a id='n276' href='#n276'>276</a>
<a id='n277' href='#n277'>277</a>
<a id='n278' href='#n278'>278</a>
<a id='n279' href='#n279'>279</a>
<a id='n280' href='#n280'>280</a>
<a id='n281' href='#n281'>281</a>
<a id='n282' href='#n282'>282</a>
<a id='n283' href='#n283'>283</a>
<a id='n284' href='#n284'>284</a>
<a id='n285' href='#n285'>285</a>
<a id='n286' href='#n286'>286</a>
<a id='n287' href='#n287'>287</a>
<a id='n288' href='#n288'>288</a>
<a id='n289' href='#n289'>289</a>
<a id='n290' href='#n290'>290</a>
<a id='n291' href='#n291'>291</a>
<a id='n292' href='#n292'>292</a>
<a id='n293' href='#n293'>293</a>
<a id='n294' href='#n294'>294</a>
<a id='n295' href='#n295'>295</a>
<a id='n296' href='#n296'>296</a>
<a id='n297' href='#n297'>297</a>
<a id='n298' href='#n298'>298</a>
<a id='n299' href='#n299'>299</a>
<a id='n300' href='#n300'>300</a>
<a id='n301' href='#n301'>301</a>
<a id='n302' href='#n302'>302</a>
<a id='n303' href='#n303'>303</a>
<a id='n304' href='#n304'>304</a>
<a id='n305' href='#n305'>305</a>
<a id='n306' href='#n306'>306</a>
<a id='n307' href='#n307'>307</a>
<a id='n308' href='#n308'>308</a>
<a id='n309' href='#n309'>309</a>
<a id='n310' href='#n310'>310</a>
<a id='n311' href='#n311'>311</a>
<a id='n312' href='#n312'>312</a>
<a id='n313' href='#n313'>313</a>
<a id='n314' href='#n314'>314</a>
<a id='n315' href='#n315'>315</a>
<a id='n316' href='#n316'>316</a>
<a id='n317' href='#n317'>317</a>
<a id='n318' href='#n318'>318</a>
<a id='n319' href='#n319'>319</a>
<a id='n320' href='#n320'>320</a>
<a id='n321' href='#n321'>321</a>
<a id='n322' href='#n322'>322</a>
<a id='n323' href='#n323'>323</a>
<a id='n324' href='#n324'>324</a>
<a id='n325' href='#n325'>325</a>
<a id='n326' href='#n326'>326</a>
<a id='n327' href='#n327'>327</a>
<a id='n328' href='#n328'>328</a>
<a id='n329' href='#n329'>329</a>
<a id='n330' href='#n330'>330</a>
<a id='n331' href='#n331'>331</a>
<a id='n332' href='#n332'>332</a>
<a id='n333' href='#n333'>333</a>
<a id='n334' href='#n334'>334</a>
<a id='n335' href='#n335'>335</a>
<a id='n336' href='#n336'>336</a>
<a id='n337' href='#n337'>337</a>
<a id='n338' href='#n338'>338</a>
<a id='n339' href='#n339'>339</a>
<a id='n340' href='#n340'>340</a>
<a id='n341' href='#n341'>341</a>
<a id='n342' href='#n342'>342</a>
<a id='n343' href='#n343'>343</a>
<a id='n344' href='#n344'>344</a>
<a id='n345' href='#n345'>345</a>
<a id='n346' href='#n346'>346</a>
<a id='n347' href='#n347'>347</a>
<a id='n348' href='#n348'>348</a>
<a id='n349' href='#n349'>349</a>
<a id='n350' href='#n350'>350</a>
<a id='n351' href='#n351'>351</a>
<a id='n352' href='#n352'>352</a>
<a id='n353' href='#n353'>353</a>
<a id='n354' href='#n354'>354</a>
<a id='n355' href='#n355'>355</a>
<a id='n356' href='#n356'>356</a>
<a id='n357' href='#n357'>357</a>
<a id='n358' href='#n358'>358</a>
<a id='n359' href='#n359'>359</a>
<a id='n360' href='#n360'>360</a>
<a id='n361' href='#n361'>361</a>
<a id='n362' href='#n362'>362</a>
<a id='n363' href='#n363'>363</a>
<a id='n364' href='#n364'>364</a>
<a id='n365' href='#n365'>365</a>
<a id='n366' href='#n366'>366</a>
<a id='n367' href='#n367'>367</a>
<a id='n368' href='#n368'>368</a>
<a id='n369' href='#n369'>369</a>
<a id='n370' href='#n370'>370</a>
<a id='n371' href='#n371'>371</a>
<a id='n372' href='#n372'>372</a>
<a id='n373' href='#n373'>373</a>
<a id='n374' href='#n374'>374</a>
<a id='n375' href='#n375'>375</a>
<a id='n376' href='#n376'>376</a>
<a id='n377' href='#n377'>377</a>
<a id='n378' href='#n378'>378</a>
<a id='n379' href='#n379'>379</a>
<a id='n380' href='#n380'>380</a>
<a id='n381' href='#n381'>381</a>
<a id='n382' href='#n382'>382</a>
<a id='n383' href='#n383'>383</a>
<a id='n384' href='#n384'>384</a>
<a id='n385' href='#n385'>385</a>
<a id='n386' href='#n386'>386</a>
<a id='n387' href='#n387'>387</a>
<a id='n388' href='#n388'>388</a>
<a id='n389' href='#n389'>389</a>
<a id='n390' href='#n390'>390</a>
<a id='n391' href='#n391'>391</a>
<a id='n392' href='#n392'>392</a>
<a id='n393' href='#n393'>393</a>
<a id='n394' href='#n394'>394</a>
<a id='n395' href='#n395'>395</a>
<a id='n396' href='#n396'>396</a>
<a id='n397' href='#n397'>397</a>
<a id='n398' href='#n398'>398</a>
<a id='n399' href='#n399'>399</a>
<a id='n400' href='#n400'>400</a>
<a id='n401' href='#n401'>401</a>
<a id='n402' href='#n402'>402</a>
<a id='n403' href='#n403'>403</a>
<a id='n404' href='#n404'>404</a>
<a id='n405' href='#n405'>405</a>
<a id='n406' href='#n406'>406</a>
<a id='n407' href='#n407'>407</a>
<a id='n408' href='#n408'>408</a>
<a id='n409' href='#n409'>409</a>
<a id='n410' href='#n410'>410</a>
<a id='n411' href='#n411'>411</a>
<a id='n412' href='#n412'>412</a>
<a id='n413' href='#n413'>413</a>
<a id='n414' href='#n414'>414</a>
<a id='n415' href='#n415'>415</a>
<a id='n416' href='#n416'>416</a>
<a id='n417' href='#n417'>417</a>
<a id='n418' href='#n418'>418</a>
<a id='n419' href='#n419'>419</a>
<a id='n420' href='#n420'>420</a>
<a id='n421' href='#n421'>421</a>
<a id='n422' href='#n422'>422</a>
<a id='n423' href='#n423'>423</a>
<a id='n424' href='#n424'>424</a>
<a id='n425' href='#n425'>425</a>
<a id='n426' href='#n426'>426</a>
<a id='n427' href='#n427'>427</a>
<a id='n428' href='#n428'>428</a>
<a id='n429' href='#n429'>429</a>
<a id='n430' href='#n430'>430</a>
<a id='n431' href='#n431'>431</a>
<a id='n432' href='#n432'>432</a>
<a id='n433' href='#n433'>433</a>
<a id='n434' href='#n434'>434</a>
<a id='n435' href='#n435'>435</a>
<a id='n436' href='#n436'>436</a>
<a id='n437' href='#n437'>437</a>
<a id='n438' href='#n438'>438</a>
<a id='n439' href='#n439'>439</a>
<a id='n440' href='#n440'>440</a>
<a id='n441' href='#n441'>441</a>
<a id='n442' href='#n442'>442</a>
<a id='n443' href='#n443'>443</a>
<a id='n444' href='#n444'>444</a>
<a id='n445' href='#n445'>445</a>
<a id='n446' href='#n446'>446</a>
<a id='n447' href='#n447'>447</a>
<a id='n448' href='#n448'>448</a>
<a id='n449' href='#n449'>449</a>
<a id='n450' href='#n450'>450</a>
<a id='n451' href='#n451'>451</a>
<a id='n452' href='#n452'>452</a>
<a id='n453' href='#n453'>453</a>
<a id='n454' href='#n454'>454</a>
<a id='n455' href='#n455'>455</a>
<a id='n456' href='#n456'>456</a>
<a id='n457' href='#n457'>457</a>
<a id='n458' href='#n458'>458</a>
<a id='n459' href='#n459'>459</a>
<a id='n460' href='#n460'>460</a>
<a id='n461' href='#n461'>461</a>
<a id='n462' href='#n462'>462</a>
<a id='n463' href='#n463'>463</a>
<a id='n464' href='#n464'>464</a>
<a id='n465' href='#n465'>465</a>
<a id='n466' href='#n466'>466</a>
<a id='n467' href='#n467'>467</a>
<a id='n468' href='#n468'>468</a>
<a id='n469' href='#n469'>469</a>
<a id='n470' href='#n470'>470</a>
<a id='n471' href='#n471'>471</a>
<a id='n472' href='#n472'>472</a>
<a id='n473' href='#n473'>473</a>
<a id='n474' href='#n474'>474</a>
<a id='n475' href='#n475'>475</a>
<a id='n476' href='#n476'>476</a>
<a id='n477' href='#n477'>477</a>
<a id='n478' href='#n478'>478</a>
<a id='n479' href='#n479'>479</a>
<a id='n480' href='#n480'>480</a>
<a id='n481' href='#n481'>481</a>
<a id='n482' href='#n482'>482</a>
<a id='n483' href='#n483'>483</a>
<a id='n484' href='#n484'>484</a>
<a id='n485' href='#n485'>485</a>
<a id='n486' href='#n486'>486</a>
<a id='n487' href='#n487'>487</a>
<a id='n488' href='#n488'>488</a>
<a id='n489' href='#n489'>489</a>
<a id='n490' href='#n490'>490</a>
<a id='n491' href='#n491'>491</a>
<a id='n492' href='#n492'>492</a>
<a id='n493' href='#n493'>493</a>
<a id='n494' href='#n494'>494</a>
<a id='n495' href='#n495'>495</a>
<a id='n496' href='#n496'>496</a>
<a id='n497' href='#n497'>497</a>
<a id='n498' href='#n498'>498</a>
<a id='n499' href='#n499'>499</a>
<a id='n500' href='#n500'>500</a>
<a id='n501' href='#n501'>501</a>
<a id='n502' href='#n502'>502</a>
<a id='n503' href='#n503'>503</a>
<a id='n504' href='#n504'>504</a>
<a id='n505' href='#n505'>505</a>
<a id='n506' href='#n506'>506</a>
<a id='n507' href='#n507'>507</a>
<a id='n508' href='#n508'>508</a>
<a id='n509' href='#n509'>509</a>
<a id='n510' href='#n510'>510</a>
<a id='n511' href='#n511'>511</a>
<a id='n512' href='#n512'>512</a>
<a id='n513' href='#n513'>513</a>
<a id='n514' href='#n514'>514</a>
<a id='n515' href='#n515'>515</a>
<a id='n516' href='#n516'>516</a>
<a id='n517' href='#n517'>517</a>
<a id='n518' href='#n518'>518</a>
<a id='n519' href='#n519'>519</a>
<a id='n520' href='#n520'>520</a>
<a id='n521' href='#n521'>521</a>
<a id='n522' href='#n522'>522</a>
<a id='n523' href='#n523'>523</a>
<a id='n524' href='#n524'>524</a>
<a id='n525' href='#n525'>525</a>
<a id='n526' href='#n526'>526</a>
<a id='n527' href='#n527'>527</a>
<a id='n528' href='#n528'>528</a>
<a id='n529' href='#n529'>529</a>
<a id='n530' href='#n530'>530</a>
<a id='n531' href='#n531'>531</a>
<a id='n532' href='#n532'>532</a>
<a id='n533' href='#n533'>533</a>
<a id='n534' href='#n534'>534</a>
<a id='n535' href='#n535'>535</a>
<a id='n536' href='#n536'>536</a>
<a id='n537' href='#n537'>537</a>
<a id='n538' href='#n538'>538</a>
<a id='n539' href='#n539'>539</a>
<a id='n540' href='#n540'>540</a>
<a id='n541' href='#n541'>541</a>
<a id='n542' href='#n542'>542</a>
<a id='n543' href='#n543'>543</a>
<a id='n544' href='#n544'>544</a>
<a id='n545' href='#n545'>545</a>
<a id='n546' href='#n546'>546</a>
<a id='n547' href='#n547'>547</a>
<a id='n548' href='#n548'>548</a>
<a id='n549' href='#n549'>549</a>
<a id='n550' href='#n550'>550</a>
<a id='n551' href='#n551'>551</a>
<a id='n552' href='#n552'>552</a>
<a id='n553' href='#n553'>553</a>
<a id='n554' href='#n554'>554</a>
<a id='n555' href='#n555'>555</a>
<a id='n556' href='#n556'>556</a>
<a id='n557' href='#n557'>557</a>
<a id='n558' href='#n558'>558</a>
<a id='n559' href='#n559'>559</a>
<a id='n560' href='#n560'>560</a>
<a id='n561' href='#n561'>561</a>
<a id='n562' href='#n562'>562</a>
<a id='n563' href='#n563'>563</a>
<a id='n564' href='#n564'>564</a>
<a id='n565' href='#n565'>565</a>
<a id='n566' href='#n566'>566</a>
<a id='n567' href='#n567'>567</a>
<a id='n568' href='#n568'>568</a>
<a id='n569' href='#n569'>569</a>
<a id='n570' href='#n570'>570</a>
<a id='n571' href='#n571'>571</a>
<a id='n572' href='#n572'>572</a>
<a id='n573' href='#n573'>573</a>
<a id='n574' href='#n574'>574</a>
<a id='n575' href='#n575'>575</a>
<a id='n576' href='#n576'>576</a>
<a id='n577' href='#n577'>577</a>
<a id='n578' href='#n578'>578</a>
<a id='n579' href='#n579'>579</a>
<a id='n580' href='#n580'>580</a>
<a id='n581' href='#n581'>581</a>
<a id='n582' href='#n582'>582</a>
<a id='n583' href='#n583'>583</a>
<a id='n584' href='#n584'>584</a>
<a id='n585' href='#n585'>585</a>
<a id='n586' href='#n586'>586</a>
<a id='n587' href='#n587'>587</a>
<a id='n588' href='#n588'>588</a>
<a id='n589' href='#n589'>589</a>
<a id='n590' href='#n590'>590</a>
<a id='n591' href='#n591'>591</a>
<a id='n592' href='#n592'>592</a>
<a id='n593' href='#n593'>593</a>
<a id='n594' href='#n594'>594</a>
<a id='n595' href='#n595'>595</a>
<a id='n596' href='#n596'>596</a>
<a id='n597' href='#n597'>597</a>
</pre></td>
<td class='lines'><pre><code><style>pre { line-height: 125%; margin: 0; }
td.linenos pre { color: #000000; background-color: #f0f0f0; padding: 0 5px 0 5px; }
span.linenos { color: #000000; background-color: #f0f0f0; padding: 0 5px 0 5px; }
td.linenos pre.special { color: #000000; background-color: #ffffc0; padding: 0 5px 0 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding: 0 5px 0 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight { background: #ffffff; }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
.highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .vm { color: #336699 } /* Name.Variable.Magic */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */</style><div class="highlight"><pre><span></span><span class="k">\section</span><span class="nb">{</span>Writing Yosys extensions in C++<span class="nb">}</span>

<span class="k">\begin</span><span class="nb">{</span>frame<span class="nb">}</span>
<span class="k">\sectionpage</span>
<span class="k">\end</span><span class="nb">{</span>frame<span class="nb">}</span>

<span class="c">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>

<span class="k">\subsection</span><span class="nb">{</span>Program Components and Data Formats<span class="nb">}</span>

<span class="k">\begin</span><span class="nb">{</span>frame<span class="nb">}{</span><span class="k">\subsecname</span><span class="nb">}</span>
<span class="k">\begin</span><span class="nb">{</span>center<span class="nb">}</span>
<span class="k">\begin</span><span class="nb">{</span>tikzpicture<span class="nb">}</span>[scale=0.6, every node/.style=<span class="nb">{</span>transform shape<span class="nb">}</span>]
	<span class="k">\tikzstyle</span><span class="nb">{</span>process<span class="nb">}</span> = [draw, fill=green!10, rectangle, minimum height=3em, minimum width=10em, node distance=15em]
	<span class="k">\tikzstyle</span><span class="nb">{</span>data<span class="nb">}</span> = [draw, fill=blue!10, ellipse, minimum height=3em, minimum width=7em, node distance=15em]
	<span class="k">\node</span><span class="na">[process]</span> (vlog) <span class="nb">{</span>Verilog Frontend<span class="nb">}</span>;
	<span class="k">\node</span><span class="na">[process, dashed, fill=green!5]</span> (vhdl) [right of=vlog] <span class="nb">{</span>VHDL Frontend<span class="nb">}</span>;
	<span class="k">\node</span><span class="na">[process]</span> (ilang) [right of=vhdl] <span class="nb">{</span>Other Frontends<span class="nb">}</span>;
	<span class="k">\node</span><span class="na">[data]</span> (ast) [below of=vlog, node distance=5em, xshift=7.5em] <span class="nb">{</span>AST<span class="nb">}</span>;
	<span class="k">\node</span><span class="na">[process]</span> (astfe) [below of=ast, node distance=5em] <span class="nb">{</span>AST Frontend<span class="nb">}</span>;
	<span class="k">\node</span><span class="na">[data]</span> (rtlil) [below of=astfe, node distance=5em, xshift=7.5em] <span class="nb">{</span>RTLIL<span class="nb">}</span>;
	<span class="k">\node</span><span class="na">[process]</span> (pass) [right of=rtlil, node distance=5em, xshift=7.5em] <span class="nb">{</span>Passes<span class="nb">}</span>;
	<span class="k">\node</span><span class="na">[process]</span> (vlbe) [below of=rtlil, node distance=7em, xshift=-13em] <span class="nb">{</span>Verilog Backend<span class="nb">}</span>;
	<span class="k">\node</span><span class="na">[process]</span> (ilangbe) [below of=rtlil, node distance=7em, xshift=0em] <span class="nb">{</span>ILANG Backend<span class="nb">}</span>;
	<span class="k">\node</span><span class="na">[process, fill=green!5]</span> (otherbe) [below of=rtlil, node distance=7em, xshift=+13em] <span class="nb">{</span>Other Backends<span class="nb">}</span>;

	<span class="k">\draw</span><span class="na">[-latex]</span> (vlog) -- (ast);
	<span class="k">\draw</span><span class="na">[-latex]</span> (vhdl) -- (ast);
	<span class="k">\draw</span><span class="na">[-latex]</span> (ast) -- (astfe);
	<span class="k">\draw</span><span class="na">[-latex]</span> (astfe) -- (rtlil);
	<span class="k">\draw</span><span class="na">[-latex]</span> (ilang) -- (rtlil);
	<span class="k">\draw</span><span class="na">[latex-latex]</span> (rtlil) -- (pass);
	<span class="k">\draw</span><span class="na">[-latex]</span> (rtlil) -- (vlbe);
	<span class="k">\draw</span><span class="na">[-latex]</span> (rtlil) -- (ilangbe);
	<span class="k">\draw</span><span class="na">[-latex]</span> (rtlil) -- (otherbe);
<span class="k">\end</span><span class="nb">{</span>tikzpicture<span class="nb">}</span>
<span class="k">\end</span><span class="nb">{</span>center<span class="nb">}</span>
<span class="k">\end</span><span class="nb">{</span>frame<span class="nb">}</span>

<span class="c">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>

<span class="k">\subsection</span><span class="nb">{</span>Simplified RTLIL Entity-Relationship Diagram<span class="nb">}</span>

<span class="k">\begin</span><span class="nb">{</span>frame<span class="nb">}{</span><span class="k">\subsecname</span><span class="nb">}</span>
Between passses and frontends/backends the design is stored in Yosys&#39; internal
RTLIL (RTL Intermediate Language) format. For writing Yosys extensions it is
key to understand this format.

<span class="k">\bigskip</span>
<span class="k">\begin</span><span class="nb">{</span>center<span class="nb">}</span>
<span class="k">\begin</span><span class="nb">{</span>tikzpicture<span class="nb">}</span>[scale=0.6, every node/.style=<span class="nb">{</span>transform shape<span class="nb">}</span>]
	<span class="k">\tikzstyle</span><span class="nb">{</span>entity<span class="nb">}</span> = [draw, fill=gray!10, rectangle, minimum height=3em, minimum width=7em, node distance=5em, font=<span class="nb">{</span><span class="k">\ttfamily</span><span class="nb">}</span>]
	<span class="k">\node</span><span class="na">[entity]</span> (design) <span class="nb">{</span>RTLIL::Design<span class="nb">}</span>;
	<span class="k">\node</span><span class="na">[entity]</span> (module) [right of=design, node distance=11em] <span class="nb">{</span>RTLIL::Module<span class="nb">}</span> edge [-latex] node[above] <span class="nb">{</span><span class="k">\tiny</span> 1 <span class="k">\hskip</span>3em N<span class="nb">}</span> (design);

	<span class="k">\node</span><span class="na">[entity]</span> (process) [fill=green!10, right of=module, node distance=10em] <span class="nb">{</span>RTLIL::Process<span class="nb">}</span> (process.west) edge [-latex] (module);
	<span class="k">\node</span><span class="na">[entity]</span> (memory) [fill=red!10, below of=process] <span class="nb">{</span>RTLIL::Memory<span class="nb">}</span> edge [-latex] (module);
	<span class="k">\node</span><span class="na">[entity]</span> (wire) [fill=blue!10, above of=process] <span class="nb">{</span>RTLIL::Wire<span class="nb">}</span> (wire.west) edge [-latex] (module);
	<span class="k">\node</span><span class="na">[entity]</span> (cell) [fill=blue!10, above of=wire] <span class="nb">{</span>RTLIL::Cell<span class="nb">}</span> (cell.west) edge [-latex] (module);

	<span class="k">\node</span><span class="na">[entity]</span> (case) [fill=green!10, right of=process, node distance=10em] <span class="nb">{</span>RTLIL::CaseRule<span class="nb">}</span> edge [latex-latex] (process);
	<span class="k">\node</span><span class="na">[entity]</span> (sync) [fill=green!10, above of=case] <span class="nb">{</span>RTLIL::SyncRule<span class="nb">}</span> edge [-latex] (process);
	<span class="k">\node</span><span class="na">[entity]</span> (switch) [fill=green!10, below of=case] <span class="nb">{</span>RTLIL::SwitchRule<span class="nb">}</span> edge [-latex] (case);
	<span class="k">\draw</span><span class="na">[latex-]</span> (switch.east) -- ++(1em,0) |- (case.east);
<span class="k">\end</span><span class="nb">{</span>tikzpicture<span class="nb">}</span>
<span class="k">\end</span><span class="nb">{</span>center<span class="nb">}</span>
<span class="k">\end</span><span class="nb">{</span>frame<span class="nb">}</span>

<span class="c">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>

<span class="k">\subsection</span><span class="nb">{</span>RTLIL without memories and processes<span class="nb">}</span>

<span class="k">\begin</span><span class="nb">{</span>frame<span class="nb">}</span>[fragile]<span class="nb">{</span><span class="k">\subsecname</span><span class="nb">}</span>
After the commands <span class="nb">{</span><span class="k">\tt</span> proc<span class="nb">}</span> and <span class="nb">{</span><span class="k">\tt</span> memory<span class="nb">}</span> (or <span class="nb">{</span><span class="k">\tt</span> memory -nomap<span class="nb">}</span>), we are
left with a much simpler version of RTLIL:

<span class="k">\begin</span><span class="nb">{</span>center<span class="nb">}</span>
<span class="k">\begin</span><span class="nb">{</span>tikzpicture<span class="nb">}</span>[scale=0.6, every node/.style=<span class="nb">{</span>transform shape<span class="nb">}</span>]
	<span class="k">\tikzstyle</span><span class="nb">{</span>entity<span class="nb">}</span> = [draw, fill=gray!10, rectangle, minimum height=3em, minimum width=7em, node distance=5em, font=<span class="nb">{</span><span class="k">\ttfamily</span><span class="nb">}</span>]
	<span class="k">\node</span><span class="na">[entity]</span> (design) <span class="nb">{</span>RTLIL::Design<span class="nb">}</span>;
	<span class="k">\node</span><span class="na">[entity]</span> (module) [right of=design, node distance=11em] <span class="nb">{</span>RTLIL::Module<span class="nb">}</span> edge [-latex] node[above] <span class="nb">{</span><span class="k">\tiny</span> 1 <span class="k">\hskip</span>3em N<span class="nb">}</span> (design);

	<span class="k">\node</span><span class="na">[entity]</span> (wire) [fill=blue!10, right of=module, node distance=10em] <span class="nb">{</span>RTLIL::Wire<span class="nb">}</span> (wire.west) edge [-latex] (module);
	<span class="k">\node</span><span class="na">[entity]</span> (cell) [fill=blue!10, above of=wire] <span class="nb">{</span>RTLIL::Cell<span class="nb">}</span> (cell.west) edge [-latex] (module);
<span class="k">\end</span><span class="nb">{</span>tikzpicture<span class="nb">}</span>
<span class="k">\end</span><span class="nb">{</span>center<span class="nb">}</span>

<span class="k">\bigskip</span>
Many commands simply choose to only work on this simpler version:
<span class="k">\begin</span><span class="nb">{</span>lstlisting<span class="nb">}</span>[xleftmargin=0.5cm, basicstyle=<span class="k">\ttfamily\fontsize</span><span class="nb">{</span>8pt<span class="nb">}{</span>10pt<span class="nb">}</span><span class="k">\selectfont</span>]
for (RTLIL::Module *module : design-&gt;selected<span class="nb">_</span>modules() <span class="nb">{</span>
    if (module-&gt;has<span class="nb">_</span>memories<span class="nb">_</span>warn() || module-&gt;has<span class="nb">_</span>processes<span class="nb">_</span>warn())
        continue;
    ....
<span class="nb">}</span>
<span class="k">\end</span><span class="nb">{</span>lstlisting<span class="nb">}</span>

For simplicity we only discuss this version of RTLIL in this presentation.
<span class="k">\end</span><span class="nb">{</span>frame<span class="nb">}</span>

<span class="c">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>

<span class="k">\subsection</span><span class="nb">{</span>Using dump and show commands<span class="nb">}</span>

<span class="k">\begin</span><span class="nb">{</span>frame<span class="nb">}{</span><span class="k">\subsecname</span><span class="nb">}</span>
<span class="k">\begin</span><span class="nb">{</span>itemize<span class="nb">}</span>
<span class="k">\item</span> The <span class="nb">{</span><span class="k">\tt</span> dump<span class="nb">}</span> command prints the design (or parts of it) in ILANG format. This is
a text representation of RTLIL.

<span class="k">\bigskip</span>
<span class="k">\item</span> The <span class="nb">{</span><span class="k">\tt</span> show<span class="nb">}</span> command visualizes how the components in the design are connected.
<span class="k">\end</span><span class="nb">{</span>itemize<span class="nb">}</span>

<span class="k">\bigskip</span>
When trying to understand what a command does, create a small test case and
look at the output of <span class="nb">{</span><span class="k">\tt</span> dump<span class="nb">}</span> and <span class="nb">{</span><span class="k">\tt</span> show<span class="nb">}</span> before and after the command
has been executed.
<span class="k">\end</span><span class="nb">{</span>frame<span class="nb">}</span>

<span class="c">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>

<span class="k">\subsection</span><span class="nb">{</span>The RTLIL Data Structures<span class="nb">}</span>

<span class="k">\begin</span><span class="nb">{</span>frame<span class="nb">}{</span><span class="k">\subsecname</span><span class="nb">}</span>
The RTLIL data structures are simple structs utilizing <span class="nb">{</span><span class="k">\tt</span> pool&lt;&gt;<span class="nb">}</span> and
<span class="nb">{</span><span class="k">\tt</span> dict&lt;&gt;<span class="nb">}</span> containers (drop-in replacements for <span class="nb">{</span><span class="k">\tt</span>
std::unordered<span class="k">\_</span>set&lt;&gt;<span class="nb">}</span> and <span class="nb">{</span><span class="k">\tt</span> std::unordered<span class="k">\_</span>map&lt;&gt;<span class="nb">}</span>).

<span class="k">\bigskip</span>
<span class="k">\begin</span><span class="nb">{</span>itemize<span class="nb">}</span>
<span class="k">\item</span> Most operations are performed directly on the RTLIL structs without
setter or getter functions.

<span class="k">\bigskip</span>
<span class="k">\item</span> In debug builds a consistency checker is run over the in-memory design
between commands to make sure that the RTLIL representation is intact.

<span class="k">\bigskip</span>
<span class="k">\item</span> Most RTLIL structs have helper methods that perform the most common operations.
<span class="k">\end</span><span class="nb">{</span>itemize<span class="nb">}</span>

<span class="k">\bigskip</span>
See <span class="nb">{</span><span class="k">\tt</span> yosys/kernel/rtlil.h<span class="nb">}</span> for details.
<span class="k">\end</span><span class="nb">{</span>frame<span class="nb">}</span>

<span class="k">\subsubsection</span><span class="nb">{</span>RTLIL::IdString<span class="nb">}</span>

<span class="k">\begin</span><span class="nb">{</span>frame<span class="nb">}{</span><span class="k">\subsubsecname</span><span class="nb">}{}</span>
<span class="nb">{</span><span class="k">\tt</span> RTLIL::IdString<span class="nb">}</span> in many ways behave like a <span class="nb">{</span><span class="k">\tt</span> std::string<span class="nb">}</span>. It is used
for names of RTLIL objects. Internally a RTLIL::IdString object is only a
single integer.

<span class="k">\medskip</span>
The first character of a <span class="nb">{</span><span class="k">\tt</span> RTLIL::IdString<span class="nb">}</span> specifies if the name is <span class="nb">{</span><span class="k">\it</span> public<span class="k">\/</span><span class="nb">}</span> or <span class="nb">{</span><span class="k">\it</span> private<span class="k">\/</span><span class="nb">}</span>:

<span class="k">\medskip</span>
<span class="k">\begin</span><span class="nb">{</span>itemize<span class="nb">}</span>
<span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> RTLIL::IdString[0] == &#39;<span class="k">\textbackslash\textbackslash</span>&#39;<span class="nb">}</span>: <span class="k">\\</span>
This is a public name. Usually this means it is a name that was declared in a Verilog file.

<span class="k">\bigskip</span>
<span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> RTLIL::IdString[0] == &#39;<span class="k">\$</span>&#39;<span class="nb">}</span>: <span class="k">\\</span>
This is a private name. It was assigned by Yosys.
<span class="k">\end</span><span class="nb">{</span>itemize<span class="nb">}</span>

<span class="k">\bigskip</span>
Use the <span class="nb">{</span><span class="k">\tt</span> NEW<span class="k">\_</span>ID<span class="nb">}</span> macro to create a new unique private name.
<span class="k">\end</span><span class="nb">{</span>frame<span class="nb">}</span>

<span class="k">\subsubsection</span><span class="nb">{</span>RTLIL::Design and RTLIL::Module<span class="nb">}</span>

<span class="k">\begin</span><span class="nb">{</span>frame<span class="nb">}</span>[t, fragile]<span class="nb">{</span><span class="k">\subsubsecname</span><span class="nb">}</span>
The <span class="nb">{</span><span class="k">\tt</span> RTLIL::Design<span class="nb">}</span> and <span class="nb">{</span><span class="k">\tt</span> RTLIL::Module<span class="nb">}</span> structs are the top-level RTLIL
data structures. Yosys always operates on one active design, but can hold many designs in memory.

<span class="k">\bigskip</span>
<span class="k">\begin</span><span class="nb">{</span>lstlisting<span class="nb">}</span>[xleftmargin=1cm, basicstyle=<span class="k">\ttfamily\fontsize</span><span class="nb">{</span>8pt<span class="nb">}{</span>10pt<span class="nb">}</span><span class="k">\selectfont</span>, language=C++]
struct RTLIL::Design <span class="nb">{</span>
    dict&lt;RTLIL::IdString, RTLIL::Module*&gt; modules<span class="nb">_</span>;
    ...
<span class="nb">}</span>;

struct RTLIL::Module <span class="nb">{</span>
    RTLIL::IdString name;
    dict&lt;RTLIL::IdString, RTLIL::Wire*&gt; wires<span class="nb">_</span>;
    dict&lt;RTLIL::IdString, RTLIL::Cell*&gt; cells<span class="nb">_</span>;
    std::vector&lt;RTLIL::SigSig&gt; connections<span class="nb">_</span>;
    ...
<span class="nb">}</span>;
<span class="k">\end</span><span class="nb">{</span>lstlisting<span class="nb">}</span>

(Use the various accessor functions instead of directly working with the <span class="nb">{</span><span class="k">\tt</span> *<span class="k">\_</span><span class="nb">}</span> members.)
<span class="k">\end</span><span class="nb">{</span>frame<span class="nb">}</span>

<span class="k">\subsubsection</span><span class="nb">{</span>The RTLIL::Wire Structure<span class="nb">}</span>

<span class="k">\begin</span><span class="nb">{</span>frame<span class="nb">}</span>[t, fragile]<span class="nb">{</span><span class="k">\subsubsecname</span><span class="nb">}</span>
Each wire in the design is represented by a <span class="nb">{</span><span class="k">\tt</span> RTLIL::Wire<span class="nb">}</span> struct:

<span class="k">\medskip</span>
<span class="k">\begin</span><span class="nb">{</span>lstlisting<span class="nb">}</span>[xleftmargin=1cm, basicstyle=<span class="k">\ttfamily\fontsize</span><span class="nb">{</span>8pt<span class="nb">}{</span>10pt<span class="nb">}</span><span class="k">\selectfont</span>, language=C++]
struct RTLIL::Wire <span class="nb">{</span>
    RTLIL::IdString name;
    int width, start<span class="nb">_</span>offset, port<span class="nb">_</span>id;
    bool port<span class="nb">_</span>input, port<span class="nb">_</span>output;
    ...
<span class="nb">}</span>;
<span class="k">\end</span><span class="nb">{</span>lstlisting<span class="nb">}</span>

<span class="k">\medskip</span>
<span class="k">\hfil\begin</span><span class="nb">{</span>tabular<span class="nb">}{</span>p<span class="nb">{</span>3cm<span class="nb">}</span>l<span class="nb">}</span>
<span class="nb">{</span><span class="k">\tt</span> width<span class="nb">}</span> <span class="k">\dotfill</span> <span class="nb">&amp;</span> The total number of bits. E.g. 10 for <span class="nb">{</span><span class="k">\tt</span> [9:0]<span class="nb">}</span>. <span class="k">\\</span>
<span class="nb">{</span><span class="k">\tt</span> start<span class="k">\_</span>offset<span class="nb">}</span> <span class="k">\dotfill</span> <span class="nb">&amp;</span> The lowest bit index. E.g. 3 for <span class="nb">{</span><span class="k">\tt</span> [5:3]<span class="nb">}</span>. <span class="k">\\</span>
<span class="nb">{</span><span class="k">\tt</span> port<span class="k">\_</span>id<span class="nb">}</span> <span class="k">\dotfill</span> <span class="nb">&amp;</span> Zero for non-ports. Positive index for ports. <span class="k">\\</span>
<span class="nb">{</span><span class="k">\tt</span> port<span class="k">\_</span>input<span class="nb">}</span> <span class="k">\dotfill</span> <span class="nb">&amp;</span> True for <span class="nb">{</span><span class="k">\tt</span> input<span class="nb">}</span> and <span class="nb">{</span><span class="k">\tt</span> inout<span class="nb">}</span> ports. <span class="k">\\</span>
<span class="nb">{</span><span class="k">\tt</span> port<span class="k">\_</span>output<span class="nb">}</span> <span class="k">\dotfill</span> <span class="nb">&amp;</span> True for <span class="nb">{</span><span class="k">\tt</span> output<span class="nb">}</span> and <span class="nb">{</span><span class="k">\tt</span> inout<span class="nb">}</span> ports. <span class="k">\\</span>
<span class="k">\end</span><span class="nb">{</span>tabular<span class="nb">}</span>
<span class="k">\end</span><span class="nb">{</span>frame<span class="nb">}</span>

<span class="k">\subsubsection</span><span class="nb">{</span>RTLIL::State and RTLIL::Const<span class="nb">}</span>

<span class="k">\begin</span><span class="nb">{</span>frame<span class="nb">}</span>[t, fragile]<span class="nb">{</span><span class="k">\subsubsecname</span><span class="nb">}</span>
The <span class="nb">{</span><span class="k">\tt</span> RTLIL::State<span class="nb">}</span> enum represents a simple 1-bit logic level:

<span class="k">\smallskip</span>
<span class="k">\begin</span><span class="nb">{</span>lstlisting<span class="nb">}</span>[xleftmargin=1cm, basicstyle=<span class="k">\ttfamily\fontsize</span><span class="nb">{</span>8pt<span class="nb">}{</span>10pt<span class="nb">}</span><span class="k">\selectfont</span>, language=C++]
enum RTLIL::State <span class="nb">{</span>
    S0 = 0,
    S1 = 1,
    Sx = 2, // undefined value or conflict
    Sz = 3, // high-impedance / not-connected
    Sa = 4, // don&#39;t care (used only in cases)
    Sm = 5  // marker (used internally by some passes)
<span class="nb">}</span>;
<span class="k">\end</span><span class="nb">{</span>lstlisting<span class="nb">}</span>

<span class="k">\bigskip</span>
The <span class="nb">{</span><span class="k">\tt</span> RTLIL::Const<span class="nb">}</span> struct represents a constant multi-bit value:

<span class="k">\smallskip</span>
<span class="k">\begin</span><span class="nb">{</span>lstlisting<span class="nb">}</span>[xleftmargin=1cm, basicstyle=<span class="k">\ttfamily\fontsize</span><span class="nb">{</span>8pt<span class="nb">}{</span>10pt<span class="nb">}</span><span class="k">\selectfont</span>, language=C++]
struct RTLIL::Const <span class="nb">{</span>
    std::vector&lt;RTLIL::State&gt; bits;
    ...
<span class="nb">}</span>;
<span class="k">\end</span><span class="nb">{</span>lstlisting<span class="nb">}</span>

<span class="k">\bigskip</span>
Notice that Yosys is not using special <span class="nb">{</span><span class="k">\tt</span> VCC<span class="nb">}</span> or <span class="nb">{</span><span class="k">\tt</span> GND<span class="nb">}</span> driver cells to represent constants. Instead
constants are part of the RTLIL representation itself.
<span class="k">\end</span><span class="nb">{</span>frame<span class="nb">}</span>

<span class="k">\subsubsection</span><span class="nb">{</span>The RTLIL::SigSpec Structure<span class="nb">}</span>

<span class="k">\begin</span><span class="nb">{</span>frame<span class="nb">}</span>[t, fragile]<span class="nb">{</span><span class="k">\subsubsecname</span><span class="nb">}</span>
The <span class="nb">{</span><span class="k">\tt</span> RTLIL::SigSpec<span class="nb">}</span> struct represents a signal vector. Each bit can either be a bit from a wire
or a constant value.

<span class="k">\bigskip</span>
<span class="k">\begin</span><span class="nb">{</span>lstlisting<span class="nb">}</span>[xleftmargin=1cm, basicstyle=<span class="k">\ttfamily\fontsize</span><span class="nb">{</span>8pt<span class="nb">}{</span>10pt<span class="nb">}</span><span class="k">\selectfont</span>, language=C++]
struct RTLIL::SigBit
<span class="nb">{</span>
    RTLIL::Wire *wire;
    union <span class="nb">{</span>
        RTLIL::State data; // used if wire == NULL
        int offset;        // used if wire != NULL
    <span class="nb">}</span>;
    ...
<span class="nb">}</span>;

struct RTLIL::SigSpec <span class="nb">{</span>
    std::vector&lt;RTLIL::SigBit&gt; bits<span class="nb">_</span>; // LSB at index 0
    ...
<span class="nb">}</span>;
<span class="k">\end</span><span class="nb">{</span>lstlisting<span class="nb">}</span>

<span class="k">\bigskip</span>
The <span class="nb">{</span><span class="k">\tt</span> RTLIL::SigSpec<span class="nb">}</span> struct has a ton of additional helper methods to compare, analyze, and
manipulate instances of <span class="nb">{</span><span class="k">\tt</span> RTLIL::SigSpec<span class="nb">}</span>.
<span class="k">\end</span><span class="nb">{</span>frame<span class="nb">}</span>

<span class="k">\subsubsection</span><span class="nb">{</span>The RTLIL::Cell Structure<span class="nb">}</span>

<span class="k">\begin</span><span class="nb">{</span>frame<span class="nb">}</span>[t, fragile]<span class="nb">{</span><span class="k">\subsubsecname</span> (1/2)<span class="nb">}</span>
The <span class="nb">{</span><span class="k">\tt</span> RTLIL::Cell<span class="nb">}</span> struct represents an instance of a module or library cell.

<span class="k">\smallskip</span>
The ports of the cell
are associated with <span class="nb">{</span><span class="k">\tt</span> RTLIL::SigSpec<span class="nb">}</span> instances and the parameters are associated with <span class="nb">{</span><span class="k">\tt</span> RTLIL::Const<span class="nb">}</span>
instances:

<span class="k">\bigskip</span>
<span class="k">\begin</span><span class="nb">{</span>lstlisting<span class="nb">}</span>[xleftmargin=1cm, basicstyle=<span class="k">\ttfamily\fontsize</span><span class="nb">{</span>8pt<span class="nb">}{</span>10pt<span class="nb">}</span><span class="k">\selectfont</span>, language=C++]
struct RTLIL::Cell <span class="nb">{</span>
    RTLIL::IdString name, type;
    dict&lt;RTLIL::IdString, RTLIL::SigSpec&gt; connections<span class="nb">_</span>;
    dict&lt;RTLIL::IdString, RTLIL::Const&gt; parameters;
    ...
<span class="nb">}</span>;
<span class="k">\end</span><span class="nb">{</span>lstlisting<span class="nb">}</span>

<span class="k">\bigskip</span>
The <span class="nb">{</span><span class="k">\tt</span> type<span class="nb">}</span> may refer to another module in the same design, a cell name from a cell library, or a
cell name from the internal cell library:

<span class="k">\begin</span><span class="nb">{</span>lstlisting<span class="nb">}</span>[xleftmargin=1cm, basicstyle=<span class="k">\ttfamily\fontsize</span><span class="nb">{</span>6pt<span class="nb">}{</span>7pt<span class="nb">}</span><span class="k">\selectfont</span>]
<span class="s">$</span><span class="nb">not </span><span class="s">$</span>pos <span class="s">$</span><span class="nb">neg </span><span class="s">$</span>and <span class="s">$</span><span class="nb">or </span><span class="s">$</span>xor <span class="s">$</span><span class="nb">xnor </span><span class="s">$</span>reduce<span class="nb">_</span>and <span class="s">$</span><span class="nb">reduce_or </span><span class="s">$</span>reduce<span class="nb">_</span>xor <span class="s">$</span><span class="nb">reduce_xnor</span>
<span class="s">$</span>reduce<span class="nb">_</span>bool <span class="s">$</span><span class="nb">shl </span><span class="s">$</span>shr <span class="s">$</span><span class="nb">sshl </span><span class="s">$</span>sshr <span class="s">$</span><span class="nb">lt </span><span class="s">$</span>le <span class="s">$</span><span class="nb">eq </span><span class="s">$</span>ne <span class="s">$</span><span class="nb">eqx </span><span class="s">$</span>nex <span class="s">$</span><span class="nb">ge </span><span class="s">$</span>gt <span class="s">$</span><span class="nb">add </span><span class="s">$</span>sub <span class="s">$</span><span class="nb">mul </span><span class="s">$</span>div <span class="s">$</span><span class="nb">mod</span>
<span class="s">$</span>pow <span class="s">$</span><span class="nb">logic_not </span><span class="s">$</span>logic<span class="nb">_</span>and <span class="s">$</span><span class="nb">logic_or </span><span class="s">$</span>mux <span class="s">$</span><span class="nb">pmux </span><span class="s">$</span>slice <span class="s">$</span><span class="nb">concat </span><span class="s">$</span>lut <span class="s">$</span><span class="nb">assert </span><span class="s">$</span>sr <span class="s">$</span><span class="nb">dff</span>
<span class="s">$</span>dffsr <span class="s">$</span><span class="nb">adff </span><span class="s">$</span>dlatch <span class="s">$</span><span class="nb">dlatchsr </span><span class="s">$</span>memrd <span class="s">$</span><span class="nb">memwr </span><span class="s">$</span>mem <span class="s">$</span><span class="nb">fsm </span><span class="s">$</span><span class="nb">_</span>NOT<span class="nb">_</span> <span class="s">$</span><span class="nb">_AND_ </span><span class="s">$</span><span class="nb">_</span>OR<span class="nb">_</span> <span class="s">$</span><span class="nb">_XOR_ </span><span class="s">$</span><span class="nb">_</span>MUX<span class="nb">_</span> <span class="s">$</span><span class="nb">_SR_NN_</span>
<span class="s">$</span><span class="nb">_</span>SR<span class="nb">_</span>NP<span class="nb">_</span> <span class="s">$</span><span class="nb">_SR_PN_ </span><span class="s">$</span><span class="nb">_</span>SR<span class="nb">_</span>PP<span class="nb">_</span> <span class="s">$</span><span class="nb">_DFF_N_ </span><span class="s">$</span><span class="nb">_</span>DFF<span class="nb">_</span>P<span class="nb">_</span> <span class="s">$</span><span class="nb">_DFF_NN</span><span class="m">0</span><span class="nb">_ </span><span class="s">$</span><span class="nb">_</span>DFF<span class="nb">_</span>NN1<span class="nb">_</span> <span class="s">$</span><span class="nb">_DFF_NP</span><span class="m">0</span><span class="nb">_ </span><span class="s">$</span><span class="nb">_</span>DFF<span class="nb">_</span>NP1<span class="nb">_</span> <span class="s">$</span><span class="nb">_DFF_PN</span><span class="m">0</span><span class="nb">_</span>
<span class="s">$</span><span class="nb">_</span>DFF<span class="nb">_</span>PN1<span class="nb">_</span> <span class="s">$</span><span class="nb">_DFF_PP</span><span class="m">0</span><span class="nb">_ </span><span class="s">$</span><span class="nb">_</span>DFF<span class="nb">_</span>PP1<span class="nb">_</span> <span class="s">$</span><span class="nb">_DFFSR_NNN_ </span><span class="s">$</span><span class="nb">_</span>DFFSR<span class="nb">_</span>NNP<span class="nb">_</span> <span class="s">$</span><span class="nb">_DFFSR_NPN_ </span><span class="s">$</span><span class="nb">_</span>DFFSR<span class="nb">_</span>NPP<span class="nb">_</span> <span class="s">$</span><span class="nb">_DFFSR_PNN_</span>
<span class="s">$</span><span class="nb">_</span>DFFSR<span class="nb">_</span>PNP<span class="nb">_</span> <span class="s">$</span><span class="nb">_DFFSR_PPN_ </span><span class="s">$</span><span class="nb">_</span>DFFSR<span class="nb">_</span>PPP<span class="nb">_</span> <span class="s">$</span><span class="nb">_DLATCH_N_ </span><span class="s">$</span><span class="nb">_</span>DLATCH<span class="nb">_</span>P<span class="nb">_</span> <span class="s">$</span><span class="nb">_DLATCHSR_NNN_ </span><span class="s">$</span><span class="nb">_</span>DLATCHSR<span class="nb">_</span>NNP<span class="nb">_</span>
<span class="s">$</span><span class="nb">_DLATCHSR_NPN_ </span><span class="s">$</span><span class="nb">_</span>DLATCHSR<span class="nb">_</span>NPP<span class="nb">_</span> <span class="s">$</span><span class="nb">_DLATCHSR_PNN_ </span><span class="s">$</span><span class="nb">_</span>DLATCHSR<span class="nb">_</span>PNP<span class="nb">_</span> <span class="s">$</span><span class="nb">_DLATCHSR_PPN_ </span><span class="s">$</span><span class="nb">_</span>DLATCHSR<span class="nb">_</span>PPP<span class="nb">_</span>
<span class="k">\end</span><span class="nb">{</span>lstlisting<span class="nb">}</span>
<span class="k">\end</span><span class="nb">{</span>frame<span class="nb">}</span>

<span class="k">\begin</span><span class="nb">{</span>frame<span class="nb">}</span>[t, fragile]<span class="nb">{</span><span class="k">\subsubsecname</span> (2/2)<span class="nb">}</span>
Simulation models (i.e. <span class="nb">{</span><span class="k">\it</span> documentation<span class="k">\/</span><span class="nb">}</span> :-) for the internal cell library:

<span class="k">\smallskip</span>
<span class="k">\hskip</span>2em <span class="nb">{</span><span class="k">\tt</span> yosys/techlibs/common/simlib.v<span class="nb">}</span> and <span class="k">\\</span>
<span class="k">\hskip</span>2em <span class="nb">{</span><span class="k">\tt</span> yosys/techlibs/common/simcells.v<span class="nb">}</span>

<span class="k">\bigskip</span>
The lower-case cell types (such as <span class="nb">{</span><span class="k">\tt</span> <span class="k">\$</span>and<span class="nb">}</span>) are parameterized cells of variable
width. This so-called <span class="nb">{</span><span class="k">\it</span> RTL Cells<span class="k">\/</span><span class="nb">}</span> are the cells described in <span class="nb">{</span><span class="k">\tt</span> simlib.v<span class="nb">}</span>.

<span class="k">\bigskip</span>
The upper-case cell types (such as <span class="nb">{</span><span class="k">\tt</span> <span class="k">\$\_</span>AND<span class="k">\_</span><span class="nb">}</span>) are single-bit cells that are not
parameterized. This so-called <span class="nb">{</span><span class="k">\it</span> Internal Logic Gates<span class="nb">}</span> are the cells described
in <span class="nb">{</span><span class="k">\tt</span> simcells.v<span class="nb">}</span>.

<span class="k">\bigskip</span>
The consistency checker also checks the interfaces to the internal cell library.
If you want to use private cell types for your own purposes, use the <span class="nb">{</span><span class="k">\tt</span> <span class="k">\$\_\_</span><span class="nb">}</span>-prefix
to avoid name collisions.
<span class="k">\end</span><span class="nb">{</span>frame<span class="nb">}</span>

<span class="k">\subsubsection</span><span class="nb">{</span>Connecting wires or constant drivers<span class="nb">}</span>

<span class="k">\begin</span><span class="nb">{</span>frame<span class="nb">}</span>[t, fragile]<span class="nb">{</span><span class="k">\subsubsecname</span><span class="nb">}</span>
Additional connections between wires or between wires and constants are modelled using
<span class="nb">{</span><span class="k">\tt</span> RTLIL::Module::connections<span class="nb">}</span>:

<span class="k">\bigskip</span>
<span class="k">\begin</span><span class="nb">{</span>lstlisting<span class="nb">}</span>[xleftmargin=1cm, basicstyle=<span class="k">\ttfamily\fontsize</span><span class="nb">{</span>8pt<span class="nb">}{</span>10pt<span class="nb">}</span><span class="k">\selectfont</span>, language=C++]
typedef std::pair&lt;RTLIL::SigSpec, RTLIL::SigSpec&gt; RTLIL::SigSig;

struct RTLIL::Module <span class="nb">{</span>
    ...
    std::vector&lt;RTLIL::SigSig&gt; connections<span class="nb">_</span>;
    ...
<span class="nb">}</span>;
<span class="k">\end</span><span class="nb">{</span>lstlisting<span class="nb">}</span>

<span class="k">\bigskip</span>
<span class="nb">{</span><span class="k">\tt</span> RTLIL::SigSig::first<span class="nb">}</span> is the driven signal and <span class="nb">{</span><span class="k">\tt</span> RTLIL::SigSig::second<span class="nb">}</span> is the driving signal.
Example usage (setting wire <span class="nb">{</span><span class="k">\tt</span> foo<span class="nb">}</span> to value <span class="nb">{</span><span class="k">\tt</span> 42<span class="nb">}</span>):
<span class="k">\begin</span><span class="nb">{</span>lstlisting<span class="nb">}</span>[xleftmargin=1cm, basicstyle=<span class="k">\ttfamily\fontsize</span><span class="nb">{</span>8pt<span class="nb">}{</span>10pt<span class="nb">}</span><span class="k">\selectfont</span>, language=C++]
module-&gt;connect(module-&gt;wire(&quot;<span class="k">\\</span>foo&quot;),
                RTLIL::SigSpec(42, module-&gt;wire(&quot;<span class="k">\\</span>foo&quot;)-&gt;width));
<span class="k">\end</span><span class="nb">{</span>lstlisting<span class="nb">}</span>
<span class="k">\end</span><span class="nb">{</span>frame<span class="nb">}</span>

<span class="c">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>

<span class="k">\subsection</span><span class="nb">{</span>Creating modules from scratch<span class="nb">}</span>

<span class="k">\begin</span><span class="nb">{</span>frame<span class="nb">}</span>[t, fragile]<span class="nb">{</span><span class="k">\subsecname</span><span class="nb">}</span>
Let&#39;s create the following module using the RTLIL API:

<span class="k">\smallskip</span>
<span class="k">\begin</span><span class="nb">{</span>lstlisting<span class="nb">}</span>[xleftmargin=1cm, basicstyle=<span class="k">\ttfamily\fontsize</span><span class="nb">{</span>8pt<span class="nb">}{</span>10pt<span class="nb">}</span><span class="k">\selectfont</span>, language=Verilog]
module absval(input signed [3:0] a, output [3:0] y);
    assign y = a[3] ? -a : a;
endmodule
<span class="k">\end</span><span class="nb">{</span>lstlisting<span class="nb">}</span>

<span class="k">\smallskip</span>
<span class="k">\begin</span><span class="nb">{</span>lstlisting<span class="nb">}</span>[xleftmargin=1cm, basicstyle=<span class="k">\ttfamily\fontsize</span><span class="nb">{</span>8pt<span class="nb">}{</span>10pt<span class="nb">}</span><span class="k">\selectfont</span>, language=C++]
RTLIL::Module *module = new RTLIL::Module;
module-&gt;name = &quot;<span class="k">\\</span>absval&quot;;

RTLIL::Wire *a = module-&gt;addWire(&quot;<span class="k">\\</span>a&quot;, 4);
a-&gt;port<span class="nb">_</span>input = true;
a-&gt;port<span class="nb">_</span>id = 1;

RTLIL::Wire *y = module-&gt;addWire(&quot;<span class="k">\\</span>y&quot;, 4);
y-&gt;port<span class="nb">_</span>output = true;
y-&gt;port<span class="nb">_</span>id = 2;

RTLIL::Wire *a<span class="nb">_</span>inv = module-&gt;addWire(NEW<span class="nb">_</span>ID, 4);
module-&gt;addNeg(NEW<span class="nb">_</span>ID, a, a<span class="nb">_</span>inv, true);
module-&gt;addMux(NEW<span class="nb">_</span>ID, a, a<span class="nb">_</span>inv, RTLIL::SigSpec(a, 1, 3), y);

module-&gt;fixup<span class="nb">_</span>ports();
<span class="k">\end</span><span class="nb">{</span>lstlisting<span class="nb">}</span>
<span class="k">\end</span><span class="nb">{</span>frame<span class="nb">}</span>

<span class="c">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>

<span class="k">\subsection</span><span class="nb">{</span>Modifying modules<span class="nb">}</span>

<span class="k">\begin</span><span class="nb">{</span>frame<span class="nb">}{</span><span class="k">\subsecname</span><span class="nb">}</span>
Most commands modify existing modules, not create new ones.

When modifying existing modules, stick to the following DOs and DON&#39;Ts:

<span class="k">\begin</span><span class="nb">{</span>itemize<span class="nb">}</span>
<span class="k">\item</span> Do not remove wires. Simply disconnect them and let a successive <span class="nb">{</span><span class="k">\tt</span> clean<span class="nb">}</span> command worry about removing it.

<span class="k">\item</span> Use <span class="nb">{</span><span class="k">\tt</span> module-&gt;fixup<span class="k">\_</span>ports()<span class="nb">}</span> after changing the <span class="nb">{</span><span class="k">\tt</span> port<span class="k">\_*</span><span class="nb">}</span> properties of wires.

<span class="k">\item</span> You can safely remove cells or change the <span class="nb">{</span><span class="k">\tt</span> connections<span class="nb">}</span> property of a cell, but be careful when
changing the size of the <span class="nb">{</span><span class="k">\tt</span> SigSpec<span class="nb">}</span> connected to a cell port.

<span class="k">\item</span> Use the <span class="nb">{</span><span class="k">\tt</span> SigMap<span class="nb">}</span> helper class (see next slide) when you need a unique handle for each signal bit.
<span class="k">\end</span><span class="nb">{</span>itemize<span class="nb">}</span>
<span class="k">\end</span><span class="nb">{</span>frame<span class="nb">}</span>

<span class="c">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>

<span class="k">\subsection</span><span class="nb">{</span>Using the SigMap helper class<span class="nb">}</span>

<span class="k">\begin</span><span class="nb">{</span>frame<span class="nb">}</span>[t, fragile]<span class="nb">{</span><span class="k">\subsecname</span><span class="nb">}</span>
Consider the following module:

<span class="k">\smallskip</span>
<span class="k">\begin</span><span class="nb">{</span>lstlisting<span class="nb">}</span>[xleftmargin=1cm, basicstyle=<span class="k">\ttfamily\fontsize</span><span class="nb">{</span>8pt<span class="nb">}{</span>10pt<span class="nb">}</span><span class="k">\selectfont</span>, language=Verilog]
module test(input a, output x, y);
    assign x = a, y = a;
endmodule
<span class="k">\end</span><span class="nb">{</span>lstlisting<span class="nb">}</span>

In this case <span class="nb">{</span><span class="k">\tt</span> a<span class="nb">}</span>, <span class="nb">{</span><span class="k">\tt</span> x<span class="nb">}</span>, and <span class="nb">{</span><span class="k">\tt</span> y<span class="nb">}</span> are all different names for the same signal. However:

<span class="k">\smallskip</span>
<span class="k">\begin</span><span class="nb">{</span>lstlisting<span class="nb">}</span>[xleftmargin=1cm, basicstyle=<span class="k">\ttfamily\fontsize</span><span class="nb">{</span>8pt<span class="nb">}{</span>10pt<span class="nb">}</span><span class="k">\selectfont</span>, language=C++]
RTLIL::SigSpec a(module-&gt;wire(&quot;<span class="k">\\</span>a&quot;)), x(module-&gt;wire(&quot;<span class="k">\\</span>x&quot;)),
                                       y(module-&gt;wire(&quot;<span class="k">\\</span>y&quot;));
log(&quot;<span class="c">%d %d %d\n&quot;, a == x, x == y, y == a); // will print &quot;0 0 0&quot;</span>
<span class="k">\end</span><span class="nb">{</span>lstlisting<span class="nb">}</span>

The <span class="nb">{</span><span class="k">\tt</span> SigMap<span class="nb">}</span> helper class can be used to map all such aliasing signals to a
unique signal from the group (usually the wire that is directly driven by a cell or port).

<span class="k">\smallskip</span>
<span class="k">\begin</span><span class="nb">{</span>lstlisting<span class="nb">}</span>[xleftmargin=1cm, basicstyle=<span class="k">\ttfamily\fontsize</span><span class="nb">{</span>8pt<span class="nb">}{</span>10pt<span class="nb">}</span><span class="k">\selectfont</span>, language=C++]
SigMap sigmap(module);
log(&quot;<span class="c">%d %d %d\n&quot;, sigmap(a) == sigmap(x), sigmap(x) == sigmap(y),</span>
                  sigmap(y) == sigmap(a)); // will print &quot;1 1 1&quot;
<span class="k">\end</span><span class="nb">{</span>lstlisting<span class="nb">}</span>
<span class="k">\end</span><span class="nb">{</span>frame<span class="nb">}</span>

<span class="c">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>

<span class="k">\subsection</span><span class="nb">{</span>Printing log messages<span class="nb">}</span>

<span class="k">\begin</span><span class="nb">{</span>frame<span class="nb">}</span>[t, fragile]<span class="nb">{</span><span class="k">\subsecname</span><span class="nb">}</span>
The <span class="nb">{</span><span class="k">\tt</span> log()<span class="nb">}</span> function is a <span class="nb">{</span><span class="k">\tt</span> printf()<span class="nb">}</span>-like function that can be used to create log messages.

<span class="k">\medskip</span>
Use <span class="nb">{</span><span class="k">\tt</span> log<span class="k">\_</span>signal()<span class="nb">}</span> to create a C-string for a SigSpec object<span class="k">\footnote</span><span class="na">[frame]</span><span class="nb">{</span>The pointer returned
by <span class="nb">{</span><span class="k">\tt</span> log<span class="k">\_</span>signal()<span class="nb">}</span> is automatically freed by the log framework at a later time.<span class="nb">}</span>:
<span class="k">\begin</span><span class="nb">{</span>lstlisting<span class="nb">}</span>[xleftmargin=1cm, basicstyle=<span class="k">\ttfamily\fontsize</span><span class="nb">{</span>8pt<span class="nb">}{</span>10pt<span class="nb">}</span><span class="k">\selectfont</span>, language=C++]
log(&quot;Mapped signal x: <span class="c">%s\n&quot;, log_signal(sigmap(x)));</span>
<span class="k">\end</span><span class="nb">{</span>lstlisting<span class="nb">}</span>

<span class="k">\medskip</span>
Use <span class="nb">{</span><span class="k">\tt</span> log<span class="k">\_</span>id()<span class="nb">}</span> to create a C-string for an <span class="nb">{</span><span class="k">\tt</span> RTLIL::IdString<span class="nb">}</span>:
<span class="k">\begin</span><span class="nb">{</span>lstlisting<span class="nb">}</span>[xleftmargin=1cm, basicstyle=<span class="k">\ttfamily\fontsize</span><span class="nb">{</span>8pt<span class="nb">}{</span>10pt<span class="nb">}</span><span class="k">\selectfont</span>, language=C++]
log(&quot;Name of this module: <span class="c">%s\n&quot;, log_id(module-&gt;name));</span>
<span class="k">\end</span><span class="nb">{</span>lstlisting<span class="nb">}</span>

<span class="k">\medskip</span>
Use <span class="nb">{</span><span class="k">\tt</span> log<span class="k">\_</span>header()<span class="nb">}</span> and <span class="nb">{</span><span class="k">\tt</span> log<span class="k">\_</span>push()<span class="nb">}</span>/<span class="nb">{</span><span class="k">\tt</span> log<span class="k">\_</span>pop()<span class="nb">}</span> to structure log messages:
<span class="k">\begin</span><span class="nb">{</span>lstlisting<span class="nb">}</span>[xleftmargin=1cm, basicstyle=<span class="k">\ttfamily\fontsize</span><span class="nb">{</span>8pt<span class="nb">}{</span>10pt<span class="nb">}</span><span class="k">\selectfont</span>, language=C++]
log<span class="nb">_</span>header(design, &quot;Doing important stuff!<span class="k">\n</span>&quot;);
log<span class="nb">_</span>push();
for (int i = 0; i &lt; 10; i++)
    log(&quot;Log message #<span class="c">%d.\n&quot;, i);</span>
log<span class="nb">_</span>pop();
<span class="k">\end</span><span class="nb">{</span>lstlisting<span class="nb">}</span>
<span class="k">\end</span><span class="nb">{</span>frame<span class="nb">}</span>

<span class="c">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>

<span class="k">\subsection</span><span class="nb">{</span>Error handling<span class="nb">}</span>

<span class="k">\begin</span><span class="nb">{</span>frame<span class="nb">}</span>[t, fragile]<span class="nb">{</span><span class="k">\subsecname</span><span class="nb">}</span>
Use <span class="nb">{</span><span class="k">\tt</span> log<span class="k">\_</span>error()<span class="nb">}</span> to report a non-recoverable error:

<span class="k">\medskip</span>
<span class="k">\begin</span><span class="nb">{</span>lstlisting<span class="nb">}</span>[xleftmargin=1cm, basicstyle=<span class="k">\ttfamily\fontsize</span><span class="nb">{</span>8pt<span class="nb">}{</span>10pt<span class="nb">}</span><span class="k">\selectfont</span>, language=C++]
if (design-&gt;modules.count(module-&gt;name) != 0)
    log<span class="nb">_</span>error(&quot;A module with the name <span class="c">%s already exists!\n&quot;,</span>
            RTLIL::id2cstr(module-&gt;name));
<span class="k">\end</span><span class="nb">{</span>lstlisting<span class="nb">}</span>

<span class="k">\bigskip</span>
Use <span class="nb">{</span><span class="k">\tt</span> log<span class="k">\_</span>cmd<span class="k">\_</span>error()<span class="nb">}</span> to report a recoverable error:
<span class="k">\begin</span><span class="nb">{</span>lstlisting<span class="nb">}</span>[xleftmargin=1cm, basicstyle=<span class="k">\ttfamily\fontsize</span><span class="nb">{</span>8pt<span class="nb">}{</span>10pt<span class="nb">}</span><span class="k">\selectfont</span>, language=C++]
if (design-&gt;selection<span class="nb">_</span>stack.back().empty())
    log<span class="nb">_</span>cmd<span class="nb">_</span>error(&quot;This command can&#39;t operator on an empty selection!<span class="k">\n</span>&quot;);
<span class="k">\end</span><span class="nb">{</span>lstlisting<span class="nb">}</span>

<span class="k">\bigskip</span>
Use <span class="nb">{</span><span class="k">\tt</span> log<span class="k">\_</span>assert()<span class="nb">}</span> and <span class="nb">{</span><span class="k">\tt</span> log<span class="k">\_</span>abort()<span class="nb">}</span> instead of <span class="nb">{</span><span class="k">\tt</span> assert()<span class="nb">}</span> and <span class="nb">{</span><span class="k">\tt</span> abort()<span class="nb">}</span>.
<span class="k">\end</span><span class="nb">{</span>frame<span class="nb">}</span>

<span class="c">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>

<span class="k">\subsection</span><span class="nb">{</span>Creating a command<span class="nb">}</span>

<span class="k">\begin</span><span class="nb">{</span>frame<span class="nb">}</span>[t, fragile]<span class="nb">{</span><span class="k">\subsecname</span><span class="nb">}</span>
Simply create a global instance of a class derived from <span class="nb">{</span><span class="k">\tt</span> Pass<span class="nb">}</span> to create
a new yosys command:

<span class="k">\bigskip</span>
<span class="k">\begin</span><span class="nb">{</span>lstlisting<span class="nb">}</span>[xleftmargin=1cm, basicstyle=<span class="k">\ttfamily\fontsize</span><span class="nb">{</span>8pt<span class="nb">}{</span>10pt<span class="nb">}</span><span class="k">\selectfont</span>, language=C++]
#include &quot;kernel/yosys.h&quot;
USING<span class="nb">_</span>YOSYS<span class="nb">_</span>NAMESPACE

struct MyPass : public Pass <span class="nb">{</span>
    MyPass() : Pass(&quot;my<span class="nb">_</span>cmd&quot;, &quot;just a simple test&quot;) <span class="nb">{</span> <span class="nb">}</span>
    virtual void execute(std::vector&lt;std::string&gt; args, RTLIL::Design *design)
    <span class="nb">{</span>
        log(&quot;Arguments to my<span class="nb">_</span>cmd:<span class="k">\n</span>&quot;);
        for (auto <span class="nb">&amp;</span>arg : args)
            log(&quot;  <span class="c">%s\n&quot;, arg.c_str());</span>

        log(&quot;Modules in current design:<span class="k">\n</span>&quot;);
        for (auto mod : design-&gt;modules())
            log(&quot;  <span class="c">%s (%d wires, %d cells)\n&quot;, log_id(mod),</span>
                    GetSize(mod-&gt;wires()), GetSize(mod-&gt;cells()));
    <span class="nb">}</span>
<span class="nb">}</span> MyPass;
<span class="k">\end</span><span class="nb">{</span>lstlisting<span class="nb">}</span>
<span class="k">\end</span><span class="nb">{</span>frame<span class="nb">}</span>

<span class="c">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>

<span class="k">\subsection</span><span class="nb">{</span>Creating a plugin<span class="nb">}</span>

<span class="k">\begin</span><span class="nb">{</span>frame<span class="nb">}</span>[fragile]<span class="nb">{</span><span class="k">\subsecname</span><span class="nb">}</span>
Yosys can be extended by adding additional C++ code to the Yosys code base, or
by loading plugins into Yosys.

<span class="k">\bigskip</span>
Use the following command to compile a Yosys plugin:
<span class="k">\begin</span><span class="nb">{</span>lstlisting<span class="nb">}</span>[xleftmargin=1cm, basicstyle=<span class="k">\ttfamily\fontsize</span><span class="nb">{</span>8pt<span class="nb">}{</span>10pt<span class="nb">}</span><span class="k">\selectfont</span>]
yosys-config --exec --cxx --cxxflags --ldflags <span class="k">\</span>
             -o my<span class="nb">_</span>cmd.so -shared my<span class="nb">_</span>cmd.cc --ldlibs
<span class="k">\end</span><span class="nb">{</span>lstlisting<span class="nb">}</span>

<span class="k">\bigskip</span>
Or shorter:
<span class="k">\begin</span><span class="nb">{</span>lstlisting<span class="nb">}</span>[xleftmargin=1cm, basicstyle=<span class="k">\ttfamily\fontsize</span><span class="nb">{</span>8pt<span class="nb">}{</span>10pt<span class="nb">}</span><span class="k">\selectfont</span>]
yosys-config --build my<span class="nb">_</span>cmd.so my<span class="nb">_</span>cmd.cc
<span class="k">\end</span><span class="nb">{</span>lstlisting<span class="nb">}</span>

<span class="k">\bigskip</span>
Load the plugin using the yosys <span class="nb">{</span><span class="k">\tt</span> -m<span class="nb">}</span> option:
<span class="k">\begin</span><span class="nb">{</span>lstlisting<span class="nb">}</span>[xleftmargin=1cm, basicstyle=<span class="k">\ttfamily\fontsize</span><span class="nb">{</span>8pt<span class="nb">}{</span>10pt<span class="nb">}</span><span class="k">\selectfont</span>]
yosys -m ./my<span class="nb">_</span>cmd.so -p &#39;my<span class="nb">_</span>cmd foo bar&#39;
<span class="k">\end</span><span class="nb">{</span>lstlisting<span class="nb">}</span>
<span class="k">\end</span><span class="nb">{</span>frame<span class="nb">}</span>

<span class="c">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>

<span class="k">\subsection</span><span class="nb">{</span>Summary<span class="nb">}</span>

<span class="k">\begin</span><span class="nb">{</span>frame<span class="nb">}{</span><span class="k">\subsecname</span><span class="nb">}</span>
<span class="k">\begin</span><span class="nb">{</span>itemize<span class="nb">}</span>
<span class="k">\item</span> Writing Yosys extensions is very straight-forward.
<span class="k">\item</span> <span class="k">\dots</span> and even simpler if you don&#39;t need RTLIL::Memory or RTLIL::Process objects.

<span class="k">\bigskip</span>
<span class="k">\item</span> Writing synthesis software? Consider learning the Yosys API and make your work
part of the Yosys framework.
<span class="k">\end</span><span class="nb">{</span>itemize<span class="nb">}</span>

<span class="k">\bigskip</span>
<span class="k">\bigskip</span>
<span class="k">\begin</span><span class="nb">{</span>center<span class="nb">}</span>
Questions?
<span class="k">\end</span><span class="nb">{</span>center<span class="nb">}</span>

<span class="k">\bigskip</span>
<span class="k">\bigskip</span>
<span class="k">\begin</span><span class="nb">{</span>center<span class="nb">}</span>
<span class="k">\url</span><span class="nb">{</span>http://www.clifford.at/yosys/<span class="nb">}</span>
<span class="k">\end</span><span class="nb">{</span>center<span class="nb">}</span>
<span class="k">\end</span><span class="nb">{</span>frame<span class="nb">}</span>
</pre></div>
</code></pre></td></tr></table>
</div> <!-- class=content -->
<div class='footer'>generated by <a href='https://git.zx2c4.com/cgit/about/'>cgit v1.2.3</a> (<a href='https://git-scm.com/'>git 2.25.1</a>) at 2025-07-02 23:19:31 +0000</div>
</div> <!-- id=cgit -->
</body>
</html>
