From a8ad97eef2835f6da29c19b5bf23eacc26073c97 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sat, 1 Feb 2020 20:28:03 -0500 Subject: [PATCH] Add VL_CACHE_LINE_BYTES and use 64 as defult. --- include/verilatedos.h | 1 + src/V3EmitC.cpp | 2 +- src/V3EmitCSyms.cpp | 2 +- src/Verilator.cpp | 1 + 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/verilatedos.h b/include/verilatedos.h index 6628c5584..1db5ad3e1 100644 --- a/include/verilatedos.h +++ b/include/verilatedos.h @@ -340,6 +340,7 @@ typedef unsigned long long vluint64_t; ///< 64-bit unsigned type #define VL_QUADSIZE 64 ///< Bits in a QData / quadword #define VL_EDATASIZE 32 ///< Bits in a EData (WData entry) #define VL_EDATASIZE_LOG2 5 ///< log2(VL_EDATASIZE) +#define VL_CACHE_LINE_BYTES 64 ///< Bytes in a cache line (for alignment) /// Bytes this number of bits needs (1 bit=1 byte) #define VL_BYTES_I(nbits) (((nbits) + (VL_BYTESIZE - 1)) / VL_BYTESIZE) diff --git a/src/V3EmitC.cpp b/src/V3EmitC.cpp index 56b899061..f7baee740 100644 --- a/src/V3EmitC.cpp +++ b/src/V3EmitC.cpp @@ -2778,7 +2778,7 @@ void EmitCImp::emitInt(AstNodeModule* modp) { } puts("}"); - if (!VN_IS(modp, Class)) puts(" VL_ATTR_ALIGNED(128)"); + if (!VN_IS(modp, Class)) puts(" VL_ATTR_ALIGNED(VL_CACHE_LINE_BYTES)"); puts(";\n"); emitIntFuncDecls(modp, false); diff --git a/src/V3EmitCSyms.cpp b/src/V3EmitCSyms.cpp index 5699ac9d5..2a9d79270 100644 --- a/src/V3EmitCSyms.cpp +++ b/src/V3EmitCSyms.cpp @@ -475,7 +475,7 @@ void EmitCSyms::emitSymHdr() { puts("void "+protect("__Vdeserialize")+"(VerilatedDeserialize& os);\n"); } puts("\n"); - puts("} VL_ATTR_ALIGNED(64);\n"); + puts("} VL_ATTR_ALIGNED(VL_CACHE_LINE_BYTES);\n"); ofp()->putsEndGuard(); } diff --git a/src/Verilator.cpp b/src/Verilator.cpp index 0a89f2f0e..dae14ea6c 100644 --- a/src/Verilator.cpp +++ b/src/Verilator.cpp @@ -466,6 +466,7 @@ static void process() { && !v3Global.opt.xmlOnly() && !v3Global.opt.dpiHdrOnly()) { // Create AstCUse to determine what class forward declarations/#includes needed in C + // Must be before V3EmitC V3CUse::cUseAll(v3Global.rootp()); // emitcInlines is first, as it may set needHInlines which other emitters read