> nvboard
ysyx_22040000 李心杨 Linux calcite 6.1.69 #1-NixOS SMP PREEMPT_DYNAMIC Wed Dec 20 16:00:29 UTC 2023 x86_64 GNU/Linux 00:10:12 up 2 days 8:49, 2 users, load average: 0.43, 0.56, 0.49
This commit is contained in:
parent
5592866540
commit
eb9c99b0fd
4 changed files with 100 additions and 5 deletions
6
npc/.gitignore
vendored
6
npc/.gitignore
vendored
|
@ -10,3 +10,9 @@
|
||||||
!.gitignore
|
!.gitignore
|
||||||
!README.md
|
!README.md
|
||||||
build/
|
build/
|
||||||
|
|
||||||
|
*.class
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||||
|
hs_err_pid*
|
||||||
|
|
|
@ -61,7 +61,6 @@ sim: sim-bin git_trace_sim
|
||||||
@echo "================================"
|
@echo "================================"
|
||||||
@$(OBJDIR)/Vexample
|
@$(OBJDIR)/Vexample
|
||||||
|
|
||||||
|
|
||||||
compile_commands.json: clean
|
compile_commands.json: clean
|
||||||
bear --output nvboard.json -- $(MAKE) nvboard-bin
|
bear --output nvboard.json -- $(MAKE) nvboard-bin
|
||||||
bear --output all.json -- $(MAKE) sim-bin
|
bear --output all.json -- $(MAKE) sim-bin
|
||||||
|
|
22
npc/build.sbt
Normal file
22
npc/build.sbt
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
ThisBuild / scalaVersion := "2.13.12"
|
||||||
|
ThisBuild / version := "0.1.0"
|
||||||
|
|
||||||
|
|
||||||
|
val chiselVersion = "5.1.0"
|
||||||
|
|
||||||
|
lazy val root = (project in file("."))
|
||||||
|
.settings(
|
||||||
|
name := "ChiselLearning",
|
||||||
|
libraryDependencies ++= Seq(
|
||||||
|
"org.chipsalliance" %% "chisel" % chiselVersion,
|
||||||
|
"edu.berkeley.cs" %% "chiseltest" % "5.0.2" % "test"
|
||||||
|
),
|
||||||
|
scalacOptions ++= Seq(
|
||||||
|
"-language:reflectiveCalls",
|
||||||
|
"-deprecation",
|
||||||
|
"-feature",
|
||||||
|
"-Xcheckinit",
|
||||||
|
"-Ymacro-annotations",
|
||||||
|
),
|
||||||
|
addCompilerPlugin("org.chipsalliance" % "chisel-plugin" % chiselVersion cross CrossVersion.full),
|
||||||
|
)
|
|
@ -10,26 +10,94 @@
|
||||||
{
|
{
|
||||||
devShells.default = pkgs.mkShell {
|
devShells.default = pkgs.mkShell {
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
verilator
|
|
||||||
gtkwave
|
gtkwave
|
||||||
gcc
|
|
||||||
gdb
|
gdb
|
||||||
jq
|
jq
|
||||||
bear
|
bear
|
||||||
clang-tools
|
clang-tools
|
||||||
rnix-lsp
|
rnix-lsp
|
||||||
|
sbt
|
||||||
];
|
];
|
||||||
|
|
||||||
nativeBuildInputs = with pkgs; [
|
nativeBuildInputs = with pkgs; [
|
||||||
|
verilator
|
||||||
|
gcc
|
||||||
|
python3
|
||||||
|
scala
|
||||||
|
self.packages.${system}.circt
|
||||||
|
];
|
||||||
|
|
||||||
|
buildInputs = with pkgs; [
|
||||||
SDL2
|
SDL2
|
||||||
SDL2_image
|
SDL2_image
|
||||||
python3
|
jre
|
||||||
];
|
];
|
||||||
|
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
export NEMU_HOME=/home/xin/repo/ysyx-workbench/nemu
|
export NEMU_HOME=/home/xin/repo/ysyx-workbench/nemu
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# This version (1.43.0) of circt does not exist in nixpkgs
|
||||||
|
# and Chisel 5.1.0 specifically build against it, so here we are.
|
||||||
|
# Ref: https://github.com/NixOS/nixpkgs/blob/b6465c8/pkgs/development/compilers/circt/default.nix
|
||||||
|
packages.circt =
|
||||||
|
with pkgs;
|
||||||
|
let
|
||||||
|
pythonEnv = python3.withPackages (ps: [ ps.psutil ]);
|
||||||
|
in
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
pname = "circt";
|
||||||
|
version = "1.43.0";
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "llvm";
|
||||||
|
repo = "circt";
|
||||||
|
rev = "firtool-${version}";
|
||||||
|
sha256 = "sha256-RkjigboswLkLgLkgOGahQLIygCkC3Q9rbVw3LqIzREY=";
|
||||||
|
fetchSubmodules = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
requiredSystemFeatures = [ "big-parallel" ];
|
||||||
|
|
||||||
|
nativeBuildInputs = [ cmake ninja git pythonEnv ];
|
||||||
|
|
||||||
|
cmakeDir = "../llvm/llvm";
|
||||||
|
cmakeFlags = [
|
||||||
|
"-DLLVM_ENABLE_BINDINGS=OFF"
|
||||||
|
"-DLLVM_ENABLE_OCAMLDOC=OFF"
|
||||||
|
"-DLLVM_BUILD_EXAMPLES=OFF"
|
||||||
|
"-DLLVM_OPTIMIZED_TABLEGEN=ON"
|
||||||
|
"-DLLVM_ENABLE_PROJECTS=mlir"
|
||||||
|
"-DLLVM_EXTERNAL_PROJECTS=circt"
|
||||||
|
"-DLLVM_EXTERNAL_CIRCT_SOURCE_DIR=.."
|
||||||
|
"-DCIRCT_LLHD_SIM_ENABLED=OFF"
|
||||||
|
];
|
||||||
|
|
||||||
|
LIT_FILTER_OUT = if stdenv.cc.isClang then "CIRCT :: Target/ExportSystemC/.*\.mlir" else null;
|
||||||
|
|
||||||
|
preConfigure = ''
|
||||||
|
find ./test -name '*.mlir' -exec sed -i 's|/usr/bin/env|${coreutils}/bin/env|g' {} \;
|
||||||
|
'';
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
mkdir -p $out/bin
|
||||||
|
mv bin/{{fir,hls}tool,circt-{as,dis,lsp-server,opt,reduce,translate}} $out/bin
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
|
||||||
|
doCheck = true;
|
||||||
|
checkTarget = "check-circt check-circt-integration";
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
description = "Circuit IR compilers and tools";
|
||||||
|
homepage = "https://circt.org/";
|
||||||
|
license = lib.licenses.asl20;
|
||||||
|
maintainers = with lib.maintainers; [ sharzy ];
|
||||||
|
platforms = lib.platforms.all;
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue