So I want to design a simple (4-bit) CPU and actually BUILD it (In real life )
Buut I need some help 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 I'm sure you can help me)

ps. I am using logisim for designing the thing.

pps. Will be posting the logisim file soon.


edit: changed topic title.
It depends how much stuff you want it to do. The first thing you need to do is define the opcode set for your processor (which should be as tiny as possible). That will help you define what you'll need in terms of logic.
Your requirements are awfully vague. Some generic pointers to resources:

I agree with Kerm in that you should define an ISA before trying to do much more. That's how I approached the task in my research paper.
Kerm, Tari: I have an instruction set, just haven't got around posting it <_<
well, once you have your instruction set, put together an ALU. if your instruction set just has ld, output, add, sub, and maybe or/xor, you can manage it with just a couple of circuits. a full adder and a 1's/2's compliment circuit should do it. then you just need to design a register for storing values, which you can do with flip-flops, and string it all together with some mux/demux magic. as for things that take multiple clock cycles, just have an enable on your input reader that's linked up to the ALU.
Hmm. I think I am making progress. I have a basical idea of what the instruction decoder will be, and I made a temporary list with the instructions.
I might switch from 4 to 8-bit instructions.
Why would you do that? That is going to make all of your logic four times as complex. Smile And post up your planned 4-bit instruction set so we can look it over with you.
Kerm, I won't be switching until I understand all the 4-bit logic Smile
Also this is the list of CPU tasks I made:
-load imm value into register: lit imm,#
-copy one register's content into another: mov #,#
-copy nibble from 8-bit memory address: get imm, imm (the 2 imms make up the 8-bit address)
-add up 2 registers: add #,#
-subtract 2 registers: sub #,#
-output 4-bit value to port: out #,imm (imm specifies the port)
-load a register from port: in #,imm
-display register value on a 7-segment display: disp #
It sounds like you should just stick with a 1-nibble opcode and 2-nibble data for all instructions, making all instructions 3 nibbles. Memory should be addressed nibble-wise. I disagree with your get imm,imm and the presumed put imm,imm. It should just be get imm (with, as always, a 2-nibble/1-byte imm) and get the two nibbles starting at that particular address. Also, is this a big-endian or little-endian machine?
Wait, I think you are misunderstanding the imm, which is 4-bits.
I guess there is no difference between big and little endian here since all values but the addressing are 4-bits.
aeTIos wrote:
Wait, I think you are misunderstanding the imm, which is 4-bits.
I guess there is no difference between big and little endian here since all values but the addressing are 4-bits.
All your imms should be a consistent size; I believe 8-bit would be best. This will ensure that all of your instructions will be the same width, which will make your life much easier.
Yeah the thing is that all my imms actually are 4-bits. So all my commands are 3 nibbles: 4-bit opcode, 8-bit data.
aeTIos wrote:
Yeah the thing is that all my imms actually are 4-bits. So all my commands are 3 nibbles: 4-bit opcode, 8-bit data.
OK, fair enough. Just be consistent about whether you refer to the argument to every command as two one-nibble immediates or one two-nibble immediate.
Any other remarks about the instruction set?
edit: also, when I'm going to build this, should I just wire everything together or so? Or is there something where I can put it on.
I found out that quite some components use IC for communicating. Could someone explain this protocol a bit and give a little schematic about how to interface with it? Thanks Very Happy
aeTIos wrote:
Any other remarks about the instruction set?
edit: also, when I'm going to build this, should I just wire everything together or so? Or is there something where I can put it on.
I found out that quite some components use IC for communicating. Could someone explain this protocol a bit and give a little schematic about how to interface with it? Thanks


You could make your processor on breadboard which is really easy to use because you don't have to solder. If you're going to make it out of like 7400 IC's it should fit on about 3/6 boards depending on how "deep" you want to go in building this thing from the ground up. I've seen people making processors using only transistors and resistors.
On the IS, I don't know how much RAM or registers you're going to use but the 7-segment display instruction can be build from the existing instructions (for example a mov to a special register).
What kind of processor layout are you thinking of using? If you want to keep it simple just use 1 bus and 1/2 general registers + maybe an accumulator. A flags register might be handy too. The control and decode logic is the most important for your processor. The control logic is going to control the buffers between different parts of your processor depending on the cycle and instruction. Because this is your first, don't try making pipelined cpu's.
You should also think about interrupts, these are asynchronous signals from (external) devices such as buttons/keyboard, if you want any I/O.

Don't know much about I2C but there should be information on the wikipedia page.
ehh... -.-' This project has long died. I recommend to first check timestamps of the last post in a thread before responding (A post in a topic that does not have any activity for months is considered a 'necropost')
aeTIos wrote:
ehh... -.-' This project has long died. I recommend to first check timestamps of the last post in a thread before responding (A post in a topic that does not have any activity for months is considered a 'necropost')
Indeed, but it sounds like he may be considering making a project like this of his own. Is that accurate, CptSemper? If so, I hope that you're planning to start a topic about it!
Lol, I checked it but I didn't see it was in 2010, haha! And yes, if I start a project like that I'll post a thread but don't expect anything in the near future, big school stuff coming up.
Well actually it was 2012 but in June.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are GMT - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement