My dream CPU


The main task for CPU is to do arithmetic and logical operations. All arithmetical and logical operations have 2 source operands and one result. Imagine CPU that have 2 registers in which we will put the source data, ALU and to much registers for results how much are all possible operations, which its CPU can do. After put data in source registers ALU calc in parallel all possible calculations with source registers and put the result in appropriate out register. The name of out register is the name of operation which data it contain. For example AplsB contain the sum between the source registers. For this type CPU is needed only one instruction. This is the instruction 'move'. Move data from memory to register, to load source register. 'move&start' move data memory register and start calculations. Move data from result register back in memory. Move data from source register, back to memory, copy operation.

All here look very simple. A program just will be the data way. There is one disadvantage, this is the big amount of energy to calc all possible results, but many of them we will not use. But in reality is just of kind of interpretation is AplsB calc code or register.

The CPUs work with integer and float numbers. So we need 2 units with similar structure. One will work with integers, the another with floating numbers. The floating point unit don't do logical operations. The flowchart is on fig.1.

Fig. 1 The flowchart for integer and float units.

To do any calc we should load the both source registers. ALU to do the calc and to store result back in memory. To do this we need something to walk over the memory to read and write. We need unit for address calculations, to calc addresses in memory to read and write.

We have 3 data flows. Two to load the source registers and one to save result back in memory. Therefore we need 3 index registers which will point to appropriate place in memory, where will be read or written data. The most used data structure is the array, the memory is linear data structure. The place of array element is defined with the beginning of array and its offset in the array. Therefore for a data flow we need one base register, which will point to the beginning of the array and one index register which will contain the offset in array. This are 3 base and 3 index registers. Yes it is possible without base register, we will load the index register with base value, and later increment it with offset, but in this case we lost the beginning of the array. The base value will be needed for other calculations and some other magic which we will explain later. We need to one more register which will contain the array end, with it we will compare the index register to check array end.

Fig. 2 program accessible registers in address unit.