xschem/doc/xschem_man/tutorial_busses.html

121 lines
5.1 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<title>XSCHEM TUTORIAL: Bussed nets - Vectors of instances</title>
<link rel="stylesheet" type="text/css" href="xschem_man.css" />
<style type="text/css">
/* Local styling goes here */
p{padding: 15px 30px 10px;}
</style>
</head>
<body>
<!-- start of slide -->
<div class="content">
<!-- navigation buttons -->
<a href="xschem_man.html" class="home">UP</a>
<!-- slide title -->
<h1> TUTORIAL: Use Bus/Vector notation for signal bundles / arrays of instances</h1>
<p>
XSCHEM has the ability to use a compact notation to represent signal bundles.
There is no specific 'bus' entity, in XSCHEM a bus is simply a wire with a label representing a bundle of bits,
the syntax is explained below.
Normally a net label assigns a name to a wire, for example 'ENABLE', 'RESET', 'CLK' and so on, however more complex formats are available to describe
multiple bits.
</p>
<ul>
<li><kbd>AAA,BBB,CCC</kbd>: described a bundle of 3 signals, AAA, BBB, CCC.</li>
<li><kbd>AAA[3:0]</kbd>: describes the set <kbd>AAA[3],AAA[2],AAA[1],AAA[0]</kbd>. The form <kbd>AAA[3:0]</kbd>
and <kbd>AAA[3],AAA[2],AAA[1],AAA[0]</kbd> are exactly equivalent.</li>
<li><kbd>AAA[1:0],BBB[5:4]</kbd>: describes the bundle: <kbd>AAA[1],AAA[0],BBB[5],BBB[4]</kbd>.</li>
<li><kbd>AAA[6:0:2]</kbd>: describes the bundle <kbd>AAA[6],AAA[4],AAA[2],AAA[0]</kbd>.</li>
<li><kbd>AAA[0:1:4:3]</kbd>: describes the bundle <kbd>AAA[0],AAA[1],AAA[4],AAA[5],AAA[8],AAA[9]</kbd>.<br>
The meaning of the 4 parameters are: start:end:offset:repetitions.</li>
<li><kbd>2*AAA[1:0]</kbd>: describes the bundle <kbd>AAA[1],AAA[0],AAA[1],AAA[0]</kbd>.</li>
<li><kbd>AAA[1:0]*2</kbd>: describes the bundle <kbd>AAA[1],AAA[1],AAA[0],AAA[0]</kbd>.</li>
<li><kbd>2*(AAA[1:0],BBB)</kbd>: describes the bundle <kbd>AAA[1],AAA[0],BBB,AAA[1],AAA[0],BBB</kbd>.</li>
<li><kbd>(AAA[1:0],BBB)*2</kbd>: describes the bundle <kbd>AAA[1],AAA[1],AAA[0],AAA[0],BBB,BBB</kbd>.</li>
</ul>
<p>
All the above notations are perfectly valid label net name attributes.<br>
In a very similar way multiple instances can be placed in a schematic setting the 'name' attribute to a vector notation.<br>
For example in picture below <kbd>x22[15:0]</kbd> represents 16 inverters with names <kbd>x22[15],x22[14],...,x22[0]</kbd>.
</p>
<img src="busses0.png">
<br>
<p>
Recently a new notation has been added for buses that expands without putting brackets:
</p>
<ul>
<li><kbd>AAA[3..0]</kbd>: describes the set <kbd>AAA3,AAA2,AAA1,AAA0</kbd>. The form <kbd>AAA[3..0]</kbd>
and <kbd>AAA3,AAA2,AAA1,AAA0</kbd> are exactly equivalent.</li>
<li><kbd>AAA[1..0],BBB[5..4]</kbd>: describes the bundle: <kbd>AAA1,AAA0,BBB5,BBB4</kbd>.</li>
<li><kbd>AAA[6..0..2]</kbd>: describes the bundle <kbd>AAA6,AAA4,AAA2,AAA0</kbd>.</li>
<li><kbd>2*AAA[1..0]</kbd>: describes the bundle <kbd>AAA1,AAA0,AAA1,AAA0</kbd>.</li>
<li><kbd>AAA[1..0]*2</kbd>: describes the bundle <kbd>AAA1,AAA1,AAA0,AAA0</kbd>.</li>
<li><kbd>2*(AAA[1..0],BBB)</kbd>: describes the bundle <kbd>AAA1,AAA0,BBB,AAA1,AAA0,BBB</kbd>.</li>
<li><kbd>(AAA[1..0],BBB)*2</kbd>: describes the bundle <kbd>AAA1,AAA1,AAA0,AAA0,BBB,BBB</kbd>.</li>
</ul>
<p>
In following picture there is a main 72 bit bus (the vertical thick wire) and bus ripper symbols
(<kbd>devices/bus_connect_nolab.sym</kbd>) are used to take slices of bits from the main bus. Wire labels are used to define bus slices.
To display thick wires for busses, select all wire segments, then press 'q' and add attribute <kbd>bus=true</kbd>.
</p>
<img src="busses1.png">
<p>
following picture shows an istantiation of 6 inverters:
</p>
<img src="busses2.png">
<p>
The generated spice netlist is the following:
</p>
<pre class="code">
...
xinv5 BB0 AA5 bf
xinv4 BB1 AA4 bf
xinv3 BB2 AA3 bf
xinv2 BB3 AA2 bf
xinv1 BB4 AA1 bf
xinv0 BB5 AA0 bf
...
</pre><br>
<p>
Example of a more complex bus routing. main bus is a bundle of 2 buses: DATA_A[0..15] and DATA_B[0..15]
</p>
<img src="busses3.png">
<h2> BUS TAPS</h2>
<p>
A new symbol, <kbd>devices/bus_tap.sym</kbd> has been creted to make bus connections more flexible.
This is a 2 pin symbol, one pin must be connected to the bus wire, the other pin only defines the bus slice, indicating
only the range of bits and not the complete bus name: </p>
<img src="busses4.png">
<p>
As you see in the picture a <kbd>lab</kbd> attribute is given that specifies only a bit range, like
<kbd>[13]</kbd> or <kbd>[7:0]</kbd>. The net attached to the 'bus slice' end of the <kbd>bus_tap.sym</kbd>
will get the base name of the bus (<kbd>DATA</kbd> in the example) and the index, that is <kbd>DATA[13]</kbd>
In the example below the menu <kbd>Options-&gt;Show net names on symbol pins / floaters</kbd> has been enbled
to see (the pink texts) the resulting net names.
</p>
<img src="busses5.png">
<p>
A complete example <kbd>examples/test_bus_tap.sch</kbd> shows various possible <kbd>bus_tap.sym</kbd> use cases.
</p>
<img src="busses6.png">
<br>
<br>
<!-- end of slide -->
<div class="filler"></div>
</div>
<!-- frame footer -->
<iframe seamless src="xschem_footer.html" class="footer_iframe" >
</body>
</html>