Author Topic: Building a CPU!  (Read 10138 times)

0 Members and 1 Guest are viewing this topic.

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Building a CPU!
« on: May 28, 2012, 10:49:28 am »
So I want to design a simple (4-bit) CPU and actually BUILD it (In real life ;D)
Buut I need some halps I think. For example, how would I go about having multiple cycles for an instruction? How would I be doing the decoding?
As you see, I am not really experienced in building CPUs. :)(but imma sure you can halp me)

ps. I am using logisim for designing teh thingz


edit: changed the topic title to better fit the actual subject.
« Last Edit: May 29, 2012, 10:17:33 am by aeTIos »
I'm not a nerd but I pretend:

Offline Keoni29

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2466
  • Rating: +291/-16
    • View Profile
    • My electronics projects at 8times8
Re: Help on designing a cpu?
« Reply #1 on: May 29, 2012, 03:15:14 am »
My decoder desing is almost finished, but I don't know what your instruction set is. You see: my decoder works like this:
fetch instruction : pntcc in which
p=prefix (5th bit for data source selecting)
n=arguments (1\0)
t=type
cc specifies the instruction number
A 4017 counter is used to time everything. After the instruction is stored in the instruction register it increases the program counter. Now if the "n" bit is low it resets the counter. Otherwise the argument is written to the argument register. If the prefix is high it knows that the argument is the data required for the instruction. Otherwise it's an address, so it puts the argument on the address bus and executes the instruction with the data from that memory address.
If you like my work: why not give me an internet?








Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Building a CPU!
« Reply #2 on: May 29, 2012, 10:19:06 am »
I am making quite a bit progress by looking at how other people built processors.
Maybe I'll switch from 4 to 8 bits when that better suits my needs.
I'm not a nerd but I pretend:

Offline MGOS

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +95/-0
    • View Profile
Re: Building a CPU!
« Reply #3 on: May 29, 2012, 03:48:20 pm »
I built a 4 bit CPU in Minecraft, but I only allowed one cycle operations / instructions, that made it a lot easier. For the decoding I splitted the 12 bit instruction code into a 3 bit OP-code, a 4 bit data part and a 5 bit address part. The OP-code decoder works with an and-gate array selecting the data / address and putting it on the right bus. The special thing about the cpu is the fact that there are two address busses, one for writing and one for reading. That allows fast access of memory and one cycle operations like pushing and loading data from one place to another.
« Last Edit: May 29, 2012, 03:48:53 pm by MGOS »

Offline Keoni29

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2466
  • Rating: +291/-16
    • View Profile
    • My electronics projects at 8times8
Re: Building a CPU!
« Reply #4 on: May 29, 2012, 04:20:44 pm »
I built a 4 bit CPU in Minecraft, but I only allowed one cycle operations / instructions, that made it a lot easier. For the decoding I splitted the 12 bit instruction code into a 3 bit OP-code, a 4 bit data part and a 5 bit address part. The OP-code decoder works with an and-gate array selecting the data / address and putting it on the right bus. The special thing about the cpu is the fact that there are two address busses, one for writing and one for reading. That allows fast access of memory and one cycle operations like pushing and loading data from one place to another.
I don't think 12 bits parallel rom/ram exists irl, so you'll just have to use 8bits instead.
If you like my work: why not give me an internet?








Offline MGOS

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +95/-0
    • View Profile
Re: Building a CPU!
« Reply #5 on: May 29, 2012, 04:58:45 pm »
I don't think 12 bits parallel rom/ram exists irl, so you'll just have to use 8bits instead.
No, it doesn't exist yet, but why not try something new? I wanted to make it as narrow as possible to use only one memory cell for every single command.

If you plan making a bigger cpu, maybe use 16 bits. Or a different amount of 8 bit blocks depending on the instruction, but that will make it a bit more complicated.

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Building a CPU!
« Reply #6 on: May 29, 2012, 05:11:21 pm »
Most likely I'll be using 1-cycle instructions. Makes life so much easier. :) And I'll most likely be using 4 bit ram and 8 bit rom.
I'm not a nerd but I pretend:

Offline MGOS

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +95/-0
    • View Profile
Re: Building a CPU!
« Reply #7 on: May 29, 2012, 05:24:09 pm »
Most likely I'll be using 1-cycle instructions. Makes life so much easier. :) And I'll most likely be using 4 bit ram and 8 bit rom.

That's the same what I did, except for 12 bit for the rom, which makes life abit more easier (*MGOS wonders if that's correct english ΓΆΓΆ) cause the program loads the same speed the cpu cycles. I think you can't do that with any smaller width.

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Building a CPU!
« Reply #8 on: May 29, 2012, 05:33:10 pm »
if I really want it I can even just buy 16 bit mem :P
I'm not a nerd but I pretend:

Offline Keoni29

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2466
  • Rating: +291/-16
    • View Profile
    • My electronics projects at 8times8
Re: Building a CPU!
« Reply #9 on: May 30, 2012, 02:40:30 am »
if I really want it I can even just buy 16 bit mem :P
Then you'd have to shift the data out of the rom, since I don't think 16 bit paralel rom is very cheap, so I'd just go with 8 bit rom.

How many memory locations can you address atm?
« Last Edit: May 30, 2012, 02:41:06 am by Keoni29 »
If you like my work: why not give me an internet?








Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Building a CPU!
« Reply #10 on: May 30, 2012, 03:48:13 am »
I can access 256 mem locs.
I'm not a nerd but I pretend:

Offline Keoni29

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2466
  • Rating: +291/-16
    • View Profile
    • My electronics projects at 8times8
Re: Building a CPU!
« Reply #11 on: May 30, 2012, 05:33:46 am »
I can access 256 mem locs.
Ah, so you have an 8 bit wide address bus. Can you give me your instruction set? How long are your instructions?
If you like my work: why not give me an internet?








Offline p2

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 849
  • Rating: +51/-11
  • I'm back :)
    • View Profile
Re: Building a CPU!
« Reply #12 on: May 30, 2012, 05:55:36 am »
If you wanne see a Minecraft-CPU:
http://www.minecraftforum.net/videos/view-12942-redgame-minecrafts-most-powerfulin-functions-redstone-computer/page__st__5
It's a whole 10bit-computer, build in minecraft, and it's all really working! ;)
*insert supercool signature*

Offline Keoni29

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2466
  • Rating: +291/-16
    • View Profile
    • My electronics projects at 8times8
Re: Building a CPU!
« Reply #13 on: May 30, 2012, 06:01:59 am »
I tried using logisim, but I really don't know why they didn't label the pins. I have no idea what to do XD
If you like my work: why not give me an internet?








Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Building a CPU!
« Reply #14 on: May 30, 2012, 07:40:46 am »
Keoni labeling in what way?
I'm not a nerd but I pretend: