So I'm working properly on my next CPU. I've been humming and hawing for a while about what to actually include, but now I have a preliminary IS that I can post here:
(instruction names are expanded so they make more sense to read here)
In a way I will still be using memory mapped locations. It's just that I'll use 3 of 11 bits as an immediate 'port' address so I don't have to deal with awkwardly sized 11-bit pointer registers
also aluOp is a placeholder name for all alu operations. I plan on providing support for all possible operations so the aluOp control bits will just be the ALU control lines. I have room in this instruction to do that, as all I'm sharing in this word is the register destination address.
The IS is based loosely on my previous CPU's IS. (DIO 1)
The biggest thing in common is the way I handle my dataloop. Instead of loading my registers to an A and B input for the dataloop, I lock the input register addresses with regSelect instruction. Basically it 'opens' the two selected registers so that when I write to a register I am also reading from, It will also update the ALU's input as the read of that register is still open.
It allows me to do code like this, assuming that there is a 1 stored in registers 001 and 010:
(The # and $ are macros I like to use for declaring and using address placeholders)
The above is a fully functional fibonacci program. Barring the checks for overflow of course.
As you can see, I only needed to load my registers once and after that I could treat the system as an accumulator setup.
Of course, you can accumulate to different registers simply by using regSelect again to use a different pair.
The IS isn't completely finished yet. There are a few more things I want to explore.
If you have any questions about what these instructions do, ask away :3
oh and the DIO stands for Derpy I/O, in honour of the posthumously named DIO 1
(instruction names are expanded so they make more sense to read here)
Code:
regSelect [regA] [regB]
aluOp [regC]
portWrite [portNum] [pointerAddr]
portWrite [portNum] [pointerAddr] [immediate]
portWrite [portNum] [immAddr]
portWrite [portNum] [immAddr] [immediate]
portRead [portNum] [regC] [pointerAddr]
portRead [portNum] [regC] [immAddr]
interruptSet [interruptCode] [subroutineAddress]
interuptRemove [interruptCode]
enableInterrupts
disableInterrupts
contextSet [regContext] [aluFlagContext] [regSelContext]
jump [immAddr]
call [immAddr]
return
branchIf [condition] [immAddr]
branchIfNot [condition] [immAddr]
In a way I will still be using memory mapped locations. It's just that I'll use 3 of 11 bits as an immediate 'port' address so I don't have to deal with awkwardly sized 11-bit pointer registers
also aluOp is a placeholder name for all alu operations. I plan on providing support for all possible operations so the aluOp control bits will just be the ALU control lines. I have room in this instruction to do that, as all I'm sharing in this word is the register destination address.
The IS is based loosely on my previous CPU's IS. (DIO 1)
The biggest thing in common is the way I handle my dataloop. Instead of loading my registers to an A and B input for the dataloop, I lock the input register addresses with regSelect instruction. Basically it 'opens' the two selected registers so that when I write to a register I am also reading from, It will also update the ALU's input as the read of that register is still open.
It allows me to do code like this, assuming that there is a 1 stored in registers 001 and 010:
(The # and $ are macros I like to use for declaring and using address placeholders)
Code:
regSelect r001 r010
# loopStart
add r001
add r010
jump $loopStart
The above is a fully functional fibonacci program. Barring the checks for overflow of course.
As you can see, I only needed to load my registers once and after that I could treat the system as an accumulator setup.
Of course, you can accumulate to different registers simply by using regSelect again to use a different pair.
The IS isn't completely finished yet. There are a few more things I want to explore.
If you have any questions about what these instructions do, ask away :3
oh and the DIO stands for Derpy I/O, in honour of the posthumously named DIO 1