Saturday, October 14, 2017

Instruction Set and major decision change.

Good'ay Y'all!
The time has once again come for an update on White Blaze. First I have to get this out of the way. White Blaze will be little endian based: meaning that it will be like how our normal number system functions; 10 is greater than 01 as opposed to vise-versa: 01 being greater than 10. Funny thing happened. The best way I thought to organize the instruction set was through excel. It excelled at it! ;)
Here's an example.

NumOpCodeShortDescriptionFormatWasted Bytes
500000101CONSTInserts Constant into Register[OpCode, Constant, Unused, Address to]1

Although: One catch I found was that there were a lot of "Unused" or "Wasted" bytes, which started bugging me, and I thought about it some more and decided that I will use a variable length instruction set. The main reason for this is that because it's 8-bits and 256-bytes to share both RAM and Program memory, I am under some memory constraints and need any storage savings that I can get.
Based on that, this would be the updated pipeline cycle:

1. load OpCode
2. from OpCode, load N number of registers to a buffer
3. from buffer, execute command and repeat.

The pictures from the last post still apply as far as how the cycle will run. The only difference is that it will now have a maximum of 4 registers to load: but it will not be required to load that many.

Another unexpected design changed happened when I was entering in the instruction set. I realized that under the math category, both modulus (%) and division would require either an extremely complicated gate arrangement and/or multiple cycles from the clock. Trying to work out how to activate multiple cycles for one instruction was beyond what I wanted to do for AmberOS v.0. So for now it will be able to do addition, subtraction, and multiplication. Later for a future version I would like to implement modulus and division. In fact I think it would actually be a good exercise later to program in a division program to help get the process down.

Like I said I would last post, I was working for a while: and here are all the OpCodes that I have come up with so far. I might tweak/change this later. There are still a lot of unused OpCodes, but that's a good thing I believe: Leaves expansion room. But for now, this is what I'm designing White Blaze around.


There are 4 main categories that these instructions can be split up into on the right. These are math operations, data manipulation, program manipulation, and IO or input/output operations.
Math operations are pretty self explanatory; Data manipulation are operations that change data without being specifically logic or math; Program Manipulation will only update the line number; and Input/Output operations will move data to and from registers and other memory locations around the architecture.  Feel free to comment below if you believe I forgot an OpCode. 

Another thing I wanted to touch on today is what will not be specifically made out of logic gates for emulation. These will be mainly the driving clock and memory. 
As far as memory goes, the Arduino will store the flag bits responsible for keeping track of the pipeline stage, the 256-bytes of program memory, the 4-bytes of instruction set buffer, the line number register, and a 3 byte error code register which I will most likely cover a little later. All of these, though stored on the Arduino will be directly addressable to the logic gates and can in real hardware can be easily swapped with flip-flops or memory banks. 

Recently on my channel, I covered a different part of the project here in this video: 


I'm planning at some point in the project to also make a lighter weight simulator on the computer, probably from python, that won't actually use logic gates but will simulate the machine code and keep track of the memory. (This will allow easier code debugging before loading it onto the Arduino). I would like it also to allow me to write higher level Assembly that will be compiled down and be put into memory through the serial port of the Arduino. 

I'm excited to keep this project going! It's teaching me a lot and I hope this is entertaining for you guys too. 
See you here in two weeks! Or next week on my Youtube Channel: BitStream.

No comments:

Post a Comment