Emulator.Components
Class Memory
java.lang.Object
Emulator.Components.Component
Emulator.Components.Memory
- All Implemented Interfaces:
- DataComponent, Constants
public class Memory
- extends Component
- implements DataComponent
**********************
Created By: Yuval Tzur
Date: 14/12/12
Time: 23:57
Description: The memory class defines the system's memory.
The memory is composed of binary values, and its size is defined by the max value of the address register (MEMORY_SIZE).
In addition to the values, the memory points to an address register that serves as the index to the memory.
There's also a write enable flag. Values can be set only if the write enable flag is true.
A buffer memory exists to mimic the the master-slave functionality of real flip-flops.
Values are written to the buffer and read from the memory.
An update method will update all the memory's registers.
***********************
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 |
Method Summary |
void |
and()
|
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()
|
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()
|
java.lang.String |
get_metaCommand(int address)
|
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_metaCommand(java.lang.String metaCommand)
|
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)
|
void |
shiftLeft1(int numOfBits,
boolean filler)
|
void |
shiftRight0(int numOfBits,
boolean filler)
|
void |
shiftRight1(int numOfBits,
boolean filler)
|
void |
subtract()
|
void |
sum()
|
void |
update()
|
void |
xor()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Memory
public Memory(int id,
java.lang.String name,
AddressRegister addressRegister)
set_value
public void set_value(Value value)
- Specified by:
set_value
in interface DataComponent
set_metaCommand
public void set_metaCommand(java.lang.String metaCommand)
get_value
public Value get_value()
- Specified by:
get_value
in interface DataComponent
get_metaCommand
public java.lang.String get_metaCommand(int address)
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
isWritable0
public boolean isWritable0()
- Specified by:
isWritable0
in interface DataComponent
isWritable1
public boolean isWritable1()
- Specified by:
isWritable1
in interface DataComponent
changed
public boolean changed()
- Specified by:
changed
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
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
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
passThrough0
public void passThrough0()
- Specified by:
passThrough0
in interface DataComponent
passThrough1
public void passThrough1()
- Specified by:
passThrough1
in interface DataComponent
sum
public void sum()
- 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()
- 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
equal
public void equal()
- 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
complement
public void complement()
- Specified by:
complement
in interface DataComponent
complement0
public void complement0()
- Specified by:
complement0
in interface DataComponent
complement1
public void complement1()
- Specified by:
complement1
in interface DataComponent
shiftLeft0
public void shiftLeft0(int numOfBits,
boolean filler)
- 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
get_row
public Value get_row(int address)
- Specified by:
get_row
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
evaluateAsBoolean
public boolean evaluateAsBoolean()
- Specified by:
evaluateAsBoolean
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
enableWrite
public void enableWrite()
- Specified by:
enableWrite
in interface DataComponent
disableWrite
public void disableWrite()
- Specified by:
disableWrite
in interface DataComponent
isWritable
public boolean isWritable()
- Specified by:
isWritable
in interface DataComponent
update
public void update()
- Specified by:
update
in interface DataComponent