CISC | RISC |
---|---|
Adopted by Intel | Promoted by IBM and ARM family |
Large number of instructions | Fewer instructions (<100) |
Allow instructions with long execution time | No instruction with long execution time |
Variable-length instruction encodings | Fixed length instruction encodings |
Multiple formats for specifying operands | Simple addressing formats |
Implementation artefacts abstracted away | Implementation artefacts exposed to programmer |
Condition codes. Special flags set as side | No condition codes. Explicit test instructions |
effects of instructions. | store the test results in normal registers |
It is a simplified version of the IA32 instruction set, which applies some of the principles of RISC. It has fewer data types, instructions etc. Y86 only allows 4 byte integer operations.
In the context of Y86, we use “word” to mean 4-bytes, since it is the only size we will operate on.
Registers available are, %eax
, %ebx
, %ecx
, %edx
, %esi
, %edi
, %esp
, %ebp
.
It also has condition codes, ZF, SF, OF, a program counter, and a program status code, and of course a memory.
The numbers in the brackets are 4 bits each, representing the bit-level encoding of the instructions.
halt
[ 0 0 ] - stops instruction exec, and sets status code to HLT.nop
[ 1 0 ] - idle state, no operationrrmovl
rA, rB [ 2 0 rA rB ] - move from register A to register Birmovl
V, rB [ 2 0 F rB V ] - move immediate value V to register Brmmovl
rA, D(rB) [ 4 0 rA rB D ] - move from register A to memory address at rB with offset Dmrmovl
D(rB), rA [ 5 0 rA rB D ] - move from memory address at rB with offset D to register AOP1
rA, rB [ 6 fn rA rB ] - For arithmetic operationsjXX
Dest [ 7 fn Dest ] - different kinds of jump instructions, to destinationThus some instructions are just 1 byte long, but those that require operands have longer encodings. There is no support for the second index register or scaling, only offsets are allowed.
The fn
mentioned in OP1
addl
- 0
subl
- 1
andl
- 2
xorl
- 3
the fn
mentioned in jXX
jmp
- 0
jle
- 1
jl
- 2
je
- 3
jne
- 4
jge
- 5
jg
- 6
| Name | Meaning |
|— |— |
| AOK | Normal operation |
| HLT | halt
instruction encountered |
| ADR | Invalid address encountered |
| INS | Invalid instruction encountered |