Skip to content

Commit

Permalink
[fixme] workaround verilator bad TOP scope
Browse files Browse the repository at this point in the history
  • Loading branch information
sequencer committed Jul 25, 2024
1 parent 3359089 commit 5a04f47
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 1 deletion.
3 changes: 2 additions & 1 deletion difftest/online_dpi/src/dpi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down
54 changes: 54 additions & 0 deletions difftest/t1dpi.nix
Original file line number Diff line number Diff line change
@@ -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
Empty file added difftest/vcs.nix
Empty file.

0 comments on commit 5a04f47

Please sign in to comment.