modified rc adder example

This commit is contained in:
hneemann 2019-02-09 16:09:42 +01:00
parent 13378c8d25
commit c2730d2ba7
4 changed files with 569 additions and 257 deletions

View File

@ -0,0 +1,122 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
viewBox="-80 -80 240 200"
version="1.1"
id="svg34"
sodipodi:docname="FullAdder.svg"
inkscape:version="0.92.1 r15371">
<metadata
id="metadata38">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs36" />
<sodipodi:namedview
showgrid="true"
id="namedview4"
inkscape:zoom="3.9"
inkscape:cx="120"
inkscape:cy="100"
inkscape:window-width="1680"
inkscape:window-height="1002"
inkscape:window-x="0"
inkscape:window-y="24"
inkscape:window-maximized="1"
inkscape:current-layer="svg34">
<inkscape:grid
type="xygrid"
empspacing="4"
spacingx="5"
spacingy="5"
id="grid2" />
</sodipodi:namedview>
<rect
x="0"
y="-20"
width="80"
height="80"
id="rect6"
style="fill:none;fill-opacity:0.78431373;stroke:#000000;stroke-width:4" />
<circle
style="fill:#0000b2"
r="3"
cy="-19.487179"
cx="19.743589"
id="pin:A_i" />
<text
style="font-size:18px;fill:#808080"
id="text10"
y="0.61538529"
x="9.6410255"
font-size="18">A_i</text>
<circle
style="fill:#0000b2"
r="3"
cy="-20.256411"
cx="60.256409"
id="pin:B_i" />
<text
style="font-size:18px;fill:#808080"
id="text15"
y="0.35897496"
x="49.897434"
font-size="18">B_i</text>
<g
id="g22"
transform="translate(0,-20)">
<circle
id="pin:C_{i-1}"
cx="0"
cy="40"
r="3"
style="fill:#0000b2" />
<text
font-size="18"
x="4"
y="46"
id="text20"
style="font-size:18px;fill:#808080">C_{i-1}</text>
</g>
<g
id="g27"
transform="translate(0,20.25641)">
<circle
id="pin:C_i"
cx="80"
cy="0"
r="3"
style="fill:#b20000" />
<text
font-size="18"
x="76"
y="6"
id="text25"
style="font-size:18px;text-anchor:end;fill:#808080">C_i</text>
</g>
<circle
style="fill:#b20000"
r="3"
cy="60.256409"
cx="40"
id="pin:S_i" />
<text
style="font-size:18px;text-anchor:end;fill:#808080"
id="text30"
y="51.641026"
x="50.256409"
font-size="18">S_i</text>
</svg>

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -2,10 +2,134 @@
<circuit>
<version>1</version>
<attributes>
<entry>
<string>shapeType</string>
<shapeType>CUSTOM</shapeType>
</entry>
<entry>
<string>Width</string>
<int>4</int>
</entry>
<entry>
<string>customShape</string>
<shape>
<pins>
<entry>
<string>BO_{i-1}</string>
<pin>
<pos x="0" y="40"/>
<showLabel>false</showLabel>
</pin>
</entry>
<entry>
<string>BO_i</string>
<pin>
<pos x="80" y="40"/>
<showLabel>false</showLabel>
</pin>
</entry>
<entry>
<string>A_i</string>
<pin>
<pos x="20" y="0"/>
<showLabel>false</showLabel>
</pin>
</entry>
<entry>
<string>S_i</string>
<pin>
<pos x="40" y="80"/>
<showLabel>false</showLabel>
</pin>
</entry>
<entry>
<string>B_i</string>
<pin>
<pos x="60" y="0"/>
<showLabel>false</showLabel>
</pin>
</entry>
</pins>
<drawables>
<poly>
<poly path="M 0,0 L 80,0 L 80,80 L 0,80 Z" evenOdd="false"/>
<thickness>4</thickness>
<filled>false</filled>
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
<alpha>255</alpha>
</color>
</poly>
<text>
<p1 x="11" y="20"/>
<p2 x="12" y="20"/>
<text>A_i</text>
<orientation>LEFTBOTTOM</orientation>
<size>18</size>
<color>
<red>128</red>
<green>128</green>
<blue>128</blue>
<alpha>255</alpha>
</color>
</text>
<text>
<p1 x="50" y="20"/>
<p2 x="51" y="20"/>
<text>B_i</text>
<orientation>LEFTBOTTOM</orientation>
<size>18</size>
<color>
<red>128</red>
<green>128</green>
<blue>128</blue>
<alpha>255</alpha>
</color>
</text>
<text>
<p1 x="4" y="54"/>
<p2 x="5" y="54"/>
<text>BO_{i-1}</text>
<orientation>LEFTBOTTOM</orientation>
<size>18</size>
<color>
<red>128</red>
<green>128</green>
<blue>128</blue>
<alpha>255</alpha>
</color>
</text>
<text>
<p1 x="76" y="39"/>
<p2 x="77" y="39"/>
<text>BO_i</text>
<orientation>RIGHTBOTTOM</orientation>
<size>18</size>
<color>
<red>128</red>
<green>128</green>
<blue>128</blue>
<alpha>255</alpha>
</color>
</text>
<text>
<p1 x="54" y="74"/>
<p2 x="55" y="74"/>
<text>S_i</text>
<orientation>RIGHTBOTTOM</orientation>
<size>18</size>
<color>
<red>128</red>
<green>128</green>
<blue>128</blue>
<alpha>255</alpha>
</color>
</text>
</drawables>
</shape>
</entry>
</attributes>
<visualElements>
<visualElement>
@ -13,7 +137,7 @@
<elementAttributes>
<entry>
<string>Label</string>
<string>$A_i$</string>
<string>A_i</string>
</entry>
</elementAttributes>
<pos x="220" y="80"/>
@ -23,7 +147,7 @@
<elementAttributes>
<entry>
<string>Label</string>
<string>$B_i$</string>
<string>B_i</string>
</entry>
</elementAttributes>
<pos x="220" y="140"/>
@ -33,7 +157,7 @@
<elementAttributes>
<entry>
<string>Label</string>
<string>$BO_{i-1}$</string>
<string>BO_{i-1}</string>
</entry>
</elementAttributes>
<pos x="220" y="200"/>
@ -53,7 +177,7 @@
<elementAttributes>
<entry>
<string>Label</string>
<string>$BO_i$</string>
<string>BO_i</string>
</entry>
</elementAttributes>
<pos x="540" y="140"/>
@ -68,7 +192,7 @@
<elementAttributes>
<entry>
<string>Label</string>
<string>$S_i$</string>
<string>S_i</string>
</entry>
</elementAttributes>
<pos x="540" y="80"/>
@ -79,7 +203,7 @@
<entry>
<string>Testdata</string>
<testData>
<dataString>A_i B_i BO_i-1 BO_i S_i
<dataString>A_i B_i BO_{i-1} BO_i S_i
0 0 0 0 0
0 0 1 1 1
0 1 0 1 1

