-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[VTA][Chisel,de10nano] Chisel fixes and de10nano support #4986
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f2c8c18
8342eeb
1e865ed
f467ced
c4ad202
bcd3d97
a184053
7197cb2
f62a296
dfae2fe
44d47a8
6e55dd4
9367fd8
2280435
8f157ee
eb61184
8a28dde
1554991
500c441
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,16 +32,36 @@ ifeq (, $(VERILATOR_INC_DIR)) | |
| endif | ||
| endif | ||
|
|
||
| CONFIG = DefaultPynqConfig | ||
| CONFIG = DefaultDe10Config | ||
tmoreau89 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| TOP = VTA | ||
| TOP_TEST = Test | ||
| BUILD_NAME = build | ||
| # Set USE_TRACE = 1 to generate a trace during simulation. | ||
| USE_TRACE = 0 | ||
| # With USE_TRACE = 1, default trace format is VCD. | ||
| # Set USE_TRACE_FST = 1 to use the FST format. | ||
| # Note that although FST is around two orders of magnitude smaller than VCD | ||
| # it is also currently much slower to produce (verilator limitation). But if | ||
| # you are low on disk space it may be your only option. | ||
| USE_TRACE_FST = 0 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we might need a comment here, to notify future users that
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense, although the logic is fairly simple and self-explanatory. |
||
| # With USE_TRACE = 1, USE_TRACE_DETAILED = 1 will generate traces that also | ||
| # include non-interface internal signal names starting with an underscore. | ||
| # This will significantly increase the trace size and should only be used | ||
| # on a per need basis for difficult debug problems. | ||
| USE_TRACE_DETAILED = 0 | ||
| USE_THREADS = $(shell nproc) | ||
| VTA_LIBNAME = libvta_hw | ||
| UNITTEST_NAME = all | ||
| CXX = g++ | ||
| # A debug build with DEBUG = 1 is useful to trace the simulation with a | ||
| # debugger. | ||
| DEBUG = 0 | ||
| # With DEBUG = 1, SANITIZE = 1 turns on address sanitizing to verify that | ||
| # the verilator build is sane. To be used if you know what you are doing. | ||
| SANITIZE = 0 | ||
|
|
||
| CXX_MAJOR := $(shell $(CXX) -dumpversion | sed 's/\..*//') | ||
| CXX_HAS_ALIGN_NEW := $(shell [ $(CXX_MAJOR) -ge 7 ] && echo true) | ||
|
|
||
| config_test = $(TOP_TEST)$(CONFIG) | ||
| vta_dir = $(abspath ../../) | ||
|
|
@@ -61,11 +81,15 @@ verilator_opt += -Mdir ${verilator_build_dir} | |
| verilator_opt += -I$(chisel_build_dir) | ||
|
|
||
| ifeq ($(DEBUG), 0) | ||
| cxx_flags = -O2 -Wall | ||
| cxx_flags = -O2 -Wall -fvisibility=hidden | ||
| else | ||
| cxx_flags = -O0 -g -Wall | ||
| endif | ||
| cxx_flags += -fvisibility=hidden -std=c++11 | ||
|
|
||
| cxx_flags += -std=c++11 -Wno-maybe-uninitialized | ||
| ifeq ($(CXX_HAS_ALIGN_NEW),true) | ||
| cxx_flags += -faligned-new | ||
| endif | ||
| cxx_flags += -DVL_TSIM_NAME=V$(TOP_TEST) | ||
| cxx_flags += -DVL_PRINTF=printf | ||
| cxx_flags += -DVL_USER_FINISH | ||
|
|
@@ -82,13 +106,33 @@ cxx_flags += -I$(tvm_dir)/3rdparty/dlpack/include | |
|
|
||
| ld_flags = -fPIC -shared | ||
|
|
||
| ifeq ($(SANITIZE), 1) | ||
| ifeq ($(DEBUG), 1) | ||
| cxx_flags += -fno-omit-frame-pointer -fsanitize=address -fsanitize-recover=address | ||
| ld_flags += -fno-omit-frame-pointer -fsanitize=address -fsanitize-recover=address | ||
| endif | ||
| endif | ||
|
|
||
| cxx_objs = $(verilator_build_dir)/verilated.o $(verilator_build_dir)/verilated_dpi.o $(verilator_build_dir)/tsim_device.o | ||
|
|
||
| ifneq ($(USE_TRACE), 0) | ||
| verilator_opt += --trace | ||
| cxx_flags += -DVM_TRACE=1 | ||
| cxx_flags += -DTSIM_TRACE_FILE=$(verilator_build_dir)/$(TOP_TEST).vcd | ||
| cxx_objs += $(verilator_build_dir)/verilated_vcd_c.o | ||
| ifeq ($(USE_TRACE_FST), 1) | ||
| cxx_flags += -DVM_TRACE_FST | ||
| verilator_opt += --trace-fst | ||
| else | ||
| verilator_opt += --trace | ||
| endif | ||
| ifeq ($(USE_TRACE_DETAILED), 1) | ||
| verilator_opt += --trace-underscore --trace-structs | ||
| endif | ||
| ifeq ($(USE_TRACE_FST), 1) | ||
| cxx_flags += -DTSIM_TRACE_FILE=$(verilator_build_dir)/$(TOP_TEST).fst | ||
| cxx_objs += $(verilator_build_dir)/verilated_fst_c.o | ||
| else | ||
| cxx_flags += -DTSIM_TRACE_FILE=$(verilator_build_dir)/$(TOP_TEST).vcd | ||
| cxx_objs += $(verilator_build_dir)/verilated_vcd_c.o | ||
| endif | ||
| else | ||
| cxx_flags += -DVM_TRACE=0 | ||
| endif | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -103,8 +103,7 @@ class TensorLoad(tensorType: String = "none", debug: Boolean = false)( | |
| state := sXPad1 | ||
| }.elsewhen(dec.ypad_1 =/= 0.U) { | ||
| state := sYPad1 | ||
| } | ||
| .otherwise { | ||
| }.otherwise { | ||
| state := sIdle | ||
| } | ||
| }.elsewhen(dataCtrl.io.stride) { | ||
|
|
@@ -198,11 +197,9 @@ class TensorLoad(tensorType: String = "none", debug: Boolean = false)( | |
| tag := tag + 1.U | ||
| } | ||
|
|
||
| when( | ||
| state === sIdle || dataCtrlDone || (set === (tp.tensorLength - 1).U && tag === (tp.numMemBlock - 1).U)) { | ||
| when(state === sIdle || dataCtrlDone || (set === (tp.tensorLength - 1).U && tag === (tp.numMemBlock - 1).U)) { | ||
| set := 0.U | ||
| }.elsewhen( | ||
| (io.vme_rd.data.fire() || isZeroPad) && tag === (tp.numMemBlock - 1).U) { | ||
| }.elsewhen((io.vme_rd.data.fire() || isZeroPad) && tag === (tp.numMemBlock - 1).U) { | ||
| set := set + 1.U | ||
| } | ||
|
|
||
|
|
@@ -211,10 +208,12 @@ class TensorLoad(tensorType: String = "none", debug: Boolean = false)( | |
| when(state === sIdle) { | ||
| waddr_cur := dec.sram_offset | ||
| waddr_nxt := dec.sram_offset | ||
| }.elsewhen((io.vme_rd.data | ||
| .fire() || isZeroPad) && set === (tp.tensorLength - 1).U && tag === (tp.numMemBlock - 1).U) { | ||
| }.elsewhen((io.vme_rd.data.fire() || isZeroPad) | ||
| && set === (tp.tensorLength - 1).U | ||
| && tag === (tp.numMemBlock - 1).U) | ||
| { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the linter might remind you to move the bracket to the previous line. |
||
| waddr_cur := waddr_cur + 1.U | ||
| }.elsewhen(dataCtrl.io.stride) { | ||
| }.elsewhen(dataCtrl.io.stride && io.vme_rd.data.fire()) { | ||
| waddr_cur := waddr_nxt + dec.xsize | ||
| waddr_nxt := waddr_nxt + dec.xsize | ||
| } | ||
|
|
@@ -261,8 +260,7 @@ class TensorLoad(tensorType: String = "none", debug: Boolean = false)( | |
| } | ||
|
|
||
| // done | ||
| val done_no_pad = io.vme_rd.data | ||
| .fire() & dataCtrl.io.done & dec.xpad_1 === 0.U & dec.ypad_1 === 0.U | ||
| val done_no_pad = io.vme_rd.data.fire() & dataCtrl.io.done & dec.xpad_1 === 0.U & dec.ypad_1 === 0.U | ||
| val done_x_pad = state === sXPad1 & xPadCtrl1.io.done & dataCtrlDone & dec.ypad_1 === 0.U | ||
| val done_y_pad = state === sYPad1 & dataCtrlDone & yPadCtrl1.io.done | ||
| io.done := done_no_pad | done_x_pad | done_y_pad | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.