~noizhardware/666cpu

ultra minimal experimental sound computer
42aab976 — noizhardware 5 days ago
nj
b96362e8 — noizhardware 8 days ago
nj
2df4499b — noizhardware 8 days ago
nj

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~noizhardware/666cpu
read/write
git@git.sr.ht:~noizhardware/666cpu

You can also use your local clone with git send-email.

#666 cpu

#ultra minimal experimental sound computer

The 666 cpu is an experiment in extreme minimalism.

The 666R version should be relatively easy to build with basic logic chips and an EEPROM.

FPGA could be another great approach. Some work on the 666R has already been done in Verilog.

#features

  • programs are read directly from ROM, no loading.
  • single-cycle microcode instructions
  • the clock is constantly moving the program counter(except for HALT), as the program itself IS the microcode, there's nothing else behind it.
  • EDP architecture: Encoded DataPath, each 8-bit OPcode activates a unique 20-bit(666R) or 23-bit(666RS) ControlWord
    • physical implementation should be easy with a simple 8-bit demux (or with 3x EEPROMS)

#666R

  • 666R (Reduced) is the most minimal version, with only 2 general purpose registers and 1 output register, no RAM, no stack

#666RS (Reduced, Stack)

  • no general purpose registers
  • 256bytes RAM (stack with SP register), it acts as both stack and runtime data storage.

#TODO:

  • banked RAM? with selector register
  • make an actual emulator, no sim
  • 666RS (targeting nyx) To implement:
    • memory-map in-out registers as devices
    • 8bit real noise generator? (mem-mapped)
    • 2 output channels (1bit pwm?) with mode setting byte(LSB, MSB, bitNO, bitscan....)
    • an input buffer, to interface with a PS/2 keyboard (and maybe a couple pots/encoders)
  • delete the arduino ide from the pipeline, program via SPI
    • more resources available
    • maybe able to run multiple instances of the cpu
    • implement inter-cpu communication protocol
    • try parallel programming (single code in eeprom, each cpu has an unique id)

#getting started

  • Windows: build.cmd or buildrs.cmd
  • Linux: build.sh or buildrs.sh
    • gnome-alsamixer if having volume-mute problems

It compiles the assembler and the simulator, assembles an example rom and runs it.

#usage

666Rsim / 666RSsim is a simulator. It takes into account actual datapaths, it's not efficient, it's not fast.

#assemble

  • 666Rasm [assemblySource] [destinationRom]; use -v for verbose assembling

#run

666Rsim [romFile], use 666RSsim [romFile] if running a rom assembled for the 666RS

#666R assembly mnemonics

  • nop : No OPeration, do nothing, waste a cycle
  • lda [val] : load next byte into register A
    • same for ldb, ldx, ldy, ldo
  • ldao [val], ldab [val], ldax [val] : same as lda, but loads the value into multiple registers at once
  • hlt : halt the clock (interrupts might be enabled)
  • hac : halt if CF is set
  • haz : halt if ZF is set
  • sa : direct register transfer: copy RS into RA
    • same for sb, sx, sy, so, xb, ao, bo, ax, bx, xa, xb, ba, ay, by, ya, yb, xo, yo
  • sao : direct register transfer from a single source to multiple destinations; copies RS into RA and OUT
    • same for sao, sbo, sax
  • soh : copy RS to OUT and then HALT
  • add, sub, mul, div, xor, and, shr, shl : just set the ALU operator
  • addb [value] : set the ALU operator to ADD and load next byte into RB
    • same for adda, subb, shrb, xorb, mulb, shlb, divb
    • also loading the same value into multiple registers at once: addbo, subsao, andsb, andso, mulso, mulsab, mulxb, mulyb, mulsy
  • jmp [addr] : unconditional jump to address contained in next byte
  • jz [addr], jc [addr] : conditional jump: jump if ZF or CF is set
  • jmpx, jmps : unconditional jump to address contained in RX or RS
  • jmpxz, jmpxc : conditional jump: jump to address contained in RX if ZF or CF is set

#other useful assembler features

  • labels: mark a point in the program with .labelName and use its address in place of any value with @labelName

example:

.loop
     -- do something here
     jmp @loop