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

Subversion Repositories System09

[/] [System09/] [tags/] [LinuxPort/] [mkfiles/] [xilinx_rules.mk] - Blame information for rev 70

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

Line No. Rev Author Line
1 59 davidgb
#-----------------------------------------------------------------
2
# File:    xilinx_rules.mk
3
# Author:  David Burnette
4
# Date:    April 7, 2008
5
#
6
# Description:
7
#
8
# Usage:
9
#  This make file fragment contains translate rules for synthesizing
10
#  Xilinx designs.
11
#
12
# This work was based on the Xilinx Makefile by Dave Vanden Bout
13
# from XESS Corp. Several major differences exist between his
14
# implementation and mine. This Makefile does not require PERL
15
# (though it does require AWK).
16
#
17
# Dependencies:
18
#  Depends on 'def_rules.mk' fragment.
19
#
20
# Revision History:
21
#   dgb 2008-04-07   Original version
22
#
23
#-----------------------------------------------------------------
24
 
25
 
26
include $(MKFRAGS)/def_rules.mk
27
 
28 70 davidgb
# Determine Xilinx ISE location
29
ifeq "$(XILINX)" ""
30
  $(error The XILINX environment variable must be set to use this makefile)
31
endif
32
XILINX_NORMAL := $(subst \,/,$(XILINX))
33
 
34
MY_OS := $(shell uname -s)
35
ifeq "$(findstring CYGWIN_NT,$(MY_OS))" "CYGWIN_NT"
36
  ifeq "$(findstring WOW64,$(MY_OS))" "WOW64"
37
    XILINX_PLAT = nt64
38
  else
39
    XILINX_PLAT = nt
40
  endif
41
else
42
  ifeq "$(MY_OS)" "Linux"
43
    XILINX_PLAT = lin
44
  else
45
    $(error Could not determine OS type for locating XILINX applications)
46
  endif
47
endif
48
 
49
 
50 59 davidgb
# Xilinx tools
51 70 davidgb
XST        := $(XILINX_NORMAL)/bin/$(XILINX_PLAT)/xst
52
NGDBUILD   := $(XILINX_NORMAL)/bin/$(XILINX_PLAT)/ngdbuild
53
MAP        := $(XILINX_NORMAL)/bin/$(XILINX_PLAT)/map
54
PAR        := $(XILINX_NORMAL)/bin/$(XILINX_PLAT)/par
55
BITGEN     := $(XILINX_NORMAL)/bin/$(XILINX_PLAT)/bitgen
56
PROMGEN    := $(XILINX_NORMAL)/bin/$(XILINX_PLAT)/promgen
57
TRCE       := $(XILINX_NORMAL)/bin/$(XILINX_PLAT)/trce
58
IMPACT     := $(XILINX_NORMAL)/bin/$(XILINX_PLAT)/impact
59 59 davidgb
 
