├── .gitattributes ├── .github └── workflows │ └── build.yml ├── .gitignore ├── LICENSE ├── README.md ├── Setup.hs ├── app └── Main.hs ├── bench └── Bench.hs ├── mips-simulator-hs.cabal ├── package.yaml ├── src ├── ALU.hs ├── Branch.hs ├── CPU.hs ├── Forward.hs ├── InstDecode.hs ├── InstFetch.hs ├── Memory.hs ├── RegisterFile.hs ├── Registers.hs ├── StageExecute.hs ├── StageMem.hs ├── StageReg.hs └── Utils.hs ├── stack.yaml ├── stack.yaml.lock └── test ├── Spec.hs ├── TestUtils.hs ├── hazard-tests ├── control-hazard.asm ├── control-hazard.hex ├── data-hazard.asm ├── data-hazard.hex ├── load-use.asm └── load-use.hex └── naive-tests ├── 0-imem.hex ├── 1-test-add.asm ├── 1-test-add.hex ├── 2-basic-arithmetic.asm ├── 2-basic-arithmetic.hex ├── 3-basic-compare.asm ├── 3-basic-compare.hex ├── 4-branch.asm ├── 4-branch.hex ├── 5-simple-mem.asm ├── 5-simple-mem.hex ├── 6-mem.asm ├── 6-mem.hex ├── 7-jump.asm ├── 7-jump.hex ├── 8-loop.asm └── 8-loop.hex /.gitattributes: -------------------------------------------------------------------------------- 1 | test/naive-tests/* linguist-vendored -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/.github/workflows/build.yml -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .stack-work/ 2 | *~ 3 | .vscode/ 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/LICENSE -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/README.md -------------------------------------------------------------------------------- /Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /app/Main.hs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/app/Main.hs -------------------------------------------------------------------------------- /bench/Bench.hs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/bench/Bench.hs -------------------------------------------------------------------------------- /mips-simulator-hs.cabal: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/mips-simulator-hs.cabal -------------------------------------------------------------------------------- /package.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/package.yaml -------------------------------------------------------------------------------- /src/ALU.hs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/src/ALU.hs -------------------------------------------------------------------------------- /src/Branch.hs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/src/Branch.hs -------------------------------------------------------------------------------- /src/CPU.hs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/src/CPU.hs -------------------------------------------------------------------------------- /src/Forward.hs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/src/Forward.hs -------------------------------------------------------------------------------- /src/InstDecode.hs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/src/InstDecode.hs -------------------------------------------------------------------------------- /src/InstFetch.hs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/src/InstFetch.hs -------------------------------------------------------------------------------- /src/Memory.hs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/src/Memory.hs -------------------------------------------------------------------------------- /src/RegisterFile.hs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/src/RegisterFile.hs -------------------------------------------------------------------------------- /src/Registers.hs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/src/Registers.hs -------------------------------------------------------------------------------- /src/StageExecute.hs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/src/StageExecute.hs -------------------------------------------------------------------------------- /src/StageMem.hs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/src/StageMem.hs -------------------------------------------------------------------------------- /src/StageReg.hs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/src/StageReg.hs -------------------------------------------------------------------------------- /src/Utils.hs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/src/Utils.hs -------------------------------------------------------------------------------- /stack.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/stack.yaml -------------------------------------------------------------------------------- /stack.yaml.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/stack.yaml.lock -------------------------------------------------------------------------------- /test/Spec.hs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/test/Spec.hs -------------------------------------------------------------------------------- /test/TestUtils.hs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/test/TestUtils.hs -------------------------------------------------------------------------------- /test/hazard-tests/control-hazard.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/test/hazard-tests/control-hazard.asm -------------------------------------------------------------------------------- /test/hazard-tests/control-hazard.hex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/test/hazard-tests/control-hazard.hex -------------------------------------------------------------------------------- /test/hazard-tests/data-hazard.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/test/hazard-tests/data-hazard.asm -------------------------------------------------------------------------------- /test/hazard-tests/data-hazard.hex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/test/hazard-tests/data-hazard.hex -------------------------------------------------------------------------------- /test/hazard-tests/load-use.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/test/hazard-tests/load-use.asm -------------------------------------------------------------------------------- /test/hazard-tests/load-use.hex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/test/hazard-tests/load-use.hex -------------------------------------------------------------------------------- /test/naive-tests/0-imem.hex: -------------------------------------------------------------------------------- 1 | deadbeef -------------------------------------------------------------------------------- /test/naive-tests/1-test-add.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/test/naive-tests/1-test-add.asm -------------------------------------------------------------------------------- /test/naive-tests/1-test-add.hex: -------------------------------------------------------------------------------- 1 | 24040064 2 | 240500c8 3 | 00853020 4 | -------------------------------------------------------------------------------- /test/naive-tests/2-basic-arithmetic.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/test/naive-tests/2-basic-arithmetic.asm -------------------------------------------------------------------------------- /test/naive-tests/2-basic-arithmetic.hex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/test/naive-tests/2-basic-arithmetic.hex -------------------------------------------------------------------------------- /test/naive-tests/3-basic-compare.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/test/naive-tests/3-basic-compare.asm -------------------------------------------------------------------------------- /test/naive-tests/3-basic-compare.hex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/test/naive-tests/3-basic-compare.hex -------------------------------------------------------------------------------- /test/naive-tests/4-branch.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/test/naive-tests/4-branch.asm -------------------------------------------------------------------------------- /test/naive-tests/4-branch.hex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/test/naive-tests/4-branch.hex -------------------------------------------------------------------------------- /test/naive-tests/5-simple-mem.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/test/naive-tests/5-simple-mem.asm -------------------------------------------------------------------------------- /test/naive-tests/5-simple-mem.hex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/test/naive-tests/5-simple-mem.hex -------------------------------------------------------------------------------- /test/naive-tests/6-mem.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/test/naive-tests/6-mem.asm -------------------------------------------------------------------------------- /test/naive-tests/6-mem.hex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/test/naive-tests/6-mem.hex -------------------------------------------------------------------------------- /test/naive-tests/7-jump.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/test/naive-tests/7-jump.asm -------------------------------------------------------------------------------- /test/naive-tests/7-jump.hex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/test/naive-tests/7-jump.hex -------------------------------------------------------------------------------- /test/naive-tests/8-loop.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/test/naive-tests/8-loop.asm -------------------------------------------------------------------------------- /test/naive-tests/8-loop.hex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyzh/mips-simulator/HEAD/test/naive-tests/8-loop.hex --------------------------------------------------------------------------------