Computer Architecture Lab/WS2007/diogenes instruction2

< Computer Architecture Lab < WS2007

Diogenes Instruction Set

(Minimalistic Instruction Set Architecture)

Διογένησ

Diogenes is a 32 Bit reduced RISC with 16 Bit wide instructions. It uses 16 general purpose registers, each 32 Bit wide.

There are several Types of Instructions:

Registers

Two registers with the same number (e.g. l3 and h3) are called "brother-registers".

Some instructions may only use the first source-register or its corresponding brother-register as the result-register (e.g. "adi r1, r1, 1", and "adi r1, h1, 5" are allowed while "adi r1, r2, 1" is not possible).

Detailed Instruction Set and Bit encoding

The most significant bits of the instruction word define the instruction category.

Arithmetic Instructions

add rd = ra + rb
subtract rd = ra - rb
logical bitwise and rd = ra + rb
logical bitwise or rd = ra or rb
logical bitwise xor rd = ra ^ rb
shift left signed rd = ra << rb rb is interpreted as signed value, negative values indicate an arithmetic shift right

Load Immediate Instructions

load 8bit rd = imm
shift and load 8bit rd = (rd << 8) + imm

These 8-Bit instructions can be used to load immediate values. For example to load the 32 Bit Value 0x87654321 to r1, the following instructions can be executed:

Our assembler supports a pseudo instruction to load 32-Bit values and uses these instructions internally.

Compare Instructions

Compare instructions compare the values of the registers ra and rb (that might be any of the 16 general purpose registers) and writes 0 or zero to the chosen register rd. The compare operations available are ra < rb for both signed and unsigned numbers. The semantic of >, <= or >= can be modeled with the branch instructions and/or exchanging ra and rb.

In this category, two instructions are still undefined, and might be used for future extensions like like multiplication.

Branch Instructions

Branch instructions are PC-relative (Program Counter) and have an 8 Bit signed offset. The check the contents of an register an branch either on a zero or non-zero value of this register. In the decode-stage (stage 2) the branch gets active and thus has one delayslot.

shift/add 6Bit Immediate Instructions

These instructions are used to add or shift the value of a register with a 6Bit signed Immediate value. The result is stored in rd while the source-register may either be rd or the brother-register of rd.


Special Instructions

Select Instructions (currently not implemented)

Select instructions are used to mask out a signed or unsigned, word or halfword from a 32 bit register. They can be used to "emulate" unaligned memory access (which is not supported by ld/st instructions) and to sign/zero extend byte and halfword values.

This article is issued from Wikiversity - version of the Saturday, August 16, 2014. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.