The ALUYou can see the ALU in the purple ring. The ALU supports 16Bit
natural numbers altough I want to implement floating point numbers. It's
return-value can be returned into the registers for further use.
The Instruction table is as following:
MOV is used to move data from one register to an other.If you want to use SUB you use 1100 instead of 0100.
The Registers can be found in the yellow ring on the picture. There are 16 registers(r0 to r15) from which only 9 are connected to enable write in. They're each 16Bit long. The right multiplexer is used to choose the second operand for an ALU operation or to choose which register should be output to the terminal. r0 is the first operand of every ALU operation and the first operand for comparator(CMP) operations. r1 is the second operand of CMP operations. The second multiplexer is used to inspect the registers from external. If the write enable(coming from the left side) is activated on a register, the content will be updated when the clock(on the top) is active (it is set at 1High and 79Lows).
The RAM-blocks can be seen in the green ring. It is split up in 3 parts to make it a bit easier to oversee. All RAM-blocks are activated when the RUN-pin is set to 1.
The Data-RAM is the upper one. It holds 16Bit of Data which then can be loaded from the RAM into the Registers.
The Instruction-RAM is situated in the middle. It holds 24Bit of Instructions. Here is a list of the functions of each Bit:
- 0 to 3 activate the write enable for one register
- 4 to 5 set the CheckRepeats option
- 6 set write enable for r8
- 7 reset the counter in the "Loop-Device"
- 8 enable external input(enables the EIU)
- 9 choose between manual Data Input from the EIU or use the return value of the last program.
- 10 to 11 not used
- 12 to 15 choose second operand for ALU operation or choose which register should be output to the screen
- 16 to 19 choose ALU Instruction(see ALU part for the ALU instruction table)
- 20 save the result of the ALU operation
- 21 save the result of the CMP operation
- 22 activate the "Loop-Device"
- 23 activate CPU stepping (needed to run the CPU)
If you want the CPU to load data from the Data-RAM to a register you issue the command 800001 (the 8 is the 23rd bit and the 1 is the 0 bit). The commands are all written in HEX to have a better overview over the code(because writing 24bits in binary is a bit longer and not so good to read).
The EIU can be seen in the blue ring on the picture. The EIU is used to program the CPU from external. It is activated through a flag which is set with a SoftwareCommand. The CPU is only programmable through the EIU, making it the key to the external happening of the CPU. It is capable of programming the data-, instruction- and address-RAM. You can set a second flag to choose if you load your data from external or use a return value. When the EIU is activated the complete CPU stops and only continues if the SR-Latch is deactivated through the RES_OVRFLW-Pin.