Author Topic: Homemade 8bit CPU & computer from scratch project  (Read 9489 times)

0 Members and 1 Guest are viewing this topic.

Offline PauloConstantinoTopic starter

  • Regular Contributor
  • *
  • !
  • Posts: 154
  • Country: gb
Homemade 8bit CPU & computer from scratch project
« on: May 31, 2017, 12:09:16 am »
Hi friends.

I just wanted to share my project with you guys. Maybe give out some inspiration  like I was inspired to do this before.

Some time ago I decided to build a CPU from scratch, using only the 74HC series of IC's: gates, counters, flip flops and so on.

It took me some time to get the design to the point I wanted. It would be built on breadboards at first for testing, and then probably transferred into wirewrap boards. I decided for an 8bit CPU because a 16bit one would require just too much wiring. The first CPU I designed was pretty much an 8085, with interrupts and DMA and most of the 8085 instruction set.

However, it would take a good while to build, so I decided to design a simpler CPU, that I could build in a few days, with just basic instructions for arithmetic and logic, data transfer between registers and memories and so on. No stack, or calls.  This CPU is microcoded, meaning the control word that controls the CPU is stored in ROMS (4 ROMS in this case).

There are 2 8bit registers A and B, an 8bit ALU, 256 bytes of RAM ( :) ), a programming mode whereby you can enter programs into the RAM for execution, and that's basically it. There are only 256 bytes of RAM because this simplified the microcode for me, so I could finish it faster, but it's easy to expand the memory system and I will do this later.

I built everything in about a week, and designed a program in C to compile the microcode so I could store it in the 4 ROMS. Basically all instructions in this CPU are customizable, and one can create new instructions up with to 64 clock cycles. One only needs to give the instruction a number from 0x00 to 0xFF, and declare the control words for each clock cycle for the nstruction.

I still have some work to do. I still need to add a few input/output ports, an HEX keypad for input, and a few LCD's for output.

But here is a photo of the result so far.

If you are interested, I can send you the schematics.

Thanks a lot!

 
The following users thanked this post: wilfred, edavid

Offline mariush

  • Super Contributor
  • ***
  • Posts: 5141
  • Country: ro
  • .
Re: Homemade 8bit CPU & computer from scratch project
« Reply #1 on: May 31, 2017, 12:23:15 am »
That thing SCREAMS to be moved over to prototyping boards, at least for the parts that you won't change often.

Here's a suggestion : http://uk.farnell.com/roth-elektronik/re520-hp/pcb-prototyp-fr2-stripes-2-54mm/dp/1172154

Good quality, very easy to separate chunks of strips just by cutting or by enlarging the hole with a drill, and very easy to add solder to strips to increase the current and lower track resistance.

And you could also use potentially more reliable 2.54mm spaced connectors and ribbon cable.. here's some suggestions : http://uk.farnell.com/w/c/cable-wire-cable-assemblies/cable-assemblies/ribbon-cable-flat-cable-assemblies?connector-pitch=2.54mm
 
 

Offline PauloConstantinoTopic starter

  • Regular Contributor
  • *
  • !
  • Posts: 154
  • Country: gb
Re: Homemade 8bit CPU & computer from scratch project
« Reply #2 on: May 31, 2017, 12:35:32 am »
That thing SCREAMS to be moved over to prototyping boards, at least for the parts that you won't change often.

Here's a suggestion : http://uk.farnell.com/roth-elektronik/re520-hp/pcb-prototyp-fr2-stripes-2-54mm/dp/1172154

Good quality, very easy to separate chunks of strips just by cutting or by enlarging the hole with a drill, and very easy to add solder to strips to increase the current and lower track resistance.

And you could also use potentially more reliable 2.54mm spaced connectors and ribbon cable.. here's some suggestions : http://uk.farnell.com/w/c/cable-wire-cable-assemblies/cable-assemblies/ribbon-cable-flat-cable-assemblies?connector-pitch=2.54mm


Hello Mariush,

Thanks for your comment. I am looking forwards to transferring the design into permanent boards once the testing is completed. I have around 8 high quality wirewrap boards here ready.  The only annoying thing for me is that these wirewrap boards are not that friendly for making buses because the pins are all spread out, so it requires connecting the pins together to form buses.

