2014-05-03

FunCPU - Tagged Architecture

In the memory, different type of symbols are stored together. It is essential for the CPU to be able to differentiate among them. Therefore type information is required to be assigned to each unit of information. This piece of information is tagged to each symbol. A lot of effort has been dedicated to come up with an optimal encoding. I wanted to have an encoding/tagging scheme, which was very economical and yet efficient. 
I have decided to use a single 8 bit RAM/ROM for memory, so everything (including the actual data and its type information) must fit there. With 8 bits of data I could encode the following information:
  • 7 bit literals
  • built-in functions
  • user-defined functions
  • expression terminator.
The latter is used to mark the end of an expression (essentially the core of the functional program) or a function.
I have further classified the 8 bit symbols with respect to the above categories as follows:
  • zero constant, which also represents True;
  • other constants
  • arguments;
  • inc function
  • dec function
  • if function
  • user-dedinable function
  • expression terminatior (EOX).
This classification, as we will see, will heavily facilitate the processing of the expressions.

No comments:

Post a Comment