Simplest Computer with ICs
Keith Young
Posts: 569
This might not be the best place to ask this in general, but of the people I know you guys as a group are the most likely to be able to answer this.
I'd like to look in to making a very simple computer that can accomplish what can be done with a few lines of code in a Prop. I hope to make it out of chips similar to 555, 4000, 7400 etc. This could be pretty simple, or just way beyond the amount of work I want to invest in this little project.
So I don't know if this will need a bus, tiny ram, or what. So first let me see if this "goal" is a good one:
I'd like to have 4 lights, and a button. I'd use the pushbutton to type in commands, and those commands would control the lights.
I think what inspired this idea I came up with today was that I read this about 4 days ago:
http://hackaday.com/2011/02/11/how-the-arduino-won-this-is-how-we-can-kill-it/
I don't know enough about this to really even know what to Google. My background isn't computer science. When I came up with the idea my Googling got me this:
http://hackaday.com/2013/09/08/the-nibbler-a-4-bit-cpu-built-with-7400-logic/
THAT is more complicated than what I can tackle with my scant free time. I hope to do this with around 4-6 14 pin chips or something like that. For example, fitting on a single full sized breadboard. Much more than that and I just won't have time.
Any pointers? My main questions are:
Is that "goal" above a decent one?
What is some basic terminology I should know to steer me in the right direction?
Do you know of a page or resource I should look at?
Would typing with the button be akin to assembly? If not, how much work would it take to make a computer with a couple assembly codes?
Am I so clueless I shouldn't bother? NO. However, I do have limited free time and might have to do something else. Hopefully I can get a bit of guidance here.
Thanks a bunch for any help. Please be honest if I'm off mark, and particularly if there's a quicker and easier way to learn how to talk directly to the machine (if that's the right phrase).
I'd like to look in to making a very simple computer that can accomplish what can be done with a few lines of code in a Prop. I hope to make it out of chips similar to 555, 4000, 7400 etc. This could be pretty simple, or just way beyond the amount of work I want to invest in this little project.
So I don't know if this will need a bus, tiny ram, or what. So first let me see if this "goal" is a good one:
I'd like to have 4 lights, and a button. I'd use the pushbutton to type in commands, and those commands would control the lights.
I think what inspired this idea I came up with today was that I read this about 4 days ago:
http://hackaday.com/2011/02/11/how-the-arduino-won-this-is-how-we-can-kill-it/
I don't know enough about this to really even know what to Google. My background isn't computer science. When I came up with the idea my Googling got me this:
http://hackaday.com/2013/09/08/the-nibbler-a-4-bit-cpu-built-with-7400-logic/
THAT is more complicated than what I can tackle with my scant free time. I hope to do this with around 4-6 14 pin chips or something like that. For example, fitting on a single full sized breadboard. Much more than that and I just won't have time.
Any pointers? My main questions are:
Is that "goal" above a decent one?
What is some basic terminology I should know to steer me in the right direction?
Do you know of a page or resource I should look at?
Would typing with the button be akin to assembly? If not, how much work would it take to make a computer with a couple assembly codes?
Am I so clueless I shouldn't bother? NO. However, I do have limited free time and might have to do something else. Hopefully I can get a bit of guidance here.
Thanks a bunch for any help. Please be honest if I'm off mark, and particularly if there's a quicker and easier way to learn how to talk directly to the machine (if that's the right phrase).
Comments
Simple 74xx chips have less than dozens of transistors per chip, depending on the complexity of the chip. IIRC the Intel 4004 4bit micro used ~2,300 transistors.
With a USB-serial (propplug equivalent) and a Propeller Chip and a crystal (plus power and decoupling) you could program and download some simple code to the propeller. You could add some LEDs and resistors so you could make them flash. Initially you don't even require the EEPROM to store your code if you are happy to download each time. While you can flash LEDs without the crystal, to do any communications you will want the crystal.
There is plenty of info and examples/projects in the sticky on the Propeller Forum.
And there are plenty of other projects using various chips on the internet. You just have to search for beginner projects.
The CPLD breakout board allows you to do all you imagine with expansion headroom, and it is still useful when you are done
Can you write up the function of the device a bit better?
How big is that 'full-size' breadboard?
http://www.ebay.co.uk/itm/281188502846?_trksid=p2059210.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT
A suitable programmer will also be required.
https://www.parallax.com/product/sx48bd-g
or you can just get a proto board and learn from that. https://solarbotics.com/product/21395/
I suppose if you really still desire the 'simplest' -- seek out a 4 bit micro-controller. Or design a 4-bit micro-controller in FPGA.
http://www.ebay.com/sch/i.html?_from=R40&_trksid=m570.l1313&_nkw=4bit+microcontroller&_sacat=0
http://en.wikipedia.org/wiki/4-bit
There really is no need to develop a motherboard for a big pile of logic chips to go through this learning excercise.
http://pdfooz.org/k-6257809.html
++++++++++
The real question that all this discussion begs is "What exactly do you desire to learn?"
If you really want the fundamentals of processor architecture, a cheap FPGA and studying Leros just might give you the best yield of knowledge. You have all the blocks of a microprocessor under one chip and can be reconfigured for alternatives via code.
I hope for something that can store the simplest possible program or command. For example just to be able to send it numbers from 0-3 and 2 commands, add or subtract for example. Maybe I just need to start with a few 4000 or 7400 chips and understand each of those individually before eventually moving up in complexity.
Cluso99,
Thanks for being candid about it.
So you're basically saying to start by writing very small and simple assembly programs?
jmg,
I'll look in to those CPLD Breakout Boards. Thank you. I wouldn't have known those exist.
Gadgetman,
Maybe one button. Like I said I don't know if that's anywhere near good or feasible.
I can't really write up the function of the device better, besides saying I want something very simple that helps me understand how computers work at their lowest level.
~6.5" long.
Leon and Loopy,
I was considering an FPGA. I'm going to have to weigh my options.
Do you guys know good resources I should look at? For example I've heard of bit shifting, buffering, things like that. Rather than reading individual articles on Wikipedia do you guys know of a book or website that walks through all of these in a logical and thorough order?
Thanks a bunch for all the help so far.
A. Everything evolves around memory, which is a grid of flip-flopish devices. The easiest model is one memory for everything, but some devices have EEPROM for program and separate RAM for variables. (This is what the PIC did)
B. Once you have memory, you have to have a means to address the memory -- that is usually a program counter that will keeping counting forward to the next line in the memory unless a Jump to else where (by inserting a different address) occurs.
C. To get the program counter to increment, you need a tick-tock -- that's why an oscillator is included.
D. Jump is somewhat useful, but testing and then Jumping is even more useful. And so are Returns. These all insert an address on the program counter from somewhere else.
E. If you got that far -- you have program flow. But you need a CPU that will do some binary interger maths. It should increment, deincrement, add, and subtract, shift left, and shift right.
F. Other features are pretty much enhancements.
++++++++++++
If you want to really learn, you should study the Machine Code instructions for a very simple device -- like a PIC 16F84. PIC 16F88, or PIc 16Fxx, and try to envision how it is all wired together. i don't know if anyone has ever written a paper to walk one thru this approach, but Mike Preko wrote books that introduced the PIC architecture (probably out of print, try AbeBooks.com). Parallax has books on the SX chips -- most for free.
Try to focus on devices with Reduced Instruction Set Computing -- the less instructions, the simpler the computer's architecture. And look at something that doesn't have hardware Serial, hardware ADC, hardware SPI, and so on. All that stuff, adds complexity.
I would Google for PIC16F84, PIC16F88, or the PIC16Fxx explained. And read the Microchip PFD documents for this device. PIClist.com will offer a lot of free code examples.
+++++++++++
Actually a tutorial for the old 4004 or 4040 4-bit processor might work quite well. I just have never gone looking for the material to read and study.
I suppose you could consider somehow copying these. There are other 4004 resources, including a JAVA emulator on the web.
It was an enjoyable read on an airplane for me (OK, I was delayed for several hours in Atlanta). I think this should be a mandatory read for anyone that wants to do more with a computer than use it as an appliance.
All you really want to build is an ALU Arithmetic Logic Unit, which is the part that 'does the magic' really.
The inputs can be switches, and the output can be LEDs.
Add a switch for which function to try and a button for GO!
First stage is to build a simple adder. Then add maybe a shifter that shifts the contents of one input one step to the right or the left.
A rotate is done by hooking it up so that the bit 'going off the end' is reintroduced at the other end, usually after a stopover in the Carry bit.
Second stage is to rebuild it with some sort of register(latches) instead of one of the input sets.
The step after that is the 'instruction decode' which is a special memory which takes a short code (2 - 5 bits on a simple 8bit computer) and translates it into a wider code which replaces all the switches used to control the ALU earlier.
And suddenly... you're halfway to a CPU...
It's a fascinating idea, and a fun way to learn about logic ICs.
you can find a lot of good ingo if you check out the links on this page:
http://www.ttlcpu.com/content/links
Darn you, Gadgetman!!!!!! You've just cost me (and possibly my employer) several hours of surfing time!!
http://hackaday.com/2015/02/26/building-an-industrial-control-unit-with-an-industrial-control-unit/
http://laughtonelectronics.com/Arcana/One-bit%20computer/One-bit%20computer.html
http://www.webalice.it/giussdp/cpu1bit/index.html
You can buy the Mc14500 off Ebay.
In regards to CPLD’s look at the MaxII line from Altera, boards based on them can be had on Ebay for $10.00. The software from Altera is free and includes a schematic design entry option and a 7400 series library so you can roll your own designs without having to learn VHDL or Verilog. Just make sure you know your logic IC's before experimenting with them.
I’d avoid the older Microchip controllers, they aren’t human friendly. Learn older CISC architectures like the 6809, Z-80 or even a 68K. Simulators can be had for all. I use the Easy68K for the MC68000.
http://en.wikipedia.org/wiki/Apollo_Guidance_Computer
What you want to build is called a State Machine.
http://ece.uprm.edu/~borges/Chp8.pdf
http://www.cs.princeton.edu/courses/archive/spr06/cos116/FSM_Tutorial.pdf
http://tzhsphysics.weebly.com/uploads/1/3/8/3/13837392/act_3_4_1___statemachinedesign__ppt.pdf
http://www.allaboutcircuits.com/vol_4/chpt_11/5.html
http://www.engr.uconn.edu/~zshi/course/cse2300/lecture11_statemachines.pdf
God bless you, Keith, you're all over the place and fairly headed "where angels fear to tread".
Your interest in computers is admirable, your desire to build something is commendable, especially given your self-admitted lack of time and knowledge. I'd suggest a different track entirely, namely learning simple microcontrollers from scratch on a proven curriculum. Get a BASIC Stamp 2 "What's a Microcontroller" kit and work through the book. It's nearly required reading to get started with this venerable 8-bit processor, and BASIC is IMO the easiest programming language to learn. You'll learn about programming, sensors, and building circuits. You can learn at your own rate, knock out a chapter in a day, week or month.
Millions of satisfied customers can't be wrong: https://www.parallax.com/product/90005 The best $80 you can spend.
When you're done, you'll have a lot more knowledge to make a more informed decision about whether to make your own computer. While I like the idea of building one, it's more gratifying to me to use one in a working project.
Although localroger and I have knocked around the idea of making an old school computer out of switches, diodes and relays.
This one's also cool, the LEDs are cheating a bit but very cool: https://www.youtube.com/watch?v=NXeBR-lbnjI
I was thinking of this type of CPLD
http://www.digikey.com/product-detail/en/LCMXO2-7000HE-B-EVN/220-2625-ND/3906092
That board includes a programmer, so it all ready to go.
or maybe this
http://www.digikey.com/product-detail/en/EK-10M08E144ES%2FP/544-3042-ND/4976140
An 8-bit "Reverse Subtract and Skip if Borrow" looks particularly simple to implement. For IO, just memory map the LED's. (programming it on the other hand...)
Marty
I think you need to work out if you want to start with programming (software) or hardware. There are lots of ways to get into either/both, but it might be best to start with one first.
An FPGA based board is a good way to go if you want something flexible and try your hand at logic design, or just download a design into it.
So, sit back and chew on some of the options here, research a little, and report back again
http://members.iinet.net.au/~daveb/simplex/ringhome.html
Have fun!
-Phil
FYI Erco, I've already been through WAM, the Boe-Bot Book, I've programmed Prop (including assembly at http://obex.parallax.com/object/705)
However, I'm just hacking stuff together. I'm poking a black box, watching what comes out the other end, and poking it differently until I get what I want. I'm very gifted in that regard. I know it's all transistors, 1's and 0's, but I don't fully understand what's going on INSIDE on a fundamental level.
I wrote the C++ for computer vision on our robot for the Graduate Robotics Team. I was an undergrad in Mechanical and Aerospace. We won based on my code. I didn't know what an array meant, I'd never written in C before. I somehow beat the code into submission.
I read Paul Allen's book and was amazed they could take some pile of Smile, and make it so people could program it. It was just switches and lights. I have no idea how to do that. I want to learn.
So an analogy would be that I want to turn a wrench in a 60's car. I've blindly followed instructions by plugging in some diagnostic thing to a 2010 car, and fixed it, but I had no idea what the heck I did. I want to understand this on a simpler level.
Thanks for the links guys. I'll try to catch up. Hopefully this is doable on the level I'd wanted. If not, I might have to buy better hardware than I'd initially envisioned.
You can build something that can do sequential logic with a Parallel Memory device and a latch, but the cheapest parallel non volatile memory devices now cost more than a MCU, and they are a pain to get the code into. (ZIF sockets anyone ?)
As a sanity check, look at MCU parts like this -
http://www.digikey.com/product-detail/en/EFM8BB10F8G-A-SOIC16/336-3166-5-ND/5115723
56c one off, in an easy to use package, and it has all of this included
I²C, SMBus, SPI, UART/USART, POR, PWM, WDT,A/D 12x12b
Number of I/O 13
8KB FLASH 512 RAM 2.2 V ~ 3.6 V
Includes a 2 wire Debug/Loader pathway too.
If you have done the above, then the following is not so easy to follow...
If you want to follow bits, or go even lower-level, then maybe look at a MCU Simulator for bit level stuff, and even a Spice Simulator, if you want to see things in waveform presentation.
NXP CMOS Logic data sheets usually have equivalent gate schematics, so you can see how they create a Flip-flip, counter, or small ALU, from the simpler gate-level stuff..
I'm all for "opening the black box". Of course inside every black box is another black box, I mean, how do those TTL chips work? Oh, logic gates. How do those logic gates work? Oh, transistors. How do those transistors work....
If you are serious about this you will need to set aside time for it.
I would not even start with a CPU. Why not just experiment with some TTL NAND gates and FLIP-FLOP packages. Like we did as kids back in the late 1970's. Build a digital clock. Many example circuits on line.
Or going a black box level further down build a flip-flop out of transistors, build a few, make a binary counter with some LEDs attached. All good fun.
Aside: Back in technical college we build a chain of flip flops, a binary counter, out of four 1 meter long pneumatic actuators and spool valves. It was damn impressive!
You might be interested in this tiny CPU design used in a class at CMU:
http://repository.cmu.edu/cgi/viewcontent.cgi?article=1595&context=compsci
The propeller can simulate the signals the rest of the logic would normally provide, and could be replaced with logic chips later if desired.
There goes my afternoon... All those parts drawers with 74xx chips. All those clever designs waiting to use them. One thing that might not be so fun would be all the wire wrapping. Is it cheating to make custom PCBs - they are so cheap these days.
Mind you, soldering takes a lot of time. I've just finished a PCB which upgrades a Z80 FPGA emulation from a cyclone II to a cyclone IV board. These are $20-$30 on ebay now, and you can learn verilog or vhdl and create any custom CPU design you like. Or tweak a Z80 design (I added a MMU in a couple of evenings, then added a one instruction multiplier just for fun). Or you can draw it up with schematics and a virtual parts drawer of every 74xx chip.
FPGAs don't have enough blinkenlichten though.
I think that is an excellent idea. TTL ALU and registers + propeller as control unit.
Ultimately I would want the machines RAM and program counter as external Propeller controlled chips. Only the chips control signals need go to the Prop not the address and data buses.
Basically the Spin/PASM program in the Prop is your microcode for the external computer. That means you can tweak around with you new machines instruction set easily.
I'm not too keen on the FPGA approach. Seems like moving the stuff in the black box into another black box. Unless you want to get into learning hardware design with Verilog/VHDL of course.