-
1Instructions
Assembly components on the PCB per schematics.
All TTL chips and components can be soldered directly on PCB.*Recommended to install EEPROM chip U3 on a DIP 24 pin socket, so that EEPROM could be easily removed and reprogrammed when needed.
*Note: U10 chip HD74LS01P has open collector output.
If using TTL chip HD74LS01P as U10, per diagram, add pull up resistors 1k to output pins 10 and 13 of the chip to the VCC.
Or use chip HD74LS00P instead. But that requires change the PCB because this chip has different pin out diagram.
*Resistors 330 for LED current limiting can be replaced with 1k resistors. But LED brightness may be reduced. -
24-bit RISC CPU Programming instructions
CPU has only 5 instructions, here with opcodes (hex):
0 - Noop
1 - Clear register A (accumulator) and Flag register.
2 - Add immediate to A and save to A.
4 - Jump conditional (when flag Carry is 1)
8 - Jump (unconditional)
Instructions are stored in EEPROM from address 0.The upper 4 bits of instruction is the opcode. The lower 4 bits are immediate add operand or address of Jump instruction.
Address space of instructions is 4 bits from 0 to 15. Program execution starts from address 0, after pressing reset button. Each instruction executes in one cycle. Jumper on PCB is used to select clock signal source, from 555 chip or from the manual clock button.Instruction set is designed such that each bit of opcode encodes one instruction to simplify decoding logic.
There is no Subtract instruction. But one can subtract by adding a ‘binary complement’ of the number in immediate value. For example subtracting 1 is equivalent to Add binary compliment (hex value F) to A.
There is no load A instruction. To load value to register A, use ‘Clear’ instruction opcode 1, following by ‘Add’ instruction opcode 2 to load value to the A accumulator.
-
3Step 3
Example of simple program for this CPU:
Clear A accumulator, then continue add 1 to Accumulator register, until the value exceeds 15.
Uses Add, Jump, and Jump when overflow instructions.
Program EEPROM contents
Address instruction code (hex) comment0 00 no op
1 10 clear accumulator
2 21 add 1 to accumulator
3 41 Jump to address 1, if overflow flag
4 82 Jump to address 2.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.