| [667] | 1 | # where is soclib? | 
|---|
|  | 2 | # | 
|---|
|  | 3 | SOCLIB_DIR=$(shell soclib-cc --getpath) | 
|---|
|  | 4 |  | 
|---|
|  | 5 | # name definitions | 
|---|
|  | 6 | # | 
|---|
|  | 7 | SOCLIB_DESC=desc.py | 
|---|
|  | 8 | SOCLIB_TOP=top.cpp | 
|---|
|  | 9 | SIMULATOR_BINARY=system.x | 
|---|
|  | 10 | SIMULATOR_CMD=./$(SIMULATOR_BINARY) --nobanner | 
|---|
|  | 11 |  | 
|---|
|  | 12 | # extra arguments for compilation | 
|---|
|  | 13 | # | 
|---|
|  | 14 | #SOCLIB_CC_ARGS=-v | 
|---|
|  | 15 | SOCLIB_CC_ARGS+=-b common:mips32 | 
|---|
|  | 16 |  | 
|---|
|  | 17 | # extra arguments for execution | 
|---|
|  | 18 | # | 
|---|
|  | 19 | # gdb | 
|---|
|  | 20 | # - F: start the simulation in a frozen state so it can be attached with a gdb | 
|---|
|  | 21 | #   client | 
|---|
|  | 22 | # - X: disable automatic break whenever an exception is caught, the exception | 
|---|
|  | 23 | #   handler will be called transparently | 
|---|
|  | 24 | # - S: make the simulation stop and wait for a gdb attachment whenever an | 
|---|
|  | 25 | #   exception is caught | 
|---|
|  | 26 | # - C: dump a trace of every inter-functions branch | 
|---|
|  | 27 | # - T: exit the simulator on trap exception | 
|---|
|  | 28 | # - Z: same as C but display only function's entrypoint | 
|---|
|  | 29 | # - W: disable automatic break whenever a watchpoint is hit, just report it on | 
|---|
|  | 30 | #   stderr (watchpoints can be defined using SOCLIB_GDB_WATCH) | 
|---|
|  | 31 | SIMULATOR_GDB= | 
|---|
|  | 32 | ifeq ("$(origin GDB)", "command line") | 
|---|
|  | 33 | ifeq ($(GDB), 1) | 
|---|
|  | 34 | SIMULATOR_GDB=SOCLIB_GDB=FCX | 
|---|
|  | 35 | else | 
|---|
|  | 36 | SIMULATOR_GDB=SOCLIB_GDB=$(GDB) | 
|---|
|  | 37 | endif | 
|---|
|  | 38 | endif | 
|---|
|  | 39 | # ncpus | 
|---|
|  | 40 | SIMULATOR_NCPUS=4 | 
|---|
|  | 41 | ifeq ("$(origin NCPUS)", "command line") | 
|---|
|  | 42 | SIMULATOR_NCPUS=$(NCPUS) | 
|---|
|  | 43 | endif | 
|---|
|  | 44 | # vmlinux | 
|---|
|  | 45 | SIMULATOR_VMLINUX=./vmlinux | 
|---|
|  | 46 | ifeq ("$(origin VMLINUX)", "command line") | 
|---|
|  | 47 | SIMULATOR_VMLINUX=$(VMLINUX) | 
|---|
|  | 48 | endif | 
|---|
|  | 49 | # dsk | 
|---|
|  | 50 | SIMULATOR_DSK= | 
|---|
|  | 51 | ifeq ("$(origin DSK)", "command line") | 
|---|
|  | 52 | SIMULATOR_DSK=--dsk $(DSK) | 
|---|
|  | 53 | endif | 
|---|
|  | 54 | # trace | 
|---|
|  | 55 | SIMULATOR_TRACE= | 
|---|
|  | 56 | ifeq ("$(origin TRACE)", "command line") | 
|---|
|  | 57 | SIMULATOR_TRACE=--trace $(TRACE) | 
|---|
|  | 58 | endif | 
|---|
|  | 59 | # ncycles | 
|---|
|  | 60 | SIMULATOR_NCYCLES= | 
|---|
|  | 61 | ifeq ("$(origin NCYCLES)", "command line") | 
|---|
|  | 62 | SIMULATOR_NCYCLES=--ncycles $(NCYCLES) | 
|---|
|  | 63 | endif | 
|---|
|  | 64 |  | 
|---|
|  | 65 | # recipes | 
|---|
|  | 66 | all: $(SIMULATOR_BINARY) | 
|---|
|  | 67 |  | 
|---|
|  | 68 | $(SIMULATOR_BINARY): $(SOCLIB_DESC) $(SOCLIB_TOP) | 
|---|
|  | 69 | soclib-cc $(SOCLIB_CC_ARGS) -P -p $(SOCLIB_DESC) -o $(SIMULATOR_BINARY) | 
|---|
|  | 70 |  | 
|---|
|  | 71 | run_tsar_boot: all tsar_boot.bin | 
|---|
|  | 72 | $(SIMULATOR_GDB) $(SIMULATOR_CMD) --ncpus $(SIMULATOR_NCPUS) --rom tsar_boot.bin $(SIMULATOR_DSK) $(SIMULATOR_TRACE) $(SIMULATOR_NCYCLES) | 
|---|
|  | 73 |  | 
|---|
|  | 74 | run_dummy_boot: all | 
|---|
|  | 75 | $(SIMULATOR_GDB) $(SIMULATOR_CMD) --ncpus $(SIMULATOR_NCPUS) --rom $(SIMULATOR_VMLINUX) $(SIMULATOR_DSK) --dummy-boot $(SIMULATOR_TRACE) $(SIMULATOR_NCYCLES) | 
|---|
|  | 76 |  | 
|---|
|  | 77 | cscope.out: | 
|---|
|  | 78 | soclib-cc -p $(SOCLIB_DESC) --tags | 
|---|
|  | 79 |  | 
|---|
|  | 80 | clean: | 
|---|
|  | 81 | soclib-cc -P -p $(SOCLIB_DESC) -x -o $(SIMULATOR_BINARY) | 
|---|
|  | 82 | rm -f $(SIMULATOR_BINARY) *.o vci* | 
|---|
|  | 83 |  | 
|---|
|  | 84 | .PHONY: $(SIMULATOR_BINARY) | 
|---|