- added
git-svn-id: http://moon:8086/svn/software/trunk/libsrc/cpp@1084 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
include ./config.mk
|
||||
|
||||
DEFINES := -Dradio_float_t=float -Dfir_float_t=float
|
||||
CXXFLAGS_release := -O3 -flto
|
||||
CFLAGS_release := -O3 -flto
|
||||
LDFLAGS_release := -O3 -flto
|
||||
TARGET_ARCH := -march=native
|
||||
CXXFLAGS += -std=c++20
|
||||
CXXFLAGS += -Wno-volatile
|
||||
CXXFLAGS += -Wno-deprecated-declarations
|
||||
|
||||
DEFINES_debug += -DTEST_DEBUG
|
||||
|
||||
PWD := $(realpath .)
|
||||
CXX_SRCS += $(PWD)/test_desymbolizer.cpp
|
||||
|
||||
LIBS := -lstdc++ -lm -lpthread -lrt
|
||||
LDFLAGS += $(TARGET_ARCH) $(LIBDIR)
|
||||
DEFINES += -DPROCESSOR_BUFFER_USE_EXCEPTIONS
|
||||
INCLUDES += -I $(LIBSRC_PATH) -I $(BLAZE_PATH)
|
||||
|
||||
all: compile app
|
||||
app: packages link
|
||||
|
||||
.PHONY: Radio Fir Crc Wav
|
||||
|
||||
packages: Radio Fir Crc Wav
|
||||
|
||||
Radio:
|
||||
@$(MAKE) -C $(LIBSRC_PATH)/cpp/radio
|
||||
Fir:
|
||||
@$(MAKE) -C $(LIBSRC_PATH)/fir
|
||||
Crc:
|
||||
@$(MAKE) -C $(LIBSRC_PATH)/crc
|
||||
Wav:
|
||||
@$(MAKE) -C $(LIBSRC_PATH)/wav
|
||||
|
||||
include $(MAKE_HOME)/compile.mk
|
||||
include $(MAKE_HOME)/link.mk
|
||||
@@ -0,0 +1,10 @@
|
||||
MAKE_HOME ?= /home/jens/work/software/make
|
||||
CONFIG ?= debug
|
||||
TARGET ?= test_desymbolizer
|
||||
BUILD_DIR ?= $(shell pwd)/build/${CONFIG}
|
||||
MAKEFLAGS += --no-print-directory
|
||||
|
||||
LIBSRC_PATH ?= $(realpath ../../../../../libsrc)
|
||||
BLAZE_PATH ?= $(realpath ../../../../../extlib/blaze)
|
||||
|
||||
export
|
||||
@@ -0,0 +1,43 @@
|
||||
#include <cpp/radio/DeSymbolizer.hpp>
|
||||
|
||||
void print_bytes(uint8_t *bytes, size_t size)
|
||||
{
|
||||
while(size--)
|
||||
{
|
||||
printf("%02X", *bytes);
|
||||
bytes++;
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void test(DeSymbolizer &dut, size_t numBitsPerSym, symbol_t *syms, size_t numSyms)
|
||||
{
|
||||
size_t numbytes;
|
||||
uint8_t bytes[2];
|
||||
|
||||
dut.setNumBitsPerSymbol(numBitsPerSym);
|
||||
for (size_t i=0; i < numSyms; i++)
|
||||
{
|
||||
printf("Symbol %zu\n", i);
|
||||
numbytes = dut.sym2bytes(syms[i], bytes);
|
||||
if (numbytes)
|
||||
{
|
||||
print_bytes(bytes, numbytes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
printf("DUT is DeSymbolizer\n");
|
||||
|
||||
DeSymbolizer dut;
|
||||
|
||||
symbol_t syms[] = {0x00000181, 0x00000523, 0x00000781, 0x00000001, 0x00000003, 0x00000003, 0x00000003, 0x00000003};
|
||||
|
||||
test(dut, 2, syms, sizeof(syms)/sizeof(syms[0]));
|
||||
test(dut, 8, syms, sizeof(syms)/sizeof(syms[0]));
|
||||
test(dut, 12, syms, sizeof(syms)/sizeof(syms[0]));
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user