Need advice : home self made computer.

Discussion in 'The Projects Forum' started by AlekseiX86, Jun 22, 2013.

  1. AlekseiX86

    Thread Starter New Member

    Jun 22, 2013
    Intro : Some months ago , i decided to learn how working computer on the most low level (CPU , ALU , RAM , Binary Code , etc). And i think that in whole i not bad all this understand. And here , in my mind came one idea : create my own simple computer , with small LED display. But the main part of my idea : i want to create such computer , without any microcontrollers (like Ardruino , Rasberry , etc) , and even maybe without ant memory microchip's. Using only or binary logical elements on transistors, or binary logical elements on microchip's (but not microcontrollers!).

    In whole , my idea :
    1)Display. Simple matrix(array) from one-color light-emitting diod's (i think 20x20=400 LEDS).
    2)Programming. I think , that is the most interesting part of my idea , i want to programming my computer... by punched tape , which include only binary code of my progrram. The special apparatus is reading binary code from punched tape , and write it is in Command RAM. After this , CPU starting to read and do binary code from Command RAM. Variables , counts , all this will be making in the Main RAM. Else CPU has acsees to Video RAM. I mean : reading binary code from punched tape and writing this in Command RAM. Then CPU reading this code , and if need do something counts , delarings , etc. in Command RAM. On this base , in binary code i want to write some algorithm, which count the position for that LED , which i want to turn on. CPU only do commands. There is no conveyor algrotinm of command reading , code optimizer's , etc. Only 3-4 simple commands Just like this : Command style : xxxx - command ID yyyy - first operand zzzz - secomd operand

    1)0001 0111 1 = > Set value of bit from Video RAM , with number 0111 in 1 (in the other words - turn on LED with number 0111).
    2)0002 0111 1 => Set value of bit from Main RAM , with number 0111 in 1. etc...

    And else i have idea to write some assembler for this computer. Some lexical analyzer on C++ , which will be tranlate my special assembler codes into binary code. On these assembler i can create even arrays and object types , using only 3-4 CPU commands. In the whole :
    Screen : 20x20=400 LED
    Video RAM : 400 bits
    Command RAM : 1KB ~ 500Bytes
    Main RAM : 200-300 Bytes. Maybe 500-600.

    Ah , forgot about IRQ. I want to create 5 buttons , and there will be IRQ RAM (5 Bit) flags of turning on for each buton.

    And i need an advice : is it really possible to create such computer (or my idea completely crazy??), which will be programming by binary code on punched tape , and 20x20 LED screen , and simple CPU , and how many time does it get to create? And of course using ONLY or binary logical elements and memory triggers based on transistrors , or binary logical elements and memory triggers based on microchip's (but not microcontroller) (It is crucial for me ). But do not understnd me wrong : i am actually glad to using microcontrollers , but i want to create this computer withount any of them. This is not some college projects, or project for real/business using , just my own idea for self-
    education. In theory , counting the position of turned on LED , i can write some games on that computer. And it is quite possible to write such games on my copmuter :

    Thanks for reading!

  2. GopherT

    AAC Fanatic!

    Nov 23, 2012
    Yes, it is completely possible. Is it interesting to me? No. But that is not the point. You said it yourself, it is for your education.

    Steve Wozniak was not much different than what you are attempting. One major difference, I believe he burned his RAM with DIP switches. One mistake and he would have to start over. I like your idea of old-time key-punching cards (or tape as you suggested).

    Herman Hollerith would be proud!

    Good luck. Even if it is never finished, you will definately learn something along the way.
    Last edited: Jun 22, 2013
    AlekseiX86 likes this.
  3. davebee

    Well-Known Member

    Oct 22, 2008
    It's a great idea. How much time do you think this will take?
    AlekseiX86 likes this.
  4. absf

    AAC Fanatic!

    Dec 29, 2010
    I have constructed a 4-bit computer with 16 instructions using 20 TTL chips plus an 2716 eprom and a 6116 SRAM. It was from from a website called "Mark's TTL microprocessor". The designer only described his CPU in block diagram and I have to work out the details.

    After a few weeks and numerous emails with the author, I finally got it to work. It was lots of fun and I learned a lot from the project.

    I hope you have plenty of time to make your project a successful one. ;)

    Last edited: Jun 23, 2013
    AlekseiX86 likes this.
  5. Austin Clark

    Active Member

    Dec 28, 2011
    It' possible, I was/am in the process of doing the same thing.

    The only problem is the scale. Things will quickly get out of hand if you limit yourself to logic gates and/or transistors. ESPECIALLY the memory. You'll be basically forced to use a large SRAM chip IC instead of building your own from scratch.

    The other problem is the screen integration. It will be very difficult to implement a memory-mapped screen with 400 elements. I would also recommend using dimensions with factors matching your bit-width of your computer. (So if you build an 8-bit computer, make the dimensions 8 by 8 or 16 by 16)

    I would recommend building with 4000 series or 7400 series ICs, and SRAM chips for the program and data memories.

    I tried building just a 4-bit counter out of BJTs once... it was a nightmare.

    You might want to try building different low-level components of your computer out of transistors, and then in your final build use the ICs with the same functionality.
    So, for example, make a 2-bit Mux, counter, adder, register, etc; out of transistors, but use ICs from there-on out. That way you gain the knowledge and satisfaction, but keep things feasible and easy (relatively). It will get extremely boring building the same things over and over again anyway.
    AlekseiX86 and absf like this.
  6. AlekseiX86

    Thread Starter New Member

    Jun 22, 2013
    Thanks for answers.
    I think use as screen display from BrickGame (10x20) , then i will be need only make some controller for it.
    All parts except RAM i think make on transistors. About RAM , what can somebody say about Magnetic based memory.I mean is it reliable and is it hard to make , because RAM on discrete transistors is REALLY take a lot of time for making and the same count of parts?
    Only Video RAM takes 200 Bits.
  7. WBahn


    Mar 31, 2012
    As AustinClark said, your should consider taking a layered approach. This is for a number of reasons.

    First, as he indicated, if you start off wanting to do everything at the lowest level, such as building the gates out of transistors, then you will almost immediately be completely overwhelmed by the number of transistors you are working with even for a truly braindead 4-bit computer. Worse, you will be forever stuck dealing with transistor-level issues that it will be very difficult for you to deal with the conceptual issues that should be your focus.

    You want to abstract the implementation issues away in layers so that you are always working with the problem of how to implement a certain new capability using capabilities that are just one step below it.

    For instance, spend some time making the basic logic gates using transistors. Get a NOT, a NAND, and a NOR working and understand how and why they work (at whatever level of detail satisfies you).

    Next, put the transistors away and get a few hex inverter chips and quad NAND and NOR chips. Using just those, make all of the other basic logic functions and a few of the more general ones. So make an AND, OR, XOR, XNOR, 2to1 MUX and perhaps some wider components such as a 4-input NAND and NOR. At that point, add those chips to your bag of parts and then go play around with decoders and encoders and muxes and demuxes. Then add half-adders and full-adders.

    With these all in your bag, you can actually build a very basic ALU with a relatively small number of parts and work with the concept of what an ALU is and how it works at the level of abstraction embodied by those parts. For instance, you can focus on why you need to invert the inputs to one side of the adder and force a carry-in in order to perform subtraction instead of worrying about how many NFETs need to be put in series between Node 234 and Node 761. But you can also have the confidence that goes along with the knowledge that you understand how that ALU works right down to the transistor level because you walked up each level from the transistor level to the ALU level one step at a time.

    Then shift gears a bit and play with basic sequential circuits such as RS latches, Master/Slave latches, and even a simple D or JK flip flop. At that point, add DFF and JKFF chips to your bag-o-parts.

    At the next step, make simple registers and counters and memory arrays using the DFF chips and logic chips in your bag. You are now ready to build CPU and, again, can do so at the appropriate level of abstraction.

    A really, really good intro to much of this -- though not quite what you are looking for -- is the Nand2Tetris project. You start with two-input NAND gates (in simulation) and walk up a very similar chain (at the right point you are just given DFFs as a second primative part) and you work your way up to a complete, functioning, brain-dead 16-bit computer. You then write an assembler for the instruction set recognized by this computer, a stack-oriented virtual machine for it, and a compiler for a high-level object-oriented language. Finally, you write an operating system library. This library supports arrays, strings, console I/O, graphics, dynamic memory allocation, and a set of math routines including division and squareroot.
    absf likes this.
  8. RichardO

    Late Member

    May 4, 2013
  9. AlekseiX86

    Thread Starter New Member

    Jun 22, 2013
    Intresting : is it possible to made computer which will be able to render 3D graphic and high optimize for this. Ofcourse using only chips. In video ram chip will be colors of all pixels , and then just need to made controller which will be convert video signal in RCA (like in SEGA consoles).
    For example 640x480 = 307 200 pixels.
    But i think it will be necessary high speed ram chips and the same chip logical elements.
    And it is not hard to write transaltor from some selfmade high language to this computer's binary code.
    No OS , just render for render code processing.
    How do you think about this?
    Thanks for reading.
  10. blueroomelectronics

    AAC Fanatic!

    Jul 22, 2007
    Certainly it's possible, but unless you're a very skilled logic circuit designer with lots of spare time and money it's not probable.

    Sort of "if you have to ask, you can't do it".
  11. WBahn


    Mar 31, 2012
    Yes, it is possible. It will be very slow. I have no idea how slow, but you are going to have so many interconnects between chips that you will probably have a hard time running much over, say, 20MHz.

    Buit it sounds like by "render 3D graphics" you don't mean make and display a single 3D image but rather produce 3D video in real time.

    Basically what you are saying is, "I want to build an airplane from scratch just like the Wright brothers, but I want it to be capable of supersonic flight."
  12. AlekseiX86

    Thread Starter New Member

    Jun 22, 2013
    So, I decided to use memory chips and chips from series 74HS or 7400 for another parts of computer (just standart logic chips (AND , OR , NAND etc)). I would like to know what frequency processor will have. Of course I understand that it is difficult to say what frequency will have processor know only using parts and not know architecture , but yet.
    So for example can i reach at about 500 kHZ frequency , or it is impossible in whole?
    Thank you.
    Last edited: Aug 18, 2013
  13. blueroomelectronics

    AAC Fanatic!

    Jul 22, 2007
  14. DickCappels


    Aug 21, 2008
    If one more suggestion is ok, I suggest that you sketch out a block diagram of the whole thing first, then decide what to use for an ALU, memory, etc. and write the instruction set. That part of the exercise might be enough to satisfy your curiosity. If you really feel the need to build a computer from scratch, you will be all set, but as WBahn said, build it one little section at a time and test as you go.
  15. m4ch1n314ngu4g3

    New Member

    Aug 20, 2013
    Wow, this is a very interesting project and I myself have been trying something very similar in the past year or so! Last year, I wanted to do a crazy grade 8 science project, if I should state, where I wanted to make an 8-bit computer that runs pong. Didn't work out. But my plan B project based on the preliminary microcontroller experience I got due to the advice of the guy at the electronics store, helped me to easily do something using led matrices and logic ICs.

    After doing well on that, I eventually ended up making huge reforms to my original designs. The problem back then was that I didn't have much experience with making instruction sets. Anyways, in the future, as I have almost completed my first CPU (one out of 3 other large boards designed to add greater graphics capabilities, the BIOS, GPU, and Graphics BIOS), I will be posting a series of tutorials based on how I figured out how to design my computer. So if you need help, I can introduce you to the "SCHM8B series computing" method that I use when designing TTL Turing machines.

    One thing, I would advise not only using logic ICs that only contain logic gates. If you only want to use NANDs, ORs, XORs, etc. alone, than that's your choice but it's only a bit less complicated than only using transistors. In grade 9, I designed a 2-bit programmable Turing machine for a science ISP, but I calculated that it needed 1200+ transistors and I have to wire them from hand. Hence the simplifications and various failures narrowed it down to just two 2-bit registers.

    Anyways, as for the quote, my system will be running at 8 MHz which is perfectly fine for me. It's just a matter of calculating the maximum propagation delay for each instruction in nanoseconds. A single 8 MHz cycle is 125 nanoseconds and the average 74HC series chip has a delay of 18 to 20+ nanoseconds. So if an instruction requires the delay of an SRAM instruction register, a 74HC574 register, a 74HC139 decoder and a 74HC574 data register as a device being part of a destination, than the propagation delay of that instruction is the total delay of each chip (let's assume that the SRAM made an output in the previous cycle and only the delays of the following chips count.

    The SRAM IR I'm using has a delay of 55ns. The 74HC574 has a delay of 18ns, and the 74HC139 a delay of 18ns. So you total would be 18 + 18 + 18 = 54 nanoseconds which fits into the 8 MHz cycle. So yes, depending on the complexity of you architecture, you might be able to go faster (16 MHz has 62.5ns of space for propagation delay) or slower if there is too much delay, or fit the processing of each instruction over multiple clocks.

    I can help you with the design of you computer if you wish.
  16. AlekseiX86

    Thread Starter New Member

    Jun 22, 2013
    m4ch1n314ngu4g3 , thanks for your answer ,interesting information.

    I thought about the processor's commands and the idea came to me: commands must working directly with the bits, but not bytes.
    It seems to me that in this way I can get, let's say a "floating bit depth."
    Here is an example command:
    Format: team name, the operands
    001 adr val -> write value val in bit from RAM at the address adr
    010 adr val -> write value val in bit from Video RAM at the address adr
    011 val -> write value ​​to the current instruction address register (this command is analog goto, it can be used to creating cycles).

    And i was thinking how realize construction "if else".

    Well , at first compiller memorize count of command from true block (ab).
    Then count result of expression in "if(...)". It can be 0 or 1. Then i use goto :
    goto (adress of first true block command + (ab * !result))
    You can see it on image.
    Full link :
    Of course this is just a first draft (with something it is necessary to start) , and most likely commands will be more difficult ...
    Last edited: Aug 21, 2013
  17. m4ch1n314ngu4g3

    New Member

    Aug 20, 2013
    Yeah, in my instruction set, it's all about the bits. When you see the long list of commands from the Magic-1 in order from 0 to 255, one may think that each number specifically does one thing. But really, it's just putting them all in order rather than showing how individual bits affect the function of other bits.

    You can find my schematics and instruction set description in this thread at the bottom of the page in my message's attachments. That way you can get a general idea of using bits in a byte to select certain functions and how to make the circuitry execute the opcode as shown. It's all about registers, line decoders (demultiplexers), their outputs and how you connect them to the parts of the circuit to make them do certain things.