All About Circuits Forum  

Go Back   All About Circuits Forum > Blogs > MITCH electronics

Notices

Rating: 2 votes, 5.00 average.

A new new new simple computer

Posted 06-03-2011 at 08:54 PM by MITCH electronics

Hey everyone,

I know, im that bad! This is my FIFTH CPU design. This time, im keeping to kiss (keep it simple stupid). I have spent time designing this one internal bus four bit computer. It has a small number of instructions as listed below:

Code:
Add(ab):
Adds the two registers A and B together and placing the result in a

Add(an):
Adds the operand to the register a and place the result into a

Sub(ab):
Subtracts the two registers A and B together and placing the result in a

Sub(an):
Subtracts the operand to the register a and place the result into a

LD A:
Sets register A to a value:

LD B:
Sets register B to a value:

LD (n),A:
Saves register A to location n:

LD A,(n):
Loads register A form location n:

JP Z:
Jump to n if the zero flag is set

JP NZ:
Jump to n if the negated zero flag is set

MOV AB:
Move A to B

MOV BA:
Move B to A

RESET:
Resets the registers, PC and just about everything

HLT:
Halt the program
Its was easy to design the initial design as i came up with a cool little idea. It may already be used by others but i have never seen it before.

Ok, so my problem was this. I want to beable to enable and disable buffers, but not by keeping the enable lines at a logic state but to toggle them. So i use a 4013 D type flip flop and connect the compliment Q to the data pin. So when you pulse a signal on the clock line it toggles state. That way, toggle it once, its on. Toggle the same line again, its off etc

I have finished the ALU today and i must say it works beautifully . Funny thing really i though the zero flag was not working but it turned out that because the 4585 comparator is connected in parallel to the LEDS on the output bus the LED's where like 0 ohm resistors and there for taking the current away from the 4585 input pins!

Today i started work on the register board which is also the main board that connects to the ALU and program control + flow board. Cant wait XD!!!

Oh, one more thing, here is a list of internal control lines

Code:
1 - Clock register A
2 - Clock register B
3 - Toggle Register A to data bus flag
4 - Toggle Register B to data bus flag
5 - Toggle Register B to ALU flag
6 - Toggle data bus to ALU flag
7 - Clock Work register
8 - Toggle Work register to data bus flag
9 - Toggle Zero Flag
10 - Toggle return address flag
11 - Clock return address
12 - Initiate jump (if zero)
13 - Increment PC
14 - TOggle Read Line
15 - TOggle write Line
16 - TOggle Enable Line
17 - Reset all flags
18 - Halt flag on
19 - Toggle enable word n
20 - Load PC
21 - Initiate jump (if not zero)
22 - Next instruction (all instructions have this at the end)
Any questions, just shout them out !!!
Posted in Uncategorized
Views 4498 Comments 3
Total Comments 3

Comments

  1. Old Comment
    Bill_Marsden's Avatar
    Just curious, have you ever learned to write assy or machine code with any other processor? Something like the 4004 perhaps?

    The 6502 op code set was written from scratch, which means it is highly organized and the op code set relates to its neighbor.

    When you make an op code set from scratch (lets say a 4 bit processor), lay out a table 4X4. This is the matrix for the command set (op codes). If it were an 8 bit processor then use a 8 X 8 table. If you look up the old 8008 op code set this is exactly how it was presented, there are some very good reasons it was done this way.
    Posted 06-04-2011 at 07:00 AM by Bill_Marsden Bill_Marsden is offline
  2. Old Comment
    MITCH electronics's Avatar
    Sorry for the disappointment, z80 only :/

    Why would one make a table for the op codes?
    Posted 06-04-2011 at 07:14 AM by MITCH electronics MITCH electronics is offline
  3. Old Comment
    Bill_Marsden's Avatar
    Partly because it meshes nicely into how a CPU works. With 4 bits you can only have 16 op codes, with 8 you can have 256 op codes.

    It also helps interpreting the op code set, as it groups similar command sets pretty automatically. There will be certain binary numbers similar to each other.

    It also makes looking up the command simpler, instead of a long list (with possibly 256 entries) it is laid out in a compact format.

    A quick look at google showed a site where they were laid out for the 8008. Since this was the first 8 bit CPU in that family they hadn't gotten too mixed up yet.

    http://www.pastraiser.com/cpu/i8008/i8008_opcodes.html

    Looking at the 4004 op code set it appears I was wrong about the number of commands, however, it still has something to teach...

    http://www.pastraiser.com/cpu/i4004/i4004_opcodes.html

    Memory structure is partly designed around op codes. With an 8 bit CPU a typical command sequence is:

    <op code> Low High

    The Low High is the width of the data path (8 bits), and can refer to a memory cell, simple binary math, or whatever.

    It is the reason typical 8 bit computers have 64K of 8 bits, it is 8 bytes X 8 bytes for addressing. You don't need to have a full 64K, but that is what is easiest achieved, while more RAM requires bank switching (each bank is 64K) and adds to the complexity of programming.

    Here is the set for one of my favorite machines, the C64 and the 6502 (actually the C64 used a 6510, but the commands are identical).

    http://www.oxyron.de/html/opcodes02.html

    There is a lot to be learned by studying prior art.
    Posted 06-04-2011 at 10:54 AM by Bill_Marsden Bill_Marsden is offline
    Updated 06-04-2011 at 11:12 AM by Bill_Marsden
 
Total Trackbacks 0

Trackbacks

 

All times are GMT. The time now is 03:20 PM.


User-posted content, unless source quoted, is licensed under a Creative Commons Public Domain License.
Powered by vBulletin
Copyright ©2000 - 2014, vBulletin Solutions, Inc.