Skip to content

Instantly share code, notes, and snippets.

@max1220
Created April 24, 2023 12:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save max1220/8d815c4901267c2ca44c66e58527b82f to your computer and use it in GitHub Desktop.
Save max1220/8d815c4901267c2ca44c66e58527b82f to your computer and use it in GitHub Desktop.
A very simple LogiSim CPU
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project source="3.8.0" version="1.0">
This file is intended to be loaded by Logisim-evolution v3.8.0(https://github.com/logisim-evolution/).
<lib desc="#Wiring" name="0">
<tool name="Pin">
<a name="appearance" val="classic"/>
</tool>
</lib>
<lib desc="#Gates" name="1">
<tool name="AND Gate">
<a name="size" val="30"/>
</tool>
<tool name="Controlled Buffer">
<a name="width" val="8"/>
</tool>
</lib>
<lib desc="#Plexers" name="2"/>
<lib desc="#Arithmetic" name="3"/>
<lib desc="#Memory" name="4"/>
<lib desc="#I/O" name="5"/>
<lib desc="#TTL" name="6"/>
<lib desc="#TCL" name="7"/>
<lib desc="#Base" name="8"/>
<lib desc="#BFH-Praktika" name="9"/>
<lib desc="#Input/Output-Extra" name="10"/>
<lib desc="#Soc" name="11"/>
<main name="main"/>
<options>
<a name="gateUndefined" val="ignore"/>
<a name="simlimit" val="1000"/>
<a name="simrand" val="0"/>
</options>
<mappings>
<tool lib="8" map="Button2" name="Poke Tool"/>
<tool lib="8" map="Button3" name="Menu Tool"/>
<tool lib="8" map="Ctrl Button1" name="Menu Tool"/>
</mappings>
<toolbar>
<tool lib="8" name="Poke Tool"/>
<tool lib="8" name="Edit Tool"/>
<tool lib="8" name="Wiring Tool"/>
<tool lib="8" name="Text Tool"/>
<sep/>
<tool lib="0" name="Pin"/>
<tool lib="0" name="Pin">
<a name="facing" val="west"/>
<a name="output" val="true"/>
</tool>
<sep/>
<tool lib="1" name="NOT Gate"/>
<tool lib="1" name="AND Gate"/>
<tool lib="1" name="OR Gate"/>
<tool lib="1" name="XOR Gate"/>
<tool lib="1" name="NAND Gate"/>
<tool lib="1" name="NOR Gate"/>
<sep/>
<tool lib="4" name="D Flip-Flop"/>
<tool lib="4" name="Register"/>
</toolbar>
<circuit name="main">
<a name="appearance" val="custom"/>
<a name="circuit" val="main"/>
<a name="circuitnamedboxfixedsize" val="true"/>
<a name="simulationFrequency" val="2048000.0"/>
<appear>
<rect height="4" stroke="none" width="10" x="60" y="178"/>
<text dominant-baseline="alphabetic" fill="#404040" font-family="Courier 10 Pitch" font-size="12" text-anchor="start" x="75" y="184">ROM_VALUE</text>
<rect height="3" stroke="none" width="10" x="60" y="199"/>
<text dominant-baseline="alphabetic" fill="#404040" font-family="Courier 10 Pitch" font-size="12" text-anchor="start" x="75" y="204">CLK</text>
<rect height="3" stroke="none" width="10" x="60" y="219"/>
<text dominant-baseline="alphabetic" fill="#404040" font-family="Courier 10 Pitch" font-size="12" text-anchor="start" x="75" y="224">RESET</text>
<rect height="4" stroke="none" width="10" x="270" y="178"/>
<text dominant-baseline="alphabetic" fill="#404040" font-family="Courier 10 Pitch" font-size="12" text-anchor="end" x="265" y="184">ROM_ADDR</text>
<rect height="20" stroke="none" width="200" x="70" y="310"/>
<rect fill="none" height="160" stroke="#000000" stroke-width="2" width="200" x="70" y="170"/>
<text dominant-baseline="alphabetic" fill="#ffffff" font-family="Courier 10 Pitch" font-size="14" font-weight="bold" text-anchor="middle" x="171" y="323">main</text>
<visible-register height="10" path="/Register(390,340)" stroke-width="0" width="13" x="90" y="250"/>
<visible-register height="10" path="/Register(610,500)" stroke-width="0" width="13" x="90" y="290"/>
<visible-register height="10" path="/Register(610,630)" stroke-width="0" width="13" x="110" y="290"/>
<visible-register height="10" path="/Register(610,760)" stroke-width="0" width="13" x="130" y="290"/>
<visible-counter height="10" path="/Counter(1090,510)" stroke-width="0" width="13" x="90" y="270"/>
<visible-tty height="130" path="/TTY(1120,410)" stroke-width="0" width="234" x="49" y="40"/>
<text dominant-baseline="central" font-family="SansSerif" font-size="12" text-anchor="middle" x="118" y="255">IMM</text>
<text dominant-baseline="central" font-family="SansSerif" font-size="12" text-anchor="middle" x="113" y="275">PC</text>
<text dominant-baseline="central" font-family="SansSerif" font-size="12" text-anchor="middle" x="160" y="295">REGS</text>
<circ-anchor facing="east" x="280" y="180"/>
<circ-port dir="in" pin="170,370" x="60" y="200"/>
<circ-port dir="in" pin="170,400" x="60" y="220"/>
<circ-port dir="in" pin="180,290" x="60" y="180"/>
<circ-port dir="out" pin="1400,600" x="280" y="180"/>
</appear>
<comp lib="0" loc="(1040,390)" name="Splitter">
<a name="appear" val="right"/>
<a name="bit1" val="0"/>
<a name="bit2" val="0"/>
<a name="bit3" val="0"/>
<a name="bit4" val="0"/>
<a name="bit5" val="0"/>
<a name="bit6" val="0"/>
<a name="bit7" val="none"/>
<a name="fanout" val="1"/>
<a name="incoming" val="8"/>
</comp>
<comp lib="0" loc="(1080,500)" name="Tunnel">
<a name="facing" val="east"/>
<a name="label" val="RESET"/>
</comp>
<comp lib="0" loc="(1110,410)" name="Tunnel">
<a name="facing" val="east"/>
<a name="label" val="CLK"/>
</comp>
<comp lib="0" loc="(1130,480)" name="Tunnel">
<a name="facing" val="east"/>
<a name="label" val="RESET"/>
</comp>
<comp lib="0" loc="(1400,600)" name="Pin">
<a name="appearance" val="classic"/>
<a name="facing" val="west"/>
<a name="label" val="ROM_ADDR"/>
<a name="output" val="true"/>
<a name="width" val="8"/>
</comp>
<comp lib="0" loc="(170,370)" name="Pin">
<a name="appearance" val="classic"/>
<a name="label" val="CLK"/>
</comp>
<comp lib="0" loc="(170,400)" name="Pin">
<a name="appearance" val="classic"/>
<a name="label" val="RESET"/>
</comp>
<comp lib="0" loc="(180,290)" name="Pin">
<a name="appearance" val="classic"/>
<a name="label" val="ROM_VALUE"/>
<a name="width" val="8"/>
</comp>
<comp lib="0" loc="(180,370)" name="Tunnel">
<a name="label" val="CLK"/>
</comp>
<comp lib="0" loc="(180,400)" name="Tunnel">
<a name="label" val="RESET"/>
</comp>
<comp lib="0" loc="(240,290)" name="Splitter">
<a name="fanout" val="8"/>
<a name="incoming" val="8"/>
</comp>
<comp lib="0" loc="(250,360)" name="Splitter">
<a name="appear" val="right"/>
<a name="bit1" val="0"/>
<a name="bit2" val="0"/>
<a name="bit3" val="0"/>
<a name="bit4" val="0"/>
<a name="bit5" val="0"/>
<a name="bit6" val="0"/>
<a name="bit7" val="none"/>
<a name="fanout" val="1"/>
<a name="incoming" val="8"/>
</comp>
<comp lib="0" loc="(320,370)" name="Bit Extender">
<a name="in_width" val="7"/>
<a name="out_width" val="8"/>
<a name="type" val="zero"/>
</comp>
<comp lib="0" loc="(380,410)" name="Tunnel">
<a name="facing" val="east"/>
<a name="label" val="CLK"/>
</comp>
<comp lib="0" loc="(410,440)" name="Tunnel">
<a name="facing" val="east"/>
<a name="label" val="RESET"/>
</comp>
<comp lib="0" loc="(600,570)" name="Tunnel">
<a name="facing" val="east"/>
<a name="label" val="CLK"/>
</comp>
<comp lib="0" loc="(600,700)" name="Tunnel">
<a name="facing" val="east"/>
<a name="label" val="CLK"/>
</comp>
<comp lib="0" loc="(600,830)" name="Tunnel">
<a name="facing" val="east"/>
<a name="label" val="CLK"/>
</comp>
<comp lib="0" loc="(630,600)" name="Tunnel">
<a name="facing" val="east"/>
<a name="label" val="RESET"/>
</comp>
<comp lib="0" loc="(630,730)" name="Tunnel">
<a name="facing" val="east"/>
<a name="label" val="RESET"/>
</comp>
<comp lib="0" loc="(630,860)" name="Tunnel">
<a name="facing" val="east"/>
<a name="label" val="RESET"/>
</comp>
<comp lib="0" loc="(820,300)" name="Bit Extender">
<a name="in_width" val="1"/>
<a name="out_width" val="8"/>
</comp>
<comp lib="0" loc="(850,520)" name="Splitter">
<a name="fanout" val="8"/>
<a name="incoming" val="8"/>
</comp>
<comp lib="0" loc="(910,370)" name="Splitter">
<a name="bit7" val="none"/>
<a name="fanout" val="7"/>
<a name="incoming" val="8"/>
</comp>
<comp lib="0" loc="(980,590)" name="Tunnel">
<a name="facing" val="east"/>
<a name="label" val="CLK"/>
</comp>
<comp lib="1" loc="(1080,540)" name="OR Gate"/>
<comp lib="1" loc="(400,560)" name="NOT Gate"/>
<comp lib="1" loc="(540,810)" name="AND Gate">
<a name="size" val="30"/>
</comp>
<comp lib="1" loc="(550,310)" name="AND Gate">
<a name="size" val="30"/>
</comp>
<comp lib="1" loc="(550,550)" name="AND Gate">
<a name="size" val="30"/>
</comp>
<comp lib="1" loc="(550,680)" name="AND Gate">
<a name="size" val="30"/>
</comp>
<comp lib="1" loc="(600,430)" name="Controlled Buffer">
<a name="facing" val="south"/>
<a name="width" val="8"/>
</comp>
<comp lib="1" loc="(730,530)" name="Controlled Buffer">
<a name="width" val="8"/>
</comp>
<comp lib="1" loc="(730,660)" name="Controlled Buffer">
<a name="width" val="8"/>
</comp>
<comp lib="1" loc="(730,790)" name="Controlled Buffer">
<a name="width" val="8"/>
</comp>
<comp lib="1" loc="(810,1030)" name="AND Gate">
<a name="size" val="30"/>
</comp>
<comp lib="1" loc="(810,950)" name="AND Gate">
<a name="inputs" val="3"/>
<a name="negate1" val="true"/>
<a name="size" val="30"/>
</comp>
<comp lib="1" loc="(810,990)" name="AND Gate">
<a name="inputs" val="3"/>
<a name="negate1" val="true"/>
<a name="size" val="30"/>
</comp>
<comp lib="1" loc="(880,320)" name="AND Gate">
<a name="width" val="8"/>
</comp>
<comp lib="1" loc="(910,740)" name="AND Gate">
<a name="size" val="30"/>
<a name="width" val="8"/>
</comp>
<comp lib="1" loc="(950,690)" name="Controlled Buffer">
<a name="width" val="8"/>
</comp>
<comp lib="1" loc="(950,740)" name="Controlled Buffer">
<a name="width" val="8"/>
</comp>
<comp lib="1" loc="(970,470)" name="AND Gate">
<a name="inputs" val="9"/>
<a name="negate1" val="true"/>
<a name="negate2" val="true"/>
<a name="negate3" val="true"/>
<a name="negate4" val="true"/>
<a name="negate5" val="true"/>
<a name="negate6" val="true"/>
<a name="negate7" val="true"/>
<a name="negate8" val="true"/>
</comp>
<comp lib="3" loc="(920,690)" name="Adder"/>
<comp lib="4" loc="(1090,510)" name="Counter">
<a name="appearance" val="logisim_evolution"/>
</comp>
<comp lib="4" loc="(390,340)" name="Register">
<a name="appearance" val="logisim_evolution"/>
<a name="label" val="REG_IMM"/>
</comp>
<comp lib="4" loc="(610,500)" name="Register">
<a name="appearance" val="logisim_evolution"/>
</comp>
<comp lib="4" loc="(610,630)" name="Register">
<a name="appearance" val="logisim_evolution"/>
</comp>
<comp lib="4" loc="(610,760)" name="Register">
<a name="appearance" val="logisim_evolution"/>
</comp>
<comp lib="5" loc="(1120,410)" name="TTY"/>
<wire from="(1000,340)" to="(1000,760)"/>
<wire from="(1020,300)" to="(1020,520)"/>
<wire from="(1020,520)" to="(1030,520)"/>
<wire from="(1060,400)" to="(1120,400)"/>
<wire from="(1070,580)" to="(1070,620)"/>
<wire from="(1070,620)" to="(1090,620)"/>
<wire from="(1080,320)" to="(1080,460)"/>
<wire from="(1080,460)" to="(1130,460)"/>
<wire from="(1080,500)" to="(1090,500)"/>
<wire from="(1080,540)" to="(1090,540)"/>
<wire from="(1090,500)" to="(1090,530)"/>
<wire from="(1110,410)" to="(1120,410)"/>
<wire from="(1130,420)" to="(1130,460)"/>
<wire from="(1130,480)" to="(1140,480)"/>
<wire from="(1140,420)" to="(1140,480)"/>
<wire from="(1280,620)" to="(1290,620)"/>
<wire from="(1290,600)" to="(1290,620)"/>
<wire from="(1290,600)" to="(1400,600)"/>
<wire from="(170,370)" to="(180,370)"/>
<wire from="(170,400)" to="(180,400)"/>
<wire from="(180,290)" to="(240,290)"/>
<wire from="(240,290)" to="(240,360)"/>
<wire from="(240,360)" to="(250,360)"/>
<wire from="(260,210)" to="(480,210)"/>
<wire from="(260,220)" to="(470,220)"/>
<wire from="(260,230)" to="(460,230)"/>
<wire from="(260,240)" to="(510,240)"/>
<wire from="(260,250)" to="(500,250)"/>
<wire from="(260,260)" to="(760,260)"/>
<wire from="(260,270)" to="(770,270)"/>
<wire from="(260,280)" to="(350,280)"/>
<wire from="(270,370)" to="(280,370)"/>
<wire from="(320,370)" to="(390,370)"/>
<wire from="(350,280)" to="(350,390)"/>
<wire from="(350,390)" to="(350,560)"/>
<wire from="(350,390)" to="(390,390)"/>
<wire from="(350,560)" to="(370,560)"/>
<wire from="(380,410)" to="(390,410)"/>
<wire from="(400,560)" to="(410,560)"/>
<wire from="(410,1000)" to="(410,1040)"/>
<wire from="(410,1000)" to="(780,1000)"/>
<wire from="(410,1040)" to="(780,1040)"/>
<wire from="(410,440)" to="(420,440)"/>
<wire from="(410,560)" to="(410,690)"/>
<wire from="(410,560)" to="(520,560)"/>
<wire from="(410,690)" to="(410,820)"/>
<wire from="(410,690)" to="(520,690)"/>
<wire from="(410,820)" to="(410,960)"/>
<wire from="(410,820)" to="(510,820)"/>
<wire from="(410,960)" to="(410,1000)"/>
<wire from="(410,960)" to="(780,960)"/>
<wire from="(420,430)" to="(420,440)"/>
<wire from="(450,370)" to="(600,370)"/>
<wire from="(460,230)" to="(460,800)"/>
<wire from="(460,800)" to="(510,800)"/>
<wire from="(470,220)" to="(470,670)"/>
<wire from="(470,670)" to="(520,670)"/>
<wire from="(480,210)" to="(480,540)"/>
<wire from="(480,540)" to="(520,540)"/>
<wire from="(500,250)" to="(500,320)"/>
<wire from="(500,250)" to="(750,250)"/>
<wire from="(500,320)" to="(520,320)"/>
<wire from="(510,240)" to="(510,300)"/>
<wire from="(510,240)" to="(740,240)"/>
<wire from="(510,300)" to="(520,300)"/>
<wire from="(540,810)" to="(610,810)"/>
<wire from="(550,310)" to="(570,310)"/>
<wire from="(550,550)" to="(610,550)"/>
<wire from="(550,680)" to="(610,680)"/>
<wire from="(560,460)" to="(560,530)"/>
<wire from="(560,460)" to="(600,460)"/>
<wire from="(560,530)" to="(560,660)"/>
<wire from="(560,530)" to="(610,530)"/>
<wire from="(560,660)" to="(560,790)"/>
<wire from="(560,660)" to="(610,660)"/>
<wire from="(560,790)" to="(610,790)"/>
<wire from="(570,310)" to="(570,420)"/>
<wire from="(570,420)" to="(570,950)"/>
<wire from="(570,420)" to="(590,420)"/>
<wire from="(570,950)" to="(720,950)"/>
<wire from="(600,370)" to="(600,410)"/>
<wire from="(600,370)" to="(810,370)"/>
<wire from="(600,430)" to="(600,460)"/>
<wire from="(600,460)" to="(780,460)"/>
<wire from="(600,570)" to="(610,570)"/>
<wire from="(600,700)" to="(610,700)"/>
<wire from="(600,830)" to="(610,830)"/>
<wire from="(630,600)" to="(640,600)"/>
<wire from="(630,730)" to="(640,730)"/>
<wire from="(630,860)" to="(640,860)"/>
<wire from="(640,590)" to="(640,600)"/>
<wire from="(640,720)" to="(640,730)"/>
<wire from="(640,850)" to="(640,860)"/>
<wire from="(670,530)" to="(690,530)"/>
<wire from="(670,660)" to="(690,660)"/>
<wire from="(670,790)" to="(710,790)"/>
<wire from="(690,390)" to="(1040,390)"/>
<wire from="(690,390)" to="(690,530)"/>
<wire from="(690,530)" to="(690,580)"/>
<wire from="(690,530)" to="(710,530)"/>
<wire from="(690,580)" to="(840,580)"/>
<wire from="(690,620)" to="(690,660)"/>
<wire from="(690,620)" to="(800,620)"/>
<wire from="(690,660)" to="(710,660)"/>
<wire from="(720,540)" to="(720,550)"/>
<wire from="(720,550)" to="(820,550)"/>
<wire from="(720,670)" to="(720,680)"/>
<wire from="(720,680)" to="(830,680)"/>
<wire from="(720,800)" to="(720,810)"/>
<wire from="(720,810)" to="(840,810)"/>
<wire from="(720,950)" to="(720,990)"/>
<wire from="(720,950)" to="(770,950)"/>
<wire from="(720,990)" to="(770,990)"/>
<wire from="(730,530)" to="(780,530)"/>
<wire from="(730,660)" to="(780,660)"/>
<wire from="(730,790)" to="(780,790)"/>
<wire from="(740,240)" to="(740,940)"/>
<wire from="(740,940)" to="(780,940)"/>
<wire from="(750,250)" to="(750,980)"/>
<wire from="(750,980)" to="(780,980)"/>
<wire from="(760,1020)" to="(780,1020)"/>
<wire from="(760,260)" to="(760,1020)"/>
<wire from="(770,270)" to="(770,300)"/>
<wire from="(770,300)" to="(780,300)"/>
<wire from="(780,460)" to="(780,530)"/>
<wire from="(780,530)" to="(780,660)"/>
<wire from="(780,660)" to="(780,790)"/>
<wire from="(780,660)" to="(980,660)"/>
<wire from="(800,620)" to="(800,700)"/>
<wire from="(800,620)" to="(850,620)"/>
<wire from="(800,700)" to="(800,750)"/>
<wire from="(800,700)" to="(880,700)"/>
<wire from="(800,750)" to="(880,750)"/>
<wire from="(810,1030)" to="(840,1030)"/>
<wire from="(810,340)" to="(810,370)"/>
<wire from="(810,340)" to="(830,340)"/>
<wire from="(810,950)" to="(820,950)"/>
<wire from="(810,990)" to="(830,990)"/>
<wire from="(820,300)" to="(830,300)"/>
<wire from="(820,550)" to="(820,950)"/>
<wire from="(830,680)" to="(830,990)"/>
<wire from="(840,580)" to="(1070,580)"/>
<wire from="(840,580)" to="(840,680)"/>
<wire from="(840,680)" to="(840,730)"/>
<wire from="(840,680)" to="(880,680)"/>
<wire from="(840,730)" to="(880,730)"/>
<wire from="(840,810)" to="(840,1030)"/>
<wire from="(850,520)" to="(850,620)"/>
<wire from="(870,440)" to="(910,440)"/>
<wire from="(870,450)" to="(910,450)"/>
<wire from="(870,460)" to="(910,460)"/>
<wire from="(870,470)" to="(910,470)"/>
<wire from="(870,480)" to="(910,480)"/>
<wire from="(870,490)" to="(910,490)"/>
<wire from="(870,500)" to="(910,500)"/>
<wire from="(870,510)" to="(910,510)"/>
<wire from="(880,320)" to="(900,320)"/>
<wire from="(900,320)" to="(900,370)"/>
<wire from="(900,370)" to="(910,370)"/>
<wire from="(910,420)" to="(910,430)"/>
<wire from="(910,420)" to="(970,420)"/>
<wire from="(910,430)" to="(920,430)"/>
<wire from="(910,740)" to="(930,740)"/>
<wire from="(920,690)" to="(930,690)"/>
<wire from="(930,300)" to="(1020,300)"/>
<wire from="(930,310)" to="(970,310)"/>
<wire from="(930,320)" to="(1080,320)"/>
<wire from="(930,330)" to="(990,330)"/>
<wire from="(930,340)" to="(1000,340)"/>
<wire from="(940,700)" to="(940,710)"/>
<wire from="(940,710)" to="(990,710)"/>
<wire from="(940,750)" to="(940,760)"/>
<wire from="(940,760)" to="(1000,760)"/>
<wire from="(950,690)" to="(980,690)"/>
<wire from="(950,740)" to="(980,740)"/>
<wire from="(970,310)" to="(970,420)"/>
<wire from="(970,470)" to="(980,470)"/>
<wire from="(980,470)" to="(980,560)"/>
<wire from="(980,560)" to="(1030,560)"/>
<wire from="(980,590)" to="(1090,590)"/>
<wire from="(980,660)" to="(980,690)"/>
<wire from="(980,690)" to="(980,740)"/>
<wire from="(990,330)" to="(990,710)"/>
</circuit>
<circuit name="testbed">
<a name="appearance" val="logisim_evolution"/>
<a name="circuit" val="testbed"/>
<a name="circuitnamedboxfixedsize" val="true"/>
<a name="simulationFrequency" val="2048000.0"/>
<comp lib="0" loc="(150,390)" name="Clock"/>
<comp lib="4" loc="(280,570)" name="ROM">
<a name="appearance" val="logisim_evolution"/>
</comp>
<comp lib="5" loc="(150,410)" name="Button"/>
<comp loc="(510,370)" name="main"/>
<wire from="(150,390)" to="(290,390)"/>
<wire from="(150,410)" to="(290,410)"/>
<wire from="(270,370)" to="(270,530)"/>
<wire from="(270,370)" to="(290,370)"/>
<wire from="(270,530)" to="(530,530)"/>
<wire from="(270,540)" to="(270,580)"/>
<wire from="(270,540)" to="(540,540)"/>
<wire from="(270,580)" to="(280,580)"/>
<wire from="(510,370)" to="(540,370)"/>
<wire from="(520,630)" to="(530,630)"/>
<wire from="(530,530)" to="(530,630)"/>
<wire from="(540,370)" to="(540,540)"/>
</circuit>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment