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

Subversion Repositories csa

[/] [csa/] [trunk/] [makefile] - Diff between revs 50 and 51

Show entire file | Details | Blame | View Log

Rev 50 Rev 51
Line 1... Line 1...
MODULE:=key_schedule
 
TEST_IN_FILE=test_dat/$(MODULE).in
################################################################################
TEST_TIMES=1
# some environment variables
DEBUG=n
################################################################################
 
MODULE          := key_schedule                   # the module name
 
TEST_TIMES      := 1                              # check times
 
DEBUG           := n                              # whether debug is enable
 
 
 
 
 
################################################################################
 
TEST_IN_FILE    := test_dat/$(MODULE).in
 
 
 
 
 
 
 
################################################################################
 
# depend
 
################################################################################
 
 
all:bench sw_sim rtl
all:bench sw_sim rtl
 
 
.PHONY: rtl
.PHONY: rtl
rtl:
rtl:
Line 18... Line 31...
.PHONY: sw_sim
.PHONY: sw_sim
sw_sim:
sw_sim:
        @echo compiling sw_sim ...
        @echo compiling sw_sim ...
        @make -s -C sw_sim PROJ_NAME=$(MODULE) DEBUG=$(DEBUG)
        @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
 
                str=$$(printf "%s%s" $$str $$binstr) ;                 \
 
        done          ;                                                \
 
        echo $$str >$(TEST_IN_FILE)
 
 
 
preare_bin_fn =                                                            \
preare_bin_fn =                                                            \
        str="" ;                                                       \
        str="" ;                                                       \
        for ((i=0;i<$1;i=i+1));                                         \
        for ((i=0;i<$1;i=i+1));                                         \
        do                                                             \
        do                                                             \
                n=$$(expr $$RANDOM % 256 )    ;                        \
                n=$$(expr $$RANDOM % 256 )    ;                        \
                binstr=$$(echo "ibase=10;obase=16;$$n"|bc) ;           \
                binstr=$$(echo "ibase=10;obase=16;$$n"|bc) ;           \
                binstr=$$(echo "000: $$binstr " | xxd -r );           \
                binstr=$$(echo "000: $$binstr " | xxd -r );           \
                str+=$$binstr ;                 \
                str+=$$binstr ;                 \
        done          ;                                                \
        done          ;                                                \
        echo -n $$str  >$(TEST_IN_FILE)  ;         \
        echo -n $$str  >$(TEST_IN_FILE)  ;
 
 
preare_block_decypher:
prepare_block_decypher:
        $(call preare_fn,64)
        $(call preare_bin_fn,64)
 
 
preare_key_perm:
prepare_key_perm:
        $(call preare_fn,8)
        $(call preare_bin_fn,8)
 
 
preare_key_schedule:
prepare_key_schedule:
        $(call preare_bin_fn,8)
        $(call preare_bin_fn,8)
 
 
preare_group_decrypt:
prepare_group_decrypt:
        $(call preare_bin_fn,192)
        $(call preare_bin_fn,192)
 
 
preare_decrypt:
prepare_stream_cypher:
        #$(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
 
                str=$$(printf "%s%s" $$str $$binstr) ;                 \
 
                echo -n $$binstr >>$(TEST_IN_FILE); \
 
        done
 
 
 
preare_stream_cypher:
 
        $(call preare_fn,24)
        $(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:
check:
        @(for ((i=0;i<$(TEST_TIMES);i=i+1))                                       \
        @(for ((i=0;i<$(TEST_TIMES);i=i+1))                                       \
                do                                                                \
                do                                                                \
                        make -s preare_$(MODULE);                                 \
                        make -s preare_$(MODULE);                                 \
                        make -s -C sw_sim test PROJ_NAME=$(MODULE);               \
                        make -s -C sw_sim test PROJ_NAME=$(MODULE);               \
                        make -s -C bench test PROJ_NAME=$(MODULE);                \
                        make -s -C bench test PROJ_NAME=$(MODULE);                \
                        diff test_dat/$(MODULE).out.sw test_dat/$(MODULE).out.v ; \
                        diff test_dat/$(MODULE).out.sw test_dat/$(MODULE).out.v ; \
                done)
                done)
endif
 
 
 
 
 
clean:
clean:
        echo clean sw_sim
        echo clean sw_sim
        @make -s -C sw_sim clean
        @make -s -C sw_sim clean
        echo clean rtl
        echo clean rtl
Line 108... Line 79...
 
 
cscope:
cscope:
        @find . -name "*.[ch]" >cscope.files
        @find . -name "*.[ch]" >cscope.files
        @cscope -b
        @cscope -b
 
 
 
help:
 
        @echo "avaliable make tagers:"
 
        @echo "help                  --- display this help information"
 
        @echo "prepare_ --- prepare the input data for test the module"
 
        @echo "all                   --- compile the rtl bench and c programs, don't run test"
 
        @echo "check                 --- run test"
 
        @echo "clean                 --- remove the compiled file"
 
        @echo "cscope                --- gernerate a cscope file for c files( i use vim )"
 
        @echo "avaliable make variable:"
 
        @echo "MODULE                --- the current module name"
 
        @echo "TEST_TIMES            --- check times"
 
        @echo "DEBUG                 --- whether enable debug"
 
 
 
 

powered by: WebSVN 2.1.0

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