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

Subversion Repositories System09

[/] [System09/] [branches/] [mkfiles_rev1/] [mkfiles/] [xilinx_rules.mk] - Blame information for rev 36

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

Line No. Rev Author Line
1 28 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
# Xilinx tools
29
XST        := xst
30
NGDBUILD   := ngdbuild
31
MAP        := map
32
PAR        := par
33
BITGEN     := bitgen
34
PROMGEN    := promgen
35
TRCE       := trce
36
IMPACT     := impact
37
 
38
# Extract info from Xilinx ISE project for use with command line tools
39
XST_FILE := $(DESIGN_NAME).xst
40
PRJ_FILE := $(shell $(AWK) '/^-ifn/ { printf("%s",$$2) }'  $(XST_FILE))
41
HDL_FILES := $(subst ",,$(shell $(AWK) '{ print $$3} ' $(PRJ_FILE)))
42
PART := $(shell $(AWK) '/^-p / { printf("%s",$$2) }' $(XST_FILE))
43
DEVICE_tmp := $(shell $(AWK) -F - '/^-p / { printf("%s",$$2) }' $(XST_FILE))
44
DEVICE := $(subst p ,,$(DEVICE_tmp))
45
SPEED := $(shell $(AWK) -F - '/^-p / { printf("%s",$$3) }' $(XST_FILE))
46
PACKAGE := $(shell $(AWK) -F - '/^-p / { printf("%s",$$4) }' $(XST_FILE))
47
BSD_FILE := $(XILINX)/$(FAMILY)/data/$(DEVICE).bsd
48
 
49 30 davidgb
XSTHDPDIR1 := $(shell $(AWK) '/^set -xsthdpdir / { printf("%s",$$3) }'  $(XST_FILE))
50
XSTHDPDIR := $(subst ",,$(XSTHDPDIR1))
51
TMPDIR1 := $(shell $(AWK) '/^set -tmpdir / { printf("%s",$$3) }'  $(XST_FILE))
52
TMPDIR := $(subst ",,$(TMPDIR1))
53
 
54 28 davidgb
INTSTYLE         ?= -intstyle silent      # call Xilinx tools in silent mode
55
INTSTYLE :=
56
XST_FLAGS        ?= $(INTSTYLE)           # most synthesis flags are specified in the .xst file
57
NGDBUILD_FLAGS   ?= $(INTSTYLE) -dd _ngo  # ngdbuild flags
58
NGDBUILD_FLAGS += $(if $(UCF_FILE),-uc,) $(UCF_FILE)
59
MAP_FLAGS        ?= $(INTSTYLE) -cm area -pr b -k 4 -c 100 -tx off
60
PAR_FLAGS        ?= $(INTSTYLE) -w -ol std -t 1
61
TRCE_FLAGS       ?= $(INTSTYLE) -e 3 -l 3
62
BITGEN_FLAGS     ?= $(INTSTYLE)           # most bitgen flags are specified in the .ut file
63
PROMGEN_FLAGS    ?= -u 0                  # flags that control the MCS/EXO file generation
64
 
65
BITGEN_OPTIONS_FILE   ?= $(DESIGN_NAME).ut
66
 
67 30 davidgb
 
68 28 davidgb
#===================================================================
69 30 davidgb
# Make sure tmpdirs are created
70
$(XSTHDPDIR):
71 36 davidgb
        @$(MKDIR) $(XSTHDPDIR)
72 30 davidgb
 
73
$(TMPDIR):
74 36 davidgb
        @$(MKDIR) $(TMPDIR)
75 30 davidgb
 
76
xst_tmp_dirs: $(XSTHDPDIR) $(TMPDIR)
77
 
78
#===================================================================
79 31 davidgb
# Define dependencies
80
 
81
$(DESIGN_NAME).ngc: $(XST_FILE) $(PRJ_FILE) $(DESIGN_NAME).lso
82
$(DESIGN_NAME).ngd: $(DESIGN_NAME).ngc $(UCF_FILE)
83
$(DESIGN_NAME).bit: $(DESIGN_NAME).ncd $(BITGEN_OPTIONS_FILE)
84
 
85
#===================================================================
86 28 davidgb
# TRANSLATE RULES
87
 
88
#   RULE: .xst => .ngc
89
# Synthesize the HDL files into an NGC file.  This rule is triggered if
90
# any of the HDL files are changed or the synthesis options are changed.
91 30 davidgb
$(DESIGN_NAME).ngc: $(HDL_FILES) $(XST_FILE) xst_tmp_dirs
92 28 davidgb
        @$(ECHO)
93
        @$(ECHO) "======= Synthesis - XST ============================"
94
        $(XST) $(XST_FLAGS) -ifn $(XST_FILE) -ofn $(DESIGN_NAME).syr
95
 
96
#   RULE: .ngc => .ngd
97
# Take the output of the synthesizer and create the NGD file.  This rule
98
# will also be triggered if constraints file is changed.
99
%.ngd: %.ngc $(UCF_FILE)
100
        @$(ECHO)
101
        @$(ECHO) "======= Synthesis - NGDBUILD ======================="
102
        $(NGDBUILD) $(NGDBUILD_FLAGS) -p $(PART) $*.ngc $*.ngd
103
 
104
#   RULE: .ngd => _map.ncd and .pcf
105
# Map the NGD file and physical-constraints to the FPGA to create the mapped NCD file.
106
%_map.ncd %.pcf: %.ngd
107
        @$(ECHO)
108
        @$(ECHO) "======= Synthesis - MAP ============================"
109
        $(MAP) $(MAP_FLAGS) -p $(PART) -o $*_map.ncd $*.ngd $*.pcf
110
 
111
#   RULE: _map.ncd and .pcf => .ncd
112
# Place & route the mapped NCD file to create the final NCD file.
113
%.ncd: %_map.ncd %.pcf
114
        @$(ECHO)
115
        @$(ECHO) "======= Synthesis - PAR ============================"
116
        $(PAR) $(PAR_FLAGS) $*_map.ncd $*.ncd $*.pcf
117
 
118
#   RULE: .ncd => .bit
119
# Take the final NCD file and create an FPGA bitstream file.  This rule will also be
120
# triggered if the bit generation options file is changed.
121
%.bit: %.ncd $(BITGEN_OPTIONS_FILE)
122
        @$(ECHO)
123
        @$(ECHO) "======= Generating bitstream ======================="
124
        $(BITGEN) $(BITGEN_FLAGS) -f $(BITGEN_OPTIONS_FILE) $*.ncd
125
 
126
#   RULE: .bit => .mcs
127
# Convert a bitstream file into an MCS hex file that can be stored into Flash memory.
128
%.mcs: %.bit
129
        @$(ECHO)
130
        @$(ECHO) "======= Generating MCS prom ========================"
131
        $(PROMGEN) $(PROMGEN_FLAGS) $*.bit -p mcs -w
132
 
133
#   RULE: .bit => .exo
134
# Convert a bitstream file into an EXO hex file that can be stored into Flash memory.
135
%.exo: %.bit
136
        @$(ECHO)
137
        @$(ECHO) "======= Generating EXO prom ========================"
138
        $(PROMGEN) $(PROMGEN_FLAGS) $*.bit -p exo
139
 
140
# Create the FPGA timing report after place & route.
141
%.twr: %.ncd %.pcf
142
        @$(ECHO)
143
        @$(ECHO) "======= Generating Timing Report ==================="
144
        $(TRCE) $(TRCE_FLAGS) $*.ncd -o $*.twr $*.pcf
145
 
146
# Preserve intermediate files.
147
.PRECIOUS: %.ngc %.ngd %_map.ncd %.ncd %.twr %.vm6 %.jed
148
 
149
 

powered by: WebSVN 2.1.0

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