Skip to content

Commit

Permalink
Add debug output
Browse files Browse the repository at this point in the history
  • Loading branch information
mole99 committed Sep 19, 2023
1 parent 01a22ba commit 3d3ea08
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 9 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ obj = ${subst $(SRCDIR),$(OBJDIR),$(addsuffix .o, $(basename $(csrc)))}
$(info $(csrc))
$(info $(obj))

default: fstdumper.so
all: fstdumper.so

CFLAGS = -I $(SRCDIR)/config -fPIC -O2
CFLAGS = -I $(SRCDIR)/config -fPIC -O2 -DDEBUG
LDFLAGS = -lz -shared

TESTBENCH = $(wildcard testbench/*.sv)
Expand Down Expand Up @@ -49,7 +49,7 @@ simulation-vcs: fstdumper.so
vcs -sverilog -full64 +vpi -load ./fstdumper.so -debug_acc+pp+f+dmptf $(TESTBENCH)
./simv

.PHONY: clean
.PHONY: clean all simulation-iverilog simulation-xrun simulation-vsim
clean:
rm -f $(obj) *.so *.so.vpi *.vvp *.fst

11 changes: 11 additions & 0 deletions src/debug.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef DEBUG_H
#define DEBUG_H

#ifndef DEBUG
#define DEBUG 0
#endif

#define debug_print(...) \
do { if (DEBUG) { fprintf(stderr, "%s(%d) : ", __FILE__, __LINE__); fprintf(stderr, __VA_ARGS__); } } while (0)

#endif
Loading

0 comments on commit 3d3ea08

Please sign in to comment.