Some years ago I started two hobbies that have now become my favourite things to do: OSdev'ing, and learning how a processor works. I will here present to you the last mentioned hobby of mine!
I have built many (5-6) processors since I started this little project of learning how a computer works. It started at a 4-bit CPU. Then 8-bits. Then pipelining. Then no pipelining again (I never really got my head around it... ). Then I expanded with some cool features like calls, conditional jumps and stacks.
Now I have finally created something that might be worth sharing!
This is the BASIC MC-162C. It's a 16-bit processor made in a logic simulation program call Logisim.
The processor has the following key features:
- - General purpose registers: AX, BX, CX, DX. All four can be split to AH, AL, BH, BL etc.
- Special Purpose registers: PC, SP, BP, CR and more advanced registers to control interrupt procedures
- Both 16-bit and 8-bit operating mode
- Interrupts
- Conditional and unconditional jumping
- Stack mechanisms
- Call/return mechanisms
- 16-bit address bus (64KB of memory)
- In/out-instructions (also 16-bit)
-A ROM-chip can be connected, and 'shade' an area of RAM. Then it can later be disabled (By clearing a bit in the control register) to 'free' the shaded RAM-area.
You can download a complete pack HERE!
This package includes:
- - The processor itself (BASIC MC-162C.circ)
- The BASIC CHIPS library needed in logisim (BASIC CHIPS.circ)
- A manual, to get started with the processor (Not completed... yet.) (BASIC MC-162C Manual.odt)
- My own personal notes and plans, for those interested... also, this contains the instruction table! (BASIC MC-162C Plans.odt)
- The microcode for the processors control logic (You don't really need this to get it running...) (MICROCODE.bin)
- Logisim itself
When you start up logisim, open 'BASIC MC-162C.circ'. It might ask you to locate 'BASIC CHIPS.circ'. This is the file included.
When loaded you should see a chip with 16 wires going out from each side. Underneath this you'll see another chip, with a lot of numbers on it. This the RAM-chip. Right click this, and select 'Edit contents' to enter your program here.
To start the simulation, go to the menu bar -> Simulate -> Simulation Enabled (Check this)
To start the clock (And start the processor), go to the menu bar -> Simulate -> Ticks Enabled (Check this).
To speed up the clock, go to the menu bar -> Simulate -> Tick Frequenzy -> Then select a preferred rate. (There is a maximum that your computer can handle though... Mine is around 40-50 hz...)
Have fun with my little baby!
If you have any questions or comments, just post below! Thanks