60
# Extract info from Xilinx ISE project for use with command line tools
61
XST_FILE := $(DESIGN_NAME).xst
62
PRJ_FILE := $(shell $(AWK) '/^-ifn/ { printf("%s",$$2) }'  $(XST_FILE))
63
HDL_FILES := $(subst ",,$(shell $(AWK) '{ print $$3} ' $(PRJ_FILE)))
64
PART := $(shell $(AWK) '/^-p / { printf("%s",$$2) }' $(XST_FILE))
65
DEVICE_tmp := $(shell $(AWK) -F - '/^-p / { printf("%s",$$2) }' $(XST_FILE))
66
DEVICE := $(subst p ,,$(DEVICE_tmp))
67
SPEED := $(shell $(AWK) -F - '/^-p / { printf("%s",$$3) }' $(XST_FILE))
68
PACKAGE := $(shell $(AWK) -F - '/^-p / { printf("%s",$$4) }' $(XST_FILE))
69
BSD_FILE := $(XILINX)/$(FAMILY)/data/$(DEVICE).bsd
70
 
71
XSTHDPDIR1 := $(shell $(AWK) '/^set -xsthdpdir / { printf("%s",$$3) }'  $(XST_FILE))
72
XSTHDPDIR := $(subst ",,$(XSTHDPDIR1))
73
TMPDIR1 := $(shell $(AWK) '/^set -tmpdir / { printf("%s",$$3) }'  $(XST_FILE))
74
TMPDIR := $(subst ",,$(TMPDIR1))
75
 
76
INTSTYLE         ?= -intstyle silent      # call Xilinx tools in silent mode
77
INTSTYLE :=
78
XST_FLAGS        ?= $(INTSTYLE)           # most synthesis flags are specified in the .xst file
79
NGDBUILD_FLAGS   ?= $(INTSTYLE) -dd _ngo  # ngdbuild flags
80
NGDBUILD_FLAGS += $(if $(UCF_FILE),-uc,) $(UCF_FILE)
81 70 davidgb
# pre-11.1 flags
82
#MAP_FLAGS        ?= $(INTSTYLE) -cm area -pr b -k 4 -c 100 -tx off
83
# ISE 11.1 flags
84
MAP_FLAGS        ?= $(INTSTYLE) -cm area -pr b -c 100 -tx off
85 59 davidgb
PAR_FLAGS        ?= $(INTSTYLE) -w -ol std -t 1
86
TRCE_FLAGS       ?= $(INTSTYLE) -e 3 -l 3
87
BITGEN_FLAGS     ?= $(INTSTYLE)           # most bitgen flags are specified in the .ut file
88
PROMGEN_FLAGS    ?= -u 0                  # flags that control the MCS/EXO file generation
89
 
90
BITGEN_OPTIONS_FILE   ?= $(DESIGN_NAME).ut
91
 
92
#===================================================================
93
# Debug variable settings
94
debug_vars:
95
        @$(ECHO) "XST_FILE    = '$(XST_FILE)'"
96
        @$(ECHO) "PRJ_FILE    = '$(PRJ_FILE)'"
97
        @$(ECHO) "HDL_FILES   = '$(HDL_FILES)'"
98
        @$(ECHO) "PART        = '$(PART)'"
99
        @$(ECHO) "DEVICE      = '$(DEVICE)'"
100
        @$(ECHO) "SPEED       = '$(SPEED)'"
101
        @$(ECHO) "PACKAGE     = '$(PACKAGE)'"
102
        @$(ECHO) "UCF_FILE    = '$(UCF_FILE)'"
103
        @$(ECHO) "BSD_FILE    = '$(BSD_FILE)'"
104
        @$(ECHO) "XSTHDPDIR   = '$(XSTHDPDIR)'"
105
        @$(ECHO) "TMPDIR      = '$(TMPDIR)'"
106
 
107
#===================================================================
108
# Make sure tmpdirs are created
109
xst_tmp_dirs:
110
        @$(MKDIR) $(XSTHDPDIR)
111
        @$(MKDIR) $(TMPDIR)
112
        touch $@
113
 
114
#===================================================================
115
# Define dependencies
116
 
117
$(DESIGN_NAME).ngc: $(XST_FILE) $(PRJ_FILE) xst_tmp_dirs $(HDL_FILES) $(DESIGN_NAME).lso
118
 
119
$(DESIGN_NAME).ngd: $(DESIGN_NAME).ngc $(UCF_FILE)
120
 
121
$(DESIGN_NAME).bit: $(DESIGN_NAME).ncd $(BITGEN_OPTIONS_FILE)
122
 
123
$(DESIGN_NAME).mcs: $(DESIGN_NAME).bit
124
 
125
#===================================================================
126
# Rule to make impact cmd file
127
 
128
$(DESIGN_NAME)_impact.cmd:
129
        @$(ECHO)
130
        @$(ECHO) "======= Generating Impact command file ============"
131
        -@$(RM) $(DESIGN_NAME)_impact.cmd
132
        @$(ECHO) "setMode -ss" >>$@
133
        @$(ECHO) "setMode -sm" >>$@
134
        @$(ECHO) "setMode -hw140" >>$@
135
        @$(ECHO) "setMode -spi" >>$@
136
        @$(ECHO) "setMode -acecf" >>$@
137
        @$(ECHO) "setMode -acempm" >>$@
138
        @$(ECHO) "setMode -pff" >>$@
139
        @$(ECHO) "setMode -bs" >>$@
140
        @$(ECHO) "deleteDevice -position 1" >>$@
141
        @$(ECHO) "deleteDevice -position 1" >>$@
142
        @$(ECHO) "setMode -bscan" >>$@
143
        @$(ECHO) "setCable -p auto" >>$@
144
        @$(ECHO) "addDevice -p 1 -file $(BSD_FILE)" >>$@
145
        @$(ECHO) "Identify" >>$@
146
        @$(ECHO) "identifyMPM" >>$@
147
        @$(ECHO) "assignFile -p 1 -file $(DESIGN_NAME).bit" >>$@
148
        @$(ECHO) "program -p 1" >>$@
149
        @$(ECHO) "quit" >>$@
150
        @$(CAT) $@
151
 
152
.PHONY: do_impact
153
do_impact: $(DESIGN_NAME).bit $(DESIGN_NAME).ngc $(DESIGN_NAME)_impact.cmd
154
        @$(ECHO)
155
        @$(ECHO) "======= Downloading bitstream to XSA-3S1000 using Impact ============"
156
        $(IMPACT) -batch $(DESIGN_NAME)_impact.cmd
157
 
158
#===================================================================
159
# TRANSLATE RULES
160
 
161
#   RULE: .xst => .ngc
162
# Synthesize the HDL files into an NGC file.  This rule is triggered if
163
# any of the HDL files are changed or the synthesis options are changed.
164
%.ngc: %.xst
165
        @$(ECHO)
166
        @$(ECHO) "======= Synthesis - XST ============================"
167
        $(XST) $(XST_FLAGS) -ifn $(XST_FILE) -ofn $(DESIGN_NAME).syr
168
 
169
#   RULE: .ngc => .ngd
170
# Take the output of the synthesizer and create the NGD file.  This rule
171
# will also be triggered if constraints file is changed.
172
%.ngd: %.ngc
173
        @$(ECHO)
174
        @$(ECHO) "======= Synthesis - NGDBUILD ======================="
175
        $(NGDBUILD) $(NGDBUILD_FLAGS) -p $(PART) $*.ngc $*.ngd
176
 
177
#   RULE: .ngd => _map.ncd and .pcf
178
# Map the NGD file and physical-constraints to the FPGA to create the mapped NCD file.
179
%_map.ncd %.pcf: %.ngd
180
        @$(ECHO)
181
        @$(ECHO) "======= Synthesis - MAP ============================"
182
        $(MAP) $(MAP_FLAGS) -p $(PART) -o $*_map.ncd $*.ngd $*.pcf
183
 
184
#   RULE: _map.ncd and .pcf => .ncd
185
# Place & route the mapped NCD file to create the final NCD file.
186
%.ncd: %_map.ncd %.pcf
187
        @$(ECHO)
188
        @$(ECHO) "======= Synthesis - PAR ============================"
189
        $(PAR) $(PAR_FLAGS) $*_map.ncd $*.ncd $*.pcf
190
 
191
#   RULE: .ncd => .bit
192
# Take the final NCD file and create an FPGA bitstream file.  This rule will also be
193
# triggered if the bit generation options file is changed.
194
%.bit: %.ncd $(BITGEN_OPTIONS_FILE)
195
        @$(ECHO)
196
        @$(ECHO) "======= Generating bitstream ======================="
197
        $(BITGEN) $(BITGEN_FLAGS) -f $(BITGEN_OPTIONS_FILE) $*.ncd
198
 
199
#   RULE: .bit => .mcs
200
# Convert a bitstream file into an MCS hex file that can be stored into Flash memory.
201
%.mcs: %.bit
202
        @$(ECHO)
203
        @$(ECHO) "======= Generating MCS prom ========================"
204
        $(PROMGEN) $(PROMGEN_FLAGS) $*.bit -p mcs -w
205
 
206
#   RULE: .bit => .exo
207
# Convert a bitstream file into an EXO hex file that can be stored into Flash memory.
208
%.exo: %.bit
209
        @$(ECHO)
210
        @$(ECHO) "======= Generating EXO prom ========================"
211
        $(PROMGEN) $(PROMGEN_FLAGS) $*.bit -p exo
212
 
213
# Create the FPGA timing report after place & route.
214
%.twr: %.ncd %.pcf
215
        @$(ECHO)
216
        @$(ECHO) "======= Generating Timing Report ==================="
217
        $(TRCE) $(TRCE_FLAGS) $*.ncd -o $*.twr $*.pcf
218
 
219
# Preserve intermediate files.
220
.PRECIOUS: %.ngc %.ngd %_map.ncd %.ncd %.twr %.vm6 %.jed
221
 
222
 

powered by: WebSVN 2.1.0

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