Omnimaga
General Discussion => Technology and Development => Other => Topic started by: aeTIos 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.
-
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.
-
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 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 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.
-
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.
-
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.
-
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.
-
if I really want it I can even just buy 16 bit mem :P
-
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?
-
I can access 256 mem locs.
-
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 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! ;)
-
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
-
Keoni labeling in what way?
-
Ah I found out that you can see what a pin does by hovering the cursor over it, but it's still very inconveniënt. There are no built in decade counters and the clock is very slow. Even at 1 tick :P
-
Why is the clock slow O.o 4.1 khz is good enough I guess
-
Why is the clock slow O.o 4.1 khz is good enough I guess
I'd go with 2Mhz (for my cpu irl)
-
Hmm I really should pick up this project again. I'm kinda worried about the very limited address space. The address bus is only 8 bits wide so I can address 256 bytes of ram and programs can only be 256 chars long. Well this is my first cpu, so... good nuff. 4 bits cpu is not enough to run decent applications on so... it's used for control applications and or simple mathematical operations. The cpu will run trough 256 bytes in about 0.256 ms @2Mhz
-
Hmm I really should pick up this project again. I'm kinda worried about the very limited address space. The address bus is only 8 bits wide so I can address 256 bytes of ram and programs can only be 256 chars long.
You can use paged addressing to increase the memory, if need be.
-
Well I kinda have that right now. I got 16 bytes pages and I got a register for selecting the page which allows me to have 8 bit addresses on a 4 bit machine. I can do basic math with the register when I rotate it into the accumulator.