1 |
2 |
marcelos |
#
|
2 |
|
|
# Copyright (c) 2018, Marcelo Samsoniuk
|
3 |
|
|
# All rights reserved.
|
4 |
|
|
#
|
5 |
|
|
# Redistribution and use in source and binary forms, with or without
|
6 |
|
|
# modification, are permitted provided that the following conditions are met:
|
7 |
|
|
#
|
8 |
|
|
# * Redistributions of source code must retain the above copyright notice, this
|
9 |
|
|
# list of conditions and the following disclaimer.
|
10 |
|
|
#
|
11 |
|
|
# * Redistributions in binary form must reproduce the above copyright notice,
|
12 |
|
|
# this list of conditions and the following disclaimer in the documentation
|
13 |
|
|
# and/or other materials provided with the distribution.
|
14 |
|
|
#
|
15 |
|
|
# * Neither the name of the copyright holder nor the names of its
|
16 |
|
|
# contributors may be used to endorse or promote products derived from
|
17 |
|
|
# this software without specific prior written permission.
|
18 |
|
|
#
|
19 |
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
20 |
|
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
21 |
|
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
22 |
|
|
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
23 |
|
|
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
24 |
|
|
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
25 |
|
|
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
26 |
|
|
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
27 |
|
|
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
28 |
|
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
29 |
|
|
#
|
30 |
|
|
# ===8<--------------------------------------------------------- cut here!
|
31 |
|
|
#
|
32 |
|
|
# The general concept is based in the article:
|
33 |
|
|
#
|
34 |
|
|
# https://www.fpgarelated.com/showarticle/786.php
|
35 |
|
|
#
|
36 |
|
|
# However, since the ISE GUI itself creates a "darksocv.cmd_log" file with
|
37 |
|
|
# all commands executed and the respective options, it is possible change
|
38 |
|
|
# some options in the ISE and check the file in order to understand how
|
39 |
|
|
# enable/disable the different options.
|
40 |
|
|
#
|
41 |
|
|
|
42 |
|
|
# board Avnet Microboard LX9
|
43 |
|
|
#BOARD = avnet_microboard_lx9
|
44 |
|
|
#DEVICE = xc6slx9-csg324-2
|
45 |
|
|
|
46 |
|
|
# board Xilinx AC701 A200
|
47 |
|
|
#BOARD = xilinx_ac701_a200
|
48 |
|
|
#DEVICE = xc7a200t-fbg676-2
|
49 |
|
|
|
50 |
|
|
# board QMTech SDRAM LX16
|
51 |
|
|
BOARD = qmtech_sdram_lx16
|
52 |
|
|
DEVICE = xc6slx16-ftg256-2
|
53 |
|
|
|
54 |
|
|
ISE = ../boards/$(BOARD)
|
55 |
|
|
RTL = ../rtl
|
56 |
|
|
SRC = ../src
|
57 |
|
|
TMP = ../tmp
|
58 |
|
|
|
59 |
|
|
XST = $(ISE)/darksocv.xst
|
60 |
|
|
SYR = $(TMP)/darksocv.syr
|
61 |
|
|
UCF = $(ISE)/darksocv.ucf
|
62 |
|
|
IMP = $(ISE)/darksocv.imp
|
63 |
|
|
NGC = $(TMP)/darksocv.ngc
|
64 |
|
|
NGD = $(TMP)/darksocv.ngd
|
65 |
|
|
PCF = $(TMP)/darksocv.pcf
|
66 |
|
|
NCD = $(TMP)/darksocv.ncd
|
67 |
|
|
TWX = $(TMP)/darksocv.twx
|
68 |
|
|
TWR = $(TMP)/darksocv.twr
|
69 |
|
|
BIT = $(TMP)/darksocv.bit
|
70 |
|
|
MAP = $(TMP)/darksocv_map.ncd
|
71 |
|
|
UT = $(ISE)/darksocv.ut
|
72 |
|
|
|
73 |
|
|
PRJS = $(ISE)/darksocv.prj
|
74 |
|
|
RTLS = $(RTL)/darksocv.v $(RTL)/darkriscv.v $(RTL)/darkuart.v
|
75 |
|
|
|
76 |
|
|
ifdef HARVARD
|
77 |
|
|
BOOT = $(SRC)/darksocv.rom.mem $(SRC)/darksocv.ram.mem
|
78 |
|
|
else
|
79 |
|
|
BOOT = $(SRC)/darksocv.mem
|
80 |
|
|
endif
|
81 |
|
|
|
82 |
|
|
IMP = $(ISE)/darksocv.imp
|
83 |
|
|
|
84 |
|
|
default: all
|
85 |
|
|
|
86 |
|
|
$(NGC): $(PRJS) $(BOOT) $(RTLS)
|
87 |
|
|
cd $(TMP) && xst -intstyle ise -ifn $(XST) -ofn $(SYR)
|
88 |
|
|
|
89 |
|
|
$(NGD): $(NGC) $(UCF) $(BOOT) $(RTLS)
|
90 |
|
|
cd $(TMP) && ngdbuild -intstyle ise -dd _ngo -nt timestamp -uc $(UCF) -p $(DEVICE) $(NGC) $(NGD)
|
91 |
|
|
|
92 |
|
|
$(PCF): $(NGD) $(BOOT) $(UCF) $(RTLS)
|
93 |
|
|
cd $(TMP) && map -intstyle ise -p $(DEVICE) -w -logic_opt on -ol high -t 1 -xt 0 -register_duplication on -r 4 -global_opt off -mt 2 -detail -ir off -ignore_keep_hierarchy -pr off -lc auto -power off -o $(MAP) $(NGD) $(PCF)
|
94 |
|
|
|
95 |
|
|
$(NCD): $(PCF) $(BOOT) $(UCF) $(RTLS)
|
96 |
|
|
cd $(TMP) && par -w -intstyle ise -ol high -mt 2 $(MAP) $(NCD) $(PCF)
|
97 |
|
|
cd $(TMP) && trce -intstyle ise -v 3 -s 2 -n 3 -fastpaths -xml $(TWX) $(NCD) -o $(TWR) $(PCF)
|
98 |
|
|
|
99 |
|
|
$(BIT): $(UT) $(NCD) $(BOOT) $(UCF) $(RTLS)
|
100 |
|
|
cd $(TMP) && bitgen -intstyle ise -f $(UT) $(NCD)
|
101 |
|
|
|
102 |
|
|
all: $(BIT) $(BOOT) $(UCF) $(RTLS)
|
103 |
|
|
|
104 |
|
|
install: $(BIT) $(BOOT) $(UCF) $(RTLS)
|
105 |
|
|
cd $(TMP) && impact -batch $(IMP)
|
106 |
|
|
|
107 |
|
|
clean:
|
108 |
|
|
-rm -v $(TMP)/*
|