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

Subversion Repositories System09

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

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
        $(ECHO) "XSTHDPDIR = $(XSTHDPDIR)"
72
        $(MKDIR) $(XSTHDPDIR)
73
 
74
$(TMPDIR):
75
        $(ECHO) "TMPDIR = $(TMPDIR)"
76
        $(MKDIR) $(TMPDIR)
77
 
78
xst_tmp_dirs: $(XSTHDPDIR) $(TMPDIR)
79
 
80
#===================================================================
81 31 davidgb
# Define dependencies
82
 
83
$(DESIGN_NAME).ngc: $(XST_FILE) $(PRJ_FILE) $(DESIGN_NAME).lso
84
$(DESIGN_NAME).ngd: $(DESIGN_NAME).ngc $(UCF_FILE)
85
$(DESIGN_NAME).bit: $(DESIGN_NAME).ncd $(BITGEN_OPTIONS_FILE)
86
 
87
#===================================================================
88 28 davidgb
# TRANSLATE RULES
89
 
90
#   RULE: .xst => .ngc
91
# Synthesize the HDL files into an NGC file.  This rule is triggered if
92
# any of the HDL files are changed or the synthesis options are changed.
93 30 davidgb
$(DESIGN_NAME).ngc: $(HDL_FILES) $(XST_FILE) xst_tmp_dirs
94 28 davidgb
        @$(ECHO)
95
        @$(ECHO) "======= Synthesis - XST ============================"
96
        $(XST) $(XST_FLAGS) -ifn $(XST_FILE) -ofn $(DESIGN_NAME).syr
97
 
98
#   RULE: .ngc => .ngd
99
# Take the output of the synthesizer and create the NGD file.  This rule
100
# will also be triggered if constraints file is changed.
101
%.ngd: %.ngc $(UCF_FILE)
102
        @$(ECHO)
103
        @$(ECHO) "======= Synthesis - NGDBUILD ======================="
104
        $(NGDBUILD) $(NGDBUILD_FLAGS) -p $(PART) $*.ngc $*.ngd
105
 
106
#   RULE: .ngd => _map.ncd and .pcf
107
# Map the NGD file and physical-constraints to the FPGA to create the mapped NCD file.
108
%_map.ncd %.pcf: %.ngd
109
        @$(ECHO)
110
        @$(ECHO) "======= Synthesis - MAP ============================"
111
        $(MAP) $(MAP_FLAGS) -p $(PART) -o $*_map.ncd $*.ngd $*.pcf
112
 
113
#   RULE: _map.ncd and .pcf => .ncd
114
# Place & route the mapped NCD file to create the final NCD file.
115
%.ncd: %_map.ncd %.pcf
116
        @$(ECHO)
117
        @$(ECHO) "======= Synthesis - PAR ============================"
118
        $(PAR) $(PAR_FLAGS) $*_map.ncd $*.ncd $*.pcf
119
 
120
#   RULE: .ncd => .bit
121
# Take the final NCD file and create an FPGA bitstream file.  This rule will also be
122
# triggered if the bit generation options file is changed.
123
%.bit: %.ncd $(BITGEN_OPTIONS_FILE)
124
        @$(ECHO)
125
        @$(ECHO) "======= Generating bitstream ======================="
126
        $(BITGEN) $(BITGEN_FLAGS) -f $(BITGEN_OPTIONS_FILE) $*.ncd
127
 
128
#   RULE: .bit => .mcs
129
# Convert a bitstream file into an MCS hex file that can be stored into Flash memory.
130
%.mcs: %.bit
131
        @$(ECHO)
132
        @$(ECHO) "======= Generating MCS prom ========================"
133
        $(PROMGEN) $(PROMGEN_FLAGS) $*.bit -p mcs -w
134
 
135
#   RULE: .bit => .exo
136
# Convert a bitstream file into an EXO hex file that can be stored into Flash memory.
137
%.exo: %.bit
138
        @$(ECHO)
139
        @$(ECHO) "======= Generating EXO prom ========================"
140
        $(PROMGEN) $(PROMGEN_FLAGS) $*.bit -p exo
141
 
142
# Create the FPGA timing report after place & route.
143
%.twr: %.ncd %.pcf
144
        @$(ECHO)
145
        @$(ECHO) "======= Generating Timing Report ==================="
146
        $(TRCE) $(TRCE_FLAGS) $*.ncd -o $*.twr $*.pcf
147
 
148
# Preserve intermediate files.
149
.PRECIOUS: %.ngc %.ngd %_map.ncd %.ncd %.twr %.vm6 %.jed
150
 
151
 

powered by: WebSVN 2.1.0

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