Emulator.Components
Class ALU
java.lang.Object
Emulator.Components.Component
Emulator.Components.ALU
- All Implemented Interfaces:
- DataComponent, Constants
public class ALU
- extends Component
- implements DataComponent
**********************
Created By: Yuval Tzur
Date: 15/12/12
Time: 00:51
Description: The ALU is the class that executes all the logical and arithmetical operations.
The ALU has two binary inputs for up to two operands, and a binary output for the solution.
Each of the inputs and outputs has its own ID, as opposed to one ID for the ALU.
Both inputs and the output have the same size as a data register.
Each input has its own write enable flag. Inputs can be set only if writing is enabled.
The ALU will also point to an end carry flag.
***********************
Field Summary |
Emulator.Components.ALU.Input |
mInput0
|
Emulator.Components.ALU.Input |
mInput1
|
Emulator.Components.ALU.Output |
mOutput
|
Fields inherited from interface Emulator.Global.Constants |
_0, _1, AC, ADDR_REGISTER_SIZE, ALU, ALU_IN0, ALU_IN1, ALU_OUT, AR, BUS, BUS_SIZE, DATA_COMPONENTS, DATA_REGISTER_SIZE, DATA_TABLE_SIZE, DR, E, FGI, FGO, I, IEN, INPR, IO_REGISTER_SIZE, IR, M, MEMORY_SIZE, OUTR, PC, R, S, TARGET_REACHED, TIMEOUT, TIMER, TIMER_LIMIT, TR, TR0, TR1, UNREACHABLE |
Constructor Summary |
ALU(int id,
java.lang.String name,
Flag endCarry)
|
Method Summary |
void |
and()
BITWISE**OPERATIONS |
boolean |
changed()
|
void |
clear()
|
void |
complement()
|
void |
complement0()
|
void |
complement1()
|
void |
disableWrite()
|
void |
disableWrite0()
|
void |
disableWrite1()
|
void |
divide()
|
void |
enableWrite()
|
void |
enableWrite0()
|
void |
enableWrite1()
|
void |
equal()
LOGIC**OPERATIONS |
boolean |
evaluateAsBoolean()
|
boolean |
evaluateAsBoolean(int bitIndex)
|
boolean |
evaluateAsBoolean(int bitStart,
int bitEnd)
|
int |
get_decimal()
|
int |
get_decimal(int bitIndex)
|
int |
get_decimal(int bitStart,
int bitEnd)
|
DataComponent |
get_input0()
|
DataComponent |
get_input1()
|
DataComponent |
get_output()
|
Value |
get_row(int address)
|
Value |
get_value()
|
Value |
get_value(int index)
|
Value |
get_value(int start,
int end)
|
void |
greaterOrEqual()
|
void |
greaterThan()
|
void |
increment()
|
boolean |
isWritable()
|
boolean |
isWritable0()
|
boolean |
isWritable1()
|
void |
lessOrEqual()
|
void |
lessThan()
|
void |
modulo()
|
void |
multiply()
|
void |
notEqual()
|
void |
or()
|
void |
passThrough0()
|
void |
passThrough1()
|
void |
set_value(int start,
int end,
Value value)
|
void |
set_value(int index,
Value value)
|
void |
set_value(Value value)
|
void |
set()
|
void |
shiftLeft0(int numOfBits,
boolean filler)
SHIFT**OPERATIONS |
void |
shiftLeft1(int numOfBits,
boolean filler)
|
void |
shiftRight0(int numOfBits,
boolean filler)
|
void |
shiftRight1(int numOfBits,
boolean filler)
|
void |
subtract()
|
void |
sum()
ARITHMETIC**OPERATIONS |
void |
update()
|
void |
xor()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
mInput0
public Emulator.Components.ALU.Input mInput0
mInput1
public Emulator.Components.ALU.Input mInput1
mOutput
public Emulator.Components.ALU.Output mOutput
ALU
public ALU(int id,
java.lang.String name,
Flag endCarry)
get_value
public Value get_value()
- Specified by:
get_value
in interface DataComponent
get_input0
public DataComponent get_input0()
- Specified by:
get_input0
in interface DataComponent
get_input1
public DataComponent get_input1()
- Specified by:
get_input1
in interface DataComponent
get_output
public DataComponent get_output()
- Specified by:
get_output
in interface DataComponent
evaluateAsBoolean
public boolean evaluateAsBoolean()
- Specified by:
evaluateAsBoolean
in interface DataComponent
isWritable
public boolean isWritable()
- Specified by:
isWritable
in interface DataComponent
changed
public boolean changed()
- Specified by:
changed
in interface DataComponent
get_row
public Value get_row(int address)
- Specified by:
get_row
in interface DataComponent
disableWrite
public void disableWrite()
- Specified by:
disableWrite
in interface DataComponent
set_value
public void set_value(Value value)
- Specified by:
set_value
in interface DataComponent
set_value
public void set_value(int index,
Value value)
- Specified by:
set_value
in interface DataComponent
set_value
public void set_value(int start,
int end,
Value value)
- Specified by:
set_value
in interface DataComponent
enableWrite
public void enableWrite()
- Specified by:
enableWrite
in interface DataComponent
update
public void update()
- Specified by:
update
in interface DataComponent
clear
public void clear()
- Specified by:
clear
in interface DataComponent
increment
public void increment()
- Specified by:
increment
in interface DataComponent
set
public void set()
- Specified by:
set
in interface DataComponent
complement
public void complement()
- Specified by:
complement
in interface DataComponent
evaluateAsBoolean
public boolean evaluateAsBoolean(int bitIndex)
- Specified by:
evaluateAsBoolean
in interface DataComponent
evaluateAsBoolean
public boolean evaluateAsBoolean(int bitStart,
int bitEnd)
- Specified by:
evaluateAsBoolean
in interface DataComponent
get_value
public Value get_value(int start,
int end)
- Specified by:
get_value
in interface DataComponent
get_value
public Value get_value(int index)
- Specified by:
get_value
in interface DataComponent
get_decimal
public int get_decimal()
- Specified by:
get_decimal
in interface DataComponent
get_decimal
public int get_decimal(int bitIndex)
- Specified by:
get_decimal
in interface DataComponent
get_decimal
public int get_decimal(int bitStart,
int bitEnd)
- Specified by:
get_decimal
in interface DataComponent
enableWrite0
public void enableWrite0()
- Specified by:
enableWrite0
in interface DataComponent
enableWrite1
public void enableWrite1()
- Specified by:
enableWrite1
in interface DataComponent
disableWrite0
public void disableWrite0()
- Specified by:
disableWrite0
in interface DataComponent
disableWrite1
public void disableWrite1()
- Specified by:
disableWrite1
in interface DataComponent
isWritable0
public boolean isWritable0()
- Specified by:
isWritable0
in interface DataComponent
isWritable1
public boolean isWritable1()
- Specified by:
isWritable1
in interface DataComponent
passThrough0
public void passThrough0()
- Specified by:
passThrough0
in interface DataComponent
passThrough1
public void passThrough1()
- Specified by:
passThrough1
in interface DataComponent
sum
public void sum()
- ARITHMETIC**OPERATIONS
- Specified by:
sum
in interface DataComponent
subtract
public void subtract()
- Specified by:
subtract
in interface DataComponent
multiply
public void multiply()
- Specified by:
multiply
in interface DataComponent
divide
public void divide()
- Specified by:
divide
in interface DataComponent
modulo
public void modulo()
- Specified by:
modulo
in interface DataComponent
and
public void and()
- BITWISE**OPERATIONS
- Specified by:
and
in interface DataComponent
or
public void or()
- Specified by:
or
in interface DataComponent
xor
public void xor()
- Specified by:
xor
in interface DataComponent
complement0
public void complement0()
- Specified by:
complement0
in interface DataComponent
complement1
public void complement1()
- Specified by:
complement1
in interface DataComponent
equal
public void equal()
- LOGIC**OPERATIONS
- Specified by:
equal
in interface DataComponent
notEqual
public void notEqual()
- Specified by:
notEqual
in interface DataComponent
greaterThan
public void greaterThan()
- Specified by:
greaterThan
in interface DataComponent
lessThan
public void lessThan()
- Specified by:
lessThan
in interface DataComponent
greaterOrEqual
public void greaterOrEqual()
- Specified by:
greaterOrEqual
in interface DataComponent
lessOrEqual
public void lessOrEqual()
- Specified by:
lessOrEqual
in interface DataComponent
shiftLeft0
public void shiftLeft0(int numOfBits,
boolean filler)
- SHIFT**OPERATIONS
- Specified by:
shiftLeft0
in interface DataComponent
shiftLeft1
public void shiftLeft1(int numOfBits,
boolean filler)
- Specified by:
shiftLeft1
in interface DataComponent
shiftRight0
public void shiftRight0(int numOfBits,
boolean filler)
- Specified by:
shiftRight0
in interface DataComponent
shiftRight1
public void shiftRight1(int numOfBits,
boolean filler)
- Specified by:
shiftRight1
in interface DataComponent