The CSE 410 machine is a simplified architecture that contains just (some of) the ideas important to understanding the hw/sw interface. The architecture is simple enough that we can master it easily, allowing us to write small programs for it. It is realistic enough that it will give you a good impression of what actual machine instruction set architectures look like (and a good start toward mastering a real one if you should ever want to).
The CSE 410 machine is implemented by a simulator, written in C. The simulator includes a program loader, which would normally be a part of the operating system. Additionally, it integrates a crude debugger, which would normally be implemented as a user-level process.
This manual describes the 410 Instruction Set Architecture (ISA). Additional documents describe the assembler, the executable file format, and the simulator/debugger.
The memory bus is sixteen bits wide, so memory addresses range from 0x0000 (0) to 0xFFFF (65535). A maximally configured instance has 64KB of memory. Words are stored big-endian. For example, if the word in a register is stored in memory at address 0x0400, the high order (big end) byte is stored at 0x0400 and the lower order byte is stored at 0x0401.
All arithmetic instructions operate on signed (2's complement) values. All address computations are unsigned. When an instruction includes an immediate value, that value is first sign-extended. If it is subsequently used in an address calculation, the sign-extended value is interpreted as unsigned, but with no change to the bit string representing it.
The processor "throws an exception" in two situations:
Name | Format | Length | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
B |
| [8 bits] | ||||||||||
O |
| [16 bits] | ||||||||||
R |
| [16 bits] | ||||||||||
RI |
| [24 bits] | ||||||||||
LI |
| [24 bits] |
All instructions are encoded in one of these five formats. Some instructions may not use all the fields of the format in which it is encoded.
opcode | Name | Format | Example instruction |
---|---|---|---|
000000 | STOP | B | STOP 0000 0000 |
opcode | Name | Format | Example instruction |
---|---|---|---|
000001 | NOP | B | NOP 0000 0100 |
opcode | Name | Format | Example instruction |
---|---|---|---|
000010 | Load word | LW | LW r2 r3 r4 0000 1001 0011 1000 |
opcode | Name | Format | Example instruction |
---|---|---|---|
000011 | Load byte | R | LB r2 r3 r4 0000 1101 0011 1000 |
opcode | Name | Format | Example instruction |
---|---|---|---|
000100 | Store word | R | SW r2 r3 r4 0001 0001 0011 1000 |
opcode | Name | Format | Example instruction |
---|---|---|---|
000101 | Store byte | R | SB r2 r3 r4 0001 0101 0011 1000 |
opcode | Name | Format | Example instruction |
---|---|---|---|
000110 | Add | R | ADD r2 r3 r4 0001 1001 0011 1000 |
opcode | Name | Format | Example instruction |
---|---|---|---|
000111 | Subtract | R | SUB r2 r3 r4 0001 1101 0011 1000 |
opcode | Name | Format | Example instruction |
---|---|---|---|
001000 | Multiply | R | MUL r2 r3 r4 0010 0001 0011 1000 |
opcode | Name | Format | Example instruction |
---|---|---|---|
001001 | Divide | R | DIV r2 r3 r4 0010 0101 0011 1000 |
opcode | Name | Format | Example instruction |
---|---|---|---|
001010 | Add Immediate | RI | ADDI r2 r3 0xfff 0010 1001 0011 1111 1111 1111 |
opcode | Name | Format | Example instruction |
---|---|---|---|
001011 | And | R | AND r2 r3 r4 0010 1101 0011 1000 |
opcode | Name | Format | Example instruction |
---|---|---|---|
001100 | Or | R | OR r2 r3 r4 0011 0001 0011 1000 |
opcode | Name | Format | Example instruction |
---|---|---|---|
001101 | Exclusive Or | R | XOR r2 r3 r4 0011 0101 0011 1000 |
opcode | Name | Format | Example instruction |
---|---|---|---|
001110 | Shift Left | RI | SHFTL r2 r3 $4 0011 1001 0011 0000 0000 0004 |
opcode | Name | Format | Example instruction |
---|---|---|---|
001111 | Shift Right | RI | SHFTR r2 r3 $4 0011 1101 0011 0000 0000 0004 |
opcode | Name | Format | Example instruction |
---|---|---|---|
010000 | Compare | R | CMP r0 r3 r4 0010 0000 0011 1000 |
opcode | Name | Format | Example instruction |
---|---|---|---|
010001 | Branch equal | O | BE 0xffe 0100 0111 1111 1110 |
opcode | Name | Format | Example instruction |
---|---|---|---|
010010 | Branch less than | O | BLT 0xffe 0100 1011 1111 1110 |
opcode | Name | Format | Example instruction |
---|---|---|---|
010010 | Branch greater than | O | BGT 0xffe 0100 1111 1111 1110 |
opcode | Name | Format | Example instruction |
---|---|---|---|
010100 | Jump register | R | JR r0 r3 r4 0101 0000 0011 1000 |
opcode | Name | Format | Example instruction |
---|---|---|---|
010101 | Call | LI | CALL r1 0x123 0101 0100 1000 0001 0010 0011 |
opcode | Name | Format | Example instruction |
---|---|---|---|
010110 | Print register | R | PRINTR r2 r3 r4 0101 1001 0011 1000 |
opcode | Name | Format | Example instruction |
---|---|---|---|
010111 | Print memory | R | PRINTM r2 r3 r4 0101 1101 0011 1000 |
opcode | Name | Format | Example instruction |
---|---|---|---|
011000 | Print char | R | PRINTC r2 r3 r4 0110 0001 0011 1000 |