Add Memory Controllers for SP and PP, add Instruction Set

This commit is contained in:
2020-05-10 21:17:12 +02:00
parent ee896160b3
commit fda22052b8
17 changed files with 189 additions and 141 deletions

View File

@@ -2,6 +2,8 @@
namespace Program;
use RuntimeException;
class Block
{
public string $N;
@@ -20,4 +22,27 @@ class Block
{
$this->words[] = $word;
}
public function valueOf(string $register): int
{
foreach ($this->words as $word) {
if ($word->register === $register) {
return $word->value;
}
}
throw new RuntimeException("No word in block for register '$register'");
}
public function __toString()
{
$buffer = "$this->N\t";
foreach ($this->words as $word) {
$buffer .= "$word\t";
}
return $buffer;
}
}