|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--physis.core.virtualmachine.VirtualMachine
|
+--physis.core.virtualmachine.PhysisVirtualMachine
|
+--arche.UP
This universal processor is designed to increase the evolvability in Tierra-like systems.
The main goal is to enable the evolution of the decoding system, here the processor structure
and the instruction set.
The universal processor is something like the Universal Turing Machine. On the codetape the description
of the processor is stored:
description_of_processor_P#self_replicating_code_for_P
WARNING FOR DEVELOPERS: The inner structure of this class is rather fragile! e.g. If you
change one of the instructions, then you should the number_of_ops table! This class is meant to be ETERNAL! ;)
| Field Summary | |
static short |
ADD
|
static short |
ALLOCATE
|
static short |
AND
|
static short |
B
Blank (for separating different stacks for example). |
private static int |
BEGIN
|
static short |
CDEC
|
static short |
CINC
|
static short |
CLEAR
|
static short |
COMPARE
|
static short |
DEC
|
private int |
direction
The actual direction (the communication partner). |
static short |
DIV
|
static short |
DIVIDE
|
static short |
FORK_TH
|
static short |
GDIR
|
static short |
I
Instruction |
static short |
IFNOTZERO
|
static short |
IFZERO
|
static short |
IN
|
static short |
INC
|
private static int |
INSTRUCTION
|
private short[][] |
instruction_table
|
private Storage |
IP
|
static short |
IS_SEP
|
static short |
JUMP
|
static short |
KILL_TH
|
static short |
LOAD
|
static short |
MOD
|
static short |
MOVE
|
static short |
MUL
|
static short |
NEG
|
static short |
NOP
|
static short |
NOT
|
private short[] |
operands
puffer for operands - 3 is the maximum number of operands |
static short |
OR
|
static short |
OUT
|
static short |
Q
Queue |
static short |
R
Register. |
static short |
RECIEVE
|
static short |
REL_LOAD
|
static short |
REL_STORE
|
static short |
S
Stack |
static short |
SDIR
|
static short |
SEND
|
static short |
SEPARATOR
Separator |
private int |
separator_position
|
private Storage[] |
ses
The structural elements. |
static short |
SHIFT_L
|
static short |
SHIFT_R
|
private int |
ssize
|
static int |
STORAGE_ARRAY_SIZE
|
static short |
STORE
|
static short |
SUB
|
static short |
XOR
|
| Fields inherited from class physis.core.virtualmachine.PhysisVirtualMachine |
alien, bearer, blank, counter, gestation_time, GESTATION_TIME_INVALID, tape |
| Constructor Summary | |
UP()
|
|
| Method Summary | |
void |
add(int op1,
int op2,
int result)
|
void |
allocate(int size_addr)
Allocates memory with the specified size. |
void |
and(int op1,
int op2,
int result)
|
(package private) void |
buildInstructionSet()
Builds the instrucionset from the tape. |
(package private) void |
buildProcessor()
The main for method for building the processor. |
(package private) void |
buildStructure(StorageArray sta)
Builds the structural elements. |
void |
cdec(int n)
|
void |
cinc(int n)
|
void |
clear(int n)
|
void |
compare(int op1,
int op2,
int result)
Compares the content of the op1 and op2 and the result is stored in the result SE element. |
(package private) void |
createInstruction(int number,
int start,
int stop)
Creates the NUMBERth instruction which is on the tape from start to stop. |
void |
dec(int what)
Decrements the content of a structural element. |
void |
div(int op1,
int op2,
int result)
|
void |
divide()
The only one biological operation for cell division. |
void |
execute()
Calling this method forces the machine to execute the next instruction. |
void |
execute(int numberofinstructions)
Calling this method forces te VM to execute the next N instructions. |
private int |
fillOperands(int numops,
short[] insts,
int from)
|
void |
fork_th(int pos)
|
void |
gdir(int whereTo)
|
Genome |
getGenome()
Returns the genetic information. |
int |
getGenomeSize()
Returns the size of the genome. |
java.lang.String |
getState()
Returns the String representation of the current state of the virtualmachine including all stacks registers in the architecture and the instruction point by the instructionpointer: etc. |
void |
ifnotzero(int strel)
Executes the next instruction if the content of thestructural element pointed by strel is zero. |
void |
ifzero(int strel)
Executes the next instruction if the content of thestructural element pointed by strel is zero. |
void |
in(int destination)
Reads one piece of data (an int) from the outside world (environment). |
void |
inc(int what)
Increments the content of a structural element. |
(package private) void |
incrementIP(int value)
The instruction pointer-register is incremented. |
void |
is_sep(int src,
int dst)
|
private boolean |
isCodeForStructruralElement(short c)
|
void |
jump(int address)
Jumps to the address (mod codetape size). |
void |
kill_th()
|
void |
load(int source,
int destination)
Loads data from memory pointed by the source structural element. |
void |
mod(int op1,
int op2,
int result)
|
void |
move(int source,
int destination)
Moves data between the SEs. |
void |
mul(int op1,
int op2,
int result)
|
void |
neg(int op1,
int result)
|
void |
not(int op1,
int result)
|
void |
or(int op1,
int op2,
int result)
|
void |
out(int source)
Writes one piece of data (an int) to the outside world (environment). |
void |
receive(int dst)
Receives a piece of data from an other processor. |
void |
rel_load(int base,
int offset,
int destination)
|
void |
rel_store(int base,
int offset,
int from)
|
void |
reset()
Resets the virtual machine's state. |
void |
restart()
This should be called after successfull proliferation. |
void |
sdir(int whereFrom)
Th processor can communicate with other processors in its neighbourhood but only with one in a moment. |
void |
send(int src)
Sends a piece of data to an other processor pointed by the direction. |
(package private) void |
setIP(int value)
Directly sets the instruction pointer. |
void |
shift_l(int op1,
int result)
|
void |
shift_r(int op1,
int result)
|
void |
store(int destination,
int data)
Writes data to memory from the source structural element. |
void |
sub(int op1,
int op2,
int result)
|
void |
xor(int op1,
int op2,
int result)
|
| Methods inherited from class physis.core.virtualmachine.PhysisVirtualMachine |
getBearer, getEffectiveLength, getGestationTime, loadCodeTape, setBearer |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
public static final int STORAGE_ARRAY_SIZE
private static final int BEGIN
private static final int INSTRUCTION
private Storage[] ses
private int ssize
private short[][] instruction_table
private int separator_position
private int direction
private short[] operands
private Storage IP
public static final short NOP
public static final short IN
public static final short OUT
public static final short LOAD
public static final short STORE
public static final short MOVE
public static final short ALLOCATE
public static final short COMPARE
public static final short IFZERO
public static final short JUMP
public static final short DEC
public static final short INC
public static final short DIVIDE
public static final short SDIR
public static final short GDIR
public static final short SEND
public static final short RECIEVE
public static final short ADD
public static final short SUB
public static final short MUL
public static final short DIV
public static final short MOD
public static final short AND
public static final short OR
public static final short XOR
public static final short NEG
public static final short NOT
public static final short SHIFT_L
public static final short SHIFT_R
public static final short FORK_TH
public static final short KILL_TH
public static final short R
public static final short S
public static final short Q
public static final short I
public static final short B
public static final short SEPARATOR
public static final short CLEAR
public static final short CINC
public static final short CDEC
public static final short IS_SEP
public static final short REL_LOAD
public static final short REL_STORE
public static final short IFNOTZERO
| Constructor Detail |
public UP()
| Method Detail |
public void reset()
VirtualMachinereset in class VirtualMachinepublic void restart()
PhysisVirtualMachinerestart in class PhysisVirtualMachinepublic java.lang.String getState()
VirtualMachinegetState in class VirtualMachinepublic void execute()
VirtualMachineexecute in class VirtualMachine
private int fillOperands(int numops,
short[] insts,
int from)
public void execute(int numberofinstructions)
VirtualMachineexecute in class VirtualMachinephysis.core.virtualmachine.VirtualMachinenumber_of_instructions - The exact number of the instructions to be executed.public Genome getGenome()
PhysisVirtualMachinegetGenome in class PhysisVirtualMachinepublic int getGenomeSize()
PhysisVirtualMachinegetGenomeSize in class PhysisVirtualMachinevoid buildProcessor()
void buildStructure(StorageArray sta)
void buildInstructionSet()
void createInstruction(int number,
int start,
int stop)
void incrementIP(int value)
value - the amount of incrementationvoid setIP(int value)
public void in(int destination)
destination - Index for the structural element where to be loaded.
It's counted modulo number_of_elements.public void out(int source)
source - Index for the structural element of the source.
It's counted modulo number_of_elements.
public void load(int source,
int destination)
source - The index of the SE which contains the memory address.destination - The index of the SE which is the destination.
public void store(int destination,
int data)
source - The index of the SE which contains the memory address.destination - The index of the SE which is the destination.
public void move(int source,
int destination)
public void allocate(int size_addr)
size_addr - is the structural elements' index.
public void compare(int op1,
int op2,
int result)
public void ifzero(int strel)
public void jump(int address)
public void dec(int what)
public void inc(int what)
public void divide()
public void sdir(int whereFrom)
whereFrom - The SE where the new direction is stored.public void gdir(int whereTo)
public void send(int src)
public void receive(int dst)
public void add(int op1,
int op2,
int result)
public void sub(int op1,
int op2,
int result)
public void mul(int op1,
int op2,
int result)
public void div(int op1,
int op2,
int result)
public void mod(int op1,
int op2,
int result)
public void and(int op1,
int op2,
int result)
public void or(int op1,
int op2,
int result)
public void xor(int op1,
int op2,
int result)
public void neg(int op1,
int result)
public void not(int op1,
int result)
public void shift_l(int op1,
int result)
public void shift_r(int op1,
int result)
public void fork_th(int pos)
public void kill_th()
public void clear(int n)
public void cinc(int n)
public void cdec(int n)
public void is_sep(int src,
int dst)
public void rel_load(int base,
int offset,
int destination)
public void rel_store(int base,
int offset,
int from)
public void ifnotzero(int strel)
private boolean isCodeForStructruralElement(short c)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||