Logisim/lab14/AdderSubtractor.circ

385 lines
14 KiB
XML

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project source="2.7.1" version="1.0">
This file is intended to be loaded by Logisim (http://www.cburch.com/logisim/).
<lib desc="#Wiring" name="0">
<tool name="Splitter">
<a name="facing" val="north"/>
<a name="fanout" val="8"/>
<a name="incoming" val="8"/>
<a name="appear" val="legacy"/>
</tool>
<tool name="Pin">
<a name="facing" val="south"/>
</tool>
</lib>
<lib desc="#Gates" name="1"/>
<lib desc="#Plexers" name="2"/>
<lib desc="#Arithmetic" name="3"/>
<lib desc="#Memory" name="4">
<tool name="ROM">
<a name="contents">addr/data: 8 8
0
</a>
</tool>
</lib>
<lib desc="#I/O" name="5"/>
<lib desc="#Base" name="6">
<tool name="Text Tool">
<a name="text" val="a"/>
<a name="font" val="SansSerif plain 12"/>
<a name="halign" val="center"/>
<a name="valign" val="base"/>
</tool>
<tool name="Text">
<a name="text" val="a"/>
</tool>
</lib>
<lib desc="file#../Adder.circ" name="7"/>
<main name="TwoBitAdderSubtractor"/>
<options>
<a name="gateUndefined" val="ignore"/>
<a name="simlimit" val="1000"/>
<a name="simrand" val="0"/>
</options>
<mappings>
<tool lib="6" map="Button2" name="Menu Tool"/>
<tool lib="6" map="Button3" name="Menu Tool"/>
<tool lib="6" map="Ctrl Button1" name="Menu Tool"/>
</mappings>
<toolbar>
<tool lib="6" name="Poke Tool"/>
<tool lib="6" name="Edit Tool"/>
<tool lib="6" name="Text Tool">
<a name="text" val="a"/>
<a name="font" val="SansSerif plain 12"/>
<a name="halign" val="center"/>
<a name="valign" val="base"/>
</tool>
<sep/>
<tool lib="0" name="Pin">
<a name="tristate" val="false"/>
</tool>
<tool lib="0" name="Pin">
<a name="facing" val="west"/>
<a name="output" val="true"/>
<a name="labelloc" val="east"/>
</tool>
<tool lib="1" name="NOT Gate"/>
<tool lib="1" name="AND Gate"/>
<tool lib="1" name="OR Gate"/>
</toolbar>
<circuit name="TwoBitAdderSubtractor">
<a name="circuit" val="TwoBitAdderSubtractor"/>
<a name="clabel" val=""/>
<a name="clabelup" val="east"/>
<a name="clabelfont" val="SansSerif plain 12"/>
<wire from="(20,70)" to="(20,200)"/>
<wire from="(210,220)" to="(210,290)"/>
<wire from="(20,200)" to="(270,200)"/>
<wire from="(210,220)" to="(270,220)"/>
<wire from="(20,310)" to="(140,310)"/>
<wire from="(70,70)" to="(70,80)"/>
<wire from="(110,60)" to="(110,70)"/>
<wire from="(200,150)" to="(250,150)"/>
<wire from="(70,130)" to="(70,270)"/>
<wire from="(290,80)" to="(290,90)"/>
<wire from="(330,210)" to="(330,220)"/>
<wire from="(290,230)" to="(290,310)"/>
<wire from="(320,200)" to="(430,200)"/>
<wire from="(70,70)" to="(110,70)"/>
<wire from="(330,210)" to="(430,210)"/>
<wire from="(40,100)" to="(270,100)"/>
<wire from="(40,170)" to="(140,170)"/>
<wire from="(250,120)" to="(250,150)"/>
<wire from="(40,70)" to="(40,100)"/>
<wire from="(320,110)" to="(320,200)"/>
<wire from="(70,80)" to="(290,80)"/>
<wire from="(300,210)" to="(330,210)"/>
<wire from="(290,310)" to="(320,310)"/>
<wire from="(300,110)" to="(320,110)"/>
<wire from="(250,120)" to="(270,120)"/>
<wire from="(20,310)" to="(20,360)"/>
<wire from="(320,110)" to="(330,110)"/>
<wire from="(70,80)" to="(70,130)"/>
<wire from="(200,290)" to="(210,290)"/>
<wire from="(290,130)" to="(290,190)"/>
<wire from="(70,130)" to="(140,130)"/>
<wire from="(70,270)" to="(140,270)"/>
<wire from="(40,170)" to="(40,360)"/>
<comp lib="7" loc="(280,210)" name="main"/>
<comp lib="0" loc="(330,220)" name="Pin">
<a name="facing" val="north"/>
<a name="output" val="true"/>
<a name="label" val="x1"/>
<a name="labelloc" val="east"/>
</comp>
<comp lib="0" loc="(110,60)" name="Pin">
<a name="facing" val="south"/>
<a name="tristate" val="false"/>
<a name="label" val="+- Control"/>
<a name="labelloc" val="north"/>
</comp>
<comp lib="0" loc="(20,360)" name="Pin">
<a name="facing" val="north"/>
<a name="tristate" val="false"/>
<a name="label" val="b1"/>
<a name="labelloc" val="south"/>
</comp>
<comp lib="7" loc="(280,110)" name="main"/>
<comp lib="1" loc="(200,290)" name="XOR Gate">
<a name="inputs" val="2"/>
</comp>
<comp lib="0" loc="(40,70)" name="Pin">
<a name="facing" val="south"/>
<a name="tristate" val="false"/>
<a name="label" val="a0"/>
<a name="labelloc" val="north"/>
</comp>
<comp lib="0" loc="(20,70)" name="Pin">
<a name="facing" val="south"/>
<a name="tristate" val="false"/>
<a name="label" val="a1"/>
<a name="labelloc" val="north"/>
</comp>
<comp lib="0" loc="(450,210)" name="Pin">
<a name="facing" val="west"/>
<a name="output" val="true"/>
<a name="width" val="2"/>
<a name="label" val="x1 x0"/>
<a name="labelloc" val="south"/>
</comp>
<comp lib="0" loc="(40,360)" name="Pin">
<a name="facing" val="north"/>
<a name="tristate" val="false"/>
<a name="label" val="b0"/>
<a name="labelloc" val="south"/>
</comp>
<comp lib="1" loc="(200,150)" name="XOR Gate">
<a name="inputs" val="2"/>
</comp>
<comp lib="0" loc="(320,310)" name="Pin">
<a name="facing" val="west"/>
<a name="output" val="true"/>
<a name="label" val="Carry (overflow)"/>
<a name="labelloc" val="east"/>
</comp>
<comp lib="0" loc="(330,110)" name="Pin">
<a name="facing" val="west"/>
<a name="output" val="true"/>
<a name="label" val="x0"/>
<a name="labelloc" val="east"/>
</comp>
<comp lib="0" loc="(450,210)" name="Splitter">
<a name="facing" val="west"/>
<a name="appear" val="legacy"/>
</comp>
</circuit>
<circuit name="EightBitAdderSubtractor">
<a name="circuit" val="EightBitAdderSubtractor"/>
<a name="clabel" val=""/>
<a name="clabelup" val="east"/>
<a name="clabelfont" val="SansSerif plain 12"/>
<wire from="(510,500)" to="(570,500)"/>
<wire from="(90,370)" to="(90,630)"/>
<wire from="(430,350)" to="(480,350)"/>
<wire from="(150,670)" to="(150,680)"/>
<wire from="(510,430)" to="(560,430)"/>
<wire from="(440,140)" to="(440,280)"/>
<wire from="(260,580)" to="(260,590)"/>
<wire from="(270,510)" to="(270,530)"/>
<wire from="(100,430)" to="(100,640)"/>
<wire from="(500,50)" to="(500,130)"/>
<wire from="(500,380)" to="(500,410)"/>
<wire from="(100,120)" to="(460,120)"/>
<wire from="(560,190)" to="(670,190)"/>
<wire from="(510,360)" to="(550,360)"/>
<wire from="(260,440)" to="(480,440)"/>
<wire from="(580,210)" to="(580,570)"/>
<wire from="(230,290)" to="(260,290)"/>
<wire from="(230,410)" to="(260,410)"/>
<wire from="(110,490)" to="(110,650)"/>
<wire from="(100,130)" to="(450,130)"/>
<wire from="(510,290)" to="(540,290)"/>
<wire from="(510,220)" to="(530,220)"/>
<wire from="(120,550)" to="(120,660)"/>
<wire from="(100,140)" to="(440,140)"/>
<wire from="(250,200)" to="(460,200)"/>
<wire from="(540,170)" to="(540,290)"/>
<wire from="(260,300)" to="(260,350)"/>
<wire from="(100,150)" to="(430,150)"/>
<wire from="(50,40)" to="(50,160)"/>
<wire from="(690,190)" to="(770,190)"/>
<wire from="(130,610)" to="(130,670)"/>
<wire from="(550,180)" to="(670,180)"/>
<wire from="(100,160)" to="(420,160)"/>
<wire from="(420,420)" to="(480,420)"/>
<wire from="(70,670)" to="(130,670)"/>
<wire from="(410,170)" to="(410,490)"/>
<wire from="(100,170)" to="(410,170)"/>
<wire from="(100,180)" to="(400,180)"/>
<wire from="(450,130)" to="(450,210)"/>
<wire from="(500,310)" to="(500,340)"/>
<wire from="(500,590)" to="(500,620)"/>
<wire from="(70,650)" to="(110,650)"/>
<wire from="(140,50)" to="(500,50)"/>
<wire from="(230,530)" to="(270,530)"/>
<wire from="(100,190)" to="(390,190)"/>
<wire from="(140,570)" to="(170,570)"/>
<wire from="(260,370)" to="(480,370)"/>
<wire from="(140,210)" to="(170,210)"/>
<wire from="(140,330)" to="(170,330)"/>
<wire from="(140,450)" to="(170,450)"/>
<wire from="(50,160)" to="(80,160)"/>
<wire from="(140,50)" to="(140,210)"/>
<wire from="(510,150)" to="(670,150)"/>
<wire from="(270,510)" to="(480,510)"/>
<wire from="(460,140)" to="(480,140)"/>
<wire from="(70,630)" to="(90,630)"/>
<wire from="(590,220)" to="(590,640)"/>
<wire from="(150,670)" to="(170,670)"/>
<wire from="(230,230)" to="(250,230)"/>
<wire from="(40,650)" to="(40,700)"/>
<wire from="(40,650)" to="(50,650)"/>
<wire from="(540,170)" to="(670,170)"/>
<wire from="(260,230)" to="(260,290)"/>
<wire from="(590,220)" to="(670,220)"/>
<wire from="(410,490)" to="(480,490)"/>
<wire from="(550,180)" to="(550,360)"/>
<wire from="(140,270)" to="(140,330)"/>
<wire from="(140,390)" to="(140,450)"/>
<wire from="(140,510)" to="(140,570)"/>
<wire from="(420,160)" to="(420,420)"/>
<wire from="(140,40)" to="(140,50)"/>
<wire from="(460,120)" to="(460,140)"/>
<wire from="(500,240)" to="(500,270)"/>
<wire from="(500,520)" to="(500,550)"/>
<wire from="(260,440)" to="(260,470)"/>
<wire from="(70,250)" to="(170,250)"/>
<wire from="(260,300)" to="(480,300)"/>
<wire from="(260,580)" to="(480,580)"/>
<wire from="(230,350)" to="(260,350)"/>
<wire from="(230,470)" to="(260,470)"/>
<wire from="(230,590)" to="(260,590)"/>
<wire from="(450,210)" to="(480,210)"/>
<wire from="(80,310)" to="(170,310)"/>
<wire from="(580,210)" to="(670,210)"/>
<wire from="(460,160)" to="(460,200)"/>
<wire from="(90,370)" to="(170,370)"/>
<wire from="(400,560)" to="(480,560)"/>
<wire from="(560,190)" to="(560,430)"/>
<wire from="(100,430)" to="(170,430)"/>
<wire from="(530,160)" to="(670,160)"/>
<wire from="(390,190)" to="(390,630)"/>
<wire from="(230,650)" to="(480,650)"/>
<wire from="(110,490)" to="(170,490)"/>
<wire from="(120,550)" to="(170,550)"/>
<wire from="(430,150)" to="(430,350)"/>
<wire from="(70,660)" to="(120,660)"/>
<wire from="(570,200)" to="(670,200)"/>
<wire from="(500,170)" to="(500,200)"/>
<wire from="(500,450)" to="(500,480)"/>
<wire from="(130,610)" to="(170,610)"/>
<wire from="(250,200)" to="(250,230)"/>
<wire from="(440,280)" to="(480,280)"/>
<wire from="(140,390)" to="(170,390)"/>
<wire from="(390,630)" to="(480,630)"/>
<wire from="(260,230)" to="(480,230)"/>
<wire from="(140,630)" to="(170,630)"/>
<wire from="(140,270)" to="(170,270)"/>
<wire from="(140,510)" to="(170,510)"/>
<wire from="(70,640)" to="(100,640)"/>
<wire from="(570,200)" to="(570,500)"/>
<wire from="(70,250)" to="(70,610)"/>
<wire from="(460,160)" to="(480,160)"/>
<wire from="(260,370)" to="(260,410)"/>
<wire from="(70,680)" to="(150,680)"/>
<wire from="(510,570)" to="(580,570)"/>
<wire from="(530,160)" to="(530,220)"/>
<wire from="(70,620)" to="(80,620)"/>
<wire from="(80,310)" to="(80,620)"/>
<wire from="(510,640)" to="(590,640)"/>
<wire from="(400,180)" to="(400,560)"/>
<wire from="(140,210)" to="(140,270)"/>
<wire from="(140,330)" to="(140,390)"/>
<wire from="(140,450)" to="(140,510)"/>
<wire from="(140,570)" to="(140,630)"/>
<comp lib="0" loc="(50,40)" name="Pin">
<a name="facing" val="south"/>
<a name="width" val="8"/>
<a name="tristate" val="false"/>
<a name="label" val="input a"/>
<a name="labelloc" val="north"/>
</comp>
<comp lib="0" loc="(770,190)" name="Pin">
<a name="facing" val="west"/>
<a name="output" val="true"/>
<a name="width" val="8"/>
<a name="tristate" val="false"/>
<a name="label" val="Result x: Negatives are in 2's compliment"/>
<a name="labelloc" val="north"/>
</comp>
<comp lib="1" loc="(230,230)" name="XOR Gate">
<a name="inputs" val="2"/>
</comp>
<comp lib="0" loc="(80,160)" name="Splitter">
<a name="fanout" val="8"/>
<a name="incoming" val="8"/>
<a name="appear" val="center"/>
</comp>
<comp lib="1" loc="(230,350)" name="XOR Gate">
<a name="inputs" val="2"/>
</comp>
<comp lib="7" loc="(490,360)" name="main"/>
<comp lib="7" loc="(490,290)" name="main"/>
<comp lib="7" loc="(490,150)" name="main"/>
<comp lib="1" loc="(230,650)" name="XOR Gate">
<a name="inputs" val="2"/>
</comp>
<comp lib="1" loc="(230,290)" name="XOR Gate">
<a name="inputs" val="2"/>
</comp>
<comp lib="7" loc="(490,500)" name="main"/>
<comp lib="1" loc="(230,590)" name="XOR Gate">
<a name="inputs" val="2"/>
</comp>
<comp lib="7" loc="(490,430)" name="main"/>
<comp lib="0" loc="(690,190)" name="Splitter">
<a name="facing" val="west"/>
<a name="fanout" val="8"/>
<a name="incoming" val="8"/>
<a name="appear" val="center"/>
</comp>
<comp lib="1" loc="(230,470)" name="XOR Gate">
<a name="inputs" val="2"/>
</comp>
<comp lib="7" loc="(490,570)" name="main"/>
<comp lib="1" loc="(230,530)" name="XOR Gate">
<a name="inputs" val="2"/>
</comp>
<comp lib="7" loc="(490,220)" name="main"/>
<comp lib="0" loc="(50,650)" name="Splitter">
<a name="fanout" val="8"/>
<a name="incoming" val="8"/>
<a name="appear" val="center"/>
</comp>
<comp lib="1" loc="(230,410)" name="XOR Gate">
<a name="inputs" val="2"/>
</comp>
<comp lib="0" loc="(140,40)" name="Pin">
<a name="facing" val="south"/>
<a name="tristate" val="false"/>
<a name="label" val="+- Control"/>
<a name="labelloc" val="north"/>
</comp>
<comp lib="0" loc="(40,700)" name="Pin">
<a name="facing" val="north"/>
<a name="width" val="8"/>
<a name="tristate" val="false"/>
<a name="label" val="input b"/>
<a name="labelloc" val="south"/>
</comp>
<comp lib="7" loc="(490,640)" name="main"/>
</circuit>
</project>