- [FPGA] Nexys 2 OS
- 06 Sep 2010 02:30:27 pm
- Last edited by Matthias1992 on 07 Sep 2010 02:57:01 am; edited 1 time in total
Hello there! I recently started a very, very ambitious project, read on and bare with me, I am fully aware of the complexity of this.
First of all it's a school project which means It has to be completed. Second it's a high school project so it's not for my study and therefor I am allowed to seek help.
The idea is to make a computer. Well, that is very vague isn't it? I am aiming for something like MS-DOS, not in complexity but in interface. Shortly said I am aiming for a CLI. Since I work on a FPGA I "only" have to make a OS.
Well actually a bit more. What I need at first is a processor, then second I need a Kernel and OS.
Let me first explain what it needs to be able to do:
-PS2 keyboard input (e.g a command)
-VGA lcd output (say I did 1 + 1 it then prints "2") on the screen
So I only need those to ports to work with altough it would be clever to have the other gates (RS232 and PMOD) supported.
So I thought first of all I need a instruction set for the SoftCore processor so I can write and program code for the SoftCore and then from there on build the OS and all the other peripherals.
So let me lay out my plans for the Instruction set.
---------------------------------------------------------------
ADD
SUB
MUL
DIV
RR -rotate right
RL -rotate left
RRC -rotate right carry
RLC -rotate left carry
SR -shift right
SL -shift left
SRC -shift right carry
SLC -shift left carry
AND
OR
NOT
XOR
JP -unconditional jump
JPFT [flag] -jump if [flag] is true
JPFF [flag] -jump if [flag] is false
PUSH
POP
LD
LEA --load effective addres (altough I currently have no idea what that means but obviously it is considered usefull)
IN --recieve data from a port over a register
OUT --send data from a register to the port (pins)
------------------------------------------------------------
First point: I bet I missed some usefull instructions, let me know if you think there is need for a couple of more instructions.
Now second point is: I was thinking about how many bits I would make my machine. 16 bits seems a little to few mostly because it can never adress the full 16MB of the onboard memory (both in Flash and SDRAM so 2x16MB basically) So then the second thought was 32, however I find that a bit of a overkill, if you think it's better then my plan (which is to make it 24bits) then let me know! The main reason I don't want 32 bits is because that lenghtens the opcodes and thus the execution cycle.
Now some more details about the registers I want to include. Single letter registers are 8 bits, double letter register are 16 bit (except PC and SP, program counter and stack pointer respectively, which are 24 bit). triple letter regs are 24 bits wide.
--------------------------------------------------------------------------------------
A --Accum
B --Backup
C --Counter (used for loops)
D --Data
F --Flag
-------------------------------------------------------------------------------------
IE --accum
HL --backup
MN --another backup
PC --program counter 24b
SP --stack pointer 24b
--------------------------------------------------------------------------------------
XOQ --accum
XRS --backup
XTU --backup
XVW --backup
XYZ --extended counter (used for loops)
--------------------------------------------------------------------------------------
So this is the mess I have atm, now I need to build a SoftCore processor out of it, then a OS on that and then a IDE on the OS so I can further develop on-FPGA.
All this is just a rough layout of what I intend to do, I have more detailed plans laying around but basically it comes down to this;
1. Does anyone have any good FPGA tutorials?
2. What do you think about the sofcore processor, is it doablez? are there enough instructions? should I make it more then or less then 24bits?
3. Any other point of cricism or help, maybe some experiences on this topic?
First of all it's a school project which means It has to be completed. Second it's a high school project so it's not for my study and therefor I am allowed to seek help.
The idea is to make a computer. Well, that is very vague isn't it? I am aiming for something like MS-DOS, not in complexity but in interface. Shortly said I am aiming for a CLI. Since I work on a FPGA I "only" have to make a OS.
Well actually a bit more. What I need at first is a processor, then second I need a Kernel and OS.
Let me first explain what it needs to be able to do:
-PS2 keyboard input (e.g a command)
-VGA lcd output (say I did 1 + 1 it then prints "2") on the screen
So I only need those to ports to work with altough it would be clever to have the other gates (RS232 and PMOD) supported.
So I thought first of all I need a instruction set for the SoftCore processor so I can write and program code for the SoftCore and then from there on build the OS and all the other peripherals.
So let me lay out my plans for the Instruction set.
---------------------------------------------------------------
ADD
SUB
MUL
DIV
RR -rotate right
RL -rotate left
RRC -rotate right carry
RLC -rotate left carry
SR -shift right
SL -shift left
SRC -shift right carry
SLC -shift left carry
AND
OR
NOT
XOR
JP -unconditional jump
JPFT [flag] -jump if [flag] is true
JPFF [flag] -jump if [flag] is false
PUSH
POP
LD
LEA --load effective addres (altough I currently have no idea what that means but obviously it is considered usefull)
IN --recieve data from a port over a register
OUT --send data from a register to the port (pins)
------------------------------------------------------------
First point: I bet I missed some usefull instructions, let me know if you think there is need for a couple of more instructions.
Now second point is: I was thinking about how many bits I would make my machine. 16 bits seems a little to few mostly because it can never adress the full 16MB of the onboard memory (both in Flash and SDRAM so 2x16MB basically) So then the second thought was 32, however I find that a bit of a overkill, if you think it's better then my plan (which is to make it 24bits) then let me know! The main reason I don't want 32 bits is because that lenghtens the opcodes and thus the execution cycle.
Now some more details about the registers I want to include. Single letter registers are 8 bits, double letter register are 16 bit (except PC and SP, program counter and stack pointer respectively, which are 24 bit). triple letter regs are 24 bits wide.
--------------------------------------------------------------------------------------
A --Accum
B --Backup
C --Counter (used for loops)
D --Data
F --Flag
-------------------------------------------------------------------------------------
IE --accum
HL --backup
MN --another backup
PC --program counter 24b
SP --stack pointer 24b
--------------------------------------------------------------------------------------
XOQ --accum
XRS --backup
XTU --backup
XVW --backup
XYZ --extended counter (used for loops)
--------------------------------------------------------------------------------------
So this is the mess I have atm, now I need to build a SoftCore processor out of it, then a OS on that and then a IDE on the OS so I can further develop on-FPGA.
All this is just a rough layout of what I intend to do, I have more detailed plans laying around but basically it comes down to this;
1. Does anyone have any good FPGA tutorials?
2. What do you think about the sofcore processor, is it doablez? are there enough instructions? should I make it more then or less then 24bits?
3. Any other point of cricism or help, maybe some experiences on this topic?