Here's a photo:

 

Offline MK14

  • Super Contributor
  • ***
  • Posts: 4952
  • Country: gb
Re: Homemade 8bit CPU & computer from scratch project
« Reply #3 on: May 31, 2017, 01:48:44 am »
Has it got a shift RIGHT instruction (now, as what I think was your earlier one, seemed to be missing it) ?
Hence divide by 2.

Although it may not have a direct shift left, something on the lines of (your) ADD A,A is effectively a shift left instruction.
« Last Edit: May 31, 2017, 01:59:09 am by MK14 »
 

Offline mariush

  • Super Contributor
  • ***
  • Posts: 5141
  • Country: ro
  • .
Re: Homemade 8bit CPU & computer from scratch project
« Reply #4 on: May 31, 2017, 02:59:45 am »


Hello Mariush,

Thanks for your comment. I am looking forwards to transferring the design into permanent boards once the testing is completed. I have around 8 high quality wirewrap boards here ready.  The only annoying thing for me is that these wirewrap boards are not that friendly for making buses because the pins are all spread out, so it requires connecting the pins together to form buses.

Here's a photo:


Those cards are nice but I think you should save them for other projects.
These prototyping boards with continuous strips would be far more suitable and i don't think your project would take
 advantage of some of the benefits of wirewrap vs soldered connections. The strips of copper would also allow to quickly
 rearrange wires (traces) just by using tiny pieces of solid core wires (jumper wires) on the top side and the 0.1" spacing
