1
\$\begingroup\$

The internet is filled with inspiring examples of homebrew computers, including ones made from relays and TTL gates.

In the first year of Make Magazine - they describe a person who builds a simple programmable computer using TTL gates. They conclude with the spin "I'm going to extend it until I can play Zork!"

My question is: Is there a Homebrew-style TTL/FPGA computer that can run a POSIX OS?

Edit:

\$\endgroup\$

closed as off-topic by Chetan Bhargava, Keelan, JYelton, placeholder, Daniel Grillo Sep 15 '14 at 11:26

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions on the use of electronic devices are off-topic as this site is intended specifically for questions on electronics design." – Chetan Bhargava, Keelan, JYelton, placeholder, Daniel Grillo
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    \$\begingroup\$ The answer is probably yes, some nutjob with too much spare time on their hands has built one. My question is: Why? It would be a useless anachronism that would require a substantial amount of mental torment to create. \$\endgroup\$ – markt Sep 14 '14 at 4:39
  • 1
    \$\begingroup\$ @markt Don't be so negative. There may be valid reasons to build a computer from discrete parts, such as learning how a it works, or demonstrating its function. Though I also don't see much of a point in making it POSIX compatible. But there are worse hobbies. \$\endgroup\$ – starblue Sep 14 '14 at 7:33
  • \$\begingroup\$ and above all he speaks of fpga too. you can write a full computer on even not so top notch chips, and run some flavor of linux on it. \$\endgroup\$ – Vladimir Cravero Sep 14 '14 at 9:22
  • \$\begingroup\$ Oh, I agree in principle - it's an interesting enough project. Just utterly pointless. The FPGA btw was an add-on following @MarkU's answer (and makes a damn sight more sense imo - that, I've done myself). \$\endgroup\$ – markt Sep 14 '14 at 11:07
  • \$\begingroup\$ You are confusing things, POSIX is a definition of the interface between the OS and applications, it has no bearing on the underlying hardware. \$\endgroup\$ – placeholder Sep 14 '14 at 16:18
3
\$\begingroup\$

I strongly recommend adopting an existing Instruction Set Architecture (ISA), unless you are very keen to write your own C compiler. A related issue is, should your machine be 'self hosting'? Do you want the machine to be able to run the compiler, and compile programs, including the OS on itself. The implications of that decision constrain several choices.

Another issue is what you want from the "POSIX OS". POSIX was a specification derived from UNIX. You could run a 'real' UNIX variant. Sources are stored at The Unix Heritage Society.

If 'self hosting' is a requirement, then probably your only 16bit CPU choice is PDP-11, and use UNIX Edition 6, Edition 7, or early BSD's. See What Unixes run on What PDPs?. It'll be hard to cram a modern UNIX-like system onto anything that small.

I think a PDP-11 could be implemented in 'TTL'. However, it did have quite a complex instruction set (with lots of addressing modes, and multi-length instructions). The upside is you would have a compiler, working UNIX, and likely a bunch of people who might be interested in collaborating.

To reduce the number of chips, designs used 'bit-slicing'. Typically this implemented 4-bit-wide 'slices' through a CPU and could be 'cascaded' side by side to make any width machine in multiples of 4 bits. Those machines were typically driven by microcode, which coordinated each step within each instruction. Microcode could be changed, so it could have almost any instruction set desired. If the microcode store was RAM it could change its instruction set on the fly!

One popular bit-slice family was AMD's 2900 bit slice. A lot of machines were built using it, including a few 32bit (IIRC). I've had a quick search, and I can't find anyone making that any more.

However, it looks like TI's 74181 are available. It's a 4-bit wide bit-slice ALU. It was used in many significant machines of the '70's, e.g. the Xerox Alto.

Moving up to 32bit gives a lot more options. People did build commercial 32bit machines from discrete logic in the 80's, sometimes using bit-slice, but they were quite complex.

By choosing an existing Instruction Set Architecture (ISA), you might get a portable compiler, and a version of xBSD, Linux, OpenSolaris, etc. which satisfies your POSIX needs.

Avoid heavily-protected Intellectual Property or complex instruction sets. Rather than Intel, ARM, or IBM, you could choose an existing RISC ISA. With RISC there's a good chance of understanding the design, and getting it to work.

Use an existing FPGA development board to get started, and quickly make progress; you could have a machine up and working quickly with no electronics to build or debug. You might still choose to build custom hardware, once the FPGA has proven everything. You might even migrate the FPGA to discrete logic in pieces, an option earlier designers did not have.

There are many choices of 32bit Architecture that support a POSIX OS. If you only used Xilinx FPGAs, there is MicroBlaze. That has a lot of flexibility in its implementation, and also has both GNU tool support, for the compiler tool chain, and Linux support.

Aim to implement an existing 'RISC' architecture which is explicitly Open Source, and which has an active community who might be interested in helping.

Three contenders:

They all have FPGA implementations.

OpenSPARC has many POSIX operating systems. OpenRISC seems to have a lot of related Harware IP which might help

RISC-V is bidding to be come the Open Source Instruction Set Architecture (ISA). It involves people who had worked on the Berkely RISC, which led to the SPARC. RISC-V is much more similar to MIPS, and claims some of the weaker decisions are improved.

Useful References:
OpenCores
SPARC
OpenSPARC T1
OpenSPARC T2
The Case For RISC-V

\$\endgroup\$
2
\$\begingroup\$

If you're asking what would be involved in building such a project:

First step is to select what processor architecture you intend to build, then find an actual Linux distribution from Red Hat or SuSE or BSD that runs on that architecture. For example, i386-32bit or ARM-32bit might be a place to start. I doubt you will find any (modern) distribution that runs on 16-bit or 8-bit architectures. (Per @DaveTweed the DEC PDP-11 is 16-bit, that might be a good place to start. Birthplace of Unix and C)

Say you decide to go with i386-32bit and you find a free, open-source POSIX OS distribution you want to use. Then the next step is to actually design and build a piece of hardware that runs i386 machine code. Out of discrete TTL logic gates. And build it. And test it.

I'd suggest take a look at opencores.org for available VHDL/Verilog microprocessor cores. Normally these would be implemented in an FPGA or an ASIC, but the only reasons not to use discrete TTL gates are cost, effort, and flexibility. These are actually pretty compelling reasons.

Building a 4-bit microcontroller is a much, much smaller and more managable project than builiding a 32-bit or 64-bit machine like a modern POSIX OS would typically require. It's more than just scaling by a factor of 16 wider data bus, it's also the address bus, the address decode logic, the instruction decode logic, the ALU, the registers... and you'd be manually connecting a whole bunch of wires. Good luck finding the problem if one of those wires breaks off, or if there is a short somewhere.

I assume part of the allure of this idea is building something yourself, but keep in mind the cost of a new or used PC -- if the goal is to run Linux, there are easier and more cost-effective ways.

edit: Yes, FPGA is definitely better than discrete TTL for a project of this scale. Look for an FPGA development board with as many LUT/Register blocks as you can afford, and on-board DDR3 memory.

\$\endgroup\$
  • 1
    \$\begingroup\$ There are plenty of 16-bit architectures that can run a POSIX-compatible OS, starting with the DEC PDP-11. \$\endgroup\$ – Dave Tweed Sep 14 '14 at 14:55

Not the answer you're looking for? Browse other questions tagged or ask your own question.