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

Subversion Repositories System09

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

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
INTSTYLE         ?= -intstyle silent      # call Xilinx tools in silent mode
50
INTSTYLE :=
51
XST_FLAGS        ?= $(INTSTYLE)           # most synthesis flags are specified in the .xst file
52
NGDBUILD_FLAGS   ?= $(INTSTYLE) -dd _ngo  # ngdbuild flags
53
NGDBUILD_FLAGS += $(if $(UCF_FILE),-uc,) $(UCF_FILE)
54
MAP_FLAGS        ?= $(INTSTYLE) -cm area -pr b -k 4 -c 100 -tx off
55
PAR_FLAGS        ?= $(INTSTYLE) -w -ol std -t 1
56
TRCE_FLAGS       ?= $(INTSTYLE) -e 3 -l 3
57
BITGEN_FLAGS     ?= $(INTSTYLE)           # most bitgen flags are specified in the .ut file
58
PROMGEN_FLAGS    ?= -u 0                  # flags that control the MCS/EXO file generation
59
 
60
BITGEN_OPTIONS_FILE   ?= $(DESIGN_NAME).ut
61
 
62
#===================================================================
63
# TRANSLATE RULES
64
 
65
#   RULE: .xst => .ngc
66
# Synthesize the HDL files into an NGC file.  This rule is triggered if
67
# any of the HDL files are changed or the synthesis options are changed.
68
$(DESIGN_NAME).ngc: $(HDL_FILES) $(XST_FILE)
69
        @$(ECHO)
70
        @$(ECHO) "======= Synthesis - XST ============================"
71
        $(XST) $(XST_FLAGS) -ifn $(XST_FILE) -ofn $(DESIGN_NAME).syr
72
 
73
#   RULE: .ngc => .ngd
74
# Take the output of the synthesizer and create the NGD file.  This rule
75
# will also be triggered if constraints file is changed.
76
%.ngd: %.ngc $(UCF_FILE)
77
        @$(ECHO)
78
        @$(ECHO) "======= Synthesis - NGDBUILD ======================="
79
        $(NGDBUILD) $(NGDBUILD_FLAGS) -p $(PART) $*.ngc $*.ngd
80
 
81
#   RULE: .ngd => _map.ncd and .pcf
82
# Map the NGD file and physical-constraints to the FPGA to create the mapped NCD file.
83
%_map.ncd %.pcf: %.ngd
84
        @$(ECHO)
85
        @$(ECHO) "======= Synthesis - MAP ============================"
86
        $(MAP) $(MAP_FLAGS) -p $(PART) -o $*_map.ncd $*.ngd $*.pcf
87
 
88
#   RULE: _map.ncd and .pcf => .ncd
89
# Place & route the mapped NCD file to create the final NCD file.
90
%.ncd: %_map.ncd %.pcf
91
        @$(ECHO)
92
        @$(ECHO) "======= Synthesis - PAR ============================"
93
        $(PAR) $(PAR_FLAGS) $*_map.ncd $*.ncd $*.pcf
94
 
95
#   RULE: .ncd => .bit
96
# Take the final NCD file and create an FPGA bitstream file.  This rule will also be
97
# triggered if the bit generation options file is changed.
98
%.bit: %.ncd $(BITGEN_OPTIONS_FILE)
99
        @$(ECHO)
100
        @$(ECHO) "======= Generating bitstream ======================="
101
        $(BITGEN) $(BITGEN_FLAGS) -f $(BITGEN_OPTIONS_FILE) $*.ncd
102
 
103
#   RULE: .bit => .mcs
104
# Convert a bitstream file into an MCS hex file that can be stored into Flash memory.
105
%.mcs: %.bit
106
        @$(ECHO)
107
        @$(ECHO) "======= Generating MCS prom ========================"
108
        $(PROMGEN) $(PROMGEN_FLAGS) $*.bit -p mcs -w
109
 
110
#   RULE: .bit => .exo
111
# Convert a bitstream file into an EXO hex file that can be stored into Flash memory.
112
%.exo: %.bit
113
        @$(ECHO)
114
        @$(ECHO) "======= Generating EXO prom ========================"
115
        $(PROMGEN) $(PROMGEN_FLAGS) $*.bit -p exo
116
 
117
# Create the FPGA timing report after place & route.
118
%.twr: %.ncd %.pcf
119
        @$(ECHO)
120
        @$(ECHO) "======= Generating Timing Report ==================="
121
        $(TRCE) $(TRCE_FLAGS) $*.ncd -o $*.twr $*.pcf
122
 
123
# Preserve intermediate files.
124
.PRECIOUS: %.ngc %.ngd %_map.ncd %.ncd %.twr %.vm6 %.jed
125
 
126
 

powered by: WebSVN 2.1.0

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