diff --git a/nemu/flake.lock b/nemu/flake.lock new file mode 100644 index 0000000..5c64744 --- /dev/null +++ b/nemu/flake.lock @@ -0,0 +1,82 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1704722960, + "narHash": "sha256-mKGJ3sPsT6//s+Knglai5YflJUF2DGj7Ai6Ynopz0kI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "317484b1ead87b9c1b8ac5261a8d2dd748a0492d", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nur-xin": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1704680562, + "narHash": "sha256-ffec3HL8OgbHB/TvLHILvC3ylou6N+KDtrn4qYVV+U4=", + "ref": "refs/heads/master", + "rev": "8adf33b6fdd113c645d83feda28622a0b1ef9f83", + "revCount": 144, + "type": "git", + "url": "https://git.xinyang.life/xin/nur.git" + }, + "original": { + "type": "git", + "url": "https://git.xinyang.life/xin/nur.git" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "nur-xin": "nur-xin" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/nemu/flake.nix b/nemu/flake.nix new file mode 100644 index 0000000..5c933c0 --- /dev/null +++ b/nemu/flake.nix @@ -0,0 +1,61 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + nur-xin = { + url = "git+https://git.xinyang.life/xin/nur.git"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { self, ... }@inputs: with inputs; + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = nixpkgs.legacyPackages.${system} // + { nur.xin = nur-xin.legacyPackages.${system}; }; + in + { + devShells.default = with pkgs; mkShell { + packages = [ + clang-tools + rnix-lsp + + gdb + jre + + gtkwave + ]; + + inputsFrom = [ self.packages.${system}.default ]; + }; + + packages.default = with pkgs; stdenv.mkDerivation rec { + pname = "nemu"; + version = "2024-01-02"; + + src = ./.; + + nativeBuildInputs = [ + gnumake + flex + bison + ]; + + buildInputs = [ + readline + libllvm + ]; + + NEMU_HOME = src; + + meta = with lib; { + description = "NJU EMUlator, a full system x86/mips32/riscv32/riscv64 emulator for teaching"; + homepage = "https://github.com/NJU-ProjectN/nemu.git"; + license = with licenses; [ ]; + maintainers = with maintainers; [ ]; + }; + }; + } + ); +} + diff --git a/npc/core/src/test/scala/Keyboard.scala b/npc/core/src/test/scala/Keyboard.scala index 24723cc..92ecadb 100644 --- a/npc/core/src/test/scala/Keyboard.scala +++ b/npc/core/src/test/scala/Keyboard.scala @@ -60,13 +60,3 @@ class KeyboardControllerSpec extends AnyFreeSpec with ChiselScalatestTester { } } } - -class SegSpec extends AnyFreeSpec with ChiselScalatestTester { - "try out vec" in { - test(new SegGenerator(8)) {c => - c.io.keycode.bits.poke(0xAC) - c.clock.step(1) - println(s"out: ${c.io.segs(0).peek().litValue}") - } - } -}