cache_sim.cpp created
This commit is contained in:
42
hw/unit_tests/cache/Makefile
vendored
Normal file
42
hw/unit_tests/cache/Makefile
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
PARAM +=
|
||||
|
||||
|
||||
# control RTL debug print states
|
||||
DBG_PRINT_FLAGS = -DDBG_PRINT_CORE_ICACHE \
|
||||
-DDBG_PRINT_CORE_DCACHE \
|
||||
-DDBG_PRINT_CACHE_BANK \
|
||||
-DDBG_PRINT_CACHE_SNP \
|
||||
-DDBG_PRINT_CACHE_MSRQ \
|
||||
-DDBG_PRINT_DRAM \
|
||||
-DDBG_PRINT_OPAE
|
||||
|
||||
#DBG_PRINT=$(DBG_PRINT_FLAGS)
|
||||
|
||||
INCLUDE = -I../../rtl/ -I../../rtl/cache -I../../rtl/libs
|
||||
|
||||
|
||||
SRCS = cache_sim.cpp
|
||||
|
||||
all: build
|
||||
|
||||
CF += -std=c++11 -fms-extensions -I../..
|
||||
|
||||
VF += --language 1800-2009 --assert -Wall --trace #-Wpedantic
|
||||
VF += -Wno-DECLFILENAME
|
||||
VF += --x-initial unique
|
||||
VF += -exe $(SRCS) $(INCLUDE)
|
||||
|
||||
DBG += -DVCD_OUTPUT $(DBG_PRINT)
|
||||
|
||||
|
||||
gen:
|
||||
verilator $(VF) -DNDEBUG -cc VX_cache.v $(PARAM) -CFLAGS '$(CF) -DNDEBUG $(PARAM)' --exe $(SRCS)
|
||||
|
||||
build: gen
|
||||
(cd obj_dir && make -j -f VVX_cache.mk)
|
||||
|
||||
run: build
|
||||
(cd obj_dir && ./VVX_cache)
|
||||
|
||||
clean:
|
||||
rm -rf obj_dir
|
||||
74
hw/unit_tests/cache/cache_sim.cpp
vendored
Normal file
74
hw/unit_tests/cache/cache_sim.cpp
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
#include "VVX_cache.h"
|
||||
#include "VVX_cache__Syms.h"
|
||||
#include "verilated.h"
|
||||
|
||||
#include <verilated_vcd_c.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
uint64_t timestamp = 0;
|
||||
|
||||
double sc_time_stamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
void tick(VVX_cache* tb){
|
||||
tb->eval();
|
||||
tb->clk = 1;
|
||||
|
||||
tb->eval();
|
||||
tb->clk = 0;
|
||||
tb->eval();
|
||||
}
|
||||
|
||||
int main(int argc, char **argv){
|
||||
Verilated::commandArgs(argc, argv); //passes the command args to the object
|
||||
|
||||
VVX_cache *tb = new VVX_cachee;
|
||||
|
||||
//reset the cache
|
||||
tb->reset = 1;
|
||||
tb->eval();
|
||||
tb->reset = 0;
|
||||
|
||||
//declare variables for output - data members in cache class
|
||||
unsigned int clk;
|
||||
bool full;
|
||||
bool empty;
|
||||
int size;
|
||||
int data_out;
|
||||
|
||||
//assign inputs
|
||||
tb->core_req_valid = 1;
|
||||
tb->core_req_rw = 1;
|
||||
|
||||
char byte_en[] = {}; //word size 4 bytes
|
||||
tb->core_req_byteen[0] = 1;
|
||||
tb->core_req_byteen[1] = 1;
|
||||
tb->core_req_byteen[2] = 1;
|
||||
tb->core_req_byteen[3] = 1;
|
||||
|
||||
char addr[4] = {0x1a, 0x2b, 0x3c, 0x4d}; //word addr width
|
||||
|
||||
tb->core_req_addr[0] = arr[0];
|
||||
tb->core_req_addr[0] = arr[1];
|
||||
tb->core_req_addr[0] = arr[2];
|
||||
tb->core_req_addr[0] = arr[3];
|
||||
|
||||
//char req_data[] = {}; //word width
|
||||
//tb->core_req_data
|
||||
|
||||
//char req_tag[] = {}; //core_req_tag_count by core req_tag_width
|
||||
//tb->core_req_tag =
|
||||
|
||||
|
||||
for (int i = 0; i < 5; ++i){
|
||||
//toggle the clock
|
||||
tick(tb);
|
||||
}
|
||||
|
||||
delete tb;
|
||||
|
||||
exit(0);
|
||||
}
|
||||
0
hw/unit_tests/cache/cache_sim.h
vendored
Normal file
0
hw/unit_tests/cache/cache_sim.h
vendored
Normal file
56983
hw/unit_tests/cache/obj_dir/VVX_cache.cpp
vendored
Normal file
56983
hw/unit_tests/cache/obj_dir/VVX_cache.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1681
hw/unit_tests/cache/obj_dir/VVX_cache.h
vendored
Normal file
1681
hw/unit_tests/cache/obj_dir/VVX_cache.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
67
hw/unit_tests/cache/obj_dir/VVX_cache.mk
vendored
Normal file
67
hw/unit_tests/cache/obj_dir/VVX_cache.mk
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
# Verilated -*- Makefile -*-
|
||||
# DESCRIPTION: Verilator output: Makefile for building Verilated archive or executable
|
||||
#
|
||||
# Execute this makefile from the object directory:
|
||||
# make -f VVX_cache.mk
|
||||
|
||||
default: VVX_cache
|
||||
|
||||
### Constants...
|
||||
# Perl executable (from $PERL)
|
||||
PERL = perl
|
||||
# Path to Verilator kit (from $VERILATOR_ROOT)
|
||||
VERILATOR_ROOT = /usr/local/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...
|
||||
# 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 = VVX_cache
|
||||
# Module prefix (from --prefix)
|
||||
VM_MODPREFIX = VVX_cache
|
||||
# User CFLAGS (from -CFLAGS on Verilator command line)
|
||||
VM_USER_CFLAGS = \
|
||||
-std=c++11 -fms-extensions -I../.. -DNDEBUG -DDATAW=4 -DSIZE=4 \
|
||||
|
||||
# User LDLIBS (from -LDFLAGS on Verilator command line)
|
||||
VM_USER_LDLIBS = \
|
||||
|
||||
# User .cpp files (from .cpp's on Verilator command line)
|
||||
VM_USER_CLASSES = \
|
||||
cache_sim \
|
||||
|
||||
# User .cpp directories (from .cpp's on Verilator command line)
|
||||
VM_USER_DIR = \
|
||||
. \
|
||||
|
||||
|
||||
### Default rules...
|
||||
# Include list of all generated classes
|
||||
include VVX_cache_classes.mk
|
||||
# Include global rules
|
||||
include $(VERILATOR_ROOT)/include/verilated.mk
|
||||
|
||||
### Executable rules... (from --exe)
|
||||
VPATH += $(VM_USER_DIR)
|
||||
|
||||
cache_sim.o: cache_sim.cpp
|
||||
$(OBJCACHE) $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(OPT_FAST) -c -o $@ $<
|
||||
|
||||
### Link rules... (from --exe)
|
||||
VVX_cache: $(VK_USER_OBJS) $(VK_GLOBAL_OBJS) $(VM_PREFIX)__ALL.a
|
||||
$(LINK) $(LDFLAGS) $^ $(LOADLIBES) $(LDLIBS) -o $@ $(LIBS) $(SC_LIBS)
|
||||
|
||||
|
||||
# Verilated -*- Makefile -*-
|
||||
107
hw/unit_tests/cache/obj_dir/VVX_cache__Syms.cpp
vendored
Normal file
107
hw/unit_tests/cache/obj_dir/VVX_cache__Syms.cpp
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
// Verilated -*- C++ -*-
|
||||
// DESCRIPTION: Verilator output: Symbol table implementation internals
|
||||
|
||||
#include "VVX_cache__Syms.h"
|
||||
#include "VVX_cache.h"
|
||||
|
||||
|
||||
|
||||
// FUNCTIONS
|
||||
VVX_cache__Syms::VVX_cache__Syms(VVX_cache* topp, const char* namep)
|
||||
// Setup locals
|
||||
: __Vm_namep(namep)
|
||||
, __Vm_activity(false)
|
||||
, __Vm_didInit(false)
|
||||
// Setup submodule names
|
||||
{
|
||||
// Pointer to top level
|
||||
TOPp = topp;
|
||||
// Setup each module's pointers to their submodules
|
||||
// Setup each module's pointer back to symbol table (for public functions)
|
||||
TOPp->__Vconfigure(this, true);
|
||||
// Setup scopes
|
||||
__Vscope_VX_cache__cache_dram_req_arb__dram_fill_arb__dfqq_queue.configure(this, name(), "VX_cache.cache_dram_req_arb.dram_fill_arb.dfqq_queue", "dfqq_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__cache_dram_req_arb__dram_fill_arb__dfqq_queue__genblk3__genblk2.configure(this, name(), "VX_cache.cache_dram_req_arb.dram_fill_arb.dfqq_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__cache_dram_req_arb__prfqq__pfq_queue.configure(this, name(), "VX_cache.cache_dram_req_arb.prfqq.pfq_queue", "pfq_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__cache_dram_req_arb__prfqq__pfq_queue__genblk3__genblk2.configure(this, name(), "VX_cache.cache_dram_req_arb.prfqq.pfq_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__0__KET____bank__core_req_arb__reqq_queue.configure(this, name(), "VX_cache.genblk5[0].bank.core_req_arb.reqq_queue", "reqq_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__0__KET____bank__core_req_arb__reqq_queue__genblk3__genblk2.configure(this, name(), "VX_cache.genblk5[0].bank.core_req_arb.reqq_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__0__KET____bank__cwb_queue.configure(this, name(), "VX_cache.genblk5[0].bank.cwb_queue", "cwb_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__0__KET____bank__cwb_queue__genblk3__genblk2.configure(this, name(), "VX_cache.genblk5[0].bank.cwb_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__0__KET____bank__dfp_queue.configure(this, name(), "VX_cache.genblk5[0].bank.dfp_queue", "dfp_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__0__KET____bank__dfp_queue__genblk3__genblk2.configure(this, name(), "VX_cache.genblk5[0].bank.dfp_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__0__KET____bank__dwb_queue.configure(this, name(), "VX_cache.genblk5[0].bank.dwb_queue", "dwb_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__0__KET____bank__dwb_queue__genblk3__genblk2.configure(this, name(), "VX_cache.genblk5[0].bank.dwb_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__0__KET____bank__snp_req_queue.configure(this, name(), "VX_cache.genblk5[0].bank.snp_req_queue", "snp_req_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__0__KET____bank__snp_req_queue__genblk3__genblk2.configure(this, name(), "VX_cache.genblk5[0].bank.snp_req_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__1__KET____bank__core_req_arb__reqq_queue.configure(this, name(), "VX_cache.genblk5[1].bank.core_req_arb.reqq_queue", "reqq_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__1__KET____bank__core_req_arb__reqq_queue__genblk3__genblk2.configure(this, name(), "VX_cache.genblk5[1].bank.core_req_arb.reqq_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__1__KET____bank__cwb_queue.configure(this, name(), "VX_cache.genblk5[1].bank.cwb_queue", "cwb_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__1__KET____bank__cwb_queue__genblk3__genblk2.configure(this, name(), "VX_cache.genblk5[1].bank.cwb_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__1__KET____bank__dfp_queue.configure(this, name(), "VX_cache.genblk5[1].bank.dfp_queue", "dfp_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__1__KET____bank__dfp_queue__genblk3__genblk2.configure(this, name(), "VX_cache.genblk5[1].bank.dfp_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__1__KET____bank__dwb_queue.configure(this, name(), "VX_cache.genblk5[1].bank.dwb_queue", "dwb_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__1__KET____bank__dwb_queue__genblk3__genblk2.configure(this, name(), "VX_cache.genblk5[1].bank.dwb_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__1__KET____bank__snp_req_queue.configure(this, name(), "VX_cache.genblk5[1].bank.snp_req_queue", "snp_req_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__1__KET____bank__snp_req_queue__genblk3__genblk2.configure(this, name(), "VX_cache.genblk5[1].bank.snp_req_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__2__KET____bank__core_req_arb__reqq_queue.configure(this, name(), "VX_cache.genblk5[2].bank.core_req_arb.reqq_queue", "reqq_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__2__KET____bank__core_req_arb__reqq_queue__genblk3__genblk2.configure(this, name(), "VX_cache.genblk5[2].bank.core_req_arb.reqq_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__2__KET____bank__cwb_queue.configure(this, name(), "VX_cache.genblk5[2].bank.cwb_queue", "cwb_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__2__KET____bank__cwb_queue__genblk3__genblk2.configure(this, name(), "VX_cache.genblk5[2].bank.cwb_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__2__KET____bank__dfp_queue.configure(this, name(), "VX_cache.genblk5[2].bank.dfp_queue", "dfp_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__2__KET____bank__dfp_queue__genblk3__genblk2.configure(this, name(), "VX_cache.genblk5[2].bank.dfp_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__2__KET____bank__dwb_queue.configure(this, name(), "VX_cache.genblk5[2].bank.dwb_queue", "dwb_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__2__KET____bank__dwb_queue__genblk3__genblk2.configure(this, name(), "VX_cache.genblk5[2].bank.dwb_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__2__KET____bank__snp_req_queue.configure(this, name(), "VX_cache.genblk5[2].bank.snp_req_queue", "snp_req_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__2__KET____bank__snp_req_queue__genblk3__genblk2.configure(this, name(), "VX_cache.genblk5[2].bank.snp_req_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__3__KET____bank__core_req_arb__reqq_queue.configure(this, name(), "VX_cache.genblk5[3].bank.core_req_arb.reqq_queue", "reqq_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__3__KET____bank__core_req_arb__reqq_queue__genblk3__genblk2.configure(this, name(), "VX_cache.genblk5[3].bank.core_req_arb.reqq_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__3__KET____bank__cwb_queue.configure(this, name(), "VX_cache.genblk5[3].bank.cwb_queue", "cwb_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__3__KET____bank__cwb_queue__genblk3__genblk2.configure(this, name(), "VX_cache.genblk5[3].bank.cwb_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__3__KET____bank__dfp_queue.configure(this, name(), "VX_cache.genblk5[3].bank.dfp_queue", "dfp_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__3__KET____bank__dfp_queue__genblk3__genblk2.configure(this, name(), "VX_cache.genblk5[3].bank.dfp_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__3__KET____bank__dwb_queue.configure(this, name(), "VX_cache.genblk5[3].bank.dwb_queue", "dwb_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__3__KET____bank__dwb_queue__genblk3__genblk2.configure(this, name(), "VX_cache.genblk5[3].bank.dwb_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__3__KET____bank__snp_req_queue.configure(this, name(), "VX_cache.genblk5[3].bank.snp_req_queue", "snp_req_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__3__KET____bank__snp_req_queue__genblk3__genblk2.configure(this, name(), "VX_cache.genblk5[3].bank.snp_req_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__4__KET____bank__core_req_arb__reqq_queue.configure(this, name(), "VX_cache.genblk5[4].bank.core_req_arb.reqq_queue", "reqq_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__4__KET____bank__core_req_arb__reqq_queue__genblk3__genblk2.configure(this, name(), "VX_cache.genblk5[4].bank.core_req_arb.reqq_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__4__KET____bank__cwb_queue.configure(this, name(), "VX_cache.genblk5[4].bank.cwb_queue", "cwb_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__4__KET____bank__cwb_queue__genblk3__genblk2.configure(this, name(), "VX_cache.genblk5[4].bank.cwb_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__4__KET____bank__dfp_queue.configure(this, name(), "VX_cache.genblk5[4].bank.dfp_queue", "dfp_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__4__KET____bank__dfp_queue__genblk3__genblk2.configure(this, name(), "VX_cache.genblk5[4].bank.dfp_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__4__KET____bank__dwb_queue.configure(this, name(), "VX_cache.genblk5[4].bank.dwb_queue", "dwb_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__4__KET____bank__dwb_queue__genblk3__genblk2.configure(this, name(), "VX_cache.genblk5[4].bank.dwb_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__4__KET____bank__snp_req_queue.configure(this, name(), "VX_cache.genblk5[4].bank.snp_req_queue", "snp_req_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__4__KET____bank__snp_req_queue__genblk3__genblk2.configure(this, name(), "VX_cache.genblk5[4].bank.snp_req_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__5__KET____bank__core_req_arb__reqq_queue.configure(this, name(), "VX_cache.genblk5[5].bank.core_req_arb.reqq_queue", "reqq_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__5__KET____bank__core_req_arb__reqq_queue__genblk3__genblk2.configure(this, name(), "VX_cache.genblk5[5].bank.core_req_arb.reqq_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__5__KET____bank__cwb_queue.configure(this, name(), "VX_cache.genblk5[5].bank.cwb_queue", "cwb_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__5__KET____bank__cwb_queue__genblk3__genblk2.configure(this, name(), "VX_cache.genblk5[5].bank.cwb_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__5__KET____bank__dfp_queue.configure(this, name(), "VX_cache.genblk5[5].bank.dfp_queue", "dfp_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__5__KET____bank__dfp_queue__genblk3__genblk2.configure(this, name(), "VX_cache.genblk5[5].bank.dfp_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__5__KET____bank__dwb_queue.configure(this, name(), "VX_cache.genblk5[5].bank.dwb_queue", "dwb_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__5__KET____bank__dwb_queue__genblk3__genblk2.configure(this, name(), "VX_cache.genblk5[5].bank.dwb_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__5__KET____bank__snp_req_queue.configure(this, name(), "VX_cache.genblk5[5].bank.snp_req_queue", "snp_req_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__5__KET____bank__snp_req_queue__genblk3__genblk2.configure(this, name(), "VX_cache.genblk5[5].bank.snp_req_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__6__KET____bank__core_req_arb__reqq_queue.configure(this, name(), "VX_cache.genblk5[6].bank.core_req_arb.reqq_queue", "reqq_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__6__KET____bank__core_req_arb__reqq_queue__genblk3__genblk2.configure(this, name(), "VX_cache.genblk5[6].bank.core_req_arb.reqq_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__6__KET____bank__cwb_queue.configure(this, name(), "VX_cache.genblk5[6].bank.cwb_queue", "cwb_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__6__KET____bank__cwb_queue__genblk3__genblk2.configure(this, name(), "VX_cache.genblk5[6].bank.cwb_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__6__KET____bank__dfp_queue.configure(this, name(), "VX_cache.genblk5[6].bank.dfp_queue", "dfp_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__6__KET____bank__dfp_queue__genblk3__genblk2.configure(this, name(), "VX_cache.genblk5[6].bank.dfp_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__6__KET____bank__dwb_queue.configure(this, name(), "VX_cache.genblk5[6].bank.dwb_queue", "dwb_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__6__KET____bank__dwb_queue__genblk3__genblk2.configure(this, name(), "VX_cache.genblk5[6].bank.dwb_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__6__KET____bank__snp_req_queue.configure(this, name(), "VX_cache.genblk5[6].bank.snp_req_queue", "snp_req_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__6__KET____bank__snp_req_queue__genblk3__genblk2.configure(this, name(), "VX_cache.genblk5[6].bank.snp_req_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__7__KET____bank__core_req_arb__reqq_queue.configure(this, name(), "VX_cache.genblk5[7].bank.core_req_arb.reqq_queue", "reqq_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__7__KET____bank__core_req_arb__reqq_queue__genblk3__genblk2.configure(this, name(), "VX_cache.genblk5[7].bank.core_req_arb.reqq_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__7__KET____bank__cwb_queue.configure(this, name(), "VX_cache.genblk5[7].bank.cwb_queue", "cwb_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__7__KET____bank__cwb_queue__genblk3__genblk2.configure(this, name(), "VX_cache.genblk5[7].bank.cwb_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__7__KET____bank__dfp_queue.configure(this, name(), "VX_cache.genblk5[7].bank.dfp_queue", "dfp_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__7__KET____bank__dfp_queue__genblk3__genblk2.configure(this, name(), "VX_cache.genblk5[7].bank.dfp_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__7__KET____bank__dwb_queue.configure(this, name(), "VX_cache.genblk5[7].bank.dwb_queue", "dwb_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__7__KET____bank__dwb_queue__genblk3__genblk2.configure(this, name(), "VX_cache.genblk5[7].bank.dwb_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__7__KET____bank__snp_req_queue.configure(this, name(), "VX_cache.genblk5[7].bank.snp_req_queue", "snp_req_queue", VerilatedScope::SCOPE_OTHER);
|
||||
__Vscope_VX_cache__genblk5__BRA__7__KET____bank__snp_req_queue__genblk3__genblk2.configure(this, name(), "VX_cache.genblk5[7].bank.snp_req_queue.genblk3.genblk2", "genblk2", VerilatedScope::SCOPE_OTHER);
|
||||
}
|
||||
123
hw/unit_tests/cache/obj_dir/VVX_cache__Syms.h
vendored
Normal file
123
hw/unit_tests/cache/obj_dir/VVX_cache__Syms.h
vendored
Normal file
@@ -0,0 +1,123 @@
|
||||
// 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 _VVX_CACHE__SYMS_H_
|
||||
#define _VVX_CACHE__SYMS_H_ // guard
|
||||
|
||||
#include "verilated_heavy.h"
|
||||
|
||||
// INCLUDE MODULE CLASSES
|
||||
#include "VVX_cache.h"
|
||||
|
||||
// SYMS CLASS
|
||||
class VVX_cache__Syms : public VerilatedSyms {
|
||||
public:
|
||||
|
||||
// LOCAL STATE
|
||||
const char* __Vm_namep;
|
||||
bool __Vm_activity; ///< Used by trace routines to determine change occurred
|
||||
bool __Vm_didInit;
|
||||
|
||||
// SUBCELL STATE
|
||||
VVX_cache* TOPp;
|
||||
|
||||
// SCOPE NAMES
|
||||
VerilatedScope __Vscope_VX_cache__cache_dram_req_arb__dram_fill_arb__dfqq_queue;
|
||||
VerilatedScope __Vscope_VX_cache__cache_dram_req_arb__dram_fill_arb__dfqq_queue__genblk3__genblk2;
|
||||
VerilatedScope __Vscope_VX_cache__cache_dram_req_arb__prfqq__pfq_queue;
|
||||
VerilatedScope __Vscope_VX_cache__cache_dram_req_arb__prfqq__pfq_queue__genblk3__genblk2;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__0__KET____bank__core_req_arb__reqq_queue;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__0__KET____bank__core_req_arb__reqq_queue__genblk3__genblk2;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__0__KET____bank__cwb_queue;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__0__KET____bank__cwb_queue__genblk3__genblk2;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__0__KET____bank__dfp_queue;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__0__KET____bank__dfp_queue__genblk3__genblk2;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__0__KET____bank__dwb_queue;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__0__KET____bank__dwb_queue__genblk3__genblk2;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__0__KET____bank__snp_req_queue;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__0__KET____bank__snp_req_queue__genblk3__genblk2;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__1__KET____bank__core_req_arb__reqq_queue;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__1__KET____bank__core_req_arb__reqq_queue__genblk3__genblk2;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__1__KET____bank__cwb_queue;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__1__KET____bank__cwb_queue__genblk3__genblk2;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__1__KET____bank__dfp_queue;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__1__KET____bank__dfp_queue__genblk3__genblk2;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__1__KET____bank__dwb_queue;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__1__KET____bank__dwb_queue__genblk3__genblk2;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__1__KET____bank__snp_req_queue;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__1__KET____bank__snp_req_queue__genblk3__genblk2;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__2__KET____bank__core_req_arb__reqq_queue;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__2__KET____bank__core_req_arb__reqq_queue__genblk3__genblk2;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__2__KET____bank__cwb_queue;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__2__KET____bank__cwb_queue__genblk3__genblk2;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__2__KET____bank__dfp_queue;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__2__KET____bank__dfp_queue__genblk3__genblk2;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__2__KET____bank__dwb_queue;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__2__KET____bank__dwb_queue__genblk3__genblk2;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__2__KET____bank__snp_req_queue;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__2__KET____bank__snp_req_queue__genblk3__genblk2;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__3__KET____bank__core_req_arb__reqq_queue;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__3__KET____bank__core_req_arb__reqq_queue__genblk3__genblk2;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__3__KET____bank__cwb_queue;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__3__KET____bank__cwb_queue__genblk3__genblk2;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__3__KET____bank__dfp_queue;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__3__KET____bank__dfp_queue__genblk3__genblk2;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__3__KET____bank__dwb_queue;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__3__KET____bank__dwb_queue__genblk3__genblk2;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__3__KET____bank__snp_req_queue;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__3__KET____bank__snp_req_queue__genblk3__genblk2;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__4__KET____bank__core_req_arb__reqq_queue;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__4__KET____bank__core_req_arb__reqq_queue__genblk3__genblk2;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__4__KET____bank__cwb_queue;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__4__KET____bank__cwb_queue__genblk3__genblk2;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__4__KET____bank__dfp_queue;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__4__KET____bank__dfp_queue__genblk3__genblk2;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__4__KET____bank__dwb_queue;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__4__KET____bank__dwb_queue__genblk3__genblk2;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__4__KET____bank__snp_req_queue;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__4__KET____bank__snp_req_queue__genblk3__genblk2;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__5__KET____bank__core_req_arb__reqq_queue;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__5__KET____bank__core_req_arb__reqq_queue__genblk3__genblk2;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__5__KET____bank__cwb_queue;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__5__KET____bank__cwb_queue__genblk3__genblk2;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__5__KET____bank__dfp_queue;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__5__KET____bank__dfp_queue__genblk3__genblk2;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__5__KET____bank__dwb_queue;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__5__KET____bank__dwb_queue__genblk3__genblk2;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__5__KET____bank__snp_req_queue;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__5__KET____bank__snp_req_queue__genblk3__genblk2;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__6__KET____bank__core_req_arb__reqq_queue;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__6__KET____bank__core_req_arb__reqq_queue__genblk3__genblk2;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__6__KET____bank__cwb_queue;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__6__KET____bank__cwb_queue__genblk3__genblk2;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__6__KET____bank__dfp_queue;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__6__KET____bank__dfp_queue__genblk3__genblk2;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__6__KET____bank__dwb_queue;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__6__KET____bank__dwb_queue__genblk3__genblk2;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__6__KET____bank__snp_req_queue;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__6__KET____bank__snp_req_queue__genblk3__genblk2;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__7__KET____bank__core_req_arb__reqq_queue;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__7__KET____bank__core_req_arb__reqq_queue__genblk3__genblk2;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__7__KET____bank__cwb_queue;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__7__KET____bank__cwb_queue__genblk3__genblk2;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__7__KET____bank__dfp_queue;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__7__KET____bank__dfp_queue__genblk3__genblk2;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__7__KET____bank__dwb_queue;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__7__KET____bank__dwb_queue__genblk3__genblk2;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__7__KET____bank__snp_req_queue;
|
||||
VerilatedScope __Vscope_VX_cache__genblk5__BRA__7__KET____bank__snp_req_queue__genblk3__genblk2;
|
||||
|
||||
// CREATORS
|
||||
VVX_cache__Syms(VVX_cache* topp, const char* namep);
|
||||
~VVX_cache__Syms() {}
|
||||
|
||||
// METHODS
|
||||
inline const char* name() { return __Vm_namep; }
|
||||
inline bool getClearActivity() { bool r=__Vm_activity; __Vm_activity=false; return r; }
|
||||
|
||||
} VL_ATTR_ALIGNED(VL_CACHE_LINE_BYTES);
|
||||
|
||||
#endif // guard
|
||||
9560
hw/unit_tests/cache/obj_dir/VVX_cache__Trace.cpp
vendored
Normal file
9560
hw/unit_tests/cache/obj_dir/VVX_cache__Trace.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
15246
hw/unit_tests/cache/obj_dir/VVX_cache__Trace__Slow.cpp
vendored
Normal file
15246
hw/unit_tests/cache/obj_dir/VVX_cache__Trace__Slow.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
43
hw/unit_tests/cache/obj_dir/VVX_cache_classes.mk
vendored
Normal file
43
hw/unit_tests/cache/obj_dir/VVX_cache_classes.mk
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
# Verilated -*- Makefile -*-
|
||||
# DESCRIPTION: Verilator output: Make include file with class lists
|
||||
#
|
||||
# This file lists generated Verilated files, for including in higher level makefiles.
|
||||
# See VVX_cache.mk for the caller.
|
||||
|
||||
### Switches...
|
||||
# Coverage output mode? 0/1 (from --coverage)
|
||||
VM_COVERAGE = 0
|
||||
# Threaded output mode? 0/1/N threads (from --threads)
|
||||
VM_THREADS = 0
|
||||
# Tracing output mode? 0/1 (from --trace)
|
||||
VM_TRACE = 1
|
||||
# Tracing threaded output mode? 0/1 (from --trace-fst-thread)
|
||||
VM_TRACE_THREADED = 0
|
||||
|
||||
### Object file lists...
|
||||
# Generated module classes, fast-path, compile with highest optimization
|
||||
VM_CLASSES_FAST += \
|
||||
VVX_cache \
|
||||
|
||||
# Generated module classes, non-fast-path, compile with low/medium optimization
|
||||
VM_CLASSES_SLOW += \
|
||||
|
||||
# Generated support classes, fast-path, compile with highest optimization
|
||||
VM_SUPPORT_FAST += \
|
||||
VVX_cache__Trace \
|
||||
|
||||
# Generated support classes, non-fast-path, compile with low/medium optimization
|
||||
VM_SUPPORT_SLOW += \
|
||||
VVX_cache__Syms \
|
||||
VVX_cache__Trace__Slow \
|
||||
|
||||
# Global classes, need linked once per executable, fast-path, compile with highest optimization
|
||||
VM_GLOBAL_FAST += \
|
||||
verilated \
|
||||
verilated_vcd_c \
|
||||
|
||||
# Global classes, need linked once per executable, non-fast-path, compile with low/medium optimization
|
||||
VM_GLOBAL_SLOW += \
|
||||
|
||||
|
||||
# Verilated -*- Makefile -*-
|
||||
83
hw/unit_tests/cache/simulator.cpp
vendored
Normal file
83
hw/unit_tests/cache/simulator.cpp
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
#include "simulator.h"
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <iomanip>
|
||||
|
||||
uint64_t timestamp = 0;
|
||||
|
||||
double sc_time_stamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
Simulator::Simulator() {
|
||||
// force random values for unitialized signals
|
||||
Verilated::randReset(1);
|
||||
|
||||
vortex_ = new VVX_priority_encoder();
|
||||
|
||||
#ifdef VCD_OUTPUT
|
||||
Verilated::traceEverOn(true);
|
||||
trace_ = new VerilatedVcdC;
|
||||
vortex_->trace(trace_, 99);
|
||||
trace_->open("trace.vcd");
|
||||
#endif
|
||||
}
|
||||
|
||||
Simulator::~Simulator() {
|
||||
#ifdef VCD_OUTPUT
|
||||
trace_->close();
|
||||
#endif
|
||||
delete vortex_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Simulator::step() {
|
||||
this->eval();
|
||||
|
||||
this->eval();
|
||||
}
|
||||
|
||||
|
||||
void Simulator::reset() {
|
||||
#ifndef NDEBUG
|
||||
std::cout << timestamp << ": [sim] reset()" << std::endl;
|
||||
#endif
|
||||
|
||||
this->step();
|
||||
}
|
||||
|
||||
|
||||
void Simulator::eval() {
|
||||
vortex_->eval();
|
||||
#ifdef VCD_OUTPUT
|
||||
trace_->dump(timestamp);
|
||||
#endif
|
||||
++timestamp;
|
||||
}
|
||||
|
||||
void Simulator::wait(uint32_t cycles) {
|
||||
for (int i = 0; i < cycles; ++i) {
|
||||
this->step();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Simulator::run() {
|
||||
// reset the device
|
||||
this->reset();
|
||||
|
||||
// execute program
|
||||
this->step();
|
||||
|
||||
|
||||
// wait 5 cycles to flush the pipeline
|
||||
this->wait(5);
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
52
hw/unit_tests/cache/simulator.h
vendored
Normal file
52
hw/unit_tests/cache/simulator.h
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
#pragma once
|
||||
|
||||
#include "VVX_priority_encoder.h"
|
||||
#include "VVX_priority_encoder__Syms.h"
|
||||
#include "verilated.h"
|
||||
|
||||
#ifdef VCD_OUTPUT
|
||||
#include <verilated_vcd_c.h>
|
||||
#endif
|
||||
|
||||
//#include <VX_config.h>
|
||||
|
||||
#include <ostream>
|
||||
#include <vector>
|
||||
|
||||
class Simulator {
|
||||
public:
|
||||
|
||||
Simulator();
|
||||
virtual ~Simulator();
|
||||
|
||||
void load_bin(const char* program_file);
|
||||
void load_ihex(const char* program_file);
|
||||
|
||||
bool is_busy();
|
||||
|
||||
void reset();
|
||||
void step();
|
||||
void wait(uint32_t cycles);
|
||||
void flush_caches(uint32_t mem_addr, uint32_t size);
|
||||
|
||||
|
||||
bool run();
|
||||
void print_stats(std::ostream& out);
|
||||
|
||||
private:
|
||||
|
||||
void eval();
|
||||
|
||||
void eval_dram_bus();
|
||||
void eval_io_bus();
|
||||
void eval_snp_bus();
|
||||
|
||||
uint32_t snp_req_active_;
|
||||
uint32_t snp_req_size_;
|
||||
uint32_t pending_snp_reqs_;
|
||||
|
||||
VVX_priority_encoder *vortex_;
|
||||
#ifdef VCD_OUTPUT
|
||||
VerilatedVcdC *trace_;
|
||||
#endif
|
||||
};
|
||||
59
hw/unit_tests/cache/testbase.cpp
vendored
Normal file
59
hw/unit_tests/cache/testbase.cpp
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
#include "VVX_generic_queue.h"
|
||||
#include "VVX_generic_queue__Syms.h"
|
||||
#include "verilated.h"
|
||||
|
||||
#include <verilated_vcd_c.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
uint64_t timestamp = 0;
|
||||
|
||||
double sc_time_stamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv){
|
||||
Verilated::commandArgs(argc, argv); //passes the command args to the object
|
||||
|
||||
VVX_generic_queue *tb = new VVX_generic_queue;
|
||||
tb->reset = 1;
|
||||
tb->eval();
|
||||
tb->reset = 0;
|
||||
unsigned int clk;
|
||||
bool full;
|
||||
bool empty;
|
||||
int size;
|
||||
int data_out;
|
||||
tb->data_in = 0xff;
|
||||
|
||||
tb->push = 1;
|
||||
|
||||
for (int i = 0; i < 5; ++i){
|
||||
//toggle the clock
|
||||
tb->eval();
|
||||
tb->clk = 1;
|
||||
|
||||
tb->eval();
|
||||
tb->clk = 0;
|
||||
tb->eval();
|
||||
|
||||
|
||||
full = tb->full;
|
||||
empty = tb->empty;
|
||||
size = tb->size;
|
||||
data_out = tb->data_out;
|
||||
clk = tb->clk;
|
||||
|
||||
std::cout << "clk: " << clk << std::endl;
|
||||
std::cout << "data_out: " << data_out << std::endl;
|
||||
std::cout << "empty: " << empty << std::endl;
|
||||
std::cout << "full: " << full << std::endl;
|
||||
std::cout << "size: " << size << std::endl;
|
||||
|
||||
}
|
||||
|
||||
delete tb;
|
||||
|
||||
exit(0);
|
||||
}
|
||||
12
hw/unit_tests/cache/testbench.cpp
vendored
Normal file
12
hw/unit_tests/cache/testbench.cpp
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
#include "simulator.h"
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <iomanip>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
Simulator simulator;
|
||||
bool curr = simulator.run();
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user