diff --git a/clash-vexriscv/src/VexRiscv.hs b/clash-vexriscv/src/VexRiscv.hs index 09e318c..4ce50f2 100644 --- a/clash-vexriscv/src/VexRiscv.hs +++ b/clash-vexriscv/src/VexRiscv.hs @@ -70,7 +70,7 @@ data CpuOut = CpuOut } deriving (Generic, NFDataX, ShowX, Eq, BitPack) -data DumpVcd = DumpVcd FilePath | NoDumpVcd +data DumpVcd = DumpVcd { vcdPath :: FilePath, vcdLevels :: Int } | NoDumpVcd data Jtag (dom :: Domain) @@ -532,9 +532,9 @@ vexCPU dumpVcd = do v <- vexrInit vcd <- case dumpVcd of NoDumpVcd -> pure nullPtr - DumpVcd path -> do + DumpVcd path levels -> do vcdPath <- newCString path - vexrInitVcd v vcdPath + vexrInitVcd v vcdPath levels let {-# NOINLINE initStage1 #-} diff --git a/clash-vexriscv/src/VexRiscv/FFI.hsc b/clash-vexriscv/src/VexRiscv/FFI.hsc index c466c1f..1090a48 100644 --- a/clash-vexriscv/src/VexRiscv/FFI.hsc +++ b/clash-vexriscv/src/VexRiscv/FFI.hsc @@ -24,7 +24,7 @@ data VerilatedVcdC data VexRiscvJtagBridge foreign import ccall unsafe "vexr_init" vexrInit :: IO (Ptr VexRiscv) -foreign import ccall unsafe "vexr_init_vcd" vexrInitVcd :: Ptr VexRiscv -> CString -> IO (Ptr VerilatedVcdC) +foreign import ccall unsafe "vexr_init_vcd" vexrInitVcd :: Ptr VexRiscv -> CString -> Int -> IO (Ptr VerilatedVcdC) foreign import ccall unsafe "vexr_shutdown" vexrShutdown :: Ptr VexRiscv -> IO () foreign import ccall unsafe "vexr_init_stage1" vexrInitStage1 :: Ptr VerilatedVcdC -> Ptr VexRiscv -> Ptr NON_COMB_INPUT -> Ptr OUTPUT -> IO () diff --git a/clash-vexriscv/src/ffi/impl.cpp b/clash-vexriscv/src/ffi/impl.cpp index 3288345..c7a6239 100644 --- a/clash-vexriscv/src/ffi/impl.cpp +++ b/clash-vexriscv/src/ffi/impl.cpp @@ -32,7 +32,7 @@ typedef struct { extern "C" { VVexRiscv *vexr_init(); -VerilatedVcdC *vexr_init_vcd(VVexRiscv *top, const char *path); +VerilatedVcdC *vexr_init_vcd(VVexRiscv *top, const char *path, int levels); void vexr_shutdown(VVexRiscv *top); void vexr_init_stage1(VerilatedVcdC *vcd, VVexRiscv *top, @@ -61,12 +61,10 @@ VVexRiscv *vexr_init() { return v; } -VerilatedVcdC *vexr_init_vcd(VVexRiscv *top, const char *path) { +VerilatedVcdC *vexr_init_vcd(VVexRiscv *top, const char *path, int levels) { VerilatedVcdC *vcd = new VerilatedVcdC; Verilated::traceEverOn(true); - // Trace 99 levels of the hierarchy. We only have one level AFAIK, so this - // should be enough :-). - top->trace(vcd, 99); + top->trace(vcd, levels); vcd->open(path); return vcd; }