diff --git a/npc/.gitignore b/npc/.gitignore new file mode 100644 index 0000000..7040bf9 --- /dev/null +++ b/npc/.gitignore @@ -0,0 +1,12 @@ +*.* +* +!*/ +!Makefile +!*.mk +!*.[cSh] +!*.v +!*.cc +!*.cpp +!.gitignore +!README.md +build/ diff --git a/npc/Makefile b/npc/Makefile new file mode 100644 index 0000000..7756a49 --- /dev/null +++ b/npc/Makefile @@ -0,0 +1,16 @@ +VERILATOR := verilator + +VSRC := $(wildcard vsrc/*.v) +CPPSRC := $(wildcard csrc/*.cpp) + +all: + @echo "Write this Makefile by your self." + +sim: obj_dir + $(call git_commit, "sim RTL") # DO NOT REMOVE THIS LINE!!! + @echo "Write this Makefile by your self." + +obj_dir: $(VSRC) $(CPPSRC) + $(VERILATOR) $(VSRC:%=--cc %) $< $(CPPSRC:%=--exe %) --Mdir $@ + +include ../Makefile diff --git a/npc/csrc/main.cpp b/npc/csrc/main.cpp new file mode 100644 index 0000000..2b2f9f8 --- /dev/null +++ b/npc/csrc/main.cpp @@ -0,0 +1,11 @@ +#include "Vexample.h" +#include "verilated.h" + +int main(int argc, char **argv, char **env) { + Verilated::commandArgs(argc, argv); + Vexample *top = new Vexample; + while (!Verilated::gotFinish()) { + top->eval(); + } + exit(0); +} diff --git a/flake.lock b/npc/flake.lock similarity index 100% rename from flake.lock rename to npc/flake.lock diff --git a/flake.nix b/npc/flake.nix similarity index 61% rename from flake.nix rename to npc/flake.nix index 4a49bd4..3c5c8af 100644 --- a/flake.nix +++ b/npc/flake.nix @@ -4,27 +4,19 @@ flake-utils.url = "github:numtide/flake-utils"; }; - outputs = { self, ... }@inputs: with inputs; + outputs = { self, ... }@inputs: with inputs; flake-utils.lib.eachDefaultSystem (system: let pkgs = nixpkgs.legacyPackages.${system}; in { devShells.default = pkgs.mkShell { packages = with pkgs; [ - gnumake - bison - flex - ncurses - readline - libllvm - - # TODO: Pin 5.008? - verilator + verilator gtkwave + gcc + bear ]; - shellHook = '' export NEMU_HOME=/home/xin/repo/ysyx-workbench/nemu - export AM_HOME=/home/xin/repo/ysyx-workbench/abstract-machine ''; }; } diff --git a/npc/obj_dir/Vexample.cpp b/npc/obj_dir/Vexample.cpp new file mode 100644 index 0000000..6d4b61f --- /dev/null +++ b/npc/obj_dir/Vexample.cpp @@ -0,0 +1,102 @@ +// Verilated -*- C++ -*- +// DESCRIPTION: Verilator output: Model implementation (design independent parts) + +#include "Vexample__pch.h" + +//============================================================ +// Constructors + +Vexample::Vexample(VerilatedContext* _vcontextp__, const char* _vcname__) + : VerilatedModel{*_vcontextp__} + , vlSymsp{new Vexample__Syms(contextp(), _vcname__, this)} + , rootp{&(vlSymsp->TOP)} +{ + // Register model with the context + contextp()->addModel(this); +} + +Vexample::Vexample(const char* _vcname__) + : Vexample(Verilated::threadContextp(), _vcname__) +{ +} + +//============================================================ +// Destructor + +Vexample::~Vexample() { + delete vlSymsp; +} + +//============================================================ +// Evaluation function + +#ifdef VL_DEBUG +void Vexample___024root___eval_debug_assertions(Vexample___024root* vlSelf); +#endif // VL_DEBUG +void Vexample___024root___eval_static(Vexample___024root* vlSelf); +void Vexample___024root___eval_initial(Vexample___024root* vlSelf); +void Vexample___024root___eval_settle(Vexample___024root* vlSelf); +void Vexample___024root___eval(Vexample___024root* vlSelf); + +void Vexample::eval_step() { + VL_DEBUG_IF(VL_DBG_MSGF("+++++TOP Evaluate Vexample::eval_step\n"); ); +#ifdef VL_DEBUG + // Debug assertions + Vexample___024root___eval_debug_assertions(&(vlSymsp->TOP)); +#endif // VL_DEBUG + vlSymsp->__Vm_deleter.deleteAll(); + if (VL_UNLIKELY(!vlSymsp->__Vm_didInit)) { + vlSymsp->__Vm_didInit = true; + VL_DEBUG_IF(VL_DBG_MSGF("+ Initial\n");); + Vexample___024root___eval_static(&(vlSymsp->TOP)); + Vexample___024root___eval_initial(&(vlSymsp->TOP)); + Vexample___024root___eval_settle(&(vlSymsp->TOP)); + } + VL_DEBUG_IF(VL_DBG_MSGF("+ Eval\n");); + Vexample___024root___eval(&(vlSymsp->TOP)); + // Evaluate cleanup + Verilated::endOfEval(vlSymsp->__Vm_evalMsgQp); +} + +//============================================================ +// Events and timing +bool Vexample::eventsPending() { return false; } + +uint64_t Vexample::nextTimeSlot() { + VL_FATAL_MT(__FILE__, __LINE__, "", "%Error: No delays in the design"); + return 0; +} + +//============================================================ +// Utilities + +const char* Vexample::name() const { + return vlSymsp->name(); +} + +//============================================================ +// Invoke final blocks + +void Vexample___024root___eval_final(Vexample___024root* vlSelf); + +VL_ATTR_COLD void Vexample::final() { + Vexample___024root___eval_final(&(vlSymsp->TOP)); +} + +//============================================================ +// Implementations of abstract methods from VerilatedModel + +const char* Vexample::hierName() const { return vlSymsp->name(); } +const char* Vexample::modelName() const { return "Vexample"; } +unsigned Vexample::threads() const { return 1; } +void Vexample::prepareClone() const { contextp()->prepareClone(); } +void Vexample::atClone() const { + contextp()->threadPoolpOnClone(); +} + +//============================================================ +// Trace configuration + +VL_ATTR_COLD void Vexample::trace(VerilatedVcdC* tfp, int levels, int options) { + vl_fatal(__FILE__, __LINE__, __FILE__,"'Vexample::trace()' called on model that was Verilated without --trace option"); +} diff --git a/npc/obj_dir/Vexample.h b/npc/obj_dir/Vexample.h new file mode 100644 index 0000000..831f3a3 --- /dev/null +++ b/npc/obj_dir/Vexample.h @@ -0,0 +1,80 @@ +// Verilated -*- C++ -*- +// DESCRIPTION: Verilator output: Primary model header +// +// This header should be included by all source files instantiating the design. +// The class here is then constructed to instantiate the design. +// See the Verilator manual for examples. + +#ifndef VERILATED_VEXAMPLE_H_ +#define VERILATED_VEXAMPLE_H_ // guard + +#include "verilated.h" + +class Vexample__Syms; +class Vexample___024root; + +// This class is the main interface to the Verilated model +class alignas(VL_CACHE_LINE_BYTES) Vexample VL_NOT_FINAL : public VerilatedModel { + private: + // Symbol table holding complete model state (owned by this class) + Vexample__Syms* const vlSymsp; + + public: + + // PORTS + // The application code writes and reads these signals to + // propagate new values into/out from the Verilated model. + + // CELLS + // Public to allow access to /* verilator public */ items. + // Otherwise the application code can consider these internals. + + // Root instance pointer to allow access to model internals, + // including inlined /* verilator public_flat_* */ items. + Vexample___024root* const rootp; + + // CONSTRUCTORS + /// Construct the model; called by application code + /// If contextp is null, then the model will use the default global context + /// If name is "", then makes a wrapper with a + /// single model invisible with respect to DPI scope names. + explicit Vexample(VerilatedContext* contextp, const char* name = "TOP"); + explicit Vexample(const char* name = "TOP"); + /// Destroy the model; called (often implicitly) by application code + virtual ~Vexample(); + private: + VL_UNCOPYABLE(Vexample); ///< Copying not allowed + + public: + // API METHODS + /// Evaluate the model. Application must call when inputs change. + void eval() { eval_step(); } + /// Evaluate when calling multiple units/models per time step. + void eval_step(); + /// Evaluate at end of a timestep for tracing, when using eval_step(). + /// Application must call after all eval() and before time changes. + void eval_end_step() {} + /// Simulation complete, run final blocks. Application must call on completion. + void final(); + /// Are there scheduled events to handle? + bool eventsPending(); + /// Returns time at next time slot. Aborts if !eventsPending() + uint64_t nextTimeSlot(); + /// Trace signals in the model; called by application code + void trace(VerilatedVcdC* tfp, int levels, int options = 0); + /// Retrieve name of this model instance (as passed to constructor). + const char* name() const; + + // Abstract methods from VerilatedModel + const char* hierName() const override final; + const char* modelName() const override final; + unsigned threads() const override final; + /// Prepare for cloning the model at the process level (e.g. fork in Linux) + /// Release necessary resources. Called before cloning. + void prepareClone() const; + /// Re-init after cloning the model at the process level (e.g. fork in Linux) + /// Re-allocate necessary resources. Called after cloning. + void atClone() const; +}; + +#endif // guard diff --git a/npc/obj_dir/Vexample.mk b/npc/obj_dir/Vexample.mk new file mode 100644 index 0000000..eec02c2 --- /dev/null +++ b/npc/obj_dir/Vexample.mk @@ -0,0 +1,68 @@ +# Verilated -*- Makefile -*- +# DESCRIPTION: Verilator output: Makefile for building Verilated archive or executable +# +# Execute this makefile from the object directory: +# make -f Vexample.mk + +default: Vexample + +### Constants... +# Perl executable (from $PERL) +PERL = perl +# Path to Verilator kit (from $VERILATOR_ROOT) +VERILATOR_ROOT = /nix/store/lyzgj5m2zhsw9m3v1fnzr3dp1z9myyaz-verilator-5.018/share/verilator +# SystemC include directory with systemc.h (from $SYSTEMC_INCLUDE) +SYSTEMC_INCLUDE ?= +# SystemC library directory with libsystemc.a (from $SYSTEMC_LIBDIR) +SYSTEMC_LIBDIR ?= + +### Switches... +# C++ code coverage 0/1 (from --prof-c) +VM_PROFC = 0 +# SystemC output mode? 0/1 (from --sc) +VM_SC = 0 +# Legacy or SystemC output mode? 0/1 (from --sc) +VM_SP_OR_SC = $(VM_SC) +# Deprecated +VM_PCLI = 1 +# Deprecated: SystemC architecture to find link library path (from $SYSTEMC_ARCH) +VM_SC_TARGET_ARCH = linux + +### Vars... +# Design prefix (from --prefix) +VM_PREFIX = Vexample +# Module prefix (from --prefix) +VM_MODPREFIX = Vexample +# User CFLAGS (from -CFLAGS on Verilator command line) +VM_USER_CFLAGS = \ + +# User LDLIBS (from -LDFLAGS on Verilator command line) +VM_USER_LDLIBS = \ + +# User .cpp files (from .cpp's on Verilator command line) +VM_USER_CLASSES = \ + main \ + +# User .cpp directories (from .cpp's on Verilator command line) +VM_USER_DIR = \ + csrc \ + + +### Default rules... +# Include list of all generated classes +include Vexample_classes.mk +# Include global rules +include $(VERILATOR_ROOT)/include/verilated.mk + +### Executable rules... (from --exe) +VPATH += $(VM_USER_DIR) + +main.o: csrc/main.cpp + $(OBJCACHE) $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(OPT_FAST) -c -o $@ $< + +### Link rules... (from --exe) +Vexample: $(VK_USER_OBJS) $(VK_GLOBAL_OBJS) $(VM_PREFIX)__ALL.a $(VM_HIER_LIBS) + $(LINK) $(LDFLAGS) $^ $(LOADLIBES) $(LDLIBS) $(LIBS) $(SC_LIBS) -o $@ + + +# Verilated -*- Makefile -*- diff --git a/npc/obj_dir/Vexample__ALL.cpp b/npc/obj_dir/Vexample__ALL.cpp new file mode 100644 index 0000000..553d165 --- /dev/null +++ b/npc/obj_dir/Vexample__ALL.cpp @@ -0,0 +1,8 @@ +// DESCRIPTION: Generated by verilator_includer via makefile +#define VL_INCLUDE_OPT include +#include "Vexample.cpp" +#include "Vexample___024root__DepSet_h625e39dc__0.cpp" +#include "Vexample___024root__DepSet_hcb5acca5__0.cpp" +#include "Vexample___024root__Slow.cpp" +#include "Vexample___024root__DepSet_hcb5acca5__0__Slow.cpp" +#include "Vexample__Syms.cpp" diff --git a/npc/obj_dir/Vexample__Syms.cpp b/npc/obj_dir/Vexample__Syms.cpp new file mode 100644 index 0000000..4cd128c --- /dev/null +++ b/npc/obj_dir/Vexample__Syms.cpp @@ -0,0 +1,26 @@ +// Verilated -*- C++ -*- +// DESCRIPTION: Verilator output: Symbol table implementation internals + +#include "Vexample__pch.h" +#include "Vexample.h" +#include "Vexample___024root.h" + +// FUNCTIONS +Vexample__Syms::~Vexample__Syms() +{ +} + +Vexample__Syms::Vexample__Syms(VerilatedContext* contextp, const char* namep, Vexample* modelp) + : VerilatedSyms{contextp} + // Setup internal state of the Syms class + , __Vm_modelp{modelp} + // Setup module instances + , TOP{this, namep} +{ + // Configure time unit / time precision + _vm_contextp__->timeunit(-12); + _vm_contextp__->timeprecision(-12); + // Setup each module's pointers to their submodules + // Setup each module's pointer back to symbol table (for public functions) + TOP.__Vconfigure(true); +} diff --git a/npc/obj_dir/Vexample__Syms.h b/npc/obj_dir/Vexample__Syms.h new file mode 100644 index 0000000..c9ead4e --- /dev/null +++ b/npc/obj_dir/Vexample__Syms.h @@ -0,0 +1,38 @@ +// Verilated -*- C++ -*- +// DESCRIPTION: Verilator output: Symbol table internal header +// +// Internal details; most calling programs do not need this header, +// unless using verilator public meta comments. + +#ifndef VERILATED_VEXAMPLE__SYMS_H_ +#define VERILATED_VEXAMPLE__SYMS_H_ // guard + +#include "verilated.h" + +// INCLUDE MODEL CLASS + +#include "Vexample.h" + +// INCLUDE MODULE CLASSES +#include "Vexample___024root.h" + +// SYMS CLASS (contains all model state) +class alignas(VL_CACHE_LINE_BYTES)Vexample__Syms final : public VerilatedSyms { + public: + // INTERNAL STATE + Vexample* const __Vm_modelp; + VlDeleter __Vm_deleter; + bool __Vm_didInit = false; + + // MODULE INSTANCE STATE + Vexample___024root TOP; + + // CONSTRUCTORS + Vexample__Syms(VerilatedContext* contextp, const char* namep, Vexample* modelp); + ~Vexample__Syms(); + + // METHODS + const char* name() { return TOP.name(); } +}; + +#endif // guard diff --git a/npc/obj_dir/Vexample___024root.h b/npc/obj_dir/Vexample___024root.h new file mode 100644 index 0000000..f77ba79 --- /dev/null +++ b/npc/obj_dir/Vexample___024root.h @@ -0,0 +1,35 @@ +// Verilated -*- C++ -*- +// DESCRIPTION: Verilator output: Design internal header +// See Vexample.h for the primary calling header + +#ifndef VERILATED_VEXAMPLE___024ROOT_H_ +#define VERILATED_VEXAMPLE___024ROOT_H_ // guard + +#include "verilated.h" + + +class Vexample__Syms; + +class alignas(VL_CACHE_LINE_BYTES) Vexample___024root final : public VerilatedModule { + public: + + // DESIGN SPECIFIC STATE + CData/*0:0*/ __VactContinue; + IData/*31:0*/ __VactIterCount; + VlTriggerVec<0> __VactTriggered; + VlTriggerVec<0> __VnbaTriggered; + + // INTERNAL VARIABLES + Vexample__Syms* const vlSymsp; + + // CONSTRUCTORS + Vexample___024root(Vexample__Syms* symsp, const char* v__name); + ~Vexample___024root(); + VL_UNCOPYABLE(Vexample___024root); + + // INTERNAL METHODS + void __Vconfigure(bool first); +}; + + +#endif // guard diff --git a/npc/obj_dir/Vexample___024root__DepSet_h625e39dc__0.cpp b/npc/obj_dir/Vexample___024root__DepSet_h625e39dc__0.cpp new file mode 100644 index 0000000..5cabb99 --- /dev/null +++ b/npc/obj_dir/Vexample___024root__DepSet_h625e39dc__0.cpp @@ -0,0 +1,23 @@ +// Verilated -*- C++ -*- +// DESCRIPTION: Verilator output: Design implementation internals +// See Vexample.h for the primary calling header + +#include "Vexample__pch.h" +#include "Vexample__Syms.h" +#include "Vexample___024root.h" + +#ifdef VL_DEBUG +VL_ATTR_COLD void Vexample___024root___dump_triggers__act(Vexample___024root* vlSelf); +#endif // VL_DEBUG + +void Vexample___024root___eval_triggers__act(Vexample___024root* vlSelf) { + if (false && vlSelf) {} // Prevent unused + Vexample__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + VL_DEBUG_IF(VL_DBG_MSGF("+ Vexample___024root___eval_triggers__act\n"); ); + // Body +#ifdef VL_DEBUG + if (VL_UNLIKELY(vlSymsp->_vm_contextp__->debug())) { + Vexample___024root___dump_triggers__act(vlSelf); + } +#endif +} diff --git a/npc/obj_dir/Vexample___024root__DepSet_hcb5acca5__0.cpp b/npc/obj_dir/Vexample___024root__DepSet_hcb5acca5__0.cpp new file mode 100644 index 0000000..73fc071 --- /dev/null +++ b/npc/obj_dir/Vexample___024root__DepSet_hcb5acca5__0.cpp @@ -0,0 +1,109 @@ +// Verilated -*- C++ -*- +// DESCRIPTION: Verilator output: Design implementation internals +// See Vexample.h for the primary calling header + +#include "Vexample__pch.h" +#include "Vexample___024root.h" + +void Vexample___024root___eval_act(Vexample___024root* vlSelf) { + if (false && vlSelf) {} // Prevent unused + Vexample__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + VL_DEBUG_IF(VL_DBG_MSGF("+ Vexample___024root___eval_act\n"); ); +} + +void Vexample___024root___eval_nba(Vexample___024root* vlSelf) { + if (false && vlSelf) {} // Prevent unused + Vexample__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + VL_DEBUG_IF(VL_DBG_MSGF("+ Vexample___024root___eval_nba\n"); ); +} + +void Vexample___024root___eval_triggers__act(Vexample___024root* vlSelf); + +bool Vexample___024root___eval_phase__act(Vexample___024root* vlSelf) { + if (false && vlSelf) {} // Prevent unused + Vexample__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + VL_DEBUG_IF(VL_DBG_MSGF("+ Vexample___024root___eval_phase__act\n"); ); + // Init + VlTriggerVec<0> __VpreTriggered; + CData/*0:0*/ __VactExecute; + // Body + Vexample___024root___eval_triggers__act(vlSelf); + __VactExecute = vlSelf->__VactTriggered.any(); + if (__VactExecute) { + __VpreTriggered.andNot(vlSelf->__VactTriggered, vlSelf->__VnbaTriggered); + vlSelf->__VnbaTriggered.thisOr(vlSelf->__VactTriggered); + Vexample___024root___eval_act(vlSelf); + } + return (__VactExecute); +} + +bool Vexample___024root___eval_phase__nba(Vexample___024root* vlSelf) { + if (false && vlSelf) {} // Prevent unused + Vexample__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + VL_DEBUG_IF(VL_DBG_MSGF("+ Vexample___024root___eval_phase__nba\n"); ); + // Init + CData/*0:0*/ __VnbaExecute; + // Body + __VnbaExecute = vlSelf->__VnbaTriggered.any(); + if (__VnbaExecute) { + Vexample___024root___eval_nba(vlSelf); + vlSelf->__VnbaTriggered.clear(); + } + return (__VnbaExecute); +} + +#ifdef VL_DEBUG +VL_ATTR_COLD void Vexample___024root___dump_triggers__nba(Vexample___024root* vlSelf); +#endif // VL_DEBUG +#ifdef VL_DEBUG +VL_ATTR_COLD void Vexample___024root___dump_triggers__act(Vexample___024root* vlSelf); +#endif // VL_DEBUG + +void Vexample___024root___eval(Vexample___024root* vlSelf) { + if (false && vlSelf) {} // Prevent unused + Vexample__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + VL_DEBUG_IF(VL_DBG_MSGF("+ Vexample___024root___eval\n"); ); + // Init + IData/*31:0*/ __VnbaIterCount; + CData/*0:0*/ __VnbaContinue; + // Body + __VnbaIterCount = 0U; + __VnbaContinue = 1U; + while (__VnbaContinue) { + if (VL_UNLIKELY((0x64U < __VnbaIterCount))) { +#ifdef VL_DEBUG + Vexample___024root___dump_triggers__nba(vlSelf); +#endif + VL_FATAL_MT("vsrc/example.v", 1, "", "NBA region did not converge."); + } + __VnbaIterCount = ((IData)(1U) + __VnbaIterCount); + __VnbaContinue = 0U; + vlSelf->__VactIterCount = 0U; + vlSelf->__VactContinue = 1U; + while (vlSelf->__VactContinue) { + if (VL_UNLIKELY((0x64U < vlSelf->__VactIterCount))) { +#ifdef VL_DEBUG + Vexample___024root___dump_triggers__act(vlSelf); +#endif + VL_FATAL_MT("vsrc/example.v", 1, "", "Active region did not converge."); + } + vlSelf->__VactIterCount = ((IData)(1U) + + vlSelf->__VactIterCount); + vlSelf->__VactContinue = 0U; + if (Vexample___024root___eval_phase__act(vlSelf)) { + vlSelf->__VactContinue = 1U; + } + } + if (Vexample___024root___eval_phase__nba(vlSelf)) { + __VnbaContinue = 1U; + } + } +} + +#ifdef VL_DEBUG +void Vexample___024root___eval_debug_assertions(Vexample___024root* vlSelf) { + if (false && vlSelf) {} // Prevent unused + Vexample__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + VL_DEBUG_IF(VL_DBG_MSGF("+ Vexample___024root___eval_debug_assertions\n"); ); +} +#endif // VL_DEBUG diff --git a/npc/obj_dir/Vexample___024root__DepSet_hcb5acca5__0__Slow.cpp b/npc/obj_dir/Vexample___024root__DepSet_hcb5acca5__0__Slow.cpp new file mode 100644 index 0000000..ffa3c5a --- /dev/null +++ b/npc/obj_dir/Vexample___024root__DepSet_hcb5acca5__0__Slow.cpp @@ -0,0 +1,73 @@ +// Verilated -*- C++ -*- +// DESCRIPTION: Verilator output: Design implementation internals +// See Vexample.h for the primary calling header + +#include "Vexample__pch.h" +#include "Vexample___024root.h" + +VL_ATTR_COLD void Vexample___024root___eval_static(Vexample___024root* vlSelf) { + if (false && vlSelf) {} // Prevent unused + Vexample__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + VL_DEBUG_IF(VL_DBG_MSGF("+ Vexample___024root___eval_static\n"); ); +} + +VL_ATTR_COLD void Vexample___024root___eval_initial__TOP(Vexample___024root* vlSelf); + +VL_ATTR_COLD void Vexample___024root___eval_initial(Vexample___024root* vlSelf) { + if (false && vlSelf) {} // Prevent unused + Vexample__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + VL_DEBUG_IF(VL_DBG_MSGF("+ Vexample___024root___eval_initial\n"); ); + // Body + Vexample___024root___eval_initial__TOP(vlSelf); +} + +VL_ATTR_COLD void Vexample___024root___eval_initial__TOP(Vexample___024root* vlSelf) { + if (false && vlSelf) {} // Prevent unused + Vexample__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + VL_DEBUG_IF(VL_DBG_MSGF("+ Vexample___024root___eval_initial__TOP\n"); ); + // Body + VL_WRITEF("Hello World\n"); + VL_FINISH_MT("vsrc/example.v", 2, ""); +} + +VL_ATTR_COLD void Vexample___024root___eval_final(Vexample___024root* vlSelf) { + if (false && vlSelf) {} // Prevent unused + Vexample__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + VL_DEBUG_IF(VL_DBG_MSGF("+ Vexample___024root___eval_final\n"); ); +} + +VL_ATTR_COLD void Vexample___024root___eval_settle(Vexample___024root* vlSelf) { + if (false && vlSelf) {} // Prevent unused + Vexample__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + VL_DEBUG_IF(VL_DBG_MSGF("+ Vexample___024root___eval_settle\n"); ); +} + +#ifdef VL_DEBUG +VL_ATTR_COLD void Vexample___024root___dump_triggers__act(Vexample___024root* vlSelf) { + if (false && vlSelf) {} // Prevent unused + Vexample__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + VL_DEBUG_IF(VL_DBG_MSGF("+ Vexample___024root___dump_triggers__act\n"); ); + // Body + if ((1U & (~ (IData)(vlSelf->__VactTriggered.any())))) { + VL_DBG_MSGF(" No triggers active\n"); + } +} +#endif // VL_DEBUG + +#ifdef VL_DEBUG +VL_ATTR_COLD void Vexample___024root___dump_triggers__nba(Vexample___024root* vlSelf) { + if (false && vlSelf) {} // Prevent unused + Vexample__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + VL_DEBUG_IF(VL_DBG_MSGF("+ Vexample___024root___dump_triggers__nba\n"); ); + // Body + if ((1U & (~ (IData)(vlSelf->__VnbaTriggered.any())))) { + VL_DBG_MSGF(" No triggers active\n"); + } +} +#endif // VL_DEBUG + +VL_ATTR_COLD void Vexample___024root___ctor_var_reset(Vexample___024root* vlSelf) { + if (false && vlSelf) {} // Prevent unused + Vexample__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + VL_DEBUG_IF(VL_DBG_MSGF("+ Vexample___024root___ctor_var_reset\n"); ); +} diff --git a/npc/obj_dir/Vexample___024root__Slow.cpp b/npc/obj_dir/Vexample___024root__Slow.cpp new file mode 100644 index 0000000..262645c --- /dev/null +++ b/npc/obj_dir/Vexample___024root__Slow.cpp @@ -0,0 +1,24 @@ +// Verilated -*- C++ -*- +// DESCRIPTION: Verilator output: Design implementation internals +// See Vexample.h for the primary calling header + +#include "Vexample__pch.h" +#include "Vexample__Syms.h" +#include "Vexample___024root.h" + +void Vexample___024root___ctor_var_reset(Vexample___024root* vlSelf); + +Vexample___024root::Vexample___024root(Vexample__Syms* symsp, const char* v__name) + : VerilatedModule{v__name} + , vlSymsp{symsp} + { + // Reset structure values + Vexample___024root___ctor_var_reset(this); +} + +void Vexample___024root::__Vconfigure(bool first) { + if (false && first) {} // Prevent unused +} + +Vexample___024root::~Vexample___024root() { +} diff --git a/npc/obj_dir/Vexample__pch.h b/npc/obj_dir/Vexample__pch.h new file mode 100644 index 0000000..7798b87 --- /dev/null +++ b/npc/obj_dir/Vexample__pch.h @@ -0,0 +1,26 @@ +// Verilated -*- C++ -*- +// DESCRIPTION: Verilator output: Precompiled header +// +// Internal details; most user sources do not need this header, +// unless using verilator public meta comments. +// Suggest use Vexample.h instead. + + +#ifndef VERILATED_VEXAMPLE__PCH_H_ +#define VERILATED_VEXAMPLE__PCH_H_ // guard + +// GCC and Clang only will precompile headers (PCH) for the first header. +// So, make sure this is the one and only PCH. +// If multiple module's includes are needed, use individual includes. +#ifdef VL_PCH_INCLUDED +# error "Including multiple precompiled header files" +#endif +#define VL_PCH_INCLUDED + + +#include "verilated.h" + +#include "Vexample__Syms.h" +#include "Vexample.h" + +#endif // guard diff --git a/npc/obj_dir/Vexample_classes.mk b/npc/obj_dir/Vexample_classes.mk new file mode 100644 index 0000000..faf0069 --- /dev/null +++ b/npc/obj_dir/Vexample_classes.mk @@ -0,0 +1,51 @@ +# Verilated -*- Makefile -*- +# DESCRIPTION: Verilator output: Make include file with class lists +# +# This file lists generated Verilated files, for including in higher level makefiles. +# See Vexample.mk for the caller. + +### Switches... +# C11 constructs required? 0/1 (always on now) +VM_C11 = 1 +# Timing enabled? 0/1 +VM_TIMING = 0 +# Coverage output mode? 0/1 (from --coverage) +VM_COVERAGE = 0 +# Parallel builds? 0/1 (from --output-split) +VM_PARALLEL_BUILDS = 0 +# Tracing output mode? 0/1 (from --trace/--trace-fst) +VM_TRACE = 0 +# Tracing output mode in VCD format? 0/1 (from --trace) +VM_TRACE_VCD = 0 +# Tracing output mode in FST format? 0/1 (from --trace-fst) +VM_TRACE_FST = 0 + +### Object file lists... +# Generated module classes, fast-path, compile with highest optimization +VM_CLASSES_FAST += \ + Vexample \ + Vexample___024root__DepSet_h625e39dc__0 \ + Vexample___024root__DepSet_hcb5acca5__0 \ + +# Generated module classes, non-fast-path, compile with low/medium optimization +VM_CLASSES_SLOW += \ + Vexample___024root__Slow \ + Vexample___024root__DepSet_hcb5acca5__0__Slow \ + +# Generated support classes, fast-path, compile with highest optimization +VM_SUPPORT_FAST += \ + +# Generated support classes, non-fast-path, compile with low/medium optimization +VM_SUPPORT_SLOW += \ + Vexample__Syms \ + +# Global classes, need linked once per executable, fast-path, compile with highest optimization +VM_GLOBAL_FAST += \ + verilated \ + verilated_threads \ + +# Global classes, need linked once per executable, non-fast-path, compile with low/medium optimization +VM_GLOBAL_SLOW += \ + + +# Verilated -*- Makefile -*- diff --git a/npc/vsrc/example.v b/npc/vsrc/example.v new file mode 100644 index 0000000..fdd7d61 --- /dev/null +++ b/npc/vsrc/example.v @@ -0,0 +1,3 @@ +module our; + initial begin $display("Hello World"); $finish; end +endmodule \ No newline at end of file