Compare commits
No commits in common. "273628c41a3ce22c6c40d4db31ec612a5810434d" and "9f3b5f17b9c14012664a1183e4379e3e32748bb2" have entirely different histories.
273628c41a
...
9f3b5f17b9
1 changed files with 9 additions and 96 deletions
105
README.md
105
README.md
|
@ -15,7 +15,6 @@ classDiagram
|
||||||
+ abstract void write(Address address, Word data)
|
+ abstract void write(Address address, Word data)
|
||||||
+ abstract void dump()
|
+ abstract void dump()
|
||||||
}
|
}
|
||||||
class Program
|
|
||||||
class ProgramCounter {
|
class ProgramCounter {
|
||||||
- int PC
|
- int PC
|
||||||
- int SysTick
|
- int SysTick
|
||||||
|
@ -29,6 +28,7 @@ classDiagram
|
||||||
+ boolean halted()
|
+ boolean halted()
|
||||||
+ void halt()
|
+ void halt()
|
||||||
}
|
}
|
||||||
|
class Program
|
||||||
class Instruction {
|
class Instruction {
|
||||||
+ abstract void execute(Memory memory, ProgramCounter pc)
|
+ abstract void execute(Memory memory, ProgramCounter pc)
|
||||||
# abstract String opcode()
|
# abstract String opcode()
|
||||||
|
@ -62,67 +62,14 @@ classDiagram
|
||||||
+ String toString()
|
+ String toString()
|
||||||
+ boolean equals(Object other)
|
+ boolean equals(Object other)
|
||||||
}
|
}
|
||||||
class Add {
|
class LongMemory {
|
||||||
- Address src
|
- long[] memory
|
||||||
- Word imm
|
+ LongMemory()
|
||||||
- Address dest
|
+ LongMemory(int size)
|
||||||
+ Add(Address src, Word imm, Address dest)
|
+ Word read(Address address)
|
||||||
+ void execute(Memory memory, ProgramCounter PC)
|
+ int size()
|
||||||
+ String opcode()
|
+ void write(Address address, Word data)
|
||||||
+ Object[] operands()
|
+ void dump()
|
||||||
+ String toString()
|
|
||||||
}
|
|
||||||
class Copy {
|
|
||||||
- Word imm
|
|
||||||
- Address dest
|
|
||||||
+ Copy(Word imm, Address dest)
|
|
||||||
+ void execute(Memory memory, ProgramCounter PC)
|
|
||||||
+ String opcode()
|
|
||||||
+ Object[] operands()
|
|
||||||
+ String toString()
|
|
||||||
}
|
|
||||||
class Halt {
|
|
||||||
+ Halt()
|
|
||||||
+ void execute(Memory memory, ProgramCounter PC)
|
|
||||||
+ String opcode()
|
|
||||||
+ Object[] operands()
|
|
||||||
+ String toString()
|
|
||||||
}
|
|
||||||
class Jump {
|
|
||||||
- int index
|
|
||||||
+ Jump(int index)
|
|
||||||
+ void execute(Memory memory, ProgramCounter PC)
|
|
||||||
+ String opcode()
|
|
||||||
+ Object[] operands()
|
|
||||||
+ String toString()
|
|
||||||
}
|
|
||||||
class JumpEq {
|
|
||||||
- int index
|
|
||||||
- Address src
|
|
||||||
- Word imm
|
|
||||||
+ JumpEq(int index, Address src, Word imm)
|
|
||||||
+ void execute(Memory memory, ProgramCounter PC)
|
|
||||||
+ String opcode()
|
|
||||||
+ Object[] operands()
|
|
||||||
+ String toString()
|
|
||||||
}
|
|
||||||
class Mul {
|
|
||||||
- Address src1
|
|
||||||
- Address src2
|
|
||||||
- Address dest
|
|
||||||
+ Mul(Address src1, Address src2, Address dest)
|
|
||||||
+ void execute(Memory memory, ProgramCounter PC)
|
|
||||||
+ String opcode()
|
|
||||||
+ Object[] operands()
|
|
||||||
+ String toString()
|
|
||||||
}
|
|
||||||
class Print {
|
|
||||||
- Address address
|
|
||||||
+ Print(Address address)
|
|
||||||
+ void execute(Memory memory, ProgramCounter PC)
|
|
||||||
+ String opcode()
|
|
||||||
+ Object[] operands()
|
|
||||||
+ String toString()
|
|
||||||
}
|
}
|
||||||
Memory <|-- LongMemory
|
Memory <|-- LongMemory
|
||||||
Word <|-- LongWord
|
Word <|-- LongWord
|
||||||
|
@ -132,38 +79,4 @@ classDiagram
|
||||||
Computer --> Memory
|
Computer --> Memory
|
||||||
Computer --> Program
|
Computer --> Program
|
||||||
Computer --> ProgramCounter
|
Computer --> ProgramCounter
|
||||||
ProgramCounter --> Program
|
|
||||||
ProgramCounter --> Instruction
|
|
||||||
ProgramCounter : +toString()
|
|
||||||
Instruction : +toString()
|
|
||||||
Instruction <|-- Add
|
|
||||||
Instruction <|-- Copy
|
|
||||||
Instruction <|-- Halt
|
|
||||||
Instruction <|-- Jump
|
|
||||||
Instruction <|-- JumpEq
|
|
||||||
Instruction <|-- Mul
|
|
||||||
Instruction <|-- Print
|
|
||||||
Add --> Address
|
|
||||||
```
|
|
||||||
|
|
||||||
```mermaid
|
|
||||||
sequenceDiagram
|
|
||||||
participant Computer
|
|
||||||
participant Program
|
|
||||||
participant Memory
|
|
||||||
participant ProgramCounter
|
|
||||||
participant Instruction
|
|
||||||
|
|
||||||
Computer -> Program: load(program)
|
|
||||||
loop Program Execution
|
|
||||||
Program -> Computer: run()
|
|
||||||
loop Instructions Execution
|
|
||||||
Computer -> ProgramCounter: incPC()
|
|
||||||
ProgramCounter -> Program: getPC()
|
|
||||||
Program -> Program: executeInstruction()
|
|
||||||
Program -> Instruction: execute(memory, PC)
|
|
||||||
Instruction -> Memory: read/write(address)
|
|
||||||
Program -> ProgramCounter: incPC()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in a new issue