-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
executable file
·157 lines (111 loc) · 3.93 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# $Id: $
# ====================================================================== #
# #
# Makefile for GOST 28147-89 CryptoCore project #
# #
# Copyright (c) 2014 Dmitry Murzinov ([email protected]) #
# #
# ====================================================================== #
# project name
PROJECT=gost_28147_89
SOURCES=$(PROJECT).v
DEFINE=GOST_SBOX_TESTPARAM
SIM_DIR=./sim/bin
SYN_DIR=./syn/bin
CUR_DIR=$(shell pwd)
#ICARUS_SETUP:=. /soft/icarus.setup
#MENTOR_SETUP:=. /soft/mentor.setup
MENTOR_SETUP:=date
#SYNPLIFY_SETUP:=. /soft/synplify.setup
SYNPLIFY_SETUP:=date
IVERILOG_SETUP:=. /opt/iverilog.setup
VERILATOR_SETUP:=. /opt/verilator.setup
VCS_OPT += +plusarg_ignore
REVISION = 1.0
SYN_LOG=../log/$(PROJECT).log
SIM_LOG=sim/log/$(PROJECT).log
#######################################################################
all: syn
default_target: help
##### HELP target #####
help:
@echo ""
@echo " Current project: $(PROJECT)"
@echo " Current directory: $(CUR_DIR)"
@echo ""
@echo " Available targets :"
@echo " =================="
@echo " make : print this text"
@echo " make synplify : synthesize design using Synplify to get netlist"
@echo " make sim : compile and run simulation RTL-design using iverilog/ModelSim"
@echo " make sim-gui : compile and run simulation RTL-design using ModelSim with GUI"
@echo " make clean : remove all temporary files"
@echo ""
sbox-gen:
@gcc -D$(DEFINE) -o s-box-generator syn/src/s-box-generator.c
@./s-box-generator > rtl/sbox.vh
@rm s-box-generator
############### SIM target ###############
sim: sbox-gen iverilog
sim-gui: modelsim-gui
##### Mentor Modelsim #####
modelsim:
@cd $(SIM_DIR);\
$(MENTOR_SETUP);\
vsim -64 -c -quiet -do gost28147-89.tcl;\
cd $(CUR_DIR);
modelsim-gui:
@cd $(SIM_DIR);\
$(MENTOR_SETUP);\
vsim -64 -do gost28147-89_gui.tcl;\
cd $(CUR_DIR);
##### Icarus Verilog #####
iverilog: icarus icarus-wave
icarus:
@cd $(SIM_DIR);\
rm -rf $(PROJECT).vvp;\
$(IVERILOG_SETUP);\
iverilog -g2005-sv -I../../rtl -D$(DEFINE) -s tb -o $(PROJECT).vvp ../src/$(PROJECT)_tb.v ../../rtl/$(PROJECT).v;\
vvp -n $(PROJECT).vvp -lxt2;\
cd $(CUR_DIR);
icarus-wave:
@gtkwave $(SIM_DIR)/$(PROJECT).vcd $(SIM_DIR)/$(PROJECT).gtkw &
############### SYN target ###############
syn: sbox-gen yosys
##### Yosys #####
yosys:
@cd $(SYN_DIR);\
yosys -Q -T -v 2 -s yosys.ys -L $(SYN_LOG);\
cd $(CUR_DIR);
##### Synplify #####
synplify:
@cd $(SYN_DIR);\
$(SYNPLIFY_SETUP);\
synplify_pro -enable64bit -batch synplify.tcl;\
cd $(CUR_DIR);
##### Vivado #####
vivado: sbox-gen
@vivado -nojournal -nolog -mode batch -source $(SYN_DIR)/vivado.tcl
-@grep VIOLATED syn/log/post_route_timing_worst.rpt
sim-core:
@$(eval ITEM = gost28147)
@rm -rf $(ITEM).vvp $(ITEM).vcd
@iverilog -g2005-sv -I./rtl -D$(DEFINE) -s tb -o $(ITEM).vvp bench/$(ITEM)_tb.v rtl/$(ITEM).v
@vvp -n $(ITEM).vvp -fst
@#gtkwave $(ITEM).vcd $(SIM_DIR)/$(ITEM).gtkw &
sim-counter:
@$(eval ITEM = counter_rollover)
@rm -rf $(ITEM).vvp $(ITEM).vcd
@iverilog -g2005-sv -I./rtl -D$(DEFINE) -s $(ITEM)_tb -o $(ITEM).vvp bench/$(ITEM)_tb.v rtl/$(ITEM).v
@vvp -n $(ITEM).vvp -fst
@gtkwave $(ITEM).vcd $(SIM_DIR)/$(ITEM).gtkw &
vcs-counter:
@export VCS_ARCH_OVERRIDE="linux"
@$(eval ITEM = counter_rollover)
@-rm -rf $(ITEM).daidir AN.DB/ simv* csrc/ DVEfiles/ *~
vcs -full64 -l $(SIM_LOG) -debug_all +v2k -v2005 +lint=TFIPC-L +lint=all,noVCDE,noZERO +warn=all +error+1024 bench/$(ITEM)_tb.v rtl/$(ITEM).v $(VCS_OPT) +define+$(DEFINE) +incdir+./rtl -o $(ITEM)
@-grep --color -i 'Error' $(SIM_LOG)
clean:
@-rm -rf *.{vcd,vvp}
##### PHONY target #####
.PHONY : clean syn sim yosys synplify vivado ise modelsim iverilog icarus