View File

@ -0,0 +1,114 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
viewBox="-80 -80 240 200"
version="1.1"
id="svg4547"
sodipodi:docname="FullSub.svg"
inkscape:version="0.92.1 r15371">
<metadata
id="metadata4551">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs4549" />
<sodipodi:namedview
showgrid="true"
id="namedview4517"
inkscape:zoom="3.9"
inkscape:cx="120"
inkscape:cy="100"
inkscape:window-width="1680"
inkscape:window-height="1002"
inkscape:window-x="0"
inkscape:window-y="24"
inkscape:window-maximized="1"
inkscape:current-layer="svg4547">
<inkscape:grid
type="xygrid"
empspacing="4"
spacingx="5"
spacingy="5"
id="grid4515" />
</sodipodi:namedview>
<rect
x="0"
y="-20"
width="80"
height="80"
id="rect4519"
style="fill:none;fill-opacity:0.78431373;stroke:#000000;stroke-width:4" />
<circle
style="fill:#0000b2"
r="3"
cy="-19.487179"
cx="20.769232"
id="pin:A_i" />
<text
style="font-size:18px;fill:#808080"
id="text4523"
y="0.10256479"
x="10.923078"
font-size="18">A_i</text>
<circle
style="fill:#0000b2"
r="3"
cy="-19.487179"
cx="60"
id="pin:B_i" />
<text
style="font-size:18px;fill:#808080"
id="text4528"
y="0.10256479"
x="49.641026"
font-size="18">B_i</text>
<circle
style="fill:#0000b2"
r="3"
cy="20"
cx="-0.25641027"
id="pin:BO_{i-1}" />
<text
style="font-size:18px;fill:#808080"
id="text4533"
y="34"
x="3.7435896"
font-size="18">BO_{i-1}</text>
<circle
style="fill:#b20000"
r="3"
cy="19.487179"
cx="80"
id="pin:BO_i" />
<text
style="font-size:18px;text-anchor:end;fill:#808080"
id="text4538"
y="19.487179"
x="76"
font-size="18">BO_i</text>
<circle
style="fill:#b20000"
r="3"
cy="60.512821"
cx="39.487179"
id="pin:S_i" />
<text
style="font-size:18px;text-anchor:end;fill:#808080"
id="text4543"
y="54.205124"
x="53.692307"
font-size="18">S_i</text>
</svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -6,162 +6,210 @@
<visualElement>
<elementName>Out</elementName>
<elementAttributes>
<entry>
<string>rotation</string>
<rotation rotation="3"/>
</entry>
<entry>
<string>Label</string>
<string>$S_0$</string>
<string>S_0</string>
</entry>
</elementAttributes>
<pos x="540" y="340"/>
<pos x="420" y="420"/>
</visualElement>
<visualElement>
<elementName>In</elementName>
<elementAttributes>
<entry>
<string>rotation</string>
<rotation rotation="3"/>
</entry>
<entry>
<string>Label</string>
<string>$A_0$</string>
<string>A_0</string>
</entry>
</elementAttributes>
<pos x="300" y="320"/>
<pos x="400" y="300"/>
</visualElement>
<visualElement>
<elementName>In</elementName>
<elementAttributes>
<entry>
<string>rotation</string>
<rotation rotation="3"/>
</entry>
<entry>
<string>Label</string>
<string>$B_0$</string>
<string>B_0</string>
</entry>
</elementAttributes>
<pos x="300" y="360"/>
<pos x="440" y="300"/>
</visualElement>
<visualElement>
<elementName>Out</elementName>
<elementAttributes>
<entry>
<string>rotation</string>
<rotation rotation="3"/>
</entry>
<entry>
<string>Label</string>
<string>S_1</string>
</entry>
</elementAttributes>
<pos x="540" y="420"/>
</visualElement>
<visualElement>
<elementName>In</elementName>
<elementAttributes>
<entry>
<string>rotation</string>
<rotation rotation="3"/>
</entry>
<entry>
<string>Label</string>
<string>A_1</string>
</entry>
</elementAttributes>
<pos x="520" y="300"/>
</visualElement>
<visualElement>
<elementName>In</elementName>
<elementAttributes>
<entry>
<string>rotation</string>
<rotation rotation="3"/>
</entry>
<entry>
<string>Label</string>
<string>B_1</string>
</entry>
</elementAttributes>
<pos x="560" y="300"/>
</visualElement>
<visualElement>
<elementName>Out</elementName>
<elementAttributes>
<entry>
<string>rotation</string>
<rotation rotation="3"/>
</entry>
<entry>
<string>Label</string>
<string>S_2</string>
</entry>
</elementAttributes>
<pos x="660" y="420"/>
</visualElement>
<visualElement>
<elementName>In</elementName>
<elementAttributes>
<entry>
<string>rotation</string>
<rotation rotation="3"/>
</entry>
<entry>
<string>Label</string>
<string>A_2</string>
</entry>
</elementAttributes>
<pos x="640" y="300"/>
</visualElement>
<visualElement>
<elementName>In</elementName>
<elementAttributes>
<entry>
<string>rotation</string>
<rotation rotation="3"/>
</entry>
<entry>
<string>Label</string>
<string>B_2</string>
</entry>
</elementAttributes>
<pos x="680" y="300"/>
</visualElement>
<visualElement>
<elementName>Out</elementName>
<elementAttributes>
<entry>
<string>rotation</string>
<rotation rotation="3"/>
</entry>
<entry>
<string>Label</string>
<string>S_3</string>
</entry>
</elementAttributes>
<pos x="780" y="420"/>
</visualElement>
<visualElement>
<elementName>In</elementName>
<elementAttributes>
<entry>
<string>rotation</string>
<rotation rotation="3"/>
</entry>
<entry>
<string>Label</string>
<string>A_3</string>
</entry>
</elementAttributes>
<pos x="760" y="300"/>
</visualElement>
<visualElement>
<elementName>In</elementName>
<elementAttributes>
<entry>
<string>rotation</string>
<rotation rotation="3"/>
</entry>
<entry>
<string>Label</string>
<string>B_3</string>
</entry>
</elementAttributes>
<pos x="800" y="300"/>
</visualElement>
<visualElement>
<elementName>Out</elementName>
<elementAttributes>
<entry>
<string>Label</string>
<string>$S_1$</string>
<string>C</string>
</entry>
</elementAttributes>
<pos x="540" y="240"/>
<pos x="840" y="360"/>
</visualElement>
<visualElement>
<elementName>In</elementName>
<elementAttributes>
<entry>
<string>Label</string>
<string>$A_1$</string>
<string>C_{-1}</string>
</entry>
</elementAttributes>
<pos x="300" y="220"/>
</visualElement>
<visualElement>
<elementName>In</elementName>
<elementAttributes>
<entry>
<string>Label</string>
<string>$B_1$</string>
</entry>
</elementAttributes>
<pos x="300" y="260"/>
</visualElement>
<visualElement>
<elementName>Out</elementName>
<elementAttributes>
<entry>
<string>Label</string>
<string>$S_2$</string>
</entry>
</elementAttributes>
<pos x="540" y="140"/>
</visualElement>
<visualElement>
<elementName>In</elementName>
<elementAttributes>
<entry>
<string>Label</string>
<string>$A_2$</string>
</entry>
</elementAttributes>
<pos x="300" y="120"/>
</visualElement>
<visualElement>
<elementName>In</elementName>
<elementAttributes>
<entry>
<string>Label</string>
<string>$B_2$</string>
</entry>
</elementAttributes>
<pos x="300" y="160"/>
</visualElement>
<visualElement>
<elementName>Out</elementName>
<elementAttributes>
<entry>
<string>Label</string>
<string>$S_3$</string>
</entry>
</elementAttributes>
<pos x="540" y="40"/>
</visualElement>
<visualElement>
<elementName>In</elementName>
<elementAttributes>
<entry>
<string>Label</string>
<string>$A_3$</string>
</entry>
</elementAttributes>
<pos x="300" y="20"/>
</visualElement>
<visualElement>
<elementName>In</elementName>
<elementAttributes>
<entry>
<string>Label</string>
<string>$B_3$</string>
</entry>
</elementAttributes>
<pos x="300" y="60"/>
</visualElement>
<visualElement>
<elementName>Out</elementName>
<elementAttributes>
<entry>
<string>Label</string>
<string>$C$</string>
</entry>
</elementAttributes>
<pos x="540" y="-20"/>
</visualElement>
<visualElement>
<elementName>In</elementName>
<elementAttributes>
<entry>
<string>Label</string>
<string>$C_{-1}$</string>
</entry>
</elementAttributes>
<pos x="300" y="420"/>
<pos x="360" y="360"/>
</visualElement>
<visualElement>
<elementName>FullSub.dig</elementName>
<elementAttributes/>
<pos x="400" y="320"/>
<pos x="380" y="320"/>
</visualElement>
<visualElement>
<elementName>FullSub.dig</elementName>
<elementAttributes/>
<pos x="400" y="220"/>
<pos x="500" y="320"/>
</visualElement>
<visualElement>
<elementName>FullSub.dig</elementName>
<elementAttributes/>
<pos x="400" y="120"/>
<pos x="620" y="320"/>
</visualElement>
<visualElement>
<elementName>FullSub.dig</elementName>
<elementAttributes/>
<pos x="400" y="20"/>
<pos x="740" y="320"/>
</visualElement>
<visualElement>
<elementName>Testcase</elementName>
@ -170,180 +218,84 @@
<string>Testdata</string>
<testData>
<dataString># complete test of all 512 possible additions
C_-1 A_3 A_2 A_1 A_0 B_3 B_2 B_1 B_0 C S_3 S_2 S_1 S_0
C_{-1} A_3 A_2 A_1 A_0 B_3 B_2 B_1 B_0 C S_3 S_2 S_1 S_0
repeat(256) 0 bits(4,n&gt;&gt;4) bits(4,n) bits(5,(n&gt;&gt;4)-(n&amp;15))
repeat(256) 1 bits(4,n&gt;&gt;4) bits(4,n) bits(5,(n&gt;&gt;4)-(n&amp;15)-1)
</dataString>
</testData>
</entry>
</elementAttributes>
<pos x="520" y="380"/>
<pos x="280" y="440"/>
</visualElement>
</visualElements>
<wires>
<wire>
<p1 x="300" y="320"/>
<p1 x="360" y="360"/>
<p2 x="380" y="360"/>
</wire>
<wire>
<p1 x="820" y="360"/>
<p2 x="840" y="360"/>
</wire>
<wire>
<p1 x="460" y="360"/>
<p2 x="500" y="360"/>
</wire>
<wire>
<p1 x="580" y="360"/>
<p2 x="620" y="360"/>
</wire>
<wire>
<p1 x="700" y="360"/>
<p2 x="740" y="360"/>
</wire>
<wire>
<p1 x="560" y="300"/>
<p2 x="560" y="320"/>
</wire>
<wire>
<p1 x="800" y="300"/>
<p2 x="800" y="320"/>
</wire>
<wire>
<p1 x="640" y="300"/>
<p2 x="640" y="320"/>
</wire>
<wire>
<p1 x="400" y="300"/>
<p2 x="400" y="320"/>
</wire>
<wire>
<p1 x="480" y="320"/>
<p2 x="500" y="320"/>
<p1 x="660" y="400"/>
<p2 x="660" y="420"/>
</wire>
<wire>
<p1 x="300" y="160"/>
<p2 x="340" y="160"/>
<p1 x="420" y="400"/>
<p2 x="420" y="420"/>
</wire>
<wire>
<p1 x="380" y="160"/>
<p2 x="400" y="160"/>
<p1 x="760" y="300"/>
<p2 x="760" y="320"/>
</wire>
<wire>
<p1 x="300" y="260"/>
<p2 x="340" y="260"/>
<p1 x="680" y="300"/>
<p2 x="680" y="320"/>
</wire>
<wire>
<p1 x="380" y="260"/>
<p2 x="400" y="260"/>
<p1 x="520" y="300"/>
<p2 x="520" y="320"/>
</wire>
<wire>
<p1 x="380" y="100"/>
<p2 x="500" y="100"/>
<p1 x="440" y="300"/>
<p2 x="440" y="320"/>
</wire>
<wire>
<p1 x="300" y="420"/>
<p2 x="380" y="420"/>
<p1 x="780" y="400"/>
<p2 x="780" y="420"/>
</wire>
<wire>
<p1 x="300" y="360"/>
<p2 x="340" y="360"/>
</wire>
<wire>
<p1 x="380" y="360"/>
<p2 x="400" y="360"/>
</wire>
<wire>
<p1 x="380" y="200"/>
<p2 x="500" y="200"/>
</wire>
<wire>
<p1 x="480" y="40"/>
<p2 x="540" y="40"/>
</wire>
<wire>
<p1 x="340" y="40"/>
<p2 x="400" y="40"/>
</wire>
<wire>
<p1 x="380" y="300"/>
<p2 x="500" y="300"/>
</wire>
<wire>
<p1 x="480" y="140"/>
<p2 x="540" y="140"/>
</wire>
<wire>
<p1 x="340" y="140"/>
<p2 x="400" y="140"/>
</wire>
<wire>
<p1 x="480" y="240"/>
<p2 x="540" y="240"/>
</wire>
<wire>
<p1 x="340" y="240"/>
<p2 x="400" y="240"/>
</wire>
<wire>
<p1 x="500" y="-20"/>
<p2 x="540" y="-20"/>
</wire>
<wire>
<p1 x="480" y="340"/>
<p2 x="540" y="340"/>
</wire>
<wire>
<p1 x="340" y="340"/>
<p2 x="400" y="340"/>
</wire>
<wire>
<p1 x="300" y="20"/>
<p2 x="400" y="20"/>
</wire>
<wire>
<p1 x="480" y="20"/>
<p2 x="500" y="20"/>
</wire>
<wire>
<p1 x="300" y="120"/>
<p2 x="400" y="120"/>
</wire>
<wire>
<p1 x="480" y="120"/>
<p2 x="500" y="120"/>
</wire>
<wire>
<p1 x="300" y="220"/>
<p2 x="400" y="220"/>
</wire>
<wire>
<p1 x="480" y="220"/>
<p2 x="500" y="220"/>
</wire>
<wire>
<p1 x="300" y="60"/>
<p2 x="340" y="60"/>
</wire>
<wire>
<p1 x="380" y="60"/>
<p2 x="400" y="60"/>
</wire>
<wire>
<p1 x="340" y="340"/>
<p2 x="340" y="360"/>
</wire>
<wire>
<p1 x="340" y="240"/>
<p2 x="340" y="260"/>
</wire>
<wire>
<p1 x="340" y="140"/>
<p2 x="340" y="160"/>
</wire>
<wire>
<p1 x="340" y="40"/>
<p2 x="340" y="60"/>
</wire>
<wire>
<p1 x="500" y="300"/>
<p2 x="500" y="320"/>
</wire>
<wire>
<p1 x="500" y="200"/>
<p2 x="500" y="220"/>
</wire>
<wire>
<p1 x="500" y="100"/>
<p2 x="500" y="120"/>
</wire>
<wire>
<p1 x="500" y="-20"/>
<p2 x="500" y="20"/>
</wire>
<wire>
<p1 x="380" y="260"/>
<p2 x="380" y="300"/>
</wire>
<wire>
<p1 x="380" y="160"/>
<p2 x="380" y="200"/>
</wire>
<wire>
<p1 x="380" y="60"/>
<p2 x="380" y="100"/>
</wire>
<wire>
<p1 x="380" y="360"/>
<p2 x="380" y="420"/>
<p1 x="540" y="400"/>
<p2 x="540" y="420"/>
</wire>
</wires>
</circuit>