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

Subversion Repositories System09

[/] [System09/] [branches/] [mkfiles_rev1/] [mkfiles/] [xilinx_rules.mk] - Diff between revs 40 and 66

Only display areas with differences | Details | Blame | View Log

Rev 40 Rev 66
#-----------------------------------------------------------------
#-----------------------------------------------------------------
# File:    xilinx_rules.mk
# File:    xilinx_rules.mk
# Author:  David Burnette
# Author:  David Burnette
# Date:    April 7, 2008
# Date:    April 7, 2008
#
#
# Description:
# Description:
#
#
# Usage:
# Usage:
#  This make file fragment contains translate rules for synthesizing
#  This make file fragment contains translate rules for synthesizing
#  Xilinx designs.
#  Xilinx designs.
#
#
# This work was based on the Xilinx Makefile by Dave Vanden Bout
# This work was based on the Xilinx Makefile by Dave Vanden Bout
# from XESS Corp. Several major differences exist between his
# from XESS Corp. Several major differences exist between his
# implementation and mine. This Makefile does not require PERL
# implementation and mine. This Makefile does not require PERL
# (though it does require AWK).
# (though it does require AWK).
#
#
# Dependencies:
# Dependencies:
#  Depends on 'def_rules.mk' fragment.
#  Depends on 'def_rules.mk' fragment.
#
#
# Revision History:
# Revision History:
#   dgb 2008-04-07   Original version
#   dgb 2008-04-07   Original version
#
#
#-----------------------------------------------------------------
#-----------------------------------------------------------------
include $(MKFRAGS)/def_rules.mk
include $(MKFRAGS)/def_rules.mk
# Xilinx tools
# Xilinx tools
XST        := xst
XST        := xst
NGDBUILD   := ngdbuild
NGDBUILD   := ngdbuild
MAP        := map
MAP        := map
PAR        := par
PAR        := par
BITGEN     := bitgen
BITGEN     := bitgen
PROMGEN    := promgen
PROMGEN    := promgen
TRCE       := trce
TRCE       := trce
IMPACT     := impact
IMPACT     := impact
# Extract info from Xilinx ISE project for use with command line tools
# Extract info from Xilinx ISE project for use with command line tools
XST_FILE := $(DESIGN_NAME).xst
XST_FILE := $(DESIGN_NAME).xst
PRJ_FILE := $(shell $(AWK) '/^-ifn/ { printf("%s",$$2) }'  $(XST_FILE))
PRJ_FILE := $(shell $(AWK) '/^-ifn/ { printf("%s",$$2) }'  $(XST_FILE))
HDL_FILES := $(subst ",,$(shell $(AWK) '{ print $$3} ' $(PRJ_FILE)))
HDL_FILES := $(subst ",,$(shell $(AWK) '{ print $$3} ' $(PRJ_FILE)))
PART := $(shell $(AWK) '/^-p / { printf("%s",$$2) }' $(XST_FILE))
PART := $(shell $(AWK) '/^-p / { printf("%s",$$2) }' $(XST_FILE))
DEVICE_tmp := $(shell $(AWK) -F - '/^-p / { printf("%s",$$2) }' $(XST_FILE))
DEVICE_tmp := $(shell $(AWK) -F - '/^-p / { printf("%s",$$2) }' $(XST_FILE))
DEVICE := $(subst p ,,$(DEVICE_tmp))
DEVICE := $(subst p ,,$(DEVICE_tmp))
SPEED := $(shell $(AWK) -F - '/^-p / { printf("%s",$$3) }' $(XST_FILE))
SPEED := $(shell $(AWK) -F - '/^-p / { printf("%s",$$3) }' $(XST_FILE))
PACKAGE := $(shell $(AWK) -F - '/^-p / { printf("%s",$$4) }' $(XST_FILE))
PACKAGE := $(shell $(AWK) -F - '/^-p / { printf("%s",$$4) }' $(XST_FILE))
BSD_FILE := $(XILINX)/$(FAMILY)/data/$(DEVICE).bsd
BSD_FILE := $(XILINX)/$(FAMILY)/data/$(DEVICE).bsd
XSTHDPDIR1 := $(shell $(AWK) '/^set -xsthdpdir / { printf("%s",$$3) }'  $(XST_FILE))
XSTHDPDIR1 := $(shell $(AWK) '/^set -xsthdpdir / { printf("%s",$$3) }'  $(XST_FILE))
XSTHDPDIR := $(subst ",,$(XSTHDPDIR1))
XSTHDPDIR := $(subst ",,$(XSTHDPDIR1))
TMPDIR1 := $(shell $(AWK) '/^set -tmpdir / { printf("%s",$$3) }'  $(XST_FILE))
TMPDIR1 := $(shell $(AWK) '/^set -tmpdir / { printf("%s",$$3) }'  $(XST_FILE))
TMPDIR := $(subst ",,$(TMPDIR1))
TMPDIR := $(subst ",,$(TMPDIR1))
INTSTYLE         ?= -intstyle silent      # call Xilinx tools in silent mode
INTSTYLE         ?= -intstyle silent      # call Xilinx tools in silent mode
INTSTYLE :=
INTSTYLE :=
XST_FLAGS        ?= $(INTSTYLE)           # most synthesis flags are specified in the .xst file
XST_FLAGS        ?= $(INTSTYLE)           # most synthesis flags are specified in the .xst file
NGDBUILD_FLAGS   ?= $(INTSTYLE) -dd _ngo  # ngdbuild flags
NGDBUILD_FLAGS   ?= $(INTSTYLE) -dd _ngo  # ngdbuild flags
NGDBUILD_FLAGS += $(if $(UCF_FILE),-uc,) $(UCF_FILE)
NGDBUILD_FLAGS += $(if $(UCF_FILE),-uc,) $(UCF_FILE)
MAP_FLAGS        ?= $(INTSTYLE) -cm area -pr b -k 4 -c 100 -tx off
MAP_FLAGS        ?= $(INTSTYLE) -cm area -pr b -k 4 -c 100 -tx off
PAR_FLAGS        ?= $(INTSTYLE) -w -ol std -t 1
PAR_FLAGS        ?= $(INTSTYLE) -w -ol std -t 1
TRCE_FLAGS       ?= $(INTSTYLE) -e 3 -l 3
TRCE_FLAGS       ?= $(INTSTYLE) -e 3 -l 3
BITGEN_FLAGS     ?= $(INTSTYLE)           # most bitgen flags are specified in the .ut file
BITGEN_FLAGS     ?= $(INTSTYLE)           # most bitgen flags are specified in the .ut file
PROMGEN_FLAGS    ?= -u 0                  # flags that control the MCS/EXO file generation
PROMGEN_FLAGS    ?= -u 0                  # flags that control the MCS/EXO file generation
BITGEN_OPTIONS_FILE   ?= $(DESIGN_NAME).ut
BITGEN_OPTIONS_FILE   ?= $(DESIGN_NAME).ut
#===================================================================
#===================================================================
# Debug variable settings
# Debug variable settings
debug_vars:
debug_vars:
        @$(ECHO) "XST_FILE    = '$(XST_FILE)'"
        @$(ECHO) "XST_FILE    = '$(XST_FILE)'"
        @$(ECHO) "PRJ_FILE    = '$(PRJ_FILE)'"
        @$(ECHO) "PRJ_FILE    = '$(PRJ_FILE)'"
        @$(ECHO) "HDL_FILES   = '$(HDL_FILES)'"
        @$(ECHO) "HDL_FILES   = '$(HDL_FILES)'"
        @$(ECHO) "PART        = '$(PART)'"
        @$(ECHO) "PART        = '$(PART)'"
        @$(ECHO) "DEVICE      = '$(DEVICE)'"
        @$(ECHO) "DEVICE      = '$(DEVICE)'"
        @$(ECHO) "SPEED       = '$(SPEED)'"
        @$(ECHO) "SPEED       = '$(SPEED)'"
        @$(ECHO) "PACKAGE     = '$(PACKAGE)'"
        @$(ECHO) "PACKAGE     = '$(PACKAGE)'"
        @$(ECHO) "UCF_FILE    = '$(UCF_FILE)'"
        @$(ECHO) "UCF_FILE    = '$(UCF_FILE)'"
        @$(ECHO) "BSD_FILE    = '$(BSD_FILE)'"
        @$(ECHO) "BSD_FILE    = '$(BSD_FILE)'"
        @$(ECHO) "XSTHDPDIR   = '$(XSTHDPDIR)'"
        @$(ECHO) "XSTHDPDIR   = '$(XSTHDPDIR)'"
        @$(ECHO) "TMPDIR      = '$(TMPDIR)'"
        @$(ECHO) "TMPDIR      = '$(TMPDIR)'"
#===================================================================
#===================================================================
# Make sure tmpdirs are created
# Make sure tmpdirs are created
xst_tmp_dirs:
xst_tmp_dirs:
        @$(MKDIR) $(XSTHDPDIR)
        @$(MKDIR) $(XSTHDPDIR)
        @$(MKDIR) $(TMPDIR)
        @$(MKDIR) $(TMPDIR)
        touch $@
        touch $@
#===================================================================
#===================================================================
# Define dependencies
# Define dependencies
$(DESIGN_NAME).ngc: $(XST_FILE) $(PRJ_FILE) xst_tmp_dirs $(HDL_FILES) $(DESIGN_NAME).lso
$(DESIGN_NAME).ngc: $(XST_FILE) $(PRJ_FILE) xst_tmp_dirs $(HDL_FILES) $(DESIGN_NAME).lso
$(DESIGN_NAME).ngd: $(DESIGN_NAME).ngc $(UCF_FILE)
$(DESIGN_NAME).ngd: $(DESIGN_NAME).ngc $(UCF_FILE)
$(DESIGN_NAME).bit: $(DESIGN_NAME).ncd $(BITGEN_OPTIONS_FILE)
$(DESIGN_NAME).bit: $(DESIGN_NAME).ncd $(BITGEN_OPTIONS_FILE)
$(DESIGN_NAME).mcs: $(DESIGN_NAME).bit
$(DESIGN_NAME).mcs: $(DESIGN_NAME).bit
#===================================================================
#===================================================================
# Rule to make impact cmd file
# Rule to make impact cmd file
$(DESIGN_NAME)_impact.cmd:
$(DESIGN_NAME)_impact.cmd:
        @$(ECHO)
        @$(ECHO)
        @$(ECHO) "======= Generating Impact command file ============"
        @$(ECHO) "======= Generating Impact command file ============"
        -@$(RM) $(DESIGN_NAME)_impact.cmd
        -@$(RM) $(DESIGN_NAME)_impact.cmd
        @$(ECHO) "setMode -ss" >>$@
        @$(ECHO) "setMode -ss" >>$@
        @$(ECHO) "setMode -sm" >>$@
        @$(ECHO) "setMode -sm" >>$@
        @$(ECHO) "setMode -hw140" >>$@
        @$(ECHO) "setMode -hw140" >>$@
        @$(ECHO) "setMode -spi" >>$@
        @$(ECHO) "setMode -spi" >>$@
        @$(ECHO) "setMode -acecf" >>$@
        @$(ECHO) "setMode -acecf" >>$@
        @$(ECHO) "setMode -acempm" >>$@
        @$(ECHO) "setMode -acempm" >>$@
        @$(ECHO) "setMode -pff" >>$@
        @$(ECHO) "setMode -pff" >>$@
        @$(ECHO) "setMode -bs" >>$@
        @$(ECHO) "setMode -bs" >>$@
        @$(ECHO) "deleteDevice -position 1" >>$@
        @$(ECHO) "deleteDevice -position 1" >>$@
        @$(ECHO) "deleteDevice -position 1" >>$@
        @$(ECHO) "deleteDevice -position 1" >>$@
        @$(ECHO) "setMode -bscan" >>$@
        @$(ECHO) "setMode -bscan" >>$@
        @$(ECHO) "setCable -p auto" >>$@
        @$(ECHO) "setCable -p auto" >>$@
        @$(ECHO) "addDevice -p 1 -file $(BSD_FILE)" >>$@
        @$(ECHO) "addDevice -p 1 -file $(BSD_FILE)" >>$@
        @$(ECHO) "Identify" >>$@
        @$(ECHO) "Identify" >>$@
        @$(ECHO) "identifyMPM" >>$@
        @$(ECHO) "identifyMPM" >>$@
        @$(ECHO) "assignFile -p 1 -file $(DESIGN_NAME).bit" >>$@
        @$(ECHO) "assignFile -p 1 -file $(DESIGN_NAME).bit" >>$@
        @$(ECHO) "program -p 1" >>$@
        @$(ECHO) "program -p 1" >>$@
        @$(ECHO) "quit" >>$@
        @$(ECHO) "quit" >>$@
        @$(CAT) $@
        @$(CAT) $@
.PHONY: do_impact
.PHONY: do_impact
do_impact: $(DESIGN_NAME).bit $(DESIGN_NAME).ngc $(DESIGN_NAME)_impact.cmd
do_impact: $(DESIGN_NAME).bit $(DESIGN_NAME).ngc $(DESIGN_NAME)_impact.cmd
        @$(ECHO)
        @$(ECHO)
        @$(ECHO) "======= Downloading bitstream to XSA-3S1000 using Impact ============"
        @$(ECHO) "======= Downloading bitstream to XSA-3S1000 using Impact ============"
        $(IMPACT) -batch $(DESIGN_NAME)_impact.cmd
        $(IMPACT) -batch $(DESIGN_NAME)_impact.cmd
#===================================================================
#===================================================================
# TRANSLATE RULES
# TRANSLATE RULES
#   RULE: .xst => .ngc
#   RULE: .xst => .ngc
# Synthesize the HDL files into an NGC file.  This rule is triggered if
# Synthesize the HDL files into an NGC file.  This rule is triggered if
# any of the HDL files are changed or the synthesis options are changed.
# any of the HDL files are changed or the synthesis options are changed.
%.ngc: %.xst
%.ngc: %.xst
        @$(ECHO)
        @$(ECHO)
        @$(ECHO) "======= Synthesis - XST ============================"
        @$(ECHO) "======= Synthesis - XST ============================"
        $(XST) $(XST_FLAGS) -ifn $(XST_FILE) -ofn $(DESIGN_NAME).syr
        $(XST) $(XST_FLAGS) -ifn $(XST_FILE) -ofn $(DESIGN_NAME).syr
#   RULE: .ngc => .ngd
#   RULE: .ngc => .ngd
# Take the output of the synthesizer and create the NGD file.  This rule
# Take the output of the synthesizer and create the NGD file.  This rule
# will also be triggered if constraints file is changed.
# will also be triggered if constraints file is changed.
%.ngd: %.ngc
%.ngd: %.ngc
        @$(ECHO)
        @$(ECHO)
        @$(ECHO) "======= Synthesis - NGDBUILD ======================="
        @$(ECHO) "======= Synthesis - NGDBUILD ======================="
        $(NGDBUILD) $(NGDBUILD_FLAGS) -p $(PART) $*.ngc $*.ngd
        $(NGDBUILD) $(NGDBUILD_FLAGS) -p $(PART) $*.ngc $*.ngd
#   RULE: .ngd => _map.ncd and .pcf
#   RULE: .ngd => _map.ncd and .pcf
# Map the NGD file and physical-constraints to the FPGA to create the mapped NCD file.
# Map the NGD file and physical-constraints to the FPGA to create the mapped NCD file.
%_map.ncd %.pcf: %.ngd
%_map.ncd %.pcf: %.ngd
        @$(ECHO)
        @$(ECHO)
        @$(ECHO) "======= Synthesis - MAP ============================"
        @$(ECHO) "======= Synthesis - MAP ============================"
        $(MAP) $(MAP_FLAGS) -p $(PART) -o $*_map.ncd $*.ngd $*.pcf
        $(MAP) $(MAP_FLAGS) -p $(PART) -o $*_map.ncd $*.ngd $*.pcf
#   RULE: _map.ncd and .pcf => .ncd
#   RULE: _map.ncd and .pcf => .ncd
# Place & route the mapped NCD file to create the final NCD file.
# Place & route the mapped NCD file to create the final NCD file.
%.ncd: %_map.ncd %.pcf
%.ncd: %_map.ncd %.pcf
        @$(ECHO)
        @$(ECHO)
        @$(ECHO) "======= Synthesis - PAR ============================"
        @$(ECHO) "======= Synthesis - PAR ============================"
        $(PAR) $(PAR_FLAGS) $*_map.ncd $*.ncd $*.pcf
        $(PAR) $(PAR_FLAGS) $*_map.ncd $*.ncd $*.pcf
#   RULE: .ncd => .bit
#   RULE: .ncd => .bit
# Take the final NCD file and create an FPGA bitstream file.  This rule will also be
# Take the final NCD file and create an FPGA bitstream file.  This rule will also be
# triggered if the bit generation options file is changed.
# triggered if the bit generation options file is changed.
%.bit: %.ncd $(BITGEN_OPTIONS_FILE)
%.bit: %.ncd $(BITGEN_OPTIONS_FILE)
        @$(ECHO)
        @$(ECHO)
        @$(ECHO) "======= Generating bitstream ======================="
        @$(ECHO) "======= Generating bitstream ======================="
        $(BITGEN) $(BITGEN_FLAGS) -f $(BITGEN_OPTIONS_FILE) $*.ncd
        $(BITGEN) $(BITGEN_FLAGS) -f $(BITGEN_OPTIONS_FILE) $*.ncd
#   RULE: .bit => .mcs
#   RULE: .bit => .mcs
# Convert a bitstream file into an MCS hex file that can be stored into Flash memory.
# Convert a bitstream file into an MCS hex file that can be stored into Flash memory.
%.mcs: %.bit
%.mcs: %.bit
        @$(ECHO)
        @$(ECHO)
        @$(ECHO) "======= Generating MCS prom ========================"
        @$(ECHO) "======= Generating MCS prom ========================"
        $(PROMGEN) $(PROMGEN_FLAGS) $*.bit -p mcs -w
        $(PROMGEN) $(PROMGEN_FLAGS) $*.bit -p mcs -w
#   RULE: .bit => .exo
#   RULE: .bit => .exo
# Convert a bitstream file into an EXO hex file that can be stored into Flash memory.
# Convert a bitstream file into an EXO hex file that can be stored into Flash memory.
%.exo: %.bit
%.exo: %.bit
        @$(ECHO)
        @$(ECHO)
        @$(ECHO) "======= Generating EXO prom ========================"
        @$(ECHO) "======= Generating EXO prom ========================"
        $(PROMGEN) $(PROMGEN_FLAGS) $*.bit -p exo
        $(PROMGEN) $(PROMGEN_FLAGS) $*.bit -p exo
# Create the FPGA timing report after place & route.
# Create the FPGA timing report after place & route.
%.twr: %.ncd %.pcf
%.twr: %.ncd %.pcf
        @$(ECHO)
        @$(ECHO)
        @$(ECHO) "======= Generating Timing Report ==================="
        @$(ECHO) "======= Generating Timing Report ==================="
        $(TRCE) $(TRCE_FLAGS) $*.ncd -o $*.twr $*.pcf
        $(TRCE) $(TRCE_FLAGS) $*.ncd -o $*.twr $*.pcf
# Preserve intermediate files.
# Preserve intermediate files.
.PRECIOUS: %.ngc %.ngd %_map.ncd %.ncd %.twr %.vm6 %.jed
.PRECIOUS: %.ngc %.ngd %_map.ncd %.ncd %.twr %.vm6 %.jed
 
 

powered by: WebSVN 2.1.0

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