allows you to use cheap connectors.
you could also use right angle connectors at each pcb edge to make a sort of backplane/bus (to use a flat ribbon cable to connect
 multiple such cards together.

You could also stack the easier with regular spacers (by enlarging some holes in corners)
The wirewrap pins would still make your boards hard to follow (look like a forest of wires and pins)

// m key acts up on my laptop. apologies for missing letters.
 

Offline PauloConstantinoTopic starter

  • Regular Contributor
  • *
  • !
  • Posts: 154
  • Country: gb
Re: Homemade 8bit CPU & computer from scratch project
« Reply #5 on: May 31, 2017, 03:09:01 am »
It doesn't have Shift instructions, but they can be implemented easily in hardware or even software. Why ?
 

Offline PauloConstantinoTopic starter

  • Regular Contributor
  • *
  • !
  • Posts: 154
  • Country: gb
Re: Homemade 8bit CPU & computer from scratch project
« Reply #6 on: May 31, 2017, 03:13:55 am »


Hello Mariush,

Thanks for your comment. I am looking forwards to transferring the design into permanent boards once the testing is completed. I have around 8 high quality wirewrap boards here ready.  The only annoying thing for me is that these wirewrap boards are not that friendly for making buses because the pins are all spread out, so it requires connecting the pins together to form buses.

Here's a photo:


Those cards are nice but I think you should save them for other projects.
These prototyping boards with continuous strips would be far more suitable and i don't think your project would take
 advantage of some of the benefits of wirewrap vs soldered connections. The strips of copper would also allow to quickly
 rearrange wires (traces) just by using tiny pieces of solid core wires (jumper wires) on the top side and the 0.1" spacing
allows you to use cheap connectors.
you could also use right angle connectors at each pcb edge to make a sort of backplane/bus (to use a flat ribbon cable to connect
 multiple such cards together.

You could also stack the easier with regular spacers (by enlarging some holes in corners)
The wirewrap pins would still make your boards hard to follow (look like a forest of wires and pins)

// m key acts up on my laptop. apologies for missing letters.

What do you mean my project wouldnt take advantage of wirewrap boards ?
 

Offline MK14

  • Super Contributor
  • ***
  • Posts: 4952
  • Country: gb
Re: Homemade 8bit CPU & computer from scratch project
« Reply #7 on: May 31, 2017, 03:24:53 am »
It doesn't have Shift instructions, but they can be implemented easily in hardware or even software. Why ?

WHY?:Part1 of 2
Because you need them, to perform things like multiply/divide and other functions.

It CAN be done in software. But that could end up being considerably slower than having them as built in instructions.

WHY?:Part2 of 2
I noticed they seemed to be missing, when I read through your list of instructions (from maybe an older version).

If your intention is just to have something which is educational and a bare minimum, to get an 8 bit processor to work. I can see why you are missing them.
But if your intention is to have a reasonably complete set of instructions, then they would be best included with it.
 

Offline PauloConstantinoTopic starter

  • Regular Contributor
  • *
  • !
  • Posts: 154
  • Country: gb
Re: Homemade 8bit CPU & computer from scratch project
« Reply #8 on: May 31, 2017, 03:33:16 am »
Where did you read about my work before? I don't remember posting it in here before.

I know it can be done by software, that's why I omitted it from this simple CPU. The point of this CPU was that it would be quick to build. The other CPU I designed does have shift instructions.
 

Offline MK14

  • Super Contributor
  • ***
  • Posts: 4952
  • Country: gb
Re: Homemade 8bit CPU & computer from scratch project
« Reply #9 on: May 31, 2017, 03:53:53 am »
Where did you read about my work before? I don't remember posting it in here before.

I know it can be done by software, that's why I omitted it from this simple CPU. The point of this CPU was that it would be quick to build. The other CPU I designed does have shift instructions.

I did NOT link to where, as I presumed you wanted to keep quiet about other stuff, you may or may not have published on the internet (not on this forum). (It is NOT for me, to decide what you want to reveal or not, on this forum).

The list of instructions, are the one included at the bottom, just after the big schematic of the whole thing.
It has many instructions, but does not seem to mention any bit shifting ones. (It could be the list changed in time by you, but was not updated, online).
It does mention arithmetic, compare, various conditional branches, subroutine, move, stack and maybe others, in the list.

If you are going 100% minimalistic, totally bare bones, then I can understand why some things are missing from it. No problem.

« Last Edit: May 31, 2017, 04:00:02 am by MK14 »
 

Offline PauloConstantinoTopic starter

  • Regular Contributor
  • *
  • !
  • Posts: 154
  • Country: gb
Re: Homemade 8bit CPU & computer from scratch project
« Reply #10 on: May 31, 2017, 04:02:44 am »
Ah so you saw it on my website! Cool. That's nice. That CPU was actually the very first I designed, and it's outdated and actually not a good one. I just haven't updated the website yet! :)

 

Offline MK14

  • Super Contributor
  • ***
  • Posts: 4952
  • Country: gb
Re: Homemade 8bit CPU & computer from scratch project
« Reply #11 on: May 31, 2017, 04:29:11 am »
Ah so you saw it on my website! Cool. That's nice. That CPU was actually the very first I designed, and it's outdated and actually not a good one. I just haven't updated the website yet! :)

Yes, that is where I got the extra details from.

At least one person, who designed an early, homebrew all TTL computer (and now works for Google as a result). Actually powers his entire website, via that same computer. He even allows random users (us lot), to log onto it for free, and play around with his minimalistic, Unix (like) environment.
I've had great fun (in the past), both reading, watching (youtube) and even logging in and playing with his homebrew TTL computer. It is really cool!



"Google engineer builds PC from scratch"

« Last Edit: May 31, 2017, 04:31:14 am by MK14 »
 

Offline PauloConstantinoTopic starter

  • Regular Contributor
  • *
  • !
  • Posts: 154
  • Country: gb
Re: Homemade 8bit CPU & computer from scratch project
« Reply #12 on: May 31, 2017, 06:23:26 am »
I know Bill Buzbee and his Magic-1. He's an online friend of mine, and his work has inspired me a lot. I've exchanged many e-mails with him! :) He's a very cool guy and a lovely person. Very friendly and helpful.  Thanks for sharing anyhow. I love his videos! :)
« Last Edit: May 31, 2017, 06:27:05 am by PauloConstantino »
 
The following users thanked this post: MK14

Offline MK14

  • Super Contributor
  • ***
  • Posts: 4952
  • Country: gb
Re: Homemade 8bit CPU & computer from scratch project
« Reply #13 on: May 31, 2017, 06:28:23 am »
I know Bill Buzbee and his Magic-1. He's an online friend of mine, and his work has inspired me a lot. I've exchanged many e-mails with him! :) He's a very cool guy and a lovely person. Very friendly and helpful.

I can imagine, he is a very nice and extremely interesting/knowledgeable/inspiring person to know. Congratulations!

It was interesting to find out, how he used a reconfigurable compiler (C) to make a compiler available for his one of a kind computer (instruction set). Then compiling a minimalistic operation system for it (Unix like), is just magic! (excuse the pun with the computers name). Hence making his computer, rather useable, even by people anywhere on the planet.

I would love to do something like that. But there is limited time (24/7, 52 weeks and 0..200+ years left), and so many other projects I can/could do ...
But maybe one day, I might.
« Last Edit: May 31, 2017, 06:38:18 am by MK14 »
 

Offline PauloConstantinoTopic starter

  • Regular Contributor
  • *
  • !
  • Posts: 154
  • Country: gb
Re: Homemade 8bit CPU & computer from scratch project
« Reply #14 on: May 31, 2017, 06:48:44 am »
It's simpler than it seems. He is a compiler guy, so retargetting the compiler was easy for him. The most suttle part of all the design is handling interrupts and DMA, but that's not so difficult either. The computer I designed is very similar to his (not this one I posted, this is the simplified version), except that it is 8bits rather than his 16bit one. 16bit requires double the amount of wiring so it's terrible to build with breadboards or even wirewrap. However, designing a pcb kinda takes the magic away from doing it by hand. It took him 4 years or so to complete his computer!

If you want to build a simple one I can send you my schematics so you can have a look what it is about in case you don't know.
 
The following users thanked this post: MK14

Offline MK14

  • Super Contributor
  • ***
  • Posts: 4952
  • Country: gb
Re: Homemade 8bit CPU & computer from scratch project
« Reply #15 on: May 31, 2017, 07:12:23 am »
There are so many different ways of doing things like that. I can be torn by all the different possibilities. I will give you some actual examples:

==>>Doing it all on an FPGA (or CPLD). It means that even quite big and complex designs can be experimented with. With little worries about costs, it getting too big physically or how long it will take to physically build etc.
It also will probably run at a much higher clock speed, than something built out of transistors or TTL.

==>>Going all (or mostly) discrete transistor. But one has to be extremely careful, to avoid such a project going out of control. Because it can soon become impractically big (and hence very expensive and power hungry). Which someone else demonstrated here:

Quote
This whopping 16-bit computer processor is being built by hand, transistor by transistor
Cambridge Brit to wire up 14,000 gates, 3,500 LEDs
https://www.theregister.co.uk/2015/06/23/brit_mega_processor/







==>>TTL like you and others. But the older TTL (such as LS) are getting harder, and harder to obtain, and even HC types are not necessarily fully available, especially in through hole.

==>>Doing a retro like, Microprocessor, build. E.g. Motorola/Hitachi 68000 or Z80/6502/6800 etc. These are probably old enough now, to count as retro (vintage like).

I think you can buy, Motherboard kits. Which allow you to build (as a kit), a complete, vintage 8086, working PC motherboard. I am very tempted by these. They are something like $150+ or so. Hence you can make an entire vintage PC (8086), yourself, with the kits.

==>>Don't get me started talking about an all valve/tube, retro cpu/computer design, with core memory. If you think that is a totally crazy idea, then look through this forum. Because at least one of the posters, has wound his own core memory devices, and put youtube videos, of his experiments with them. Which were then used to make a useful project for him.

--------------------------------------------------------------------------------------------------------------------------------

Currently, I favor starting with the FPGA route. Because learning more about FPGA's, is a useful/fun skill, anyway. It is a relatively cheap way, as well. With the FPGA obtainable, ready assembled in developer board format.
If you get it dramatically wrong, it is real quick and easy to correct. Unlike large/complicated physical builds.

Thanks for the kind offer of the schematics. But a big part of the fun element for me, would be designing it, completely by myself.
« Last Edit: May 31, 2017, 07:21:59 am by MK14 »
 

Offline PauloConstantinoTopic starter

  • Regular Contributor
  • *
  • !
  • Posts: 154
  • Country: gb
