Shop OBEX P1 Docs P2 Docs Learn Events
Simplest Computer with ICs — Parallax Forums

Simplest Computer with ICs

Keith YoungKeith Young Posts: 569
edited 2015-04-09 19:38 in General Discussion
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).
«13

Comments

  • Cluso99Cluso99 Posts: 18,069
    edited 2015-04-06 23:06
    Sorry, but you are not going to build a computer from 4-16 14 pin logic chips.
    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.
  • jmgjmg Posts: 15,148
    edited 2015-04-07 01:56
    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.
    That's already up to close to 100 pins, so why not buy a CPLD breakout board, unless you really love soldering.
    The CPLD breakout board allows you to do all you imagine with expansion headroom, and it is still useful when you are done :)
  • GadgetmanGadgetman Posts: 2,436
    edited 2015-04-07 04:02
    One button?

    Can you write up the function of the device a bit better?

    How big is that 'full-size' breadboard?
  • LeonLeon Posts: 7,620
    edited 2015-04-07 05:31
    An FPGA makes more sense than a CPLD. FPGAs have on-chip RAM, and many boards have large external RAMs. They can be obtained for under $30:

    http://www.ebay.co.uk/itm/281188502846?_trksid=p2059210.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT

    A suitable programmer will also be required.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2015-04-07 05:52
    It is really awkward to encourage such an effort when Parallax is still selling an SX48 chip for 78 cents,
    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.
  • Keith YoungKeith Young Posts: 569
    edited 2015-04-07 08:33
    Thanks for being honest about this. Really what I'm looking for is something I can use that removes the "black box". I know it's all transistors, and 1's and 0's, but that's it. It was the same for me and engines, gas blows up and moves a piston. It wasn't until I went through 3 levels of Thermodynamics that I had a real grasp of it.

    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.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2015-04-07 09:32
    Well, I don't think you have to go down to the individual transistor level to grasp the elements of a microcontroller.

    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.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2015-04-07 10:08
    Okay, just to advocate a bit of fun mayhem... Here is the 4004.pdf and the Intel schematic for it.

    I suppose you could consider somehow copying these. There are other 4004 resources, including a JAVA emulator on the web.
  • mindrobotsmindrobots Posts: 6,506
    edited 2015-04-07 10:31
    Code by Charles Petzold

    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.
  • GadgetmanGadgetman Posts: 2,436
    edited 2015-04-07 11:15
    You don't need to build a functioning CPU to manage what you want.

    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
  • mindrobotsmindrobots Posts: 6,506
    edited 2015-04-07 11:27
    Gadgetman wrote: »

    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!! :D
  • Keith YoungKeith Young Posts: 569
    edited 2015-04-07 12:09
    This forum is awesome. Thanks a bunch guys for the info. It will take me some time to absorb this before I can ask any semi intelligent questions.
  • rod1963rod1963 Posts: 752
    edited 2015-04-07 12:18
    The easiest computer to build and understand would be a 1 bit MC14500 Industrial Control Unit.

    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.
  • ercoerco Posts: 20,254
    edited 2015-04-07 13:12
    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.

    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.

    My background isn't computer science.

    THAT is more complicated than what I can tackle with my scant free time.

    Much more than that and I just won't have time.

    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.

    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
  • jmgjmg Posts: 15,148
    edited 2015-04-07 14:31
    Leon wrote: »
    An FPGA makes more sense than a CPLD. FPGAs have on-chip RAM, and many boards have large external RAMs. They can be obtained for under $30:

    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
  • LawsonLawson Posts: 870
    edited 2015-04-07 16:11
    You could always go the "Turing tarpit" route and make a single instruction computer. http://en.wikipedia.org/wiki/One_instruction_set_computer

    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
  • Mike GreenMike Green Posts: 23,101
    edited 2015-04-07 16:17
    Another simple computer was the Digital Equipment PDP-8 series (see http://en.wikipedia.org/wiki/PDP-8). There was a serial version, the PDP-8/S, that could be implemented with maybe 100 ICs plus some kind of memory. It's very simple to understand and there are emulators available, some of which include emulation of the original front panel where you could see the register contents and set them using switches (emulated by clicking on them). There was a huge amount of software available for it much of which will run under the emulator.
  • Cluso99Cluso99 Posts: 18,069
    edited 2015-04-07 17:11
    Keith,
    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 ;)
  • localrogerlocalroger Posts: 3,451
    edited 2015-04-07 17:47
    Behold the homemade CPU web ring:

    http://members.iinet.net.au/~daveb/simplex/ringhome.html

    Have fun!
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2015-04-07 19:52
    localroger wrote:
    Behold the homemade CPU web ring: ...
    Oh. My. Goodness. Those are so retro! Keep das hands in das pockets, und vatch der blinkinlights. :)

    -Phil
  • kwinnkwinn Posts: 8,697
    edited 2015-04-07 20:17
    I built a small 4 bit cpu way back using a 74181 alu and two 74172 multi port register chips along with a whole bunch of counters and logic chips, and later worked on a lot of instruments and mini computers built with similar chips. They all needed a lot more than 16 chips to create a working cpu. These days it might be possible to build a small very simple 8 bitter with 30 - 40 7400 series (or equivalent cmos) chips, and a bit of ram and eeprom. A cpld would reduce the chip count some. It would require some careful design and be pretty slow but it would also be a good learning tool.
  • Keith YoungKeith Young Posts: 569
    edited 2015-04-07 21:57
    Wow, you guys already swamped me for a week with all this reading. When I say thanks a lot, it's 75% genuine and 25% sarcastic.

    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.
  • jmgjmg Posts: 15,148
    edited 2015-04-07 22:21
    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.
    It does not take very long before 'a few chips' totals more than the cost of a Small MCU.

    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.
  • jmgjmg Posts: 15,148
    edited 2015-04-07 22:33
    ... I've programmed Prop (including assembly at http://obex.parallax.com/object/705)

    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.

    If you have done the above, then the following is not so easy to follow...
    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.
    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..
  • Heater.Heater. Posts: 21,230
    edited 2015-04-08 06:21
    Keith Young,

    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
  • Dave HeinDave Hein Posts: 6,347
    edited 2015-04-08 06:35
    I built a controller based on the AMD 2900 ALU back in the late 70's. It used the 2904 sequencer to control program flow. I'll have to see if I can find the schematic for it. I think it used a 32-bit instruction word. Each bit in the instruction went directly to control lines in the 2900's and the 2904. I wrote a macro-assembler for it so I could program it. I probably wrote the macro-assembler in Fortran since that's the programming language I used back then.
  • kwinnkwinn Posts: 8,697
    edited 2015-04-08 06:45
    The arithmetic and logic unit is the heart of a cpu. If you want to understand how a cpu works at the gate level you could start with two 74HC181 (alu chips), and five 74HC573 (or 74HC373) (8 bit register chips) and use the propeller board for the control signals. By placing leds (48 needed) on the signal pins you can monitor the state of each signal in and out of the alu.

    The propeller can simulate the signals the rest of the logic would normally provide, and could be replaced with logic chips later if desired.
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2015-04-08 06:52
    Behold the homemade CPU web ring:

    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.
  • Heater.Heater. Posts: 21,230
    edited 2015-04-08 07:09
    kwinn,

    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.
Sign In or Register to comment.