-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
1446 lines (1217 loc) · 57.7 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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
SHELL=/bin/bash
CURRENT_DIR=$(shell pwd)
INFOC=\033[32m
WARNC=\033[33m
ERRC=\033[31m
PJPC=\033[31m
DEFC=\033[0m
SEND=\033[400C\033[11D
-include local.mk
-include .config
-include generated.mk
##### Kconfig processing (.config has always precedence)
PREFIX := CONFIG_
define unquote
$(subst ",,$(1))
endef
$(foreach VAR,$(filter ${PREFIX}%,$(.VARIABLES)), $(eval $(patsubst ${PREFIX}%,%,$(VAR)) := $(call unquote,$($(VAR)))))
##### Kconfig specific vars
ifneq ($(BASM_DEBUG), )
BASM_ARGS+= -d
endif
ifneq ($(BASM_LIB), )
BASM_LIB_FILES=$(BASM_LIB)/*.basm
endif
ifneq ($(UART_SUPPORT), )
BM_ARGS+= -uart
endif
ifneq ($(UART_MAPFILE), )
BM_ARGS+= -uart-mapfile $(UART_MAPFILE)
endif
# Boards
ifeq ($(XILINX_BOARD_BASYS3),y)
BOARD=basys3
endif
ifeq ($(XILINX_BOARD_ZEDBOARD),y)
BOARD=zedboard
endif
ifeq ($(XILINX_BOARD_ZC702),y)
BOARD=zc702
endif
ifeq ($(XILINX_BOARD_KC705),y)
BOARD=kc705
endif
ifeq ($(XILINX_BOARD_EBAZ4205),y)
BOARD=ebaz4205
endif
ifeq ($(LATTICE_BOARD_ICEFUN),y)
BOARD=icefun
endif
ifeq ($(LATTICE_BOARD_ICE40LP1K),y)
BOARD=ice40lp1k
endif
ifeq ($(LATTICE_BOARD_ICEBREAKER),y)
BOARD=icebreaker
endif
ifeq ($(LATTICE_BOARD_ICESUGARNANO),y)
BOARD=icesugarnano
endif
ifeq ($(ALTERA_BOARD_MAX1000),y)
BOARD=max1000
endif
ifeq ($(ALTERA_BOARD_DE10NANO),y)
BOARD=de10nano
endif
##### Cluster or single target selection
ifneq ($(CLUSTER), )
MAINTARGET=cluster
else
ifneq ($(SOURCE_MULTI), )
MAINTARGET=projects
else
MAINTARGET=bondmachine
endif
endif
##### Project name
PROJECT_NAME=$(shell basename `pwd`)
PJP=$(PJPC)"[Project: $(PROJECT_NAME)]"$(DEFC)" - "
##### Toolchain selection
ifndef BOARD
BOARD=none
endif
ifeq ($(shell [[ $(BOARD) == "basys3" || $(BOARD) == "zedboard" || $(BOARD) == "zc702" || $(BOARD) == "kc705" || $(BOARD) == "ebaz4205" || $(BOARD) == "alveou50" || $(BOARD) == "alveou55c" ]] && echo true ),true)
BOARDOK=yes
TOOLCHAIN=vivado
VIVADO_VERSION=$(shell vivado -version | head -n 1 | sed -e 's/.*\([0-9][0-9][0-9][0-9]\.[0-9]\).*/\1/')
PROJECT_TARGET=$(WORKING_DIR)/vivado_creation
SYNTHESIS_TARGET=$(WORKING_DIR)/vivado_synthesis
IMPLEMENTATION_TARGET=$(WORKING_DIR)/vivado_implementation
BITSTREAM_TARGET=$(WORKING_DIR)/vivado_bitstream
PROGRAM_TARGET=$(WORKING_DIR)/vivado_program
ACCELERATOR_TARGET=$(WORKING_DIR)/vivado_accelerator
DESIGN_TARGET=$(WORKING_DIR)/vivado_design_creation
DESIGN_SYNTHESIS_TARGET=$(WORKING_DIR)/vivado_design_synthesis
DESIGN_IMPLEMENTATION_TARGET=$(WORKING_DIR)/vivado_design_implementation
DESIGN_BISTREAM_TARGET=$(WORKING_DIR)/vivado_design_bitstream
EXPORT_HARDWARD_TARGET=$(WORKING_DIR)/vivado_export_hardware
DEVICETREE_TARGET=$(WORKING_DIR)/vivado_devicetree
KERNEL_MODULE_TARGET=$(WORKING_DIR)/vivado_kernel_module
BUILDROOT_TARGET=$(WORKING_DIR)/vivado_buildroot
XCLBIN_TARGET=$(WORKING_DIR)/vivado_xclbin
endif
ifeq ($(shell [[ $(BOARD) == "max1000" || $(BOARD) == "de10nano" ]] && echo true ),true)
BOARDOK=yes
TOOLCHAIN=quartus
PROJECT_TARGET=$(WORKING_DIR)/quartus_creation
SYNTHESIS_TARGET=$(WORKING_DIR)/quartus_synthesis
IMPLEMENTATION_TARGET=$(WORKING_DIR)/quartus_implementation
BITSTREAM_TARGET=$(WORKING_DIR)/quartus_bitstream
PROGRAM_TARGET=$(WORKING_DIR)/quartus_program
endif
ifeq ($(shell [[ $(BOARD) == "ice40lp1k" || $(BOARD) == "icefun" || $(BOARD) == "icebreaker" || $(BOARD) == "icesugarnano" ]] && echo true ),true)
BOARDOK=yes
TOOLCHAIN=icestorm
PROJECT_TARGET=$(WORKING_DIR)/icestorm_creation
SYNTHESIS_TARGET=$(WORKING_DIR)/icestorm_synthesis
IMPLEMENTATION_TARGET=$(WORKING_DIR)/icestorm_implementation
BITSTREAM_TARGET=$(WORKING_DIR)/icestorm_bitstream
PROGRAM_TARGET=$(WORKING_DIR)/icestorm_program
endif
ifeq ($(shell [[ $(BOARD) == "icefun" ]] && echo true ),true)
BOARD_MODEL="hx8k"
BOARD_PACKAGE="cb132"
endif
ifeq ($(shell [[ $(BOARD) == "ice40lp1k" ]] && echo true ),true)
BOARD_MODEL="lp1k"
BOARD_PACKAGE="vq100"
endif
ifeq ($(shell [[ $(BOARD) == "icebreaker" ]] && echo true ),true)
BOARD_MODEL="up5k"
BOARD_PACKAGE="sg48"
endif
##### Source selection
ifneq ($(SOURCE_BASM), )
ifeq ($(MAINTARGET), cluster)
$(error Unsupported)
endif
SOURCE_COMMAND=basm $(BASM_ARGS) $(BMINFO_ARGS) -o $(WORKING_DIR)/bondmachine.json $(BASM_LIB_FILES) $(SOURCE_BASM)
SOURCE=$(SOURCE_BASM)
endif
ifneq ($(SOURCE_MULTIASM), )
ifeq ($(MAINTARGET), cluster)
$(error Unsupported)
endif
SOURCE_COMMAND=bondgo $(BONDGO_ARGS) -input-file $(SOURCE_MULTIASM) -save-bondmachine $(WORKING_DIR)/bondmachine.json -multi-abstract-assembly-input
SOURCE=$(SOURCE_MULTIASM)
endif
ifneq ($(SOURCE_ASM), )
ifeq ($(MAINTARGET), cluster)
$(error Unsupported)
endif
SOURCE_COMMAND=bondgo $(BONDGO_ARGS) -input-file $(SOURCE_ASM) -save-bondmachine $(WORKING_DIR)/bondmachine.json -abstract-assembly-input
SOURCE=$(SOURCE_ASM)
endif
ifneq ($(SOURCE_GO), )
ifneq ($(MAINTARGET), cluster)
SOURCE_COMMAND=bondgo $(BONDGO_ARGS) -input-file $(SOURCE_GO) -save-bondmachine $(WORKING_DIR)/bondmachine.json -mpm
else
SOURCE_COMMAND=bondgo $(BONDGO_ARGS) -input-file $(SOURCE_GO) -mpm $(ETHERBOND_ARGS) $(UDPBOND_ARGS) $(BONDIRECT_ARGS)
endif
SOURCE=$(SOURCE_GO)
endif
ifneq ($(SOURCE_EXPRESSION), )
ifeq ($(MAINTARGET), cluster)
$(error Unsupported)
endif
SOURCE_COMMAND=symbond -expression `cat $(SOURCE_EXPRESSION)` -save-bondmachine $(WORKING_DIR)/bondmachine.json
SOURCE=$(SOURCE_EXPRESSION)
endif
ifneq ($(SOURCE_BOOLEAN), )
ifeq ($(MAINTARGET), cluster)
$(error Unsupported)
endif
SOURCE_COMMAND=boolbond $(BOOL_ARGS) -system-file $(SOURCE_BOOLEAN) -save-bondmachine $(WORKING_DIR)/bondmachine.json
SOURCE=$(SOURCE_BOOLEAN)
endif
ifneq ($(SOURCE_JSON), )
ifeq ($(MAINTARGET), cluster)
$(error Unsupported)
endif
SOURCE_COMMAND=cp $(SOURCE_JSON) $(WORKING_DIR)/bondmachine.json
SOURCE=$(SOURCE_JSON)
endif
ifneq ($(SOURCE_MATRIXWORK), )
ifeq ($(MAINTARGET), cluster)
$(error Unsupported)
endif
SOURCE_COMMAND=matrixwork -constants $(SOURCE_MATRIXWORK) -constant-matrix $(MATRIXWORKMATRIX) -numerical-type $(MATRIXWORKTYPE) -save-bondmachine $(WORKING_DIR)/bondmachine.json
SOURCE=$(SOURCE_MATRIXWORK)
endif
ifneq ($(SOURCE_NEURALBOND), )
ifeq ($(MAINTARGET), cluster)
$(error Unsupported)
endif
SOURCE_COMMAND=neuralbond -net-file $(SOURCE_NEURALBOND) -neuron-lib-path $(NEURALBOND_LIBRARY) -save-basm $(WORKING_DIR)/bondmachine.basm $(NEURALBOND_ARGS) $(BMINFO_ARGS) ; basm $(BASM_ARGS) $(BMINFO_ARGS) -o $(WORKING_DIR)/bondmachine.json $(WORKING_DIR)/bondmachine.basm $(NEURALBOND_LIBRARY)/*.basm
SOURCE=$(SOURCE_NEURALBOND)
endif
ifneq ($(SOURCE_QUANTUM), )
ifeq ($(MAINTARGET), cluster)
$(error Unsupported)
endif
SOURCE_COMMAND=bmqsim -save-basm $(WORKING_DIR)/bondmachine.basm $(QUANTUM_ARGS) $(BMINFO_ARGS) $(SOURCE_QUANTUM) ; basm $(BASM_ARGS) $(BMINFO_ARGS) -o $(WORKING_DIR)/bondmachine.json $(WORKING_DIR)/bondmachine.basm
SOURCE=$(SOURCE_QUANTUM)
endif
ifneq ($(SOURCE_QUANTUMFULL), )
ifeq ($(MAINTARGET), cluster)
$(error Unsupported)
endif
SOURCE_COMMAND=bmqsim -build-full-hw-hardcoded -save-bondmachine $(WORKING_DIR)/bondmachine.json $(QUANTUM_ARGS) $(SOURCE_QUANTUMFULL)
SOURCE=$(SOURCE_QUANTUMFULL)
endif
ifneq ($(SOURCE_BMBUILDER), )
ifeq ($(MAINTARGET), cluster)
$(error Unsupported)
endif
SOURCE_COMMAND=bmbuilder -save-bondmachine $(WORKING_DIR)/bondmachine.json $(BMBUILDER_ARGS) $(SOURCE_BMBUILDER)
SOURCE=$(SOURCE_BMBUILDER)
endif
ifneq ($(SOURCE_BMGRAPH), )
ifeq ($(MAINTARGET), cluster)
$(error Unsupported)
endif
SOURCE_COMMAND=bmgraph -graph-file $(SOURCE_BMGRAPH) -neuron-lib-path $(BMGRAPH_LIBRARY) -save-basm $(WORKING_DIR)/bondmachine.basm $(BMGRAPH_ARGS) $(BMINFO_ARGS) ; basm $(BASM_ARGS) $(BMINFO_ARGS) -o $(WORKING_DIR)/bondmachine.json $(WORKING_DIR)/bondmachine.basm $(BMGRAPH_LIBRARY)/*.basm
SOURCE=$(SOURCE_BMGRAPH)
endif
ifneq ($(SOURCE_MELBOND), )
ifeq ($(MAINTARGET), cluster)
$(error Unsupported)
endif
SOURCE_COMMAND=melbond -neuron-lib-path $(MELBOND_LIBRARY) -save-basm $(WORKING_DIR)/bondmachine.basm $(MELBOND_ARGS) $(BMINFO_ARGS) $(SOURCE_MELBOND); basm $(BASM_ARGS) $(BMINFO_ARGS) -o $(WORKING_DIR)/bondmachine.json $(WORKING_DIR)/bondmachine.basm $(MELBOND_LIBRARY)/*.basm
SOURCE=$(SOURCE_MELBOND)
endif
##### Arguments processing
ifneq ($(BOARD_SLOW), )
SLOW_ARGS=-board-slow -board-slow-factor $(BOARD_SLOW_FACTOR)
else
SLOW_ARGS=
endif
ifneq ($(BENCHCORE), )
BENCHCORE_ARGS=-attach-benchmark-core $(BENCHCORE)
else
BENCHCORE_ARGS=
endif
ifneq ($(SHOWARGS), )
SHOW_ARGS=$(SHOWARGS)
else
SHOW_ARGS=
endif
ifneq ($(SHOWRENDERER), )
SHOW_RENDERER=$(SHOWRENDERER)
else
SHOW_RENDERER=dot -Txlib
endif
ifneq ($(BOOLEANARGS), )
BOOL_ARGS=$(BOOLEANARGS)
else
BOOL_ARGS=
endif
ifneq ($(ETHERBOND_MACFILE), )
ETHERBOND_MACFILE_ARGS=-etherbond-macfile $(ETHERBOND_MACFILE)
else
ETHERBOND_MACFILE_ARGS=
endif
ifneq ($(ETHERBOND_EXTERNAL), )
ETHERBOND_EXTERNAL_ARGS=-etherbond-external $(ETHERBOND_EXTERNAL)
else
ETHERBOND_EXTERNAL_ARGS=
endif
ifneq ($(USE_ETHERBOND), )
ifeq ($(MAINTARGET), cluster)
ETHERBOND_ARGS=-use-etherbond
else
ETHERBOND_ARGS=-use-etherbond $(ETHERBOND_EXTERNAL_ARGS) -cluster-spec $(CLUSTER_SPEC) -peer-id $(PEER_ID) -etherbond-mapfile $(ETHERBOND_MAPFILE) $(ETHERBOND_MACFILE_ARGS)
endif
else
ETHERBOND_ARGS=
endif
ifneq ($(UDPBOND_IPFILE), )
UDPBOND_IPFILE_ARGS=-udpbond-ipfile $(UDPBOND_IPFILE)
else
UDPBOND_IPFILE_ARGS=
endif
ifneq ($(UDPBOND_NETCONFIG), )
UDPBOND_NETCONFIG_ARGS=-udpbond-netconfig $(UDPBOND_NETCONFIG)
else
UDPBOND_NETCONFIG_ARGS=
endif
ifneq ($(UDPBOND_EXTERNAL), )
UDPBOND_EXTERNAL_ARGS=-udpbond-external $(UDPBOND_EXTERNAL)
else
UDPBOND_EXTERNAL_ARGS=
endif
ifneq ($(USE_UDPBOND), )
UDPBOND_ARGS=-use-udpbond $(UDPBOND_EXTERNAL_ARGS) -cluster-spec $(CLUSTER_SPEC) -peer-id $(PEER_ID) -udpbond-mapfile $(UDPBOND_MAPFILE) $(UDPBOND_IPFILE_ARGS) $(UDPBOND_NETCONFIG_ARGS)
else
UDPBOND_ARGS=
endif
## BMAPI SUB ARGS PROCESSING
ifneq ($(BMAPI_DATATYPE), )
BMAPI_DATATYPE_ARGS=-bmapi-data-type "$(BMAPI_DATATYPE)"
else
ifneq ($(DATATYPE), )
BMAPI_DATATYPE_ARGS=-bmapi-data-type "$(DATATYPE)"
else
BMAPI_DATATYPE_ARGS=
endif
endif
ifneq ($(BMAPI_LANGUAGE), )
BMAPI_LANGUAGE_ARGS=-bmapi-language $(BMAPI_LANGUAGE)
else
BMAPI_LANGUAGE_ARGS=
endif
ifneq ($(BMAPI_FRAMEWORK), )
BMAPI_FRAMEWORK_ARGS=-bmapi-framework $(BMAPI_FRAMEWORK)
else
BMAPI_FRAMEWORK_ARGS=
endif
ifneq ($(USE_BMAPI), )
ifeq ($(BMAPI_FLAVOR),aximm)
BMAPI_ARGS=-use-bmapi -bmapi-flavor $(BMAPI_FLAVOR) $(BMAPI_LANGUAGE_ARGS) -bmapi-mapfile $(BMAPI_MAPFILE) -bmapi-liboutdir $(BMAPI_LIBOUTDIR) $(BMAPI_FRAMEWORK_ARGS) -bmapi-modoutdir $(BMAPI_MODOUTDIR) -bmapi-auxoutdir $(BMAPI_AUXOUTDIR) -bmapi-generate-example $(BMAPI_GENERATE_EXAMPLE) $(BMAPI_DATATYPE_ARGS)
endif
ifeq ($(BMAPI_FLAVOR),axist)
ifeq ($(BOARD),alveou50)
BMAPI_ARGS=-use-bmapi -bmapi-flavor $(BMAPI_FLAVOR) $(BMAPI_LANGUAGE_ARGS) -bmapi-mapfile $(BMAPI_MAPFILE) -bmapi-liboutdir $(BMAPI_LIBOUTDIR) $(BMAPI_FRAMEWORK_ARGS) -bmapi-flavor-version $(BMAPI_FLAVOR_VERSION) -bmapi-modoutdir $(BMAPI_MODOUTDIR) -bmapi-generate-example $(BMAPI_GENERATE_EXAMPLE) $(BMAPI_DATATYPE_ARGS)
else
ifeq ($(BOARD),alveou55c)
BMAPI_ARGS=-use-bmapi -bmapi-flavor $(BMAPI_FLAVOR) $(BMAPI_LANGUAGE_ARGS) -bmapi-mapfile $(BMAPI_MAPFILE) -bmapi-liboutdir $(BMAPI_LIBOUTDIR) $(BMAPI_FRAMEWORK_ARGS) -bmapi-flavor-version $(BMAPI_FLAVOR_VERSION) -bmapi-modoutdir $(BMAPI_MODOUTDIR) -bmapi-generate-example $(BMAPI_GENERATE_EXAMPLE) $(BMAPI_DATATYPE_ARGS)
else
BMAPI_ARGS=-use-bmapi -bmapi-flavor $(BMAPI_FLAVOR) $(BMAPI_LANGUAGE_ARGS) -bmapi-mapfile $(BMAPI_MAPFILE) -bmapi-liboutdir $(BMAPI_LIBOUTDIR) $(BMAPI_FRAMEWORK_ARGS) -bmapi-flavor-version $(BMAPI_FLAVOR_VERSION) -bmapi-generate-example $(BMAPI_GENERATE_EXAMPLE) $(BMAPI_DATATYPE_ARGS)
endif
endif
endif
ifeq ($(BMAPI_FLAVOR),uartusb)
BMAPI_ARGS=-use-bmapi -bmapi-flavor $(BMAPI_FLAVOR) $(BMAPI_LANGUAGE_ARGS) -bmapi-mapfile $(BMAPI_MAPFILE) -bmapi-liboutdir $(BMAPI_LIBOUTDIR) $(BMAPI_FRAMEWORK_ARGS) $(BMAPI_DATATYPE_ARGS)
endif
else
BMAPI_ARGS=
endif
ifneq ($(BASYS3_7SEG), )
BASYS3_7SEG_ARGS=-basys3-7segment -basys3-7segment-map $(BASYS3_7SEG_MAP)
else
BASYS3_7SEG_ARGS=
endif
ifneq ($(IB_LEDS), )
IB_LEDS_ARGS=-icebreaker-leds -icebreaker-leds-map $(IB_LEDS_MAP)
else
IB_LEDS_ARGS=
endif
ifneq ($(IF_LEDS), )
IF_LEDS_ARGS=-icefun-leds -icefun-leds-map $(IF_LEDS_MAP)
else
IF_LEDS_ARGS=
endif
ifneq ($(I4_LEDS), )
I4_LEDS_ARGS=-ice40lp1k-leds -ice40lp1k-leds-map $(I4_LEDS_MAP)
else
I4_LEDS_ARGS=
endif
ifneq ($(PS2IOKBD), )
PS2IOKBD_ARGS=-ps2-keyboard-io -ps2-keyboard-io-map $(PS2IOKBD_MAP)
else
PS2IOKBD_ARGS=
endif
ifneq ($(VGATEXT), )
VGATEXT_ARGS=-vgatext -vgatext-flavor $(VGATEXT_FLAVOR) -vgatext-fonts $(VGATEXT_FONTS) -vgatext-header $(VGATEXT_HEADER)
else
VGATEXT_ARGS=
endif
ifneq ($(EXTRA_INCLUDES), )
EXTRA_INCLUDES_ARGS=$(EXTRA_INCLUDES)
else
EXTRA_INCLUDES_ARGS=
endif
ifneq ($(UDPBOND_IPFILE), )
UDPBOND_IPFILE_ARGS=
else
UDPBOND_IPFILE_ARGS=
endif
ifneq ($(UDPBOND_NETCONFIG), )
UDPBOND_NETCONFIG_ARGS=
else
UDPBOND_NETCONFIG_ARGS=
endif
ifneq ($(USE_UDPBOND), )
UDPBOND_ARGS=-use-udpbond $(UDPBOND_NETCONFIG_ARGS) $(UDPBOND_IPFILE_ARGS)
else
UDPBOND_ARGS=
endif
ifneq ($(USE_BONDIRECT), )
BONDIRECT_ARGS=-use-bondirect
else
BONDIRECT_ARGS=
endif
##### Rootdir
ifeq ($(ROOTDIR), )
ROOTDIR=..
endif
ifneq ($(HDL_REGRESSION), )
HDL_REGRESSION_TARGETS=$(WORKING_DIR)/hdl_target
else
HDL_REGRESSION_TARGETS=
endif
ifneq ($(BM_REGRESSION), )
BM_REGRESSION_TARGETS=$(WORKING_DIR)/hdl_target
else
BM_REGRESSION_TARGETS=
endif
ifneq ($(SIM_REGRESSION), )
SIM_REGRESSION_TARGETS=simulate
else
SIM_REGRESSION_TARGETS=
endif
ifneq ($(DATATYPE), )
SIMBATCH_DATATYPE=--data-type "$(DATATYPE)"
else
SIMBATCH_DATATYPE=
endif
ifneq ($(BMINFO), )
BMINFO_ARGS=-bminfo-file $(BMINFO)
else
BMINFO_ARGS=
endif
ifneq ($(BMREQS), )
BMREQS_ARGS=-bmrequirements-file $(BMREQS)
else
BMREQS_ARGS=
endif
ifneq ($(HWOPTIMIZATIONS), )
BMOPT_ARGS=-hw-optimizations $(HWOPTIMIZATIONS)
else
BMOPT_ARGS=
endif
##### Placeholders targets
all: ${MAINTARGET}
bondmachine: $(WORKING_DIR)/bondmachine_target | $(WORKING_DIR) checkenv
hdl: $(WORKING_DIR)/hdl_target | $(WORKING_DIR) checkenv
project: $(PROJECT_TARGET) | $(WORKING_DIR) checkenv
synthesis: $(SYNTHESIS_TARGET) | $(WORKING_DIR) checkenv
implementation: $(IMPLEMENTATION_TARGET) | $(WORKING_DIR) checkenv
bitstream: $(BITSTREAM_TARGET) | $(WORKING_DIR) checkenv
design: $(DESIGN_TARGET) | $(WORKING_DIR) checkenv
accelerator: $(ACCELERATOR_TARGET) | $(WORKING_DIR) checkenv
design_synthesis: $(DESIGN_SYNTHESIS_TARGET) | $(WORKING_DIR) checkenv
design_implementation: $(DESIGN_IMPLEMENTATION_TARGET) | $(WORKING_DIR) checkenv
design_bitstream: $(DESIGN_BISTREAM_TARGET) | $(WORKING_DIR) checkenv
export_hardware: $(EXPORT_HARDWARD_TARGET) | $(WORKING_DIR) checkenv
devicetree: $(DEVICETREE_TARGET) | $(WORKING_DIR) checkenv
kernel_module: $(KERNEL_MODULE_TARGET) | $(WORKING_DIR) checkenv
buildroot: $(BUILDROOT_TARGET) | $(WORKING_DIR) checkenv
bmapp: $(WORKING_DIR)/bmapp_target | $(WORKING_DIR) checkenv
xclbin: $(XCLBIN_TARGET) | $(WORKING_DIR) checkenv
hdl_simulation: $(WORKING_DIR)/hdl_simulation_target | $(WORKING_DIR) checkenv
.PHONY: program
program: $(PROGRAM_TARGET) | $(WORKING_DIR) checkenv
##### Kconfig based confifuration
.PHONY: menuconfig
menuconfig:
ifneq (, $(shell which menuconfig 2> /dev/null))
@menuconfig
else
ifneq (, $(shell which kconfig-mconf 2> /dev/null))
@kconfig-mconf Kconfig
else
$(error "No Kconfig tool in $(PATH)")
endif
endif
##### Toolchain independent targets
.PHONY: apply
apply:
@bmhelper apply
.PHONY: validate
validate:
@bmhelper validate
name:
@echo $(PROJECT_NAME)
$(WORKING_DIR):
@echo -e "$(PJP)$(INFOC)[Working directory creation begin]$(DEFC) - $(WARNC)[Target: $@] $(DEFC)"
mkdir -p $(WORKING_DIR)
@echo -e "$(PJP)$(INFOC)[Working directory creation end]$(DEFC)"
@echo
$(WORKING_DIR)/bondmachine_target: $(SOURCE) | $(WORKING_DIR) checkenv
@echo -e "$(PJP)$(INFOC)[BondMachine generation begin]$(DEFC) - $(WARNC)[Target: $@] $(DEFC)"
$(SOURCE_COMMAND)
@touch $(WORKING_DIR)/bondmachine_target
@echo -e "$(PJP)$(INFOC)[BondMachine generation end]$(DEFC)"
@echo
$(WORKING_DIR)/hdl_target: $(WORKING_DIR)/bondmachine_target | $(WORKING_DIR) checkenv
@echo -e "$(PJP)$(INFOC)[HDL generation begin]$(DEFC) - $(WARNC)[Target: $@] $(DEFC)"
bondmachine -bondmachine-file $(WORKING_DIR)/bondmachine.json -create-verilog -verilog-mapfile $(MAPFILE) -verilog-flavor $(BOARD) $(BM_ARGS) $(BENCHCORE_ARGS) $(SLOW_ARGS) $(BASYS3_7SEG_ARGS) $(IB_LEDS_ARGS) $(IF_LEDS_ARGS) $(I4_LEDS_ARGS) $(PS2IOKBD_ARGS) $(VGATEXT_ARGS) $(ETHERBOND_ARGS) $(UDPBOND_ARGS) $(BMAPI_ARGS) $(VERILOG_OPTIONS) $(BMINFO_ARGS) $(BMREQS_ARGS) $(BMOPT_ARGS) $(BMRANGES)
echo > $(WORKING_DIR)/bondmachine.sv
for i in `ls *.v | sort -d` ; do cat $$i >> $(WORKING_DIR)/bondmachine.sv ; done
rm -f *.v
echo > $(WORKING_DIR)/bondmachine.vhd
for i in `ls *.vhd | sort -d` ; do cat $$i >> $(WORKING_DIR)/bondmachine.vhd ; done
rm -f *.vhd
@touch $(WORKING_DIR)/hdl_target
@echo -e "$(PJP)$(INFOC)[HDL generation end]$(DEFC)"
@echo
$(WORKING_DIR)/bmapp_target: $(WORKING_DIR)/bondmachine_target | $(WORKING_DIR) checkenv
@echo -e "$(PJP)$(INFOC)[BondMachine App compiling begin]$(DEFC) - $(WARNC)[Target: $@] $(DEFC)"
rm -rf $(WORKING_DIR)/app
mkdir -p $(WORKING_DIR)/app
cp $(BMAPI_APP) $(WORKING_DIR)/app
cd $(WORKING_DIR)/app ; go mod init $(BMAPI_GOMOD) ; go mod edit -replace git.fisica.unipg.it/bondmachine/bmapiusbuart.git=../bmapi ; go mod tidy
cd $(WORKING_DIR)/app ; go build
@touch $(WORKING_DIR)/bmapp_target
@echo -e "$(PJP)$(INFOC)[BondMachine App compiling end]$(DEFC)"
@echo
bmapprun: $(WORKING_DIR)/bmapp_target program | $(WORKING_DIR) checkenv
@echo -e "$(PJP)$(INFOC)[BondMachine run App begin]$(DEFC) - $(WARNC)[Target: $@] $(DEFC)"
cd $(WORKING_DIR)/app ; go run $(BMAPI_APP)
@echo -e "$(PJP)$(INFOC)[BondMachine run App end]$(DEFC)"
@echo
.PHONY: deploy
deploy: $(WORKING_DIR)/vivado_design_bitstream | $(WORKING_DIR) checkenv
@echo -e "$(PJP)$(INFOC)[BondMachine deploy begin]$(DEFC) - $(WARNC)[Target: $@] $(DEFC)"
ifeq ($(DEPLOY_TYPE),ssh)
ifndef DEPLOY_USER
$(error DEPLOY_USER is not set)
endif
ifndef DEPLOY_GROUP
$(error DEPLOY_GROUP is not set)
endif
ifndef DEPLOY_HOST
$(error DEPLOY_HOST is not set)
endif
ifndef DEPLOY_PATH
$(error DEPLOY_PATH is not set)
endif
@echo -e "$(PJP)$(INFOC)[BondMachine deploy via ssh]$(DEFC)"
ifeq ($(DEPLOY_OVERRIDE),true)
ssh $(SSH_ARGS) $(DEPLOY_USER)@$(DEPLOY_HOST) "if [ -d $(DEPLOY_PATH) ]; then rm -rf $(DEPLOY_PATH); fi"
else
ssh $(SSH_ARGS) $(DEPLOY_USER)@$(DEPLOY_HOST) "if [ -d $(DEPLOY_PATH) ]; then ; exit 1; fi"
endif
ifneq ($(DEPLOY_CLONE),)
ssh $(SSH_ARGS) $(DEPLOY_USER)@$(DEPLOY_HOST) "if [ -d $(DEPLOY_CLONE) ]; then cp -a $(DEPLOY_CLONE) $(DEPLOY_PATH); fi"
else
ssh $(SSH_ARGS) $(DEPLOY_USER)@$(DEPLOY_HOST) "if [ ! -d $(DEPLOY_PATH) ]; then mkdir -p $(DEPLOY_PATH); fi"
endif
scp $(SSH_ARGS) $(WORKING_DIR)/bmaccelerator/bmaccelerator.runs/impl_1/bm_design_wrapper.bit $(DEPLOY_USER)@$(DEPLOY_HOST):$(DEPLOY_PATH)/firmware.bit
scp $(SSH_ARGS) $$(find | grep hwh) $(DEPLOY_USER)@$(DEPLOY_HOST):$(DEPLOY_PATH)/firmware.hwh
ifneq ($(DEPLOY_APP),)
scp $(SSH_ARGS) $(DEPLOY_APP) $(DEPLOY_USER)@$(DEPLOY_HOST):$(DEPLOY_PATH)/
endif
endif
@echo -e "$(PJP)$(INFOC)[BondMachine deploy end]$(DEFC)"
@echo
.PHONY: deploy_xclbin
deploy_xclbin: $(WORKING_DIR)/vivado_xclbin | $(WORKING_DIR) checkenv
@echo -e "$(PJP)$(INFOC)[BondMachine deploy xclbin begin]$(DEFC) - $(WARNC)[Target: $@] $(DEFC)"
ifeq ($(DEPLOY_TYPE),local)
@echo -e "$(PJP)$(INFOC)[BondMachine deploy local]$(DEFC)"
ifeq ($(DEPLOY_OVERRIDE),true)
if [ -d $(DEPLOY_PATH) ]; then rm -rf $(DEPLOY_PATH); fi
else
if [ -d $(DEPLOY_PATH) ]; then exit 1; fi
endif
ifneq ($(DEPLOY_CLONE),)
if [ -d $(DEPLOY_CLONE) ]; then cp -a $(DEPLOY_CLONE) $(DEPLOY_PATH); fi
else
if [ ! -d $(DEPLOY_PATH) ]; then mkdir -p $(DEPLOY_PATH); fi
endif
ifeq ($(DEPLOY_BITTYPE),xclbin)
cp $(WORKING_DIR)/rtl_bondmachine/build_dir.hw.$(PLATFORM)/bondmachine.xclbin $(DEPLOY_PATH)/firmware.xclbin
else
cp $(WORKING_DIR)/bmaccelerator/bmaccelerator.runs/impl_1/bm_design_wrapper.bit $(DEPLOY_PATH)/firmware.bit
cp $$(find | grep hwh) $(DEPLOY_PATH)/firmware.hwh
endif
endif
ifneq ($(DEPLOY_APP),)
cp $(DEPLOY_APP) $(DEPLOY_PATH)/
endif
@echo -e "$(PJP)$(INFOC)[BondMachine deploy xclbin end]$(DEFC)"
@echo
.PHONY: deployrun
deployrun: deploy | $(WORKING_DIR) checkenv
@echo -e "$(PJP)$(INFOC)[BondMachine deployrun begin]$(DEFC) - $(WARNC)[Target: $@] $(DEFC)"
ifeq ($(DEPLOY_TYPE),ssh)
ifneq ($(DEPLOY_APP),)
ifneq ($(DEPLOY_RUN_COMMAND),)
ssh $(SSH_ARGS) $(DEPLOY_USER)@$(DEPLOY_HOST) "cd $(DEPLOY_PATH) ; $(DEPLOY_RUN_COMMAND)"
endif
endif
endif
@echo -e "$(PJP)$(INFOC)[BondMachine deployrun end]$(DEFC)"
@echo
.PHONY: deploycollect
deploycollect: deployrun | $(WORKING_DIR) checkenv
@echo -e "$(PJP)$(INFOC)[BondMachine deploycollect begin]$(DEFC) - $(WARNC)[Target: $@] $(DEFC)"
ifeq ($(DEPLOY_TYPE),ssh)
ifneq ($(DEPLOY_COLLECT),)
@bash -c 'for i in $(DEPLOY_COLLECT) ; do scp $(SSH_ARGS) $(DEPLOY_USER)@$(DEPLOY_HOST):$(DEPLOY_PATH)/$$i $(WORKING_DIR)/$$i ; done'
endif
endif
@echo -e "$(PJP)$(INFOC)[BondMachine deploycollect end]$(DEFC)"
@echo
.PHONY: dumpcollect
dumpcollect:
ifneq ($(DEPLOY_COLLECT),)
@bash -c 'for i in $(DEPLOY_COLLECT) ; do echo $$i ; done'
endif
show: $(WORKING_DIR)/bondmachine_target | $(WORKING_DIR) checkenv
@echo -e "$(PJP)$(INFOC)[BondMachine diagram show begin]$(DEFC) - $(WARNC)[Target: $@] $(DEFC)"
bondmachine -bondmachine-file $(WORKING_DIR)/bondmachine.json -emit-dot $(SHOW_ARGS) $(BMINFO_ARGS) | $(SHOW_RENDERER)
@echo -e "$(PJP)$(INFOC)[BondMachine diagram show end]$(DEFC)"
@echo
specs: $(WORKING_DIR)/bondmachine_target | $(WORKING_DIR) checkenv
@echo -e "$(PJP)$(INFOC)[BondMachine specs begin]$(DEFC) - $(WARNC)[Target: $@] $(DEFC)"
@bondmachine -bondmachine-file $(WORKING_DIR)/bondmachine.json -specs
@echo -e "$(PJP)$(INFOC)[BondMachine specs end]$(DEFC)"
@echo
report: $(WORKING_DIR)/vivado_design_implementation | $(WORKING_DIR) checkenv
@echo -e "$(PJP)$(INFOC)[BondMachine report begin]$(DEFC) - $(WARNC)[Target: $@] $(DEFC)"
@echo -e "{" > $(WORKING_DIR)/report.json
@echo -e '\t"cps": '`bondmachine -bondmachine-file $(WORKING_DIR)/bondmachine.json $(BMRANGES) -enum-processors`',' >> $(WORKING_DIR)/report.json
@echo -e '\t"bonds": '`bondmachine -bondmachine-file $(WORKING_DIR)/bondmachine.json $(BMRANGES) -enum-bonds`',' >> $(WORKING_DIR)/report.json
@echo -e '\t"luts": '`grep -F -e LUTs $(WORKING_DIR)/bmaccelerator/bmaccelerator.runs/impl_1/bm_design_wrapper_utilization_placed.rpt | cut -d '|' -f 3 | sed 's/ //g'`',' >> $(WORKING_DIR)/report.json
@echo -e '\t"regs": '`grep -F -e 'Slice Registers' $(WORKING_DIR)/bmaccelerator/bmaccelerator.runs/impl_1/bm_design_wrapper_utilization_placed.rpt | cut -d '|' -f 3 | sed 's/ //g' | head -n 1`',' >> $(WORKING_DIR)/report.json
@echo -e '\t"power": '`grep -F -e 'bondmachineip_0' $(WORKING_DIR)/bmaccelerator/bmaccelerator.runs/impl_1/bm_design_wrapper_power_routed.rpt | cut -d "|" -f 3 | sed 's/ //g'| head -n 1`',' >> $(WORKING_DIR)/report.json
ifeq ($(BOARD),zedboard)
@echo -e '\t"clock_freq": 100,' >> $(WORKING_DIR)/report.json
endif
ifeq ($(BOARD),ebaz4205)
@echo -e '\t"clock_freq": 50,' >> $(WORKING_DIR)/report.json
endif
ifneq ($(SOURCE_NEURALBOND),)
@cat neuralbondconfig.json | jq --tab .Params | head -n -1 | tail -n +2 >> $(WORKING_DIR)/report.json
endif
@echo -e "}" >> $(WORKING_DIR)/report.json
@echo -e "$(PJP)$(INFOC)[BondMachine report end]$(DEFC)"
@echo
simulate: $(WORKING_DIR)/bondmachine_target | $(WORKING_DIR) checkenv
ifndef SIMBOX_FILE
$(error SIMBOX_FILE is undefined)
endif
ifndef SIM_INTERACTIONS
$(error SIM_INTERACTIONS is undefined)
endif
@echo -e "$(PJP)$(INFOC)[BondMachine simulation begin]$(DEFC) - $(WARNC)[Target: $@] $(DEFC)"
cp $(SIMBOX_FILE) $(WORKING_DIR)
bondmachine -bondmachine-file $(WORKING_DIR)/bondmachine.json -sim -simbox-file $(WORKING_DIR)/$(SIMBOX_FILE) -sim-interactions $(SIM_INTERACTIONS) $(SIM_OPTIONS) $(BMRANGES) | tee $(WORKING_DIR)/simulate.out
ifdef SIMREPORT_CLEANUP
bmnumbers -omit-prefix $(BMRANGES) -use-files $(SIM_REPORT)
mv $(SIM_REPORT).out $(SIM_REPORT)
endif
@echo -e "$(PJP)$(INFOC)[BondMachine simulation end]$(DEFC)"
@echo
simbatch: $(WORKING_DIR)/bondmachine_target | $(WORKING_DIR) checkenv
ifndef SIMBATCH_INPUT_DATASET
$(error SIMBATCH_INPUT_DATASET is undefined)
endif
ifndef SIMBATCH_OUTPUT_DATASET
$(error SIMBATCH_OUTPUT_DATASET is undefined)
endif
ifndef SIMBATCH_ITERACTIONS
$(error SIMBATCH_ITERACTIONS is undefined)
endif
@echo -e "$(PJP)$(INFOC)[BondMachine simbatch begin]$(DEFC) - $(WARNC)[Target: $@] $(DEFC)"
./simbatch.py -w $(WORKING_DIR) -i $(SIMBATCH_INPUT_DATASET) -o $(SIMBATCH_OUTPUT_DATASET) -s $(SIMBATCH_ITERACTIONS) $(SIMBATCH_ARGS) $(BMRANGES) $(SIMBATCH_DATATYPE)
@echo -e "$(PJP)$(INFOC)[BondMachine simbatch end]$(DEFC)"
@echo
simvideo: simulate
@echo -e "$(PJP)$(INFOC)[Simulation video creation begin]$(DEFC) - $(WARNC)[Target: $@] $(DEFC)"
rm -f graphviz.mp4
./Makevideo
mplayer -fs graphviz.mp4
@echo -e "$(PJP)$(INFOC)[Simulation video creation end]$(DEFC)"
@echo
emulate: $(WORKING_DIR)/bondmachine_target | $(WORKING_DIR) checkenv
@echo -e "$(PJP)$(INFOC)[BondMachine emulation begin]$(DEFC) - $(WARNC)[Target: $@] $(DEFC)"
$(EMU_PREREQUISITES) &
@sleep 1
bondmachine -bondmachine-file $(WORKING_DIR)/bondmachine.json -emu $(EMU_OPTIONS)
@echo -e "$(PJP)$(INFOC)[BondMachine emmulation end]$(DEFC)"
@echo
.PHONY: regressionhdl
regressionhdl: $(HDL_REGRESSION_TARGETS) | silent
ifneq ($(HDL_REGRESSION_TARGETS), )
@echo -e "$(PJP)$(INFOC)[HDL Regression begin]$(DEFC) - $(WARNC)[Target: $@] $(DEFC)"
@for rfile in $(HDL_REGRESSION); do echo -n "$$rfile" ; ( cmp $(WORKING_DIR)/$$rfile $$rfile.reg > /dev/null 2>&1 && echo -e "$(INFOC)$(SEND)[ Passed ]$(DEFC)" ) || (echo -e "$(ERRC)$(SEND)[ Failed ]$(DEFC)" ; exit 1) ; done
@echo -e "$(PJP)$(INFOC)[HDL Regression end]$(DEFC)"
@echo
endif
.PHONY: regressionbm
regressionbm: $(BM_REGRESSION_TARGETS) | silent
ifneq ($(BM_REGRESSION_TARGETS), )
@echo -e "$(PJP)$(INFOC)[BondMachine Regression begin]$(DEFC) - $(WARNC)[Target: $@] $(DEFC)"
@for rfile in $(BM_REGRESSION); do echo -n "$$rfile" ; ( cmp $(WORKING_DIR)/$$rfile $$rfile.reg > /dev/null 2>&1 && echo -e "$(INFOC)$(SEND)[ Passed ]$(DEFC)" ) || (echo -ne "$(ERRC)$(SEND)[ Failed ]$(DEFC)" ; exit 1) ; done
@echo -e "$(PJP)$(INFOC)[BondMachine Regression end]$(DEFC)"
@echo
endif
.PHONY: regressionsim
regressionsim: $(SIM_REGRESSION_TARGETS) | silent
ifneq ($(SIM_REGRESSION_TARGETS), )
@echo -e "$(PJP)$(INFOC)[Simulation Regression begin]$(DEFC) - $(WARNC)[Target: $@] $(DEFC)"
@for rfile in $(SIM_REGRESSION); do echo -n "$$rfile" ; ( cmp $(WORKING_DIR)/$$rfile $$rfile.reg > /dev/null 2>&1 && echo -e "$(INFOC)$(SEND)[ Passed ]$(DEFC)" ) || (echo -ne "$(ERRC)$(SEND)[ Failed ]$(DEFC)" ; exit 1) ; done
@echo -e "$(PJP)$(INFOC)[Simulation Regression end]$(DEFC)"
@echo
endif
.PHONY: regression
regression: regressionbm regressionhdl regressionsim
.PHONY: regressionhdldiff
regressionhdldiff: $(HDL_REGRESSION_TARGETS)
ifneq ($(HDL_REGRESSION_TARGETS), )
@echo -e "$(PJP)$(INFOC)[HDL Regression begin]$(DEFC) - $(WARNC)[Target: $@] $(DEFC)"
@for rfile in $(HDL_REGRESSION); do ( cmp $(WORKING_DIR)/$$rfile $$rfile.reg > /dev/null 2>&1 && echo -ne "$(INFOC)$(SEND)[ Passed ]$(DEFC)" ) || ( vimdiff $(WORKING_DIR)/$$rfile $$rfile.reg ) ; done
@echo -e "$(PJP)$(INFOC)[HDL Regression end]$(DEFC)"
@echo
endif
.PHONY: regressionbmdiff
regressionbmdiff: $(BM_REGRESSION_TARGETS)
ifneq ($(BM_REGRESSION_TARGETS), )
@echo -e "$(PJP)$(INFOC)[BondMachine Regression begin]$(DEFC) - $(WARNC)[Target: $@] $(DEFC)"
@for rfile in $(BM_REGRESSION); do ( cmp $(WORKING_DIR)/$$rfile $$rfile.reg > /dev/null 2>&1 && echo -ne "$(INFOC)$(SEND)[ Passed ]$(DEFC)" ) || ( vimdiff $(WORKING_DIR)/$$rfile $$rfile.reg ) ; done
@echo -e "$(PJP)$(INFOC)[BondMachine Regression end]$(DEFC)"
@echo
endif
.PHONY: regressionsimdiff
regressionsimdiff: $(SIM_REGRESSION_TARGETS)
ifneq ($(SIM_REGRESSION_TARGETS), )
@echo -e "$(PJP)$(INFOC)[Simulation Regression begin]$(DEFC) - $(WARNC)[Target: $@] $(DEFC)"
@for rfile in $(SIM_REGRESSION); do ( cmp $(WORKING_DIR)/$$rfile $$rfile.reg > /dev/null 2>&1 && echo -ne "$(INFOC)$(SEND)[ Passed ]$(DEFC)" ) || ( vimdiff $(WORKING_DIR)/$$rfile $$rfile.reg ) ; done
@echo -e "$(PJP)$(INFOC)[Simulation Regression end]$(DEFC)"
@echo
endif
.PHONY: regressiondiff
regressiondiff: regressionbmdiff regressionhdldiff regressionsimdiff
.PHONY: regressionhdlreset
regressionhdlreset: $(HDL_REGRESSION_TARGETS)
ifneq ($(HDL_REGRESSION_TARGETS), )
@echo -e "$(PJP)$(INFOC)[HDL Regression reset begin]$(DEFC) - $(WARNC)[Target: $@] $(DEFC)"
@for rfile in $(HDL_REGRESSION); do cp $(WORKING_DIR)/$$rfile $$rfile.reg ; echo "$$rfile Resetted" ; done
@echo -e "$(PJP)$(INFOC)[HDL Regression reset end]$(DEFC)"
@echo
endif
.PHONY: regressionbmreset
regressionbmreset: $(BM_REGRESSION_TARGETS)
ifneq ($(BM_REGRESSION_TARGETS), )
@echo -e "$(PJP)$(INFOC)[BondMachine Regression reset begin]$(DEFC) - $(WARNC)[Target: $@] $(DEFC)"
@for rfile in $(BM_REGRESSION); do cp $(WORKING_DIR)/$$rfile $$rfile.reg ; echo "$$rfile Resetted" ; done
@echo -e "$(PJP)$(INFOC)[BondMachine Regression reset end]$(DEFC)"
@echo
endif
.PHONY: regressionsimreset
regressionsimreset: $(SIM_REGRESSION_TARGETS)
ifneq ($(SIM_REGRESSION_TARGETS), )
@echo -e "$(PJP)$(INFOC)[Simulation Regression reset begin]$(DEFC) - $(WARNC)[Target: $@] $(DEFC)"
@for rfile in $(SIM_REGRESSION); do cp $(WORKING_DIR)/$$rfile $$rfile.reg ; echo "$$rfile Resetted" ; done
@echo -e "$(PJP)$(INFOC)[Simulation Regression reset end]$(DEFC)"
@echo
endif
.PHONY: regressionreset
regressionreset: regressionbmreset regressionhdlreset regressionsimreset
##### Projects analysis
.PHONY: projects
projects:
ifndef SOURCE_MULTI
$(error "undefined SOURCE_MULTI")
endif
ifndef MULTI_TARGET
$(error "undefined MULTI_TARGET")
endif
@echo -e "$(PJP)$(INFOC)[Projects begin]$(DEFC) - $(WARNC)[Target: $@] $(DEFC)"
@bash -c 'for i in `cat $(SOURCE_MULTI)` ; do make --no-print-directory -C $$i $(MULTI_TARGET) || exit 1 ; done'
@echo -e "$(PJP)$(INFOC)[Projects end]$(DEFC)"
.PHONY: projectscollect
projectscollect: projects | $(WORKING_DIR)
ifndef MULTI_TYPE
$(error "undefined MULTI_TYPE")
endif
@echo -e "$(PJP)$(INFOC)[Projects collect begin]$(DEFC) - $(WARNC)[Target: $@] $(DEFC)"
ifeq ($(MULTI_TYPE),ml)
@bash -c 'for i in `cat $(SOURCE_MULTI)` ; do make --no-print-directory -C $$i SHOWRENDERER="dot -Tpng > working_dir/image.png" show ; cp -a $$i/working_dir/image.png working_dir/`basename $$i`_image.png ; done'
@bash -c 'for i in `cat $(SOURCE_MULTI)` ; do make --no-print-directory -C $$i report ; cp -a $$i/working_dir/report.json working_dir/`basename $$i`_report.json ; done'
@bash -c 'for i in `cat $(SOURCE_MULTI)` ; do for j in `make --no-print-directory -C $$i dumpcollect` ; do cp -a $$i/working_dir/$$j working_dir/`basename $$i`_$$j ; done ; done'
@bash -c 'LIST="" ; for i in `cat $(SOURCE_MULTI)` ; do LIST=`basename $$i`,$$LIST ; bmanalysis -analysis-type ml -projects-list $$LIST -ipynb-file working_dir/analysis.ipynb ; done'
endif
ifeq ($(MULTI_TYPE),templsim)
@bash -c 'for i in `cat $(SOURCE_MULTI)` ; do for j in `make --no-print-directory -C $$i dumpcollect` ; do cp -a $$i/working_dir/$$j working_dir/`basename $$i`_$$j ; done ; done'
@bash -c 'LIST="" ; for i in `cat $(SOURCE_MULTI)` ; do LIST=`basename $$i`,$$LIST ; bmanalysis -analysis-type mlsim -projects-list $$LIST -ipynb-file working_dir/analysis.ipynb ; done'
endif
@echo -e "$(PJP)$(INFOC)[Projects collect end]$(DEFC)"
.PHONY: projectsdeploy
projectsdeploy: projectscollect | $(WORKING_DIR)
@echo -e "$(PJP)$(INFOC)[Projects deploy begin]$(DEFC) - $(WARNC)[Target: $@] $(DEFC)"
ifeq ($(DEPLOY_TYPE),local)
ifndef DEPLOY_PATH
$(error "undefined DEPLOY_PATH")
endif
ifeq ($(DEPLOY_OVERRIDE),true)
@rm -rf $(DEPLOY_PATH)
else
@bash -c 'if [ -d $(DEPLOY_PATH) ]; then ; exit 1; fi'
endif
endif
@mkdir -p $(DEPLOY_PATH)
@bash -c 'for i in `ls $(WORKING_DIR)` ; do cp -a $(WORKING_DIR)/$$i $(DEPLOY_PATH) ; done'
@echo -e "$(PJP)$(INFOC)[Projects deploy end]$(DEFC)"
@echo
##### HDL simulation targets
$(WORKING_DIR)/hdl_simulation_target: $(WORKING_DIR)/bondmachine_target | $(WORKING_DIR) checkenv
cp $(SIMBOX_FILE) $(WORKING_DIR)
bondmachine -bondmachine-file $(WORKING_DIR)/bondmachine.json -create-verilog -verilog-mapfile $(MAPFILE) -verilog-flavor iverilog $(BENCHCORE_ARGS) $(VERILOG_OPTIONS) -verilog-simulation -simbox-file $(WORKING_DIR)/$(SIMBOX_FILE) -sim-interactions $(SIM_INTERACTIONS)
echo > $(WORKING_DIR)/bondmachine_simulation.sv
for i in `ls *.v | sort -d` ; do cat $$i >> $(WORKING_DIR)/bondmachine_simulation.sv ; done
rm -f *.v
##### Iverilog gtkwave toolchain
# TODO Convert here to a new toolchain for iverilog
#$(WORKING_DIR)/bondmachine_simulation.sv: $(WORKING_DIR)/bondmachine_target | $(WORKING_DIR) checkenv
# cp $(SIMBOX_FILE) $(WORKING_DIR)
# bondmachine -bondmachine-file $(WORKING_DIR)/bondmachine.json -create-verilog -verilog-mapfile $(MAPFILE) -verilog-flavor iverilog $(BENCHCORE_ARGS) $(VERILOG_OPTIONS) -verilog-simulation -simbox-file $(WORKING_DIR)/$(SIMBOX_FILE) -sim-interactions $(SIM_INTERACTIONS)
# echo > $(WORKING_DIR)/bondmachine_simulation.sv
# for i in `ls *.v | sort -d` ; do cat $$i >> $(WORKING_DIR)/bondmachine_simulation.sv ; done
# rm -f *.v
# TODO Convert here to a new toolchain for iverilog gtkwave
#simverilog: $(WORKING_DIR)/bondmachine_simulation.sv | $(WORKING_DIR) checkenv
# iverilog $(WORKING_DIR)/bondmachine_simulation.sv -o $(WORKING_DIR)/bondmachine_simulation.vvp
# vvp $(WORKING_DIR)/bondmachine_simulation.vvp
#
#simgtkwave: $(WORKING_DIR)/bondmachine_simulation.sv | $(WORKING_DIR) checkenv
# bondmachine -bondmachine-file $(WORKING_DIR)/bondmachine.json -show-program-alias
# mv p*.alias $(WORKING_DIR)
# iverilog $(WORKING_DIR)/bondmachine_simulation.sv -o $(WORKING_DIR)/bondmachine_simulation.vvp
# vvp $(WORKING_DIR)/bondmachine_simulation.vvp
# gtkwave $(WORKING_DIR)/bondmachine.vcd
##### Quartus toolchain targets
$(WORKING_DIR)/$(BOARD).sdc: | $(WORKING_DIR) checkenv
@echo -e "$(PJP)$(INFOC)[Quartus toolchain - copy constraints begin]$(DEFC) - $(WARNC)[Target: $@] $(DEFC)"
cp $(BOARD).sdc $(WORKING_DIR)
@touch $(WORKING_DIR)/constraint_target
@echo -e "$(PJP)$(INFOC)[Quartus toolchain - copy constraints end]$(DEFC)"
@echo
$(WORKING_DIR)/quartus_creation: $(WORKING_DIR)/$(BOARD).sdc $(WORKING_DIR)/hdl_target | $(WORKING_DIR) checkenv
@echo -e "$(PJP)$(INFOC)[Quartus toolchain - project creation begin]$(DEFC) - $(WARNC)[Target: $@] $(DEFC)"
cat $(ROOTDIR)/$(BOARD)_template_creation.tcl >> $(WORKING_DIR)/quartus-script-creation.tcl