|
|
Instruction Formats
|
Instruction Formats
|
-------------------
|
-------------------
|
|
|
RRR (three register operands)
|
RRR (three register operands)
|
RRS (two registers and a signed half operand)
|
RRS (two registers and a signed half operand)
|
RRH (two registers and an unsigned half operand)
|
RRH (two registers and an unsigned half operand)
|
RHH (one register and a half operand, high-order 16 bits encoded)
|
RHH (one register and a half operand, high-order 16 bits encoded)
|
RRB (two registers and a 16 bit signed offset operand)
|
RRB (two registers and a 16 bit signed offset operand)
|
J (no registers and a 26 bit signed offset operand)
|
J (no registers and a 26 bit signed offset operand)
|
JR (one register operand)
|
JR (one register operand)
|
|
|
|
|
Instruction Set
|
Instruction Set
|
---------------
|
---------------
|
|
|
Notation:
|
Notation:
|
'r[n]' The bits representing 'r' are padded with zeroes
|
'r[n]' The bits representing 'r' are padded with zeroes
|
to the left (or zeroes are dropped from the left)
|
to the left (or zeroes are dropped from the left)
|
until a width of n bits is reached.
|
until a width of n bits is reached.
|
'a || b' The bits representing 'a' and 'b' are concatenated;
|
'a || b' The bits representing 'a' and 'b' are concatenated;
|
'a' occupies the more significant bits.
|
'a' occupies the more significant bits.
|
All numbers are given in decimal (base 10), except when prefixed
|
All numbers are given in decimal (base 10), except when prefixed
|
with "0x", which means they are given in hexadecimal (base 16).
|
with "0x", which means they are given in hexadecimal (base 16).
|
|
|
ADD (add)
|
ADD (add)
|
format: RRR
|
format: RRR
|
coding: 0x00[6] || rs1[5] || rs2[5] || rd[5] || 0[11]
|
coding: 0x00[6] || rs1[5] || rs2[5] || rd[5] || 0[11]
|
assembler: add rd,rs1,rs2
|
assembler: add rd,rs1,rs2
|
example: add $1,$2,$3
|
example: add $1,$2,$3
|
operation: The contents of register rs2 are added to the contents
|
operation: The contents of register rs2 are added to the contents
|
of register rs1. The result is stored into register rd.
|
of register rs1. The result is stored into register rd.
|
Overflow is ignored.
|
Overflow is ignored.
|
|
|
ADDI (add immediate)
|
ADDI (add immediate)
|
format: RRS
|
format: RRS
|
coding: 0x01[6] || rs1[5] || rd[5] || simm[16]
|
coding: 0x01[6] || rs1[5] || rd[5] || simm[16]
|
assembler: add rd,rs1,simm
|
assembler: add rd,rs1,simm
|
example: add $1,$2,1234
|
example: add $1,$2,1234
|
operation: The sign-extended immediate constant simm is added to
|
operation: The sign-extended immediate constant simm is added to
|
the contents of register rs1. The result is stored into
|
the contents of register rs1. The result is stored into
|
register rd. Overflow is ignored.
|
register rd. Overflow is ignored.
|
|
|
SUB (subtract)
|
SUB (subtract)
|
format: RRR
|
format: RRR
|
coding: 0x02[6] || rs1[5] || rs2[5] || rd[5] || 0[11]
|
coding: 0x02[6] || rs1[5] || rs2[5] || rd[5] || 0[11]
|
assembler: sub rd,rs1,rs2
|
assembler: sub rd,rs1,rs2
|
example: sub $1,$2,$3
|
example: sub $1,$2,$3
|
operation: The contents of register rs2 are subtracted from the
|
operation: The contents of register rs2 are subtracted from the
|
contents of register rs1. The result is stored into
|
contents of register rs1. The result is stored into
|
register rd. Overflow is ignored.
|
register rd. Overflow is ignored.
|
|
|
SUBI (subtract immediate)
|
SUBI (subtract immediate)
|
format: RRS
|
format: RRS
|
coding: 0x03[6] || rs1[5] || rd[5] || simm[16]
|
coding: 0x03[6] || rs1[5] || rd[5] || simm[16]
|
assembler: sub rd,rs1,simm
|
assembler: sub rd,rs1,simm
|
example: add $1,$2,1234
|
example: add $1,$2,1234
|
operation: The sign-extended immediate constant simm is subtracted
|
operation: The sign-extended immediate constant simm is subtracted
|
from the contents of register rs1. The result is stored
|
from the contents of register rs1. The result is stored
|
into register rd. Overflow is ignored.
|
into register rd. Overflow is ignored.
|
|
|
AND (logical and)
|
AND (logical and)
|
format: RRR
|
format: RRR
|
coding: 0x10[6] || rs1[5] || rs2[5] || rd[5] || 0[11]
|
coding: 0x10[6] || rs1[5] || rs2[5] || rd[5] || 0[11]
|
assembler: and rd,rs1,rs2
|
assembler: and rd,rs1,rs2
|
example: and $1,$2,$3
|
example: and $1,$2,$3
|
operation: The contents of register rs2 are bitwise anded with the
|
operation: The contents of register rs2 are bitwise anded with the
|
contents of register rs1. The result is stored into
|
contents of register rs1. The result is stored into
|
register rd.
|
register rd.
|
|
|
ANDI (logical and immediate)
|
ANDI (logical and immediate)
|
format: RRH
|
format: RRH
|
coding: 0x11[6] || rs1[5] || rd[5] || uimm[16]
|
coding: 0x11[6] || rs1[5] || rd[5] || uimm[16]
|
assembler: and rd,rs1,uimm
|
assembler: and rd,rs1,uimm
|
example: and $1,$2,1234
|
example: and $1,$2,1234
|
operation: The zero-extended immediate constant uimm is bitwise
|
operation: The zero-extended immediate constant uimm is bitwise
|
anded with the contents of register rs1. The result
|
anded with the contents of register rs1. The result
|
is stored into register rd.
|
is stored into register rd.
|
|
|
OR (logical or)
|
OR (logical or)
|
format: RRR
|
format: RRR
|
coding: 0x12[6] || rs1[5] || rs2[5] || rd[5] || 0[11]
|
coding: 0x12[6] || rs1[5] || rs2[5] || rd[5] || 0[11]
|
assembler: or rd,rs1,rs2
|
assembler: or rd,rs1,rs2
|
example: or $1,$2,$3
|
example: or $1,$2,$3
|
operation: The contents of register rs2 are bitwise ored with the
|
operation: The contents of register rs2 are bitwise ored with the
|
contents of register rs1. The result is stored into
|
contents of register rs1. The result is stored into
|
register rd.
|
register rd.
|
|
|
ORI (logical or immediate)
|
ORI (logical or immediate)
|
format: RRH
|
format: RRH
|
coding: 0x13[6] || rs1[5] || rd[5] || uimm[16]
|
coding: 0x13[6] || rs1[5] || rd[5] || uimm[16]
|
assembler: or rd,rs1,uimm
|
assembler: or rd,rs1,uimm
|
example: or $1,$2,1234
|
example: or $1,$2,1234
|
operation: The zero-extended immediate constant uimm is bitwise
|
operation: The zero-extended immediate constant uimm is bitwise
|
ored with the contents of register rs1. The result
|
ored with the contents of register rs1. The result
|
is stored into register rd.
|
is stored into register rd.
|
|
|
XOR (logical xor)
|
XOR (logical xor)
|
format: RRR
|
format: RRR
|
coding: 0x14[6] || rs1[5] || rs2[5] || rd[5] || 0[11]
|
coding: 0x14[6] || rs1[5] || rs2[5] || rd[5] || 0[11]
|
assembler: xor rd,rs1,rs2
|
assembler: xor rd,rs1,rs2
|
example: xor $1,$2,$3
|
example: xor $1,$2,$3
|
operation: The contents of register rs2 are bitwise xored with the
|
operation: The contents of register rs2 are bitwise xored with the
|
contents of register rs1. The result is stored into
|
contents of register rs1. The result is stored into
|
register rd.
|
register rd.
|
Remark: (a xor b) <=> ((a and ~b) or (~a and b))
|
Remark: (a xor b) <=> ((a and ~b) or (~a and b))
|
|
|
XORI (logical xor immediate)
|
XORI (logical xor immediate)
|
format: RRH
|
format: RRH
|
coding: 0x15[6] || rs1[5] || rd[5] || uimm[16]
|
coding: 0x15[6] || rs1[5] || rd[5] || uimm[16]
|
assembler: xor rd,rs1,uimm
|
assembler: xor rd,rs1,uimm
|
example: xor $1,$2,1234
|
example: xor $1,$2,1234
|
operation: The zero-extended immediate constant uimm is bitwise
|
operation: The zero-extended immediate constant uimm is bitwise
|
xored with the contents of register rs1. The result
|
xored with the contents of register rs1. The result
|
is stored into register rd.
|
is stored into register rd.
|
Remark: (a xor b) <=> ((a and ~b) or (~a and b))
|
Remark: (a xor b) <=> ((a and ~b) or (~a and b))
|
|
|
XNOR (logical xnor)
|
XNOR (logical xnor)
|
format: RRR
|
format: RRR
|
coding: 0x16[6] || rs1[5] || rs2[5] || rd[5] || 0[11]
|
coding: 0x16[6] || rs1[5] || rs2[5] || rd[5] || 0[11]
|
assembler: xnor rd,rs1,rs2
|
assembler: xnor rd,rs1,rs2
|
example: xnor $1,$2,$3
|
example: xnor $1,$2,$3
|
operation: The contents of register rs2 are bitwise xnored with the
|
operation: The contents of register rs2 are bitwise xnored with the
|
contents of register rs1. The result is stored into
|
contents of register rs1. The result is stored into
|
register rd.
|
register rd.
|
Remark: (a xnor b) <=> ((a and b) or (~a and ~b))
|
Remark: (a xnor b) <=> ((a and b) or (~a and ~b))
|
|
|
XNORI (logical xnor immediate)
|
XNORI (logical xnor immediate)
|
format: RRH
|
format: RRH
|
coding: 0x17[6] || rs1[5] || rd[5] || uimm[16]
|
coding: 0x17[6] || rs1[5] || rd[5] || uimm[16]
|
assembler: xnor rd,rs1,uimm
|
assembler: xnor rd,rs1,uimm
|
example: xnor $1,$2,1234
|
example: xnor $1,$2,1234
|
operation: The zero-extended immediate constant uimm is bitwise
|
operation: The zero-extended immediate constant uimm is bitwise
|
xnored with the contents of register rs1. The result
|
xnored with the contents of register rs1. The result
|
is stored into register rd.
|
is stored into register rd.
|
Remark: (a xnor b) <=> ((a and b) or (~a and ~b))
|
Remark: (a xnor b) <=> ((a and b) or (~a and ~b))
|
|
|
LDHI (load high immediate)
|
LDHI (load high immediate)
|
format: RHH
|
format: RHH
|
coding: 0x1F[6] || 0[5] || rd[5] || uimm[16]
|
coding: 0x1F[6] || 0[5] || rd[5] || uimm[16]
|
assembler: ldhi rd,uimm
|
assembler: ldhi rd,uimm
|
example: ldhi $1,1234
|
example: ldhi $1,1234
|
operation: The zero-extended immediate constant uimm is shifted
|
operation: The zero-extended immediate constant uimm is shifted
|
left by 16 bits. The result is stored into register rd.
|
left by 16 bits. The result is stored into register rd.
|
|
|
BEQ (branch on equal)
|
BEQ (branch on equal)
|
format: RRB
|
format: RRB
|
coding: 0x20[6] || rs1[5] || rs2[5] || simm[16]
|
coding: 0x20[6] || rs1[5] || rs2[5] || simm[16]
|
assembler: beq rs1,rs2,target
|
assembler: beq rs1,rs2,target
|
example: beq $1,$2,label3
|
example: beq $1,$2,label3
|
operation: If the contents of register rs1 are equal to the contents
|
operation: If the contents of register rs1 are equal to the contents
|
of register rs2, the sign-extended immediate constant
|
of register rs2, the sign-extended immediate constant
|
simm is shifted left by two bits and added to the address
|
simm is shifted left by two bits and added to the address
|
of the instruction following the branch instruction. The
|
of the instruction following the branch instruction. The
|
result is placed into the program counter. If the contents
|
result is placed into the program counter. If the contents
|
differ, the next instruction after the branch is executed.
|
differ, the next instruction after the branch is executed.
|
|
|
BNE (branch on not equal)
|
BNE (branch on not equal)
|
format: RRB
|
format: RRB
|
coding: 0x21[6] || rs1[5] || rs2[5] || simm[16]
|
coding: 0x21[6] || rs1[5] || rs2[5] || simm[16]
|
assembler: bne rs1,rs2,target
|
assembler: bne rs1,rs2,target
|
example: bne $1,$2,label3
|
example: bne $1,$2,label3
|
operation: If the contents of register rs1 are not equal to the contents
|
operation: If the contents of register rs1 are not equal to the contents
|
of register rs2, the sign-extended immediate constant
|
of register rs2, the sign-extended immediate constant
|
simm is shifted left by two bits and added to the address
|
simm is shifted left by two bits and added to the address
|
of the instruction following the branch instruction. The
|
of the instruction following the branch instruction. The
|
result is placed into the program counter. If the contents
|
result is placed into the program counter. If the contents
|
are equal, the next instruction after the branch is executed.
|
are equal, the next instruction after the branch is executed.
|
|
|
BLEU (branch on less or equal unsigned)
|
BLEU (branch on less or equal unsigned)
|
format: RRB
|
format: RRB
|
coding: 0x23[6] || rs1[5] || rs2[5] || simm[16]
|
coding: 0x23[6] || rs1[5] || rs2[5] || simm[16]
|
assembler: bleu rs1,rs2,target
|
assembler: bleu rs1,rs2,target
|
example: bleu $1,$2,label3
|
example: bleu $1,$2,label3
|
operation: If the contents of register rs1 are less than or equal
|
operation: If the contents of register rs1 are less than or equal
|
to the contents of register rs2 (both are interpreted as
|
to the contents of register rs2 (both are interpreted as
|
unsigned numbers), the sign-extended immediate constant
|
unsigned numbers), the sign-extended immediate constant
|
simm is shifted left by two bits and added to the address
|
simm is shifted left by two bits and added to the address
|
of the instruction following the branch instruction. The
|
of the instruction following the branch instruction. The
|
result is placed into the program counter. If the contents
|
result is placed into the program counter. If the contents
|
do not satisfy the condition, the next instruction after
|
do not satisfy the condition, the next instruction after
|
the branch is executed.
|
the branch is executed.
|
|
|
BLTU (branch on less than unsigned)
|
BLTU (branch on less than unsigned)
|
format: RRB
|
format: RRB
|
coding: 0x25[6] || rs1[5] || rs2[5] || simm[16]
|
coding: 0x25[6] || rs1[5] || rs2[5] || simm[16]
|
assembler: bltu rs1,rs2,target
|
assembler: bltu rs1,rs2,target
|
example: bltu $1,$2,label3
|
example: bltu $1,$2,label3
|
operation: If the contents of register rs1 are less than the contents
|
operation: If the contents of register rs1 are less than the contents
|
of register rs2 (both are interpreted as unsigned numbers),
|
of register rs2 (both are interpreted as unsigned numbers),
|
the sign-extended immediate constant simm is shifted left
|
the sign-extended immediate constant simm is shifted left
|
by two bits and added to the address of the instruction
|
by two bits and added to the address of the instruction
|
following the branch instruction. The result is placed into
|
following the branch instruction. The result is placed into
|
the program counter. If the contents do not satisfy the
|
the program counter. If the contents do not satisfy the
|
condition, the next instruction after the branch is executed.
|
condition, the next instruction after the branch is executed.
|
|
|
BGEU (branch on greater or equal unsigned)
|
BGEU (branch on greater or equal unsigned)
|
format: RRB
|
format: RRB
|
coding: 0x27[6] || rs1[5] || rs2[5] || simm[16]
|
coding: 0x27[6] || rs1[5] || rs2[5] || simm[16]
|
assembler: bgeu rs1,rs2,target
|
assembler: bgeu rs1,rs2,target
|
example: bgeu $1,$2,label3
|
example: bgeu $1,$2,label3
|
operation: If the contents of register rs1 are greater than or equal
|
operation: If the contents of register rs1 are greater than or equal
|
to the contents of register rs2 (both are interpreted as
|
to the contents of register rs2 (both are interpreted as
|
unsigned numbers), the sign-extended immediate constant
|
unsigned numbers), the sign-extended immediate constant
|
simm is shifted left by two bits and added to the address
|
simm is shifted left by two bits and added to the address
|
of the instruction following the branch instruction. The
|
of the instruction following the branch instruction. The
|
result is placed into the program counter. If the contents
|
result is placed into the program counter. If the contents
|
do not satisfy the condition, the next instruction after
|
do not satisfy the condition, the next instruction after
|
the branch is executed.
|
the branch is executed.
|
|
|
BGTU (branch on greater than unsigned)
|
BGTU (branch on greater than unsigned)
|
format: RRB
|
format: RRB
|
coding: 0x29[6] || rs1[5] || rs2[5] || simm[16]
|
coding: 0x29[6] || rs1[5] || rs2[5] || simm[16]
|
assembler: bgtu rs1,rs2,target
|
assembler: bgtu rs1,rs2,target
|
example: bgtu $1,$2,label3
|
example: bgtu $1,$2,label3
|
operation: If the contents of register rs1 are greater than the contents
|
operation: If the contents of register rs1 are greater than the contents
|
of register rs2 (both are interpreted as unsigned numbers),
|
of register rs2 (both are interpreted as unsigned numbers),
|
the sign-extended immediate constant simm is shifted left
|
the sign-extended immediate constant simm is shifted left
|
by two bits and added to the address of the instruction
|
by two bits and added to the address of the instruction
|
following the branch instruction. The result is placed into
|
following the branch instruction. The result is placed into
|
the program counter. If the contents do not satisfy the
|
the program counter. If the contents do not satisfy the
|
condition, the next instruction after the branch is executed.
|
condition, the next instruction after the branch is executed.
|
|
|
J (jump)
|
J (jump)
|
format: J
|
format: J
|
coding: 0x2A[6] || simm[26]
|
coding: 0x2A[6] || simm[26]
|
assembler: j target
|
assembler: j target
|
example: j label3
|
example: j label3
|
operation: The sign-extended immediate constant simm is shifted left
|
operation: The sign-extended immediate constant simm is shifted left
|
by two bits and added to the address of the instruction
|
by two bits and added to the address of the instruction
|
following the jump instruction. The result is placed into
|
following the jump instruction. The result is placed into
|
the program counter.
|
the program counter.
|
|
|
JR (jump register)
|
JR (jump register)
|
format: JR
|
format: JR
|
coding: 0x2B[6] || rs[5] || 0[5] || 0[16]
|
coding: 0x2B[6] || rs[5] || 0[5] || 0[16]
|
assembler: jr rs
|
assembler: jr rs
|
example: jr $31
|
example: jr $31
|
operation: The contents of register rs are placed into the program
|
operation: The contents of register rs are placed into the program
|
counter.
|
counter.
|
|
|
JAL (jump and link)
|
JAL (jump and link)
|
format: J
|
format: J
|
coding: 0x2C[6] || simm[26]
|
coding: 0x2C[6] || simm[26]
|
assembler: jal target
|
assembler: jal target
|
example: jal label3
|
example: jal label3
|
operation: The address of the instruction following the jal instruction
|
operation: The address of the instruction following the jal instruction
|
is placed into register 31. The sign-extended immediate
|
is placed into register 31. The sign-extended immediate
|
constant simm is shifted left by two bits and added to the
|
constant simm is shifted left by two bits and added to the
|
address of the instruction following the jal instruction.
|
address of the instruction following the jal instruction.
|
The result is placed into the program counter.
|
The result is placed into the program counter.
|
|
|
LDW (load word)
|
LDW (load word)
|
format: RRS
|
format: RRS
|
coding: 0x30[6] || rs[5] || rd[5] || simm[16]
|
coding: 0x30[6] || rs[5] || rd[5] || simm[16]
|
assembler: ldw rd,rs,simm
|
assembler: ldw rd,rs,simm
|
example: ldw $1,$2,1234
|
example: ldw $1,$2,1234
|
operation: The sign-extended immediate constant simm is added to the
|
operation: The sign-extended immediate constant simm is added to the
|
contents of register rs to form an effective memory address.
|
contents of register rs to form an effective memory address.
|
A word is read from this address and stored into register
|
A word is read from this address and stored into register
|
rd.
|
rd.
|
|
|
LDH (load halfword)
|
LDH (load halfword)
|
format: RRS
|
format: RRS
|
coding: 0x31[6] || rs[5] || rd[5] || simm[16]
|
coding: 0x31[6] || rs[5] || rd[5] || simm[16]
|
assembler: ldh rd,rs,simm
|
assembler: ldh rd,rs,simm
|
example: ldh $1,$2,1234
|
example: ldh $1,$2,1234
|
operation: The sign-extended immediate constant simm is added to the
|
operation: The sign-extended immediate constant simm is added to the
|
contents of register rs to form an effective memory address.
|
contents of register rs to form an effective memory address.
|
A halfword is read from this address, sign-extended, and
|
A halfword is read from this address, sign-extended, and
|
stored into register rd.
|
stored into register rd.
|
|
|
LDHU (load halfword unsigned)
|
LDHU (load halfword unsigned)
|
format: RRS
|
format: RRS
|
coding: 0x32[6] || rs[5] || rd[5] || simm[16]
|
coding: 0x32[6] || rs[5] || rd[5] || simm[16]
|
assembler: ldhu rd,rs,simm
|
assembler: ldhu rd,rs,simm
|
example: ldhu $1,$2,1234
|
example: ldhu $1,$2,1234
|
operation: The sign-extended immediate constant simm is added to the
|
operation: The sign-extended immediate constant simm is added to the
|
contents of register rs to form an effective memory address.
|
contents of register rs to form an effective memory address.
|
A halfword is read from this address, zero-extended, and
|
A halfword is read from this address, zero-extended, and
|
stored into register rd.
|
stored into register rd.
|
|
|
LDB (load byte)
|
LDB (load byte)
|
format: RRS
|
format: RRS
|
coding: 0x33[6] || rs[5] || rd[5] || simm[16]
|
coding: 0x33[6] || rs[5] || rd[5] || simm[16]
|
assembler: ldb rd,rs,simm
|
assembler: ldb rd,rs,simm
|
example: ldb $1,$2,1234
|
example: ldb $1,$2,1234
|
operation: The sign-extended immediate constant simm is added to the
|
operation: The sign-extended immediate constant simm is added to the
|
contents of register rs to form an effective memory address.
|
contents of register rs to form an effective memory address.
|
A byte is read from this address, sign-extended, and stored
|
A byte is read from this address, sign-extended, and stored
|
into register rd.
|
into register rd.
|
|
|
LDBU (load byte unsigned)
|
LDBU (load byte unsigned)
|
format: RRS
|
format: RRS
|
coding: 0x34[6] || rs[5] || rd[5] || simm[16]
|
coding: 0x34[6] || rs[5] || rd[5] || simm[16]
|
assembler: ldbu rd,rs,simm
|
assembler: ldbu rd,rs,simm
|
example: ldbu $1,$2,1234
|
example: ldbu $1,$2,1234
|
operation: The sign-extended immediate constant simm is added to the
|
operation: The sign-extended immediate constant simm is added to the
|
contents of register rs to form an effective memory address.
|
contents of register rs to form an effective memory address.
|
A byte is read from this address, zero-extended, and stored
|
A byte is read from this address, zero-extended, and stored
|
into register rd.
|
into register rd.
|
|
|
STW (store word)
|
STW (store word)
|
format: RRS
|
format: RRS
|
coding: 0x35[6] || rs[5] || rd[5] || simm[16]
|
coding: 0x35[6] || rs[5] || rd[5] || simm[16]
|
assembler: stw rd,rs,simm
|
assembler: stw rd,rs,simm
|
example: stw $1,$2,1234
|
example: stw $1,$2,1234
|
operation: The sign-extended immediate constant simm is added to the
|
operation: The sign-extended immediate constant simm is added to the
|
contents of register rs to form an effective memory address.
|
contents of register rs to form an effective memory address.
|
The contents of register rd (all 32 bits) are stored
|
The contents of register rd (all 32 bits) are stored
|
as a word to this address.
|
as a word to this address.
|
|
|
STH (store halfword)
|
STH (store halfword)
|
format: RRS
|
format: RRS
|
coding: 0x36[6] || rs[5] || rd[5] || simm[16]
|
coding: 0x36[6] || rs[5] || rd[5] || simm[16]
|
assembler: sth rd,rs,simm
|
assembler: sth rd,rs,simm
|
example: sth $1,$2,1234
|
example: sth $1,$2,1234
|
operation: The sign-extended immediate constant simm is added to the
|
operation: The sign-extended immediate constant simm is added to the
|
contents of register rs to form an effective memory address.
|
contents of register rs to form an effective memory address.
|
The contents of register rd (the lower 16 bits) are stored
|
The contents of register rd (the lower 16 bits) are stored
|
as a halfword to this address.
|
as a halfword to this address.
|
|
|
STB (store byte)
|
STB (store byte)
|
format: RRS
|
format: RRS
|
coding: 0x37[6] || rs[5] || rd[5] || simm[16]
|
coding: 0x37[6] || rs[5] || rd[5] || simm[16]
|
assembler: stb rd,rs,simm
|
assembler: stb rd,rs,simm
|
example: stb $1,$2,1234
|
example: stb $1,$2,1234
|
operation: The sign-extended immediate constant simm is added to the
|
operation: The sign-extended immediate constant simm is added to the
|
contents of register rs to form an effective memory address.
|
contents of register rs to form an effective memory address.
|
The contents of register rd (the lowest 8 bits) are stored
|
The contents of register rd (the lowest 8 bits) are stored
|
as a byte to this address.
|
as a byte to this address.
|
|
|
|
|
Interrupts and Exceptions
|
Interrupts and Exceptions
|
-------------------------
|
-------------------------
|
|
|
There are neither interrupts nor exceptions in this version of ECO32e.
|
There are neither interrupts nor exceptions in this version of ECO32e.
|
Unknown opcodes should nevertheless be recognized. A CPU simulation can
|
Unknown opcodes should nevertheless be recognized. A CPU simulation can
|
then report the execution of an unknown opcode; an implementation may
|
then report the execution of an unknown opcode; an implementation may
|
trap such an execution in a state of its controller which cannot be left
|
trap such an execution in a state of its controller which cannot be left
|
without reset.
|
without reset.
|
|
|
|
|
Peripherals
|
Peripherals
|
-----------
|
-----------
|
|
|
Peripherals are memory-mapped. They need only support word accesses.
|
Peripherals are memory-mapped. They need only support word accesses.
|
A sensible reaction to accesses with smaller widths (halfword or byte)
|
A sensible reaction to accesses with smaller widths (halfword or byte)
|
is not required.
|
is not required.
|
|
|
In this version of ECO32e there are only two peripherals: a character
|
In this version of ECO32e there are only two peripherals: a character
|
display and a keyboard.
|
display and a keyboard.
|
|
|
The character display is capable of showing 30 lines with 80 characters
|
The character display is capable of showing 30 lines with 80 characters
|
each. Its base address is 0x30100000. Each line occupies 128 words in
|
each. Its base address is 0x30100000. Each line occupies 128 words in
|
the I/O address space, one word for each column (and 48 unusable columns
|
the I/O address space, one word for each column (and 48 unusable columns
|
at the end of the line). Therefore the address to which a character is
|
at the end of the line). Therefore the address to which a character is
|
written and its location on the screen are related as follows:
|
written and its location on the screen are related as follows:
|
address = 0x30100000 + (line * 128 + column) * 4
|
address = 0x30100000 + (line * 128 + column) * 4
|
The character to be displayed must be written as a word to the corresponding
|
The character to be displayed must be written as a word to the corresponding
|
address with its ASCII code contained in the lowest 8 bits of the word.
|
address with its ASCII code contained in the lowest 8 bits of the word.
|
|
|
The keyboard is represented by two I/O registers. The status register
|
The keyboard is represented by two I/O registers. The status register
|
is located at address 0x30200000. When read (32 bits), its LSB indicates
|
is located at address 0x30200000. When read (32 bits), its LSB indicates
|
if a character has been received from the physical keyboard. If this bit
|
if a character has been received from the physical keyboard. If this bit
|
is 1, the character can be read at address 0x30200004, the address of
|
is 1, the character can be read at address 0x30200004, the address of
|
the data register. By reading this latter address, the LSB of the
|
the data register. By reading this latter address, the LSB of the
|
status register is automatically reset to 0. The data register must be
|
status register is automatically reset to 0. The data register must be
|
read with a word read; the character read is contained in the lowest
|
read with a word read; the character read is contained in the lowest
|
8 bits of the word.
|
8 bits of the word.
|
|
|
|
|