OpenCores
URL https://opencores.org/ocsvn/csa/csa/trunk

Subversion Repositories csa

[/] [csa/] [trunk/] [makefile] - Rev 32

Go to most recent revision | Compare with Previous | Blame | View Log

MODULE=decrypt
TEST_IN_FILE=test_dat/$(MODULE).in
TEST_TIMES=1
DEBUG=y

all:bench sw_sim rtl

.PHONY: rtl
rtl:
        @echo compiling rtl ...
        @make -s -C rtl    PROJ_NAME=$(MODULE) DEBUG=$(DEBUG)
 
.PHONY: bench
bench:
        @echo compiling bench ...
        @make -s -C bench  PROJ_NAME=$(MODULE) DEBUG=$(DEBUG)

.PHONY: sw_sim
sw_sim:
        @echo compiling sw_sim ...
        @make -s -C sw_sim PROJ_NAME=$(MODULE) DEBUG=$(DEBUG)

synthesis:
        @make -s -C rtl $(MODULE)

sw:
        @make -s -C sw_sim $(MODULE)

preare_fn =                                                            \
        str="" ;                                                       \
        for ((i=0;i<$1;i=i+1));                                         \
        do                                                             \
                n=$$(expr $$RANDOM % 256 )    ;                        \
                binstr=$$(echo "ibase=10;obase=2;$$n"|bc) ;           \
                binstr=$$(echo "$$binstr" | awk ' { n=8-length($$1);for(i=0;i<n;i=i+1) printf "0"; printf $$1; }' )             ;                                   \
                str=$$(printf "%s%s" $$str $$binstr) ;                 \
        done          ;                                                \
        echo $$str >$(TEST_IN_FILE)  

preare_block_decypher:
        $(call preare_fn,64)

preare_key_perm:
        $(call preare_fn,8)

preare_key_schedule:
        $(call preare_fn,8)

preare_decrypt:
        #$(call preare_fn,204) # evenkey + oddkey + ts pacted (188)
        str="";
        cp /dev/null $(TEST_IN_FILE);
        cat decrypted | while read n;                        \
        do \
                n=$$(echo $$n | tr 'a-z' 'A-F');                  \
                binstr=$$(echo "ibase=16;obase=2;$$n"|bc); \
                binstr=$$(echo "$$binstr" | awk ' { n=8-length($$1);for(i=0;i<n;i=i+1) printf "0"; printf $$1; }' )             ;                                   \
                str=$$(printf "%s%s" $$str $$binstr) ;                 \
                echo -n $$binstr >>$(TEST_IN_FILE); \
        done

preare_stream_cypher:
        $(call preare_fn,24)
        
ifeq ($(DEBUG),y)
check:
        @(for ((i=0;i<$(TEST_TIMES);i=i+1))                                       \
                do                                                                \
                        make -s -C sw_sim test PROJ_NAME=$(MODULE);               \
                        make -s -C bench test PROJ_NAME=$(MODULE);                \
                        diff test_dat/$(MODULE).out.sw test_dat/$(MODULE).out.v ; \
                done)

else
check:
        @(for ((i=0;i<$(TEST_TIMES);i=i+1))                                       \
                do                                                                \
                        make -s preare_$(MODULE);                                 \
                        make -s -C sw_sim test PROJ_NAME=$(MODULE);               \
                        make -s -C bench test PROJ_NAME=$(MODULE);                \
                        diff test_dat/$(MODULE).out.sw test_dat/$(MODULE).out.v ; \
                done)
endif


clean:
        echo clean sw_sim
        @make -s -C sw_sim clean
        echo clean rtl
        @make -s -C rtl clean
        echo clean bench
        @make -s -C bench clean
        @rm -fr test_dat/*

cscope:
        @find . -name "*.[ch]" >cscope.files
        @cscope -b


Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.