Re: Homemade 8bit CPU & computer from scratch project
« Reply #16 on: May 31, 2017, 07:17:27 am »
I know the megaprocessor too. That guy is brave. I think FPGA's also take the magic away. Hardware design is fun for hardware engineers. Coding FPGA's is halfway between software and hardware. Anyway, the fun for me is designing it by hand using logic gates.

Yes I agree about the schems. But if you're starting out, you need to have an idea of how it is done, because it's not very obvious how to start.
 

Offline MK14

  • Super Contributor
  • ***
  • Posts: 4952
  • Country: gb
Re: Homemade 8bit CPU & computer from scratch project
« Reply #17 on: May 31, 2017, 07:32:35 am »
I know the megaprocessor too. That guy is brave. I think FPGA's also take the magic away. Hardware design is fun for hardware engineers. Coding FPGA's is halfway between software and hardware. Anyway, the fun for me is designing it by hand using logic gates.

Yes I agree about the schems. But if you're starting out, you need to have an idea of how it is done, because it's not very obvious how to start.

To me it is fairly obvious how to do it. (Probably because of other digital/computer stuff, I have learnt about, experienced or been involved with in some way, such as building in kit form or something). Or even reading about how such things are done, over the years. So maybe I'm claiming it is "obvious", but it was partly taught, really.

Until you start talking about super fast floating point multipliers/dividers, such as what the Cray1 super computer had. But maybe it is not that hard to do, in practice.

I understand what you mean, as regards the FPGA. But they do allow you to have many millions or even 10+ millions of custom gates. Which would probably be impracticable, to build physically. Hence allowing sophisticated 64 bit, pipelined cpus to be implemented.
It can also compute things, VERY quickly. Because of reasonable clock frequencies (e.g. > 100 MHz) and mass parallelable/pipelined circuits.

But I agree, building it out of raw parts, such as Valves/tubes, Transistors, TTL, ECL, Relays etc. Is going to be a lot more fun.

Projects/career wise. FPGAs are a useful skill, to have/improve. So you sort of get two birds with one stone, by doing it with FPGAs.
« Last Edit: May 31, 2017, 07:49:36 am by MK14 »
 

Offline fourtytwo42

  • Super Contributor
  • ***
  • Posts: 1201
  • Country: gb
  • Interested in all things green/ECO NOT political
Re: Homemade 8bit CPU & computer from scratch project
« Reply #18 on: May 31, 2017, 08:16:10 am »
That thing SCREAMS to be moved over to prototyping boards, at least for the parts that you won't change often.

Here's a suggestion : http://uk.farnell.com/roth-elektronik/re520-hp/pcb-prototyp-fr2-stripes-2-54mm/dp/1172154

Good quality, very easy to separate chunks of strips just by cutting or by enlarging the hole with a drill, and very easy to add solder to strips to increase the current and lower track resistance.

And you could also use potentially more reliable 2.54mm spaced connectors and ribbon cable.. here's some suggestions : http://uk.farnell.com/w/c/cable-wire-cable-assemblies/cable-assemblies/ribbon-cable-flat-cable-assemblies?connector-pitch=2.54mm
Hi Paulo :) What a wonderful project, reminds me very much of life in the 70's surrounded by these things, I used to both repair them and fix design faults, later still design my own, mostly 74S & H (HOT). Out of interest what clock speed re you able to obtain with that construction ?
 

Offline PauloConstantinoTopic starter

  • Regular Contributor
  • *
  • !
  • Posts: 154
  • Country: gb
Re: Homemade 8bit CPU & computer from scratch project
« Reply #19 on: May 31, 2017, 08:52:51 am »
That thing SCREAMS to be moved over to prototyping boards, at least for the parts that you won't change often.

Here's a suggestion : http://uk.farnell.com/roth-elektronik/re520-hp/pcb-prototyp-fr2-stripes-2-54mm/dp/1172154

Good quality, very easy to separate chunks of strips just by cutting or by enlarging the hole with a drill, and very easy to add solder to strips to increase the current and lower track resistance.

And you could also use potentially more reliable 2.54mm spaced connectors and ribbon cable.. here's some suggestions : http://uk.farnell.com/w/c/cable-wire-cable-assemblies/cable-assemblies/ribbon-cable-flat-cable-assemblies?connector-pitch=2.54mm
Hi Paulo :) What a wonderful project, reminds me very much of life in the 70's surrounded by these things, I used to both repair them and fix design faults, later still design my own, mostly 74S & H (HOT). Out of interest what clock speed re you able to obtain with that construction ?

Hi there and thanks. I'm still using the manual clock for testing but I predict it will reach 4MHz or so. Glad you like it! The point of it is being vintage indeed:)
 

Offline fourtytwo42

  • Super Contributor
  • ***
  • Posts: 1201
  • Country: gb
  • Interested in all things green/ECO NOT political
Re: Homemade 8bit CPU & computer from scratch project
« Reply #20 on: May 31, 2017, 09:13:01 am »
Hi Paulo I got the wrong quote! ALU's we used to use were 74S181 4 bit in big package, they were called MSI (Medium Scale Integration) vs SSI (Small Scale Integration) for gates etc. I still have the schematics (somewhere) for a 16 bit 0.8MIP CPU with no PALS circa 1972 that I used to do a lot of work on :)
 

Offline MK14

  • Super Contributor
  • ***
  • Posts: 4952
  • Country: gb
Re: Homemade 8bit CPU & computer from scratch project
« Reply #21 on: May 31, 2017, 09:28:34 am »
Hi Paulo I got the wrong quote! ALU's we used to use were 74S181 4 bit in big package, they were called MSI (Medium Scale Integration) vs SSI (Small Scale Integration) for gates etc. I still have the schematics (somewhere) for a 16 bit 0.8MIP CPU with no PALS circa 1972 that I used to do a lot of work on :)

Was it an ICL 1904S, with a 500ns semiconductor store ?

https://en.wikipedia.org/wiki/ICT_1900_series
 

Offline fourtytwo42

  • Super Contributor
  • ***
  • Posts: 1201
  • Country: gb
  • Interested in all things green/ECO NOT political
Re: Homemade 8bit CPU & computer from scratch project
« Reply #22 on: May 31, 2017, 09:38:30 am »
Hi Paulo I got the wrong quote! ALU's we used to use were 74S181 4 bit in big package, they were called MSI (Medium Scale Integration) vs SSI (Small Scale Integration) for gates etc. I still have the schematics (somewhere) for a 16 bit 0.8MIP CPU with no PALS circa 1972 that I used to do a lot of work on :)
Was it an ICL 1904S, with a 500ns semiconductor store ?
Nope it was a Computek 200 intelligent terminal used to spoof mainframe remote batch terminals and the like, loads of synchronous comms software :) memory was silicon, high voltage drive 1103's I recall using MH0026 clock drivers that would regularly burn. At that time I preferred working on core stores in the likes of Data General Nova's but I am drifting off thread here....sorry Paulo :)
 
The following users thanked this post: MK14

Offline PauloConstantinoTopic starter

  • Regular Contributor
  • *
  • !
  • Posts: 154
  • Country: gb
Re: Homemade 8bit CPU & computer from scratch project
« Reply #23 on: May 31, 2017, 01:04:27 pm »
Hi Paulo I got the wrong quote! ALU's we used to use were 74S181 4 bit in big package, they were called MSI (Medium Scale Integration) vs SSI (Small Scale Integration) for gates etc. I still have the schematics (somewhere) for a 16 bit 0.8MIP CPU with no PALS circa 1972 that I used to do a lot of work on :)
Was it an ICL 1904S, with a 500ns semiconductor store ?
Nope it was a Computek 200 intelligent terminal used to spoof mainframe remote batch terminals and the like, loads of synchronous comms software :) memory was silicon, high voltage drive 1103's I recall using MH0026 clock drivers that would regularly burn. At that time I preferred working on core stores in the likes of Data General Nova's but I am drifting off thread here....sorry Paulo :)

I'm using the 74HC181 ALU in this project. :)
 
The following users thanked this post: fourtytwo42

Offline PauloConstantinoTopic starter

  • Regular Contributor
  • *
  • !
  • Posts: 154
  • Country: gb
Re: Homemade 8bit CPU & computer from scratch project
« Reply #24 on: May 31, 2017, 01:07:16 pm »
I've attached the schematics here as an Image for those interested.
 
The following users thanked this post: fourtytwo42


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf