SAMIRA is a 8 bit RISC accumulator machine without microcode, which means it only has one working register, the accumulator. The result of every calculation is automatically stored back in to the acc. Every instruction consists of two bytes, the first byte specifies the operation to perform, the second byte contains the operand. The operand byte can be data or an adress. This keeps the hardware and the decoder fairly simple.
The basic elements of the CPU are:
CLK - the master clock, step and auto
SEQ - the sequencer, performs the instruction cycle
DEC - the decoder, controlls most control lines in the CPU
RAM - the main memory, holds code and data
PC - the program counter, holds current program position
IR - instruction register, holds the current instruction
OP - operand register, holds the current operand
A - the accumulator, the one and only main working register
ALU - arithmetic [logic] unit, performs calculations and jumps
IN/OUT - basic IO interface
The 14 instructions are:
NOP - does nothing but wait
LD - loads operand byte to acc
LD$ - loads byte from adress, to which operand points, to acc
STO - stores acc to adress to which operand points
ADD - adds operand byte to acc and stores back to acc
ADD$ - adds byte from adress, to which operand points, to acc
SUB - subtracts operand from acc
SUB$ - subtracts byte form adress, to which operand points, from acc
JMP - jumps to adress specified by operand (loads PC)
ZRO - jumps if A not equal to 0
MSB - jumps if MSB (most significant bit) is not set
CAR - jumps if carry flag is not set
IN - loads byte from external device to a
OUT - writes byte from a to external device
The flags of the conditional jumps are inverted to make loops easier.
Due to the simplicity of the decoder the corresponding hex values for the commands are quite odd.
The ever repeating instruction cycle is:
FI - fetch instruction
INC - increment pc to next adress
FO - fetch operand
INC - increment pc
DEC - decode instruction, decoder sets all control lines
EXE - command is executed, registers are modified
The seperation of DEC and EXE was done to give the bus lines time to settle, prevent race conditions and provide stability.
The following simple program counts down from 100 (0x64) to 0 and then ends in a loop:
ADR CMD
00: LD 64
02: SUB 01
04: ZRO 02
06: JMP 06
Hello! Can you provide your logicism file so I can test my own circuit? Thanks!