Commit 998c0cf5 authored by Federico Vaga's avatar Federico Vaga

demos: add profiling demo

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent 948b709c
......@@ -3,6 +3,7 @@ DIRS := hello_world
DIRS += hello_world_framework
DIRS += alarm_clock
DIRS += demo_generator
DIRS += profiling
all clean modules install modules_install: $(DIRS)
......
-include Makefile.specific
DIRS := firmware
all clean modules install modules_install: $(DIRS)
clean: TARGET = clean
modules: TARGET = modules
install: TARGET = install
modules_install: TARGET = modules_install
$(DIRS):
$(MAKE) -C $@ $(TARGET)
.PHONY: all clean modules install modules_install
.PHONY: $(DIRS)
-include Makefile.specific
DIRS := fw-01
DIRS += fw-02
DIRS += fw-03
all clean modules install modules_install: $(DIRS)
clean: TARGET = clean
modules: TARGET = modules
install: TARGET = install
modules_install: TARGET = modules_install
$(DIRS):
$(MAKE) -C $@ $(TARGET)
.PHONY: all clean modules install modules_install
.PHONY: $(DIRS)
OBJS = fw-profile.o
OBJS += # add other object files that you need
OUTPUT = fw-profile
TRTL ?= ../../../../
CFLAGS_OPT = -O0
EXTRA_CFLAGS += -DFPGA_APPLICATION_ID=0x0
EXTRA_CFLAGS += -DRT_APPLICATION_ID=0x0
MOCKTURTLE_LIBRARY_PRINT_ENABLE := 1
MOCKTURTLE_LIBRARY_PRINT_DEBUG_ENABLE := 1
# Firmware Libray configuration
MOCKTURTLE_FRAMEWORK_ENABLE := 0
MOCKTURTLE_FRAMEWORK_VARIABLE_ENABLE := 0
MOCKTURTLE_FRAMEWORK_BUFFER_ENABLE := 0
MOCKTURTLE_FRAMEWORK_DEBUG_ENABLE := 0
MOCKTURTLE_FRAMEWORK_32BIT_ALIGN := 0
include $(TRTL)/rt/Makefile
#include <mockturtle-rt-serial.h>
#include <mockturtle-rt-profile.h>
int main()
{
pr_debug("%s:%d\n\r", __func__, __LINE__);
trtl_tpu_profile_start(1);
pr_debug("%s:%d\n\r", __func__, __LINE__);
trtl_tpu_probe_trigger(2);
pr_debug("%s:%d\n\r", __func__, __LINE__);
trtl_tpu_probe_trigger(3);
pr_debug("%s:%d\n\r", __func__, __LINE__);
trtl_tpu_probe_trigger(4);
pr_debug("%s:%d\n\r", __func__, __LINE__);
trtl_tpu_probe_trigger(5);
pr_debug("%s:%d\n\r", __func__, __LINE__);
trtl_tpu_profile_stop(6);
pr_debug("%s:%d\n\r", __func__, __LINE__);
return 0;
}
OBJS = fw-profile.o
OBJS += # add other object files that you need
OUTPUT = fw-profile
TRTL ?= ../../../../
CFLAGS_OPT = -O0
EXTRA_CFLAGS += -DFPGA_APPLICATION_ID=0x0
EXTRA_CFLAGS += -DRT_APPLICATION_ID=0x0
MOCKTURTLE_LIBRARY_PRINT_ENABLE := 1
MOCKTURTLE_LIBRARY_PRINT_DEBUG_ENABLE := 1
# Firmware Libray configuration
MOCKTURTLE_FRAMEWORK_ENABLE := 0
MOCKTURTLE_FRAMEWORK_VARIABLE_ENABLE := 0
MOCKTURTLE_FRAMEWORK_BUFFER_ENABLE := 0
MOCKTURTLE_FRAMEWORK_DEBUG_ENABLE := 0
MOCKTURTLE_FRAMEWORK_32BIT_ALIGN := 0
include $(TRTL)/rt/Makefile
#include <mockturtle-rt-serial.h>
#include <mockturtle-rt-profile.h>
int main()
{
int i;
pr_debug("%s:%d\n\r", __func__, __LINE__);
trtl_tpu_profile_start(1);
for (i = 0; i < 10; ++i) {
trtl_tpu_probe_trigger(2);
pr_debug("%s:%d\n\r", __func__, __LINE__);
trtl_tpu_probe_trigger(3);
}
trtl_tpu_profile_stop(4);
pr_debug("%s:%d\n\r", __func__, __LINE__);
return 0;
}
OBJS = fw-profile.o
OBJS += # add other object files that you need
OUTPUT = fw-profile
TRTL ?= ../../../../
CFLAGS_OPT = -O0
EXTRA_CFLAGS += -DFPGA_APPLICATION_ID=0x0
EXTRA_CFLAGS += -DRT_APPLICATION_ID=0x0
MOCKTURTLE_LIBRARY_PRINT_ENABLE := 1
MOCKTURTLE_LIBRARY_PRINT_DEBUG_ENABLE := 1
# Firmware Libray configuration
MOCKTURTLE_FRAMEWORK_ENABLE := 0
MOCKTURTLE_FRAMEWORK_VARIABLE_ENABLE := 0
MOCKTURTLE_FRAMEWORK_BUFFER_ENABLE := 0
MOCKTURTLE_FRAMEWORK_DEBUG_ENABLE := 0
MOCKTURTLE_FRAMEWORK_32BIT_ALIGN := 0
include $(TRTL)/rt/Makefile
#include <mockturtle-rt-serial.h>
#include <mockturtle-rt-profile.h>
#define PROFILE_PROBE_ID0 0
#define PROFILE_PROBE_ID1 1
static int num = 0;
static void profile_short(void)
{
int i = 0;
pr_debug("%s:%d\n\r", __func__, __LINE__);
trtl_tpu_probe_trigger(3); /* start */
for (i = 0; i < 100; ++i)
num *= 2;
trtl_tpu_probe_trigger(4); /* end */
pr_debug("%s:%d\n\r", __func__, __LINE__);
}
static void profile_long(void)
{
int i = 0;
pr_debug("%s:%d\n\r", __func__, __LINE__);
trtl_tpu_probe_trigger(5); /* start */
for (i = 0; i < 10000; ++i) {
num /= 2;
num++;
}
trtl_tpu_probe_trigger(6); /* end */
pr_debug("%s:%d\n\r", __func__, __LINE__);
}
static void profile_func(void)
{
pr_debug("%s:%d\n\r", __func__, __LINE__);
trtl_tpu_profile_start(1);
profile_short();
profile_long();
trtl_tpu_profile_stop(2);
pr_debug("%s:%d\n\r", __func__, __LINE__);
}
int main()
{
pr_debug("%s:%d\n\r", __func__, __LINE__);
profile_func();
pr_debug("%s:%d\n\r", __func__, __LINE__);
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment