<!DOCTYPE html>
<html lang='en'>
<head>
<title>iCE40/yosys - [no description]</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/iCE40/yosys/atom/backends?h=master' type='application/atom+xml'/>
<link rel='vcs-git' href='git://git.panaceas.org/iCE40/yosys' title='iCE40/yosys Git repository'/>
<link rel='vcs-git' href='ssh://git@git.panaceas.org/git/iCE40/yosys' title='iCE40/yosys 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='iCE40/yosys' href='/cgit.cgi/iCE40/yosys/'>iCE40/yosys</a></td><td class='form'><form method='get'>
<input type='hidden' name='id' value='ee5067e8646b388aefc6cf95c13403c42cb96fa4'/><select name='h' onchange='this.form.submit();'>
<option value='master' selected='selected'>master</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>[no description]</td><td class='sub right'></td></tr></table>
<table class='tabs'><tr><td>
<a href='/cgit.cgi/iCE40/yosys/about/'>about</a><a href='/cgit.cgi/iCE40/yosys/'>summary</a><a href='/cgit.cgi/iCE40/yosys/refs/?id=ee5067e8646b388aefc6cf95c13403c42cb96fa4'>refs</a><a href='/cgit.cgi/iCE40/yosys/log/backends'>log</a><a href='/cgit.cgi/iCE40/yosys/tree/backends?id=ee5067e8646b388aefc6cf95c13403c42cb96fa4'>tree</a><a href='/cgit.cgi/iCE40/yosys/commit/backends?id=ee5067e8646b388aefc6cf95c13403c42cb96fa4'>commit</a><a class='active' href='/cgit.cgi/iCE40/yosys/diff/backends?id=ee5067e8646b388aefc6cf95c13403c42cb96fa4'>diff</a><a href='/cgit.cgi/iCE40/yosys/stats/backends'>stats</a></td><td class='form'><form class='right' method='get' action='/cgit.cgi/iCE40/yosys/log/backends'>
<input type='hidden' name='id' value='ee5067e8646b388aefc6cf95c13403c42cb96fa4'/><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/iCE40/yosys/diff/?id=ee5067e8646b388aefc6cf95c13403c42cb96fa4'>root</a>/<a href='/cgit.cgi/iCE40/yosys/diff/backends?id=ee5067e8646b388aefc6cf95c13403c42cb96fa4'>backends</a></div><div class='content'><div class='cgit-panel'><b>diff options</b><form method='get'><input type='hidden' name='id' value='ee5067e8646b388aefc6cf95c13403c42cb96fa4'/><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><div class='diffstat-header'><a href='/cgit.cgi/iCE40/yosys/diff/?id=ee5067e8646b388aefc6cf95c13403c42cb96fa4'>Diffstat</a> (limited to 'backends')</div><table summary='diffstat' class='diffstat'><tr><td class='mode'>-rw-r--r--</td><td class='upd'><a href='/cgit.cgi/iCE40/yosys/diff/backends/edif/edif.cc?id=ee5067e8646b388aefc6cf95c13403c42cb96fa4'>backends/edif/edif.cc</a></td><td class='right'>58</td><td class='graph'><table summary='file diffstat' width='58%'><tr><td class='add' style='width: 75.9%;'/><td class='rem' style='width: 24.1%;'/><td class='none' style='width: 0.0%;'/></tr></table></td></tr>
</table><div class='diffstat-summary'>1 files changed, 44 insertions, 14 deletions</div><table summary='diff' class='diff'><tr><td><div class='head'>diff --git a/backends/edif/edif.cc b/backends/edif/edif.cc<br/>index cc20f17fc..d07e0fa12 100644<br/>--- a/<a href='/cgit.cgi/iCE40/yosys/tree/backends/edif/edif.cc?id=ae115fa3aac9acf7534b3f7c08afaa1b86bfc4ad'>backends/edif/edif.cc</a><br/>+++ b/<a href='/cgit.cgi/iCE40/yosys/tree/backends/edif/edif.cc?id=ee5067e8646b388aefc6cf95c13403c42cb96fa4'>backends/edif/edif.cc</a></div><div class='hunk'>@@ -113,6 +113,9 @@ struct EdifBackend : public Backend {</div><div class='ctx'> 		log("    -attrprop\n");</div><div class='ctx'> 		log("        create EDIF properties for cell attributes\n");</div><div class='ctx'> 		log("\n");</div><div class='add'>+		log("    -keep\n");</div><div class='add'>+		log("        create extra KEEP nets by allowing a cell to drive multiple nets.\n");</div><div class='add'>+		log("\n");</div><div class='ctx'> 		log("    -pvector {par|bra|ang}\n");</div><div class='ctx'> 		log("        sets the delimiting character for module port rename clauses to\n");</div><div class='ctx'> 		log("        parentheses, square brackets, or angle brackets.\n");</div><div class='hunk'>@@ -130,7 +133,7 @@ struct EdifBackend : public Backend {</div><div class='ctx'> 		bool port_rename = false;</div><div class='ctx'> 		bool attr_properties = false;</div><div class='ctx'> 		std::map&lt;RTLIL::IdString, std::map&lt;RTLIL::IdString, int&gt;&gt; lib_cell_ports;</div><div class='del'>-		bool nogndvcc = false, gndvccy = false;</div><div class='add'>+		bool nogndvcc = false, gndvccy = false, keepmode = false;</div><div class='ctx'> 		CellTypes ct(design);</div><div class='ctx'> 		EdifNames edif_names;</div><div class='ctx'> </div><div class='hunk'>@@ -153,6 +156,10 @@ struct EdifBackend : public Backend {</div><div class='ctx'> 				attr_properties = true;</div><div class='ctx'> 				continue;</div><div class='ctx'> 			}</div><div class='add'>+			if (args[argidx] == "-keep") {</div><div class='add'>+				keepmode = true;</div><div class='add'>+				continue;</div><div class='add'>+			}</div><div class='ctx'> 			if (args[argidx] == "-pvector" &amp;&amp; argidx+1 &lt; args.size()) {</div><div class='ctx'> 				std::string parray;</div><div class='ctx'> 				port_rename = true;</div><div class='hunk'>@@ -337,6 +344,7 @@ struct EdifBackend : public Backend {</div><div class='ctx'> 			*f &lt;&lt; stringf("      (view VIEW_NETLIST\n");</div><div class='ctx'> 			*f &lt;&lt; stringf("        (viewType NETLIST)\n");</div><div class='ctx'> 			*f &lt;&lt; stringf("        (interface\n");</div><div class='add'>+</div><div class='ctx'> 			for (auto wire : module-&gt;wires()) {</div><div class='ctx'> 				if (wire-&gt;port_id == 0)</div><div class='ctx'> 					continue;</div><div class='hunk'>@@ -369,12 +377,15 @@ struct EdifBackend : public Backend {</div><div class='ctx'> 					}</div><div class='ctx'> 				}</div><div class='ctx'> 			}</div><div class='add'>+</div><div class='ctx'> 			*f &lt;&lt; stringf("        )\n");</div><div class='ctx'> 			*f &lt;&lt; stringf("        (contents\n");</div><div class='add'>+</div><div class='ctx'> 			if (!nogndvcc) {</div><div class='ctx'> 				*f &lt;&lt; stringf("          (instance GND (viewRef VIEW_NETLIST (cellRef GND (libraryRef LIB))))\n");</div><div class='ctx'> 				*f &lt;&lt; stringf("          (instance VCC (viewRef VIEW_NETLIST (cellRef VCC (libraryRef LIB))))\n");</div><div class='ctx'> 			}</div><div class='add'>+</div><div class='ctx'> 			for (auto cell : module-&gt;cells()) {</div><div class='ctx'> 				*f &lt;&lt; stringf("          (instance %s\n", EDIF_DEF(cell-&gt;name));</div><div class='ctx'> 				*f &lt;&lt; stringf("            (viewRef VIEW_NETLIST (cellRef %s%s))", EDIF_REF(cell-&gt;type),</div><div class='hunk'>@@ -412,6 +423,7 @@ struct EdifBackend : public Backend {</div><div class='ctx'> 						}</div><div class='ctx'> 				}</div><div class='ctx'> 			}</div><div class='add'>+</div><div class='ctx'> 			for (auto &amp;it : net_join_db) {</div><div class='ctx'> 				RTLIL::SigBit sig = it.first;</div><div class='ctx'> 				if (sig.wire == NULL &amp;&amp; sig != RTLIL::State::S0 &amp;&amp; sig != RTLIL::State::S1) {</div><div class='hunk'>@@ -440,7 +452,7 @@ struct EdifBackend : public Backend {</div><div class='ctx'> 				}</div><div class='ctx'> 				*f &lt;&lt; stringf("          (net %s (joined\n", EDIF_DEF(netname));</div><div class='ctx'> 				for (auto &amp;ref : it.second)</div><div class='del'>-					*f &lt;&lt; stringf("            %s\n", ref.first.c_str());</div><div class='add'>+					*f &lt;&lt; stringf("              %s\n", ref.first.c_str());</div><div class='ctx'> 				if (sig.wire == NULL) {</div><div class='ctx'> 					if (nogndvcc)</div><div class='ctx'> 						log_error("Design contains constant nodes (map with \"hilomap\" first).\n");</div><div class='hunk'>@@ -455,30 +467,48 @@ struct EdifBackend : public Backend {</div><div class='ctx'> 						add_prop(p.first, p.second);</div><div class='ctx'> 				*f &lt;&lt; stringf("\n          )\n");</div><div class='ctx'> 			}</div><div class='del'>-			for (auto wire : module-&gt;wires()) {</div><div class='add'>+</div><div class='add'>+			for (auto wire : module-&gt;wires())</div><div class='add'>+			{</div><div class='ctx'> 				if (!wire-&gt;get_bool_attribute(ID::keep))</div><div class='ctx'> 					continue;</div><div class='del'>-				for(int i = 0; i &lt; wire-&gt;width; i++) {</div><div class='add'>+</div><div class='add'>+				for(int i = 0; i &lt; wire-&gt;width; i++)</div><div class='add'>+				{</div><div class='ctx'> 					SigBit raw_sig = RTLIL::SigSpec(wire, i);</div><div class='ctx'> 					SigBit mapped_sig = sigmap(raw_sig);</div><div class='add'>+</div><div class='ctx'> <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">\documentclass</span><span class="na">[oneside,a4paper]</span><span class="nb">{</span>book<span class="nb">}</span>

<span class="k">\usepackage</span><span class="na">[T1]</span><span class="nb">{</span>fontenc<span class="nb">}</span>   <span class="c">% required for luximono!</span>
<span class="k">\usepackage</span><span class="nb">{</span>lmodern<span class="nb">}</span>
<span class="k">\usepackage</span><span class="na">[scaled=0.8]</span><span class="nb">{</span>luximono<span class="nb">}</span>  <span class="c">% typewriter font with bold face</span>

<span class="c">% To install the luximono font files:</span>
<span class="c">% getnonfreefonts-sys --all        or</span>
<span class="c">% getnonfreefonts-sys luximono</span>
<span class="c">%</span>
<span class="c">% when there are trouble you might need to:</span>
<span class="c">% - Create /etc/texmf/updmap.d/99local-luximono.cfg</span>
<span class="c">%   containing the single line: Map ul9.map</span>
<span class="c">% - Run update-updmap followed by mktexlsr and updmap-sys</span>
<span class="c">%</span>
<span class="c">% This commands must be executed as root with a root environment</span>
<span class="c">% (i.e. run &quot;sudo su&quot; and then execute the commands in the root</span>
<span class="c">% shell, don&#39;t just prefix the commands with &quot;sudo&quot;).</span>

<span class="c">% formats the text according the set language</span>
<span class="k">\usepackage</span><span class="na">[english]</span><span class="nb">{</span>babel<span class="nb">}</span>
<span class="k">\usepackage</span><span class="na">[table,usenames]</span><span class="nb">{</span>xcolor<span class="nb">}</span>
<span class="c">% generates indices with the &quot;\index&quot; command</span>
<span class="k">\usepackage</span><span class="nb">{</span>makeidx<span class="nb">}</span>
<span class="c">% enables import of graphics. We use pdflatex here so do the pdf optimisation.</span>
<span class="c">%\usepackage[dvips]{graphicx}</span>
<span class="k">\usepackage</span><span class="na">[pdftex]</span><span class="nb">{</span>graphicx<span class="nb">}</span>
<span class="k">\usepackage</span><span class="nb">{</span>pdfpages<span class="nb">}</span>
<span class="c">% includes floating objects like tables and figures.</span>
<span class="k">\usepackage</span><span class="nb">{</span>float<span class="nb">}</span>
<span class="c">% for generating subfigures with ohne indented captions</span>
<span class="k">\usepackage</span><span class="na">[hang]</span><span class="nb">{</span>subfigure<span class="nb">}</span>
<span class="c">% redefines and smartens captions of figures and tables (indentation, smaller and boldface)</span>
<span class="k">\usepackage</span><span class="na">[hang,small,bf,center]</span><span class="nb">{</span>caption<span class="nb">}</span>
<span class="c">% enables tabstops and the numeration of lines</span>
<span class="k">\usepackage</span><span class="nb">{</span>moreverb<span class="nb">}</span>
<span class="c">% enables user defined header and footer lines (former &quot;fancyheadings&quot;)</span>
<span class="k">\usepackage</span><span class="nb">{</span>fancyhdr<span class="nb">}</span>
<span class="c">% Some smart mathematical stuff</span>
<span class="k">\usepackage</span><span class="nb">{</span>amsmath<span class="nb">}</span>
<span class="c">% Package for rotating several objects</span>
<span class="k">\usepackage</span><span class="nb">{</span>rotating<span class="nb">}</span>
<span class="k">\usepackage</span><span class="nb">{</span>natbib<span class="nb">}</span>
<span class="k">\usepackage</span><span class="nb">{</span>epsf<span class="nb">}</span>
<span class="k">\usepackage</span><span class="nb">{</span>dsfont<span class="nb">}</span>
<span class="k">\usepackage</span><span class="na">[algochapter, boxruled, vlined]</span><span class="nb">{</span>algorithm2e<span class="nb">}</span>
<span class="c">%Activating and setting of character protruding - if you like</span>
<span class="c">%\usepackage[activate,DVIoutput]{pdfcprot}</span>
<span class="c">% If you really need special chars...</span>
<span class="k">\usepackage</span><span class="na">[latin1]</span><span class="nb">{</span>inputenc<span class="nb">}</span>
<span class="c">% Hyperlinks</span>
<span class="k">\usepackage</span>[colorlinks,hyperindex,plainpages=false,<span class="c">%</span>
pdftitle=<span class="nb">{</span>Yosys Manual<span class="nb">}</span>,<span class="c">%</span>
pdfauthor=<span class="nb">{</span>Clifford Wolf<span class="nb">}</span>,<span class="c">%</span>
<span class="c">%pdfkeywords={keyword},%</span>
pdfpagelabels,<span class="c">%</span>
pagebackref,<span class="c">%</span>
bookmarksopen=false<span class="c">%</span>
]<span class="nb">{</span>hyperref<span class="nb">}</span>
<span class="c">% For the two different reference lists ...</span>
<span class="k">\usepackage</span><span class="nb">{</span>multibib<span class="nb">}</span>
<span class="k">\usepackage</span><span class="nb">{</span>multirow<span class="nb">}</span>
<span class="k">\usepackage</span><span class="nb">{</span>booktabs<span class="nb">}</span>
<span class="k">\usepackage</span><span class="nb">{</span>pdfpages<span class="nb">}</span>

<span class="k">\usepackage</span><span class="nb">{</span>listings<span class="nb">}</span>
<span class="k">\usepackage</span><span class="nb">{</span>pifont<span class="nb">}</span>
<span class="k">\usepackage</span><span class="nb">{</span>skull<span class="nb">}</span>
<span class="c">% \usepackage{draftwatermark}</span>

<span class="k">\usepackage</span><span class="nb">{</span>tikz<span class="nb">}</span>
<span class="k">\usetikzlibrary</span><span class="nb">{</span>calc<span class="nb">}</span>
<span class="k">\usetikzlibrary</span><span class="nb">{</span>arrows<span class="nb">}</span>
<span class="k">\usetikzlibrary</span><span class="nb">{</span>scopes<span class="nb">}</span>
<span class="k">\usetikzlibrary</span><span class="nb">{</span>through<span class="nb">}</span>
<span class="k">\usetikzlibrary</span><span class="nb">{</span>shapes.geometric<span class="nb">}</span>

<span class="k">\lstset</span><span class="nb">{</span>basicstyle=<span class="k">\ttfamily</span><span class="nb">}</span>

<span class="k">\def\B</span>#1<span class="nb">{{</span><span class="k">\tt\textbackslash</span><span class="nb">{}</span>#1<span class="nb">}}</span>
<span class="k">\def\C</span>#1<span class="nb">{</span><span class="k">\lstinline</span><span class="na">[language=C++]</span><span class="nb">{</span>#1<span class="nb">}}</span>
<span class="k">\def\V</span>#1<span class="nb">{</span><span class="k">\lstinline</span><span class="na">[language=Verilog]</span><span class="nb">{</span>#1<span class="nb">}}</span>

<span class="k">\newsavebox</span><span class="nb">{</span><span class="k">\fixmebox</span><span class="nb">}</span>
<span class="k">\newenvironment</span><span class="nb">{</span>fixme<span class="nb">}</span><span class="c">%</span>
<span class="nb">{</span><span class="k">\newcommand\colboxcolor</span><span class="nb">{</span>FFBBBB<span class="nb">}</span><span class="c">%</span>
<span class="k">\begin</span><span class="nb">{</span>lrbox<span class="nb">}{</span><span class="k">\fixmebox</span><span class="nb">}</span><span class="c">%</span>
<span class="k">\begin</span><span class="nb">{</span>minipage<span class="nb">}{</span><span class="k">\dimexpr\columnwidth</span>-2<span class="k">\fboxsep\relax</span><span class="nb">}}</span>
<span class="nb">{</span><span class="k">\end</span><span class="nb">{</span>minipage<span class="nb">}</span><span class="k">\end</span><span class="nb">{</span>lrbox<span class="nb">}</span><span class="k">\textbf</span><span class="nb">{</span>FIXME: <span class="nb">}</span><span class="k">\\</span><span class="c">%</span>
<span class="k">\colorbox</span><span class="na">[HTML]</span><span class="nb">{</span><span class="k">\colboxcolor</span><span class="nb">}{</span><span class="k">\usebox</span><span class="nb">{</span><span class="k">\fixmebox</span><span class="nb">}}}</span>

<span class="k">\newcites</span><span class="nb">{</span>weblink<span class="nb">}{</span>Internet References<span class="nb">}</span>

<span class="k">\setcounter</span><span class="nb">{</span>secnumdepth<span class="nb">}{</span>3<span class="nb">}</span>
<span class="k">\makeindex</span>

<span class="k">\setlength</span><span class="nb">{</span><span class="k">\oddsidemargin</span><span class="nb">}{</span>4mm<span class="nb">}</span>
<span class="k">\setlength</span><span class="nb">{</span><span class="k">\evensidemargin</span><span class="nb">}{</span>-6mm<span class="nb">}</span>
<span class="k">\setlength</span><span class="nb">{</span><span class="k">\textwidth</span><span class="nb">}{</span>162mm<span class="nb">}</span>
<span class="k">\setlength</span><span class="nb">{</span><span class="k">\textheight</span><span class="nb">}{</span>230mm<span class="nb">}</span>
<span class="k">\setlength</span><span class="nb">{</span><span class="k">\topmargin</span><span class="nb">}{</span>-5mm<span class="nb">}</span>

<span class="k">\setlength</span><span class="nb">{</span><span class="k">\parskip</span><span class="nb">}{</span>1.5ex plus 1ex minus 0.5ex<span class="nb">}</span>
<span class="k">\setlength</span><span class="nb">{</span><span class="k">\parindent</span><span class="nb">}{</span>0pt<span class="nb">}</span>

<span class="k">\lstdefinelanguage</span><span class="nb">{</span>liberty<span class="nb">}{</span>
	morecomment=[s]<span class="nb">{</span>/*<span class="nb">}{</span>*/<span class="nb">}</span>,
	morekeywords=<span class="nb">{</span>library,cell,area,pin,direction,function,clocked<span class="nb">_</span>on,next<span class="nb">_</span>state,clock,ff<span class="nb">}</span>,
	morestring=[b]&quot;,
<span class="nb">}</span>

<span class="k">\lstdefinelanguage</span><span class="nb">{</span>rtlil<span class="nb">}{</span>
	morecomment=[l]<span class="nb">{</span><span class="k">\#</span><span class="nb">}</span>,
	morekeywords=<span class="nb">{</span>module,attribute,parameter,wire,memory,auto,width,offset,size,input,output,inout,cell,connect,switch,case,assign,sync,low,high,posedge,negedge,edge,always,update,process,end<span class="nb">}</span>,
	morestring=[b]&quot;,
<span class="nb">}</span>



<span class="k">\begin</span><span class="nb">{</span>document<span class="nb">}</span>

<span class="k">\fancypagestyle</span><span class="nb">{</span>mypagestyle<span class="nb">}{</span><span class="c">%</span>
<span class="k">\fancyhf</span><span class="nb">{}</span><span class="c">%</span>
<span class="k">\fancyhead</span><span class="na">[C]</span><span class="nb">{</span><span class="k">\leftmark</span><span class="nb">}</span><span class="c">%</span>
<span class="k">\fancyfoot</span><span class="na">[C]</span><span class="nb">{</span><span class="k">\thepage</span><span class="nb">}</span><span class="c">%</span>
<span class="k">\renewcommand</span><span class="nb">{</span><span class="k">\headrulewidth</span><span class="nb">}{</span>0pt<span class="nb">}</span><span class="c">%</span>
<span class="k">\renewcommand</span><span class="nb">{</span><span class="k">\footrulewidth</span><span class="nb">}{</span>0pt<span class="nb">}}</span>
<span class="k">\pagestyle</span><span class="nb">{</span>mypagestyle<span class="nb">}</span>

<span class="k">\thispagestyle</span><span class="nb">{</span>empty<span class="nb">}</span>
<span class="k">\null\vfil</span>

<span class="k">\begin</span><span class="nb">{</span>center<span class="nb">}</span>
<span class="k">\bf\Huge</span> Yosys Manual

<span class="k">\bigskip</span>
<span class="k">\large</span> Clifford Wolf
<span class="k">\end</span><span class="nb">{</span>center<span class="nb">}</span>

<span class="k">\vfil\null</span>
<span class="k">\eject</span>

<span class="k">\chapter*</span><span class="nb">{</span>Abstract<span class="nb">}</span>
Most of today&#39;s digital design is done in HDL code (mostly Verilog or VHDL) and
with the help of HDL synthesis tools.

In special cases such as synthesis for coarse-grain cell libraries or when
testing new synthesis algorithms it might be necessary to write a custom HDL
synthesis tool or add new features to an existing one. It this cases the
availability of a Free and Open Source (FOSS) synthesis tool that can be used
as basis for custom tools would be helpful.

In the absence of such a tool, the Yosys Open SYnthesis Suite (Yosys) was
developed. This document covers the design and implementation of this tool.
At the moment the main focus of Yosys lies on the high-level aspects of
digital synthesis. The pre-existing FOSS logic-synthesis tool ABC is used
by Yosys to perform advanced gate-level optimizations.

An evaluation of Yosys based on real-world designs is included. It is shown
that Yosys can be used as-is to synthesize such designs. The results produced
by Yosys in this tests where successfully verified using formal verification
and are comparable in quality to the results produced by a commercial
synthesis tool.

<span class="k">\bigskip</span>

This document was originally published as bachelor thesis at the Vienna
University of Technology <span class="k">\cite</span><span class="nb">{</span>BACC<span class="nb">}</span>.

<span class="k">\chapter*</span><span class="nb">{</span>Abbreviations<span class="nb">}</span>
<span class="k">\begin</span><span class="nb">{</span>tabular<span class="nb">}{</span>ll<span class="nb">}</span>
AIG         <span class="nb">&amp;</span> And-Inverter-Graph <span class="k">\\</span>
ASIC        <span class="nb">&amp;</span> Application-Specific Integrated Circuit <span class="k">\\</span>
AST         <span class="nb">&amp;</span> Abstract Syntax Tree <span class="k">\\</span>
BDD         <span class="nb">&amp;</span> Binary Decision Diagram <span class="k">\\</span>
BLIF        <span class="nb">&amp;</span> Berkeley Logic Interchange Format <span class="k">\\</span>
EDA         <span class="nb">&amp;</span> Electronic Design Automation <span class="k">\\</span>
EDIF        <span class="nb">&amp;</span> Electronic Design Interchange Format <span class="k">\\</span>
ER Diagram  <span class="nb">&amp;</span> Entity-Relationship Diagram <span class="k">\\</span>
FOSS        <span class="nb">&amp;</span> Free and Open-Source Software <span class="k">\\</span>
FPGA        <span class="nb">&amp;</span> Field-Programmable Gate Array <span class="k">\\</span>
FSM         <span class="nb">&amp;</span> Finite-state machine <span class="k">\\</span>
HDL         <span class="nb">&amp;</span> Hardware Description Language <span class="k">\\</span>
LPM         <span class="nb">&amp;</span> Library of Parameterized Modules <span class="k">\\</span>
RTLIL       <span class="nb">&amp;</span> RTL Intermediate Language <span class="k">\\</span>
RTL         <span class="nb">&amp;</span> Register Transfer Level <span class="k">\\</span>
SAT         <span class="nb">&amp;</span> Satisfiability Problem <span class="k">\\</span>
<span class="c">% SSA       &amp; Static Single Assignment Form \\</span>
VHDL        <span class="nb">&amp;</span> VHSIC Hardware Description Language <span class="k">\\</span>
VHSIC       <span class="nb">&amp;</span> Very-High-Speed Integrated Circuit <span class="k">\\</span>
YOSYS       <span class="nb">&amp;</span> Yosys Open SYnthesis Suite <span class="k">\\</span>
<span class="k">\end</span><span class="nb">{</span>tabular<span class="nb">}</span>

<span class="k">\tableofcontents</span>

<span class="k">\include</span><span class="nb">{</span>CHAPTER<span class="nb">_</span>Intro<span class="nb">}</span>
<span class="k">\include</span><span class="nb">{</span>CHAPTER<span class="nb">_</span>Basics<span class="nb">}</span>
<span class="k">\include</span><span class="nb">{</span>CHAPTER<span class="nb">_</span>Approach<span class="nb">}</span>
<span class="k">\include</span><span class="nb">{</span>CHAPTER<span class="nb">_</span>Overview<span class="nb">}</span>
<span class="k">\include</span><span class="nb">{</span>CHAPTER<span class="nb">_</span>CellLib<span class="nb">}</span>
<span class="k">\include</span><span class="nb">{</span>CHAPTER<span class="nb">_</span>Prog<span class="nb">}</span>

<span class="k">\include</span><span class="nb">{</span>CHAPTER<span class="nb">_</span>Verilog<span class="nb">}</span>
<span class="k">\include</span><span class="nb">{</span>CHAPTER<span class="nb">_</span>Optimize<span class="nb">}</span>
<span class="k">\include</span><span class="nb">{</span>CHAPTER<span class="nb">_</span>Techmap<span class="nb">}</span>
<span class="c">% \include{CHAPTER_Eval}</span>

<span class="k">\appendix</span>

<span class="k">\include</span><span class="nb">{</span>CHAPTER<span class="nb">_</span>Auxlibs<span class="nb">}</span>
<span class="k">\include</span><span class="nb">{</span>CHAPTER<span class="nb">_</span>Auxprogs<span class="nb">}</span>

<span class="k">\chapter</span><span class="nb">{</span>Command Reference Manual<span class="nb">}</span>
<span class="k">\label</span><span class="nb">{</span>commandref<span class="nb">}</span>
<span class="k">\input</span><span class="nb">{</span>command-reference-manual<span class="nb">}</span>

<span class="k">\include</span><span class="nb">{</span>CHAPTER<span class="nb">_</span>Appnotes<span class="nb">}</span>
<span class="c">% \include{CHAPTER_StateOfTheArt}</span>

<span class="k">\bibliography</span><span class="nb">{</span>literature<span class="nb">}</span>
<span class="k">\bibliographystyle</span><span class="nb">{</span>alphadin<span class="nb">}</span>

<span class="k">\bibliographyweblink</span><span class="nb">{</span>weblinks<span class="nb">}</span>
<span class="k">\bibliographystyleweblink</span><span class="nb">{</span>abbrv<span class="nb">}</span>

<span class="k">\end</span><span class="nb">{</span>document<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-06-05 00:59:05 +0000</div>
</div> <!-- id=cgit -->
</body>
</html>
