|
MIXAL
|
Public Member Functions | |
| Computer () | |
| Register2 & | rI (int index) |
| const ComputerWord & | memoryAt (int16_t index) const |
| ComputerWord & | memoryAt (int16_t index) |
| IODevice * | getDevice (int32_t index) |
| void | waitDevice (IODevice *device) |
| void | waitDevices () |
| ComputerWord & | getDeviceWordAt (int32_t device, int32_t index) |
| void | reset () |
| int | line () const |
| int | elapsed () const |
| std::string | getSingleLineSymbol () |
| void | executeSingle () |
| void | executeUntilSelfLoop () |
| void | executeUntilHalt () |
| void | executeSingle (ParsedResult *instruction) |
| void | executeSingle (const InstructionWord &instruction) |
| void | executeSinglePesudo (ParsedResult *instruction) |
| void | loadCodes (const std::string &codes, bool addHalt=true) |
| void | loadCodes (const std::vector< std::string > &codes, bool addHalt=true) |
Public Attributes | |
| Register5 | rA |
| Register5 | rX |
| Register2 | rI1 |
| Register2 | rI2 |
| Register2 | rI3 |
| Register2 | rI4 |
| Register2 | rI5 |
| Register2 | rI6 |
| Register2 | rJ |
| bool | overflow |
| ComparisonIndicator | comparison |
| ComputerWord | memory [NUM_MEMORY] |
| std::vector< IODevice * > | devices |
Static Public Attributes | |
| static const int | NUM_INDEX_REGISTER = 6 |
| static const int | NUM_MEMORY = 4000 |
| static const int | NUM_IO_DEVICE = 21 |
| mixal::Computer::Computer | ( | ) |
|
inline |
| void mixal::Computer::executeSingle | ( | ) |
Execute a single instruction in the memory.
Definition at line 69 of file machine.cpp.
References executeSingle(), and memory.
Referenced by executeSingle(), executeUntilHalt(), and executeUntilSelfLoop().
| void mixal::Computer::executeSingle | ( | const InstructionWord & | instruction | ) |
Execute a single instruction based on the given instruction.
Definition at line 121 of file machine.cpp.
References mixal::ComputerWord::field(), mixal::Instructions::getCost(), mixal::ComputerWord::operation(), rA, and rX.
| void mixal::Computer::executeSingle | ( | ParsedResult * | instruction | ) |
Execute a single instruction based on the given instruction.
Definition at line 103 of file machine.cpp.
References mixal::ParsedResult::address, mixal::ParsedResult::evaluate(), mixal::ParsedResult::evaluated(), executeSingle(), executeSinglePesudo(), mixal::ParsedResult::field, mixal::ParsedResult::index, mixal::Expression::literalConstant(), mixal::ParsedResult::parsedType, and mixal::ParsedResult::word.
| void mixal::Computer::executeSinglePesudo | ( | ParsedResult * | instruction | ) |
Execute a single pesudo instruction.
Definition at line 315 of file machine.cpp.
References mixal::ComputerWord::operation(), and mixal::ParsedResult::word.
Referenced by executeSingle().
| void mixal::Computer::executeUntilHalt | ( | ) |
Execute instructions until the HLT operation has been met.
Definition at line 88 of file machine.cpp.
References executeSingle(), memory, NUM_MEMORY, and waitDevices().
| void mixal::Computer::executeUntilSelfLoop | ( | ) |
Execute instructions until there is a self loop.
Definition at line 73 of file machine.cpp.
References executeSingle(), memory, NUM_MEMORY, and waitDevices().
| IODevice * mixal::Computer::getDevice | ( | int32_t | index | ) |
Get the device based on the index value.
Definition at line 11 of file machine_io.cpp.
References devices.
Referenced by getDeviceWordAt().
| ComputerWord & mixal::Computer::getDeviceWordAt | ( | int32_t | device, |
| int32_t | index | ||
| ) |
Get a word from a device.
Definition at line 56 of file machine_io.cpp.
References getDevice(), and mixal::IODevice::wordAt().
| std::string mixal::Computer::getSingleLineSymbol | ( | ) |
Get a unique symbol name.
Definition at line 63 of file machine.cpp.
|
inline |
| void mixal::Computer::loadCodes | ( | const std::string & | codes, |
| bool | addHalt = true |
||
| ) |
| void mixal::Computer::loadCodes | ( | const std::vector< std::string > & | codes, |
| bool | addHalt = true |
||
| ) |
Parse and load codes to memory.
Definition at line 339 of file machine.cpp.
References mixal::Expression::getConstExpression(), mixal::Expression::getConstOffsetExpression(), mixal::Atomic::isLocalSymbol(), memory, NUM_MEMORY, mixal::Parser::parseLine(), and mixal::ComputerWord::set().
| ComputerWord & mixal::Computer::memoryAt | ( | int16_t | index | ) |
| const ComputerWord & mixal::Computer::memoryAt | ( | int16_t | index | ) | const |
| void mixal::Computer::reset | ( | ) |
Reset the machine to zeros.
Definition at line 42 of file machine.cpp.
References comparison, devices, memory, NUM_INDEX_REGISTER, NUM_IO_DEVICE, NUM_MEMORY, overflow, rA, mixal::ComputerWord::reset(), mixal::Register2::reset(), rI(), rJ, and rX.
| Register2 & mixal::Computer::rI | ( | int | index | ) |
Get the index register given the index of the register.
Definition at line 16 of file machine.cpp.
References rI1.
Referenced by reset().
| void mixal::Computer::waitDevice | ( | IODevice * | device | ) |
Wait the IO device to be ready.
Definition at line 42 of file machine_io.cpp.
References mixal::IODevice::ready().
Referenced by waitDevices().
| void mixal::Computer::waitDevices | ( | ) |
Wait all IO devices to be ready.
Definition at line 48 of file machine_io.cpp.
References devices, NUM_IO_DEVICE, and waitDevice().
Referenced by executeUntilHalt(), and executeUntilSelfLoop().
| ComparisonIndicator mixal::Computer::comparison |
| std::vector<IODevice*> mixal::Computer::devices |
The IO devices.
Definition at line 39 of file machine.h.
Referenced by getDevice(), reset(), and waitDevices().
| ComputerWord mixal::Computer::memory[NUM_MEMORY] |
The memory in the machine.
Definition at line 38 of file machine.h.
Referenced by executeSingle(), executeUntilHalt(), executeUntilSelfLoop(), loadCodes(), memoryAt(), and reset().
|
static |
|
static |
Number of IO devices.
Definition at line 30 of file machine.h.
Referenced by reset(), and waitDevices().
|
static |
Number of words in memory.
Definition at line 29 of file machine.h.
Referenced by executeUntilHalt(), executeUntilSelfLoop(), loadCodes(), and reset().
| bool mixal::Computer::overflow |
| Register5 mixal::Computer::rA |
Accumulator register.
Definition at line 32 of file machine.h.
Referenced by executeSingle(), and reset().
| Register2 mixal::Computer::rI1 |
| Register2 mixal::Computer::rJ |
| Register5 mixal::Computer::rX |
Extension register.
Definition at line 32 of file machine.h.
Referenced by executeSingle(), and reset().