kiama.example.oberon0.machine

object RISCISA

[source: kiama/example/oberon0/machine/RISCISA.scala]

object RISCISA
extends AnyRef
Instruction set architecture for a simple RISC machine.
Type Summary
type Code
A code sequence.
type RegNo
Register numbers (0-31). Program counter is R28.
Methods inherited from AnyRef
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Class Summary
case class ADD (val a : Byte, val b : Byte, val c : Byte) extends Instr with scala.Product
Add the values in registers b and c, store the result in register a.
case class ADDI (val a : Byte, val b : Byte, val im : Int) extends Instr with scala.Product
Add the value in register b and the value im, store the result in register a.
case class BEQ (val label : Int) extends Branch with scala.Product
If the Z condition code is set, set the program counter to its value plus four times disp.
case class BGE (val label : Int) extends Branch with scala.Product
If the N condition code is clear, set the program counter to its value plus four times disp.
case class BGT (val label : Int) extends Branch with scala.Product
If both of the Z and N condition codes are clear, set the program counter to its value plus four times disp.
case class BLE (val label : Int) extends Branch with scala.Product
If either of the Z or N condition codes is set, set the program counter to its value plus four times disp.
case class BLT (val label : Int) extends Branch with scala.Product
If the N condition code is set, set the program counter to its value plus four times disp.
case class BNE (val label : Int) extends Branch with scala.Product
If the Z condition code is clear, set the program counter to its value plus four times disp.
case class BR (val label : Int) extends Branch with scala.Product
Set the program counter to its value plus disp.
case class BSR (val label : Int) extends Branch with scala.Product
Set R31 to the value of the program counter plus one. Set the program counter to its value plus disp.
abstract class Branch extends Instr
Abstract interface for all branch instructions. Branches are created using symbolic labels. The assembler sets the disp field once the symbolic label has been resolved to an offset.
case class CHKI (val a : Byte, val im : Int) extends Instr with scala.Product
If register a contains a value that is negative or greater than or equal to the value im, set register a to zero.
case class CMP (val b : Byte, val c : Byte) extends Instr with scala.Product
Set the Z condition code if the contents of registers b and c are equal. Set the N condition code if the content of register b is less than the content of register c.
case class CMPI (val b : Byte, val im : Int) extends Instr with scala.Product
Set the Z condition code if the content of register b and the value im are equal, otherwise clear Z. Set the N condition code if the content of register b is less than the value im, otherwise clear N.
case class DIV (val a : Byte, val b : Byte, val c : Byte) extends Instr with scala.Product
Divide the values in registers b and c, store the (integer) result in register a.
case class DIVI (val a : Byte, val b : Byte, val im : Int) extends Instr with scala.Product
Divide the value in register b and the value im, store the (integer) result in register a.
abstract class Instr extends AnyRef
Machine instructions.
case class LDB (val a : Byte, val b : Byte, val im : Int) extends Instr with scala.Product
Load register a with the byte value stored in memory at the address given by the contents of register b plus the value im.
case class LDW (val a : Byte, val b : Byte, val im : Int) extends Instr with scala.Product
Load register a with the word value stored in memory at the address given by the contents of register b plus the value im. The lowest two bits of the address are ignored.
case class MOD (val a : Byte, val b : Byte, val c : Byte) extends Instr with scala.Product
Divide the values in registers b and c, store the (integer) remainder in register a.
case class MODI (val a : Byte, val b : Byte, val im : Int) extends Instr with scala.Product
Divide the value in registers b and the value im, store the (integer) remainder in register a.
case class MOV (val a : Byte, val b : Int, val c : Byte) extends Instr with scala.Product
Shift the value in register c by b and store the result in register a.
case class MOVI (val a : Byte, val b : Byte, val im : Int) extends Instr with scala.Product
Shift the value im by b and store the result in register a.
case class MUL (val a : Byte, val b : Byte, val c : Byte) extends Instr with scala.Product
Muliply the values in registers b and c, store the result in register a.
case class MULI (val a : Byte, val b : Byte, val im : Int) extends Instr with scala.Product
Multiply the value in register b and the value im, store the result in register a.
case class MVN (val a : Byte, val b : Byte, val c : Byte) extends Instr with scala.Product
Shift the value in register c by b and store the negation of the result in register a.
case class MVNI (val a : Byte, val b : Byte, val im : Int) extends Instr with scala.Product
Shift the value im by b and store the negation of the result in register a.
case class POP (val a : Byte, val b : Byte, val im : Int) extends Instr with scala.Product
Load register a with the word value stored in register b. The lowest two bits of the address are ignored. Subtract (???) im from the contents of register b and store the result in register b.
case class PSH (val a : Byte, val b : Byte, val im : Int) extends Instr with scala.Product
Add im to the contents of register b and store the result in register b. Store the value in register a into memory at the address given by the contents of register b. The lowest two bits of the address are ignored.
case class RD (val a : Byte) extends Instr with scala.Product
Read an integer variable from standard input and store the value in register a.
case class RET (val c : Int) extends Instr with scala.Product
Set the program counter to the value in register c. If that value is zero, halt the machine.
case class STB (val a : Byte, val b : Byte, val im : Int) extends Instr with scala.Product
Store the least-significant byte of the contents of register a to memory at the address given by the contents of register b plus the value im.
case class STW (val a : Byte, val b : Byte, val im : Int) extends Instr with scala.Product
Store the contents of register a to memory at the address given by the contents of register b plus the value im. The lowest two bits of the address are ignored.
case class SUB (val a : Byte, val b : Byte, val c : Byte) extends Instr with scala.Product
Subtract the values in registers b and c, store the result in register a.
case class SUBI (val a : Byte, val b : Byte, val im : Int) extends Instr with scala.Product
Subtract the value in register b and the value im, store the result in register a.
case class WRD (val c : Byte) extends Instr with scala.Product
Write a decimal representation of the value in register c to standard output.
case class WRH (val c : Byte) extends Instr with scala.Product
Write a hexadecimal representation of the value in register c to standard output.
Object Summary
case object WRL extends Instr with scala.Product
Write a newline to standard output.
Type Details
type Code
A code sequence.

type RegNo
Register numbers (0-31). Program counter is R28.