Minecraft Maps / Redstone Device

Two Bit Computer Ideas

  • 443 views, 1 today
  • 0
  • 0
  • 1
ender_scythe's Avatar ender_scythe
Level 3 : Apprentice Crafter
0
These are some ideas for a jam-packed 2-bit computer that I might make, this will be updated.
Little endian is used throughout this post.

Made-Up Jargon

  • Dubit=dual bit (two bits)
  • Reg=register
  • Insreg=instruction register

Ideas

Instructions

0/1st: perform arithmetic (reg a +/-/N/<=> reg b)
1/2nd: load dubit into register
2/3rd: write data from register to location (RAM, I/O or register)
3/4th: restart computer (clears everything)

I/O

The computer will have a dubit output which can be triggered using the 3rd instruction, and a dubit input which can be accessed using the 2nd instruction.

How the Instructions Will Work

All of the functions require some data in some of the instruction registers (which hold numbers, adresses, etc. for the cpu to use). For the first instruction the first insreg holds the operation. For the second operation the first insreg holds the overall address (I/O, RAM or register, the fourth doesn't do anything), the second holds the address (0th dubit-3rd dubit) and the third holds the register (a, b, y or z). The third operation uses the first insreg for the register (a, b, y, z), the second insreg for the overall address (I/O, RAM, register or insreg) and the third for the address (0-3). The final instruction clears everything but the ROM, so it clears the registers, the RAM, the insregs and the program counter.

Registers

a: used as the first operator in arithmetic functions (or the thing to NOT for inversion)
b: used as the second operator in arithmetic functions
y: used as temporary storage, recommended for data transport
z: used as the output for the arithmetic functions

ALU

0/N: NOT/inversion
1/+: add
2/-: subtract
3/<=>: compare

ROM/Program Memory

The computer has 256 dubits+256 control dubits+256 jump bytes (64 bytes+64 control bytes+256 jump bytes) of program memory that can be dynamically jumped to via in-ROM commands (uses the control bit). When the computer boots it starts at the first dubit (0th in jumping terms), then (as long as it doesn't have to jump) increments the program counter once the CPU is finished with that instruction, which makes the computer execute the next instruction. If the first control bit is on it jumps to the ROM address stored in the current jump byte. The other control bit is to set a insreg/register to a number initially (it uses the last two bits in the jump byte to choose which insreg to write to, or if the third to last is on it uses the last two as the register instead), it uses the program dubit as the number to set it to. If both control bits are on it will halt execution until the user presses a "resume" button. If the third to last jump bit is on it will start a conditional jump, where the last two bits store what flag to jump on (all0, =, >, <), then the next ROM line's jumpop byte stores the pace to jump to, if the flag is different than the one specified in the jump byte, it instead increments to program counter twice, skipping the next line (which stores the jump byte). An idea to make the ROM smaller is to have a small number of jump bytes, which can be called using a smaller amount of bits as the calling bits, instead of the first control bits. You could also get rid of the first control bit altogether and set it so that if any of the jump/calling bits/bytes are on, it jumps to the set address. A further idea could be to use the program dubits in the jump/calling bits/bytes, assuming you do this you could cut down on 3 bits, or much more.

RAM

The RAM has three inputs, the control, the address and the data. The control line is a single bit which sets the RAM to either read or write mode. The address is a number from 0-3 which corresponds to a dubit inside. The address input is connected to a 2 to 4 decoder which is connected to AND gates which pass the data to the correct dubit, or if you are reading, it passes the contents to the output.

Example Programs

Parentheses are comments.

program dubit-control dubit-jump byte
  • 01-01-00000100 (load 1 into the a register)
  • 01-01-00000101 (load 1 into the b register)
  • 01-01-00000000 (load "add" into the first insreg)
  • 00-00-00000000 (perform arithmetic)
  • 11-00-00000101 (load 3 into the a register)

  • 11-01-00000000 (load "z" into insreg 1)
  • 10-01-00000001 (load "register" into insreg 2)
  • 00-01-00000010 (load "a" into insreg 3)
  • 10-00-00000000 (perform move to location)
  • 11-00-00000000 (load "compare" into the first insreg)

  • 00-00-00000000 (perform arithmetic)

  • 00-00-00000101 (conditional jump on equal)

  • 00-00-00001111 (jump to restart line)

  • 00-11-00000000 (halt execution)
  • 11-00-00000000 (restart)
That program adds 01 and 01 (10) and checks if it equals 11, if it does it restarts, if not it pauses, then restarts.

License
This computer is licensed under the Attribution-NonCommercial-ShareAlike 4.0 International license.
Progress50% complete
Tags

Create an account or sign in to comment.

1
09/11/2016 6:29 pm
Level 3 : Apprentice Crafter
ender_scythe
ender_scythe's Avatar
This site is odd, it automatically gives your own post a like, from yourself.
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome