> compile NEMU

ysyx_22040000 李心杨
Linux calcite 6.1.69 #1-NixOS SMP PREEMPT_DYNAMIC Wed Dec 20 16:00:29 UTC 2023 x86_64 GNU/Linux
 16:16:42  up 3 days 15:17,  2 users,  load average: 0.88, 0.74, 0.68
This commit is contained in:
tracer-ysyx 2024-01-11 16:16:42 +08:00 committed by xinyangli
parent 80c192b99b
commit 2f8255e336
No known key found for this signature in database
3 changed files with 143 additions and 10 deletions

82
nemu/flake.lock Normal file
View file

@ -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
}

61
nemu/flake.nix Normal file
View file

@ -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; [ ];
};
};
}
);
}

View file

@ -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}")
}
}
}