
The Min-T Processor - mabynogy
http://www.nanocpu.org/
======
theamk
This project specifically does not try to implement memory, leaving this to
Raspberry PI. In this case (1), the simplest CPU (by part count) is a 1-bit
one, such as Motorola MC14500B. The application handbook
[http://tinymicros.com/mediawiki/images/e/ec/MC14500B_Handboo...](http://tinymicros.com/mediawiki/images/e/ec/MC14500B_Handbook.pdf)
(pdf) explains how it works.

\- CPU does not contain program counter: instead, a regular binary counter
counts PC from 0 to max program ROM, then wraps. You can clear OEN bit to turn
write operations into no-op's. (For an advanced usage, you have JMP and RTN
instructions which just set corresponding pins. It is up to you to wire
something to them.)

\- CPU does not contain instruction decoder: instead, some bits from program
ROM are wired to address bus. For example, 16-bit wide ROM will be split into
4 bit instruction and 12 bit memory address. Max amount of RAM supported
depends on your ROM's width. RAM is bit-addressable. There is no indirect RAM
access (unless you implement it yourself).

\- CPU does not contain wide registers: you get one data bit, one result bit,
and two flags, for 4 bits of state total.

\- CPU does not contain ALU: you can do AND/OR/XOR, optionally inverted -- so
just a single bit LU unit.

This machine is not Turing complete at all (2), but it is still possible to
implement basic arithmetic, as well as simple games such as "pong".

(1) I am ignoring all other requirements here, like clear layout and
educational value.

(2) Strictly speaking, no real machine is Turing complete, because Turing
machines require infinite memory. But this machine is super bad because it has
no indirect memory access at all.

~~~
delinka
"...this machine is super bad because..."

I can't tell if you mean it's awesome, or terrible.

~~~
striking
My opinion is that both are true.

------
lelandbatey
This reminds me of another educational CPU that's also in progress, the "8-bit
breadboard computer" being created by Khan Academy's Ben Eater:
[https://www.youtube.com/playlist?list=PLowKtXNTBypGqImE405J2...](https://www.youtube.com/playlist?list=PLowKtXNTBypGqImE405J2565dvjafglHU)

I find his diagrams and narrations extremely clear and straightforward. I've
been using it as a chance to learn more about digital logic, and hobbyist
electronics. For example, I've been (very slowly) learningttfdfd KiCad by
translating Mr. Eaters designs into KiCAD form so they can be manufactured as
dedicated boards. I _finally_ got the first module, the clock module, correct
and manufactured, and you can find the designs here:
[https://github.com/lelandbatey/clock-
module](https://github.com/lelandbatey/clock-module)

Here's the clock module on the printed PCB with all the components, and only
one bodge wire needed (now fixed in the design):
[https://s16.postimg.org/gxi0plptv/2017-03-26_15.51.00.jpg](https://s16.postimg.org/gxi0plptv/2017-03-26_15.51.00.jpg)

~~~
Limb
Very nice! I had the same idea, and had started laying out the designs he was
using in KiCAD as well. If you haven't already I suggest picking up a copy of
Digital Computer Electronics [0] by Malvino, which he uses as a basis for his
designs. It's a great reference and lets you dive a little deeper into the
design as well.

[0] [https://www.amazon.com/Digital-Computer-Electronics-
Albert-M...](https://www.amazon.com/Digital-Computer-Electronics-Albert-
Malvino/dp/0028005945/ref=tmm_hrd_swatch_0?_encoding=UTF8&qid=&sr=)

------
theaustinseven
If your going for a small processor, you should really implement a small
subset of MIPS. It is really simple, and you can even compile programs from C
and run them on your processor. Some Universities use this as their primary
teaching tool for processor design.

~~~
tonyRobinson
I liked the challenge of implementing my own instruction set. It turned out to
be quite similar to a subset of ARM, so it may also be similar to a subset of
MIPS (I haven't checked).

~~~
theaustinseven
Yeah, I can understand the appeal of implementing your own, but MIPS itself is
very small. There are also a lot of good resources on it, and the spec fits on
one page :
[http://www.mrc.uidaho.edu/mrc/people/jff/digital/MIPSir.html](http://www.mrc.uidaho.edu/mrc/people/jff/digital/MIPSir.html)

~~~
tonyRobinson
Thanks for that link. I'm sure I've looked at MIPS before and it may well have
unconsciously influenced me, or it may be a case of converging evolution, but
I use the three register design much like MIPS does. However, mine is much
smaller, essentially only six "ALU" instructions D = S op T for op in AND, OR,
XOR, ADD, SUB, ASR along with PUSH and POP. Given the simplicity of my set I
can start from anywhere and cut it down, in fact I'm thinking about cutting
down TCC x86_64 to what I use in order to learn how to port TCC.

------
pankajdoharey
I think Implementing a 6502 is a good example for an architecture
implementation. Since it has already been done in numerous NES emulation
projects, A lot of us have a good understanding of the CPU. Plus it is the
part of a history which many kids could relate to. The video game era and
genesis of personal computing era was almost entirely based off of this single
CPU. It isnt small but definitely a stepping stone towards understanding a
modern CPU. anything lesser makes it just a toy. For a toy, I like the one
described in "Elements of Computign systems" here
[https://www.amazon.com/Elements-Computing-Systems-
Building-P...](https://www.amazon.com/Elements-Computing-Systems-Building-
Principles/dp/0262640686)

~~~
Retric
I would go with the Intel 4004 for historic reasons
[https://en.m.wikipedia.org/wiki/Intel_4004](https://en.m.wikipedia.org/wiki/Intel_4004)
or other 4bit CPU for simplicity. Latency is going to force any large scale
CPU into toy category, but you can still do a lot even at a few kHz with a 4
bit CPU.

~~~
tonyRobinson
8 bit and 4 bit CPUs are horrible things to teach. By being 16 bits throughout
you can do many high level things in one instruction. It also makes for an
efficient FORTH implementation.

------
throwaway7645
Yes, most people can barely fathom how (well anything) works around them. The
power grid is stupidly complicated (I've been studying it for 10 years) and so
are modern computers and compilers, electronics, cars, aircraft...etc. I'm an
engineer and am blown away by how we can work together to put a man on the
moon, while individually we can do so little. I got off topic, but we REALLY
need to find ways to teach tech and carry it forward.

------
FullyFunctional
Yes, this is great fun. I have a few paper designs of my own in a similar
spirit and if you look around you'll find many existing projects.

However the "Min-T" name to me implies a higher ambition than "just"
implementing a transistor computer. True minimalism requires exacting
definitions and metrics. That could be pretty interesting, but keeping memory
outside the definition is in a sense cheating as [the size and speed of]
random access memory was a key differentiators between early computers (ENIAC
era).

Essentially, this design would be facing the same constraints as _early_
computers, so I would expect the solution to look similar: micro-coded bit-
serial design, Rope memory for ROM, and core memory for "ram". I'd look to the
HP-1900A for inspiration.

~~~
tonyRobinson
I'm experimenting with names. You'll see a write up where I minimise the
number of legs, i.e. solder joints you have to make. That seemed like a very
good metric. But then I found myself discussing everything in terms of the
transistor count, so I'm favouring min-T right now. Passive components like
resistors and didoes you can see what they do from looking at them.
Transistors are much harder to work out what they are going to do. Other name
suggestions are welcome.

------
jfoutz
One of the funnest video game things i've ever done is build a little computer
in minecraft, back when redstone was first introduced. just 4 bits, input as
switches and output as torches. Add, subtract, multiplication, jump if zero.
the 256 bits of memory took acres of space.

absolutely useless excercise, aside from being a fun way to spend some time.

