Close
0%
0%

Plasma Cortex: open source CPU in VHDL!

This CPU was designed for efficiency and simplicity, while staying an effective and useful design.

Public Chat
Similar projects worth following
My Plasma Cortex design is aging now, but I am just getting it up on HaD.

Plasma Cortex specs:
* 32 bit design, and 8 registers
* mostly simple instructions with a few complex yet useful goodies
* VBCC compiler backend
* assembler and linker written in python

The CPU already has a compiler, assembler, and linker. Currently the linker is limited but it works.

PROCESSOR SPECIFICATIONS

  • 32 bit design
  • 8 registers, including 4 general purpose registers
  • up to 4 GB of RAM without banking
  • Written in VHDL for easy FPGA implementation
  • VBCC C compiler seems to work!

I designed it to be simple, effective, and useful.  I have gotten pretty far with it, and I eventually would like to port python and Java.

The instruction set is, in my opinion the biggest advancement. It is more RISC than my older designs, allowing me to build processors that are less complex, use less logic, and have faster clock speeds in FPGAs.

Admittedly, I have not done much with the CPU yet, so although I have developed it a lot, it still has not been used much in the real world.

The whole idea was to make a simple yet powerful CPU.  Powerful meant having extra useful instructions (like lodsb), but mostly having fast and simple instructions, and being 32 bits.  I wanted each instruction that did not take in a constant to be one byte, so I utilized my understanding of 8-bit CPU architectures to design a fast and simple instruction set.  The register names are from x86 CPUs, but most of the instruction set itself is actually based off the Z80 instruction set, the only other instruction set I know intimately enough to use.

I still have some ideas to make the CPU even faster and the instruction set simpler, too.

  • 1 × Xilinx Spartan 6 LX9 FPGA An awesome FPGA I use :D

  • Added most stack instructions

    Dylan Brophy08/05/2018 at 23:22 2 comments

    I needed to re-add the stack instructions to make the CPU work.

    As some saw in the HDD crash project log on the #DEXT Meteor project, I lost the VHDL code for the latest version of the Plasma Cortex processor.  That version had most of the instructions already implemented, and the old version I had a backup of did not have all those instructions.  Today I added the four main stack instructions for my CPU:

    CALL address
    PUSH register
    POP  register
    ADD  SP, 32 bit constant

    You notice no RET instruction?  The Plasma Cortex allows access of all registers the same way, so these are actually valid instructions:

    MOV  PC, 0xDEADBEEF ; alias of JMP 0xDEADBEEF
    POP  PC ; alias of RET
    PUSH PC ; unique instruction
    MOV  AX, PC ; another unique instruction

    The programmer has full control over the program counter, so the assembler just converts RET instructions to POP PC.

    There are no interrupts *yet*, so no IRET or anything like that.  I actually do not plan on having a special return instruction for the Plasma Cortex because I feel it is unneeded.

    [edit] Just realized I still need to add these instructions:

    MOV [sp+16 bit offset], general purpose register
    MOV general purpose register, [sp+16 bit offset]

    Those are for the C compiler's local variables.  Those instructions greatly speed up C programs running on the Plasma Cortex.

    That's all for now, thanks for reading!!

View project log

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates