diff --git a/difftest/online_dpi/src/dpi.rs b/difftest/online_dpi/src/dpi.rs index cec292c0e6..7e19229df0 100644 --- a/difftest/online_dpi/src/dpi.rs +++ b/difftest/online_dpi/src/dpi.rs @@ -282,7 +282,8 @@ pub(crate) fn dump_wave(path: &str) { use crate::svdpi; let path_cstring = CString::new(path).unwrap(); - svdpi::set_scope_by_name("TOP.TestBench.clockGen"); + // TODO: use vcs/verialtor/... feature to select features, verilator always has a TOP scope + svdpi::set_scope_by_name("TestBench.clockGen"); unsafe { dpi_export::dump_wave(path_cstring.as_ptr()); } diff --git a/difftest/t1dpi.nix b/difftest/t1dpi.nix new file mode 100644 index 0000000000..491d24d2d5 --- /dev/null +++ b/difftest/t1dpi.nix @@ -0,0 +1,54 @@ +{ lib +, libspike +, callPackage +, elaborateConfig + +, rustPlatform + +, rust-analyzer +, rust-bindgen + +, verilator +, verilated +, cmake +, clang-tools +}: + +let + spike_interfaces = callPackage ./spike_interfaces { }; + + src = with lib.fileset; toSource { + root = ./.; + fileset = unions [ + ./spike_rs + ./offline + ./online_dpi + ./online_drive + ./online_vcs + ./test_common + ./Cargo.lock + ./Cargo.toml + ]; + }; + + env = { + SPIKE_LIB_DIR = "${libspike}/lib"; + SPIKE_INTERFACES_LIB_DIR = "${spike_interfaces}/lib"; + DESIGN_VLEN = elaborateConfig.parameter.vLen; + DESIGN_DLEN = elaborateConfig.parameter.dLen; + }; + + self = rustPlatform.buildRustPackage { + name = "online-dpi-lib"; + + inherit src env; + + cargoLock = { + lockFile = ./Cargo.lock; + }; + + buildFeatures = lib.optionals verilated.enable-trace [ "trace" ]; + buildAndTestSubdir = "./online_vcs"; + }; +in +self diff --git a/difftest/vcs.nix b/difftest/vcs.nix new file mode 100644 index 0000000000..e69de29bb2