I'm trying to create a Makefile which can build/clean recursively when it's called. I have the build working, but I'm getting errors with the clean command.
My directory structure is something like:
main
|
+-- Makefile
|
+-- common
| |
| +-- gcas_debug
| | |
| | +-- Makefile
| + -- gcas_nvdata
| |
| +-- Makefile
+-- gcinit
+-- Makefile
When I call make in the main directory it goes through and builds everything as I desire, but when I call make clean it does with:
mike#mike-VirtualBox:~/iCOM/framework$ make clean
for d in common/gcas_debug common/gcas_nvdata; \
do \
make --directory=$f clean; \
done
make: the `-C' option requires a non-empty string argument
Usage: make [options] [target] ...
Options:
-b, -m Ignored for compatibility.
...
I don't understand why the clean command isn't working... Any suggestions?
Full (main) Makefile:
lib_gcas_debug := common/gcas_debug
lib_gcas_nvdata := common/gcas_nvdata
libraries := $(lib_gcas_debug) $(lib_gcas_nvdata)
DESTDIR=$(PWD)/output
bindir=
gc_init := gcinit
EXE := $(gc_init)/$(gc_init)
.PHONY: all $(gc_init) $(libraries)
all: $(gc_init)
$(gc_init) $(libraries):
$(MAKE) --directory=$#
$(gc_init): $(libraries)
install: $(gc_init)
install -d -m 0755 $(DESTDIR)$(bindir)
install -m 0755 $(EXE) $(DESTDIR)$(bindir)
clean:
for d in $(libraries); \
do \
$(MAKE) --directory=$$f clean; \
done
EDIT: If I swap the for d with for $d I get instead:
mike#mike-VirtualBox:~/iCOM/framework$ make clean
for in common/gcas_debug common/gcas_nvdata; \
do \
make --directory= clean; \
done
/bin/sh: -c: line 0: syntax error near unexpected token `common/gcas_debug'
/bin/sh: -c: line 0: `for in common/gcas_debug common/gcas_nvdata; \'
make: *** [clean] Error 1
This worked for me:
SUBDIRS := foo bar baz
.PHONY: subdirs $(SUBDIRS) clean all
subdirs: $(SUBDIRS)
$(SUBDIRS):
$(MAKE) -C $# $(MAKECMDGOALS)
clean: $(SUBDIRS)
rm -rf dist
dist: $(SUBDIRS) dist/.build_marker
dist/.build_marker:
mkdir -p dist
for d in $(SUBDIRS) ; do cp $$d/dist/* dist ; done
touch dist/.build_marker
I only need to use the for loop in the dist target to copy files. This allows make -j build parallelism, not to mention simpler-to-read Makefiles.
Read the for loop again:
for d in [...]; do make --directory=$f
Didn't you mean $d, as in
for d in [...]; do make --directory=$d
So, the Makefile should look:
for d in common/gcas_debug common/gcas_nvdata; \
do \
make --directory=$d clean; \
done
Related
I have the following Makefile and I get an error when I use all target. I am not sure what is the root cause of the problem.
APSTOP= ../..
VERSION=2.12.8
SVERSION=2.12
SCALAC= /afs/package/scala/scala-${VERSION}/common/bin/scalac
APSLIB = ${APSTOP}/lib/aps-library-${SVERSION}.jar
COOLCOMPILERDIR= /afs/project/cool/scala
SCALAFLAGS= -cp .:${APSLIB}
SCALACFLAGS= ${SCALAFLAGS}
APS2SCALA = ${APSTOP}/bin/aps2scala
APS2SCALAFLAGS = -p ..:${APSTOP}/base -G
SCALASRC = cool-symbol.handcode.scala cool-semant-driver.scala cool-handcode.scala cool-noinherit-semant-driver.scala
SCALAGEN = cool-symbol.scala cool-tree.scala \
cool-noinherit-semant.scala cool-dynamic-semant.scala
SCALACOPY= basic.scala A2I.scala \
CoolTokens.scala CoolScanner.scala CoolOptions.scala \
CoolParser.scala
SCALAHAND = CoolCompiler.scala
EXAMPLEDIR = ../examples
.PHONY: all clean src
src : ${SCALASRC}
all : ${SCALAGEN}
all : cool_symbol_implicit.class \
cool_tree_implicit.class \
cool_noinherit_semant_implicit.class \
cool_dynamic_semant_implicit.class
%.scala : ../%.aps
${APS2SCALA} ${APS2SCALAFLAGS} $*
cool-symbol.scala : ../cool-symbol.aps
${APS2SCALA} ${APS2SCALAFLAGS} --omit SYMBOL --omit gensym cool-symbol
%_implicit.class : %.scala
${SCALAC} ${SCALACFLAGS} $*.scala
cool_symbol_implicit.class : cool-symbol.scala cool-symbol.handcode.scala
${SCALAC} ${SCALACFLAGS} cool-symbol.scala cool-symbol.handcode.scala
cool_tree_implicit.class : cool-tree.scala cool_symbol_implicit.class
${SCALAC} ${SCALACFLAGS} cool-tree.scala
cool_noinherit_semant_implicit.class : cool-noinherit-semant.scala
${SCALAC} ${SCALACFLAGS} $<
cool_dynamic_semant_implicit.class : cool-dynamic-semant.scala
${SCALAC} ${SCALACFLAGS} $<
%.scala : RCS/%.scala,v
co $<
.PHONY: %.run
%.run : %.class
scala ${SCALAFLAGS} $*
.PHONY: %.compile
%.compile : %.scala
scalac ${SCALACFLAGS} $*.scala
.PHONY: %.semant
%.semant : ${EXAMPLEDIR}/%.cool Semant.class
scala ${SCALAFLAGS} CoolCompiler $<
.PHONY: %.debug
%.debug : ${EXAMPLEDIR}/%.cool Semant.class
scala ${SCALAFLAGS} CoolCompiler -s $<
COOLCOMPILERSCALA = \
cool-symbol.scala cool-symbol.handcode.scala cool-tree.scala \
cool-handcode.scala ${SCALACOPY} \
cool-dummy-semant-driver.scala ${SCALAHAND}
${SCALACOPY} :
echo "import cool_implicit._" | cat - ${COOLCOMPILERDIR}/$# > $#
CoolParser.scala :
echo "import cool_implicit._" | cat - ${COOLCOMPILERDIR}/$# > $#.tmp
sed 's/result.set_inheritablep(/t_Tree.s_inheritablep(result,/' \
< $#.tmp > $#
cool-parser-${SVERSION}.jar : ${COOLCOMPILERSCALA}
#rm -f *.class
${SCALAC} -deprecation ${SCALACFLAGS} ${COOLCOMPILERSCALA}
jar cvf $# *.class
install: cool-parser-${SVERSION}.jar
cp cool-parser-${SVERSION}.jar ../../lib/.
clean:
rm -f *.class ${SCALAGEN} ${SCALACOPY} *.jar
Error:
Makefile:79: warning: overriding recipe for target 'CoolParser.scala'
Makefile:76: warning: ignoring old recipe for target 'CoolParser.scala'
make: Nothing to be done for 'src'.
That is not an error: if it was an error the build would have failed. This build succeeded. In make error messages contain ***. This is just a warning about a weird thing in your makefile.
To understand it you just have to look at the lines in your makefile that make is complaining about, and read the message it printed.
You have this variable set:
SCALACOPY= basic.scala A2I.scala \
CoolTokens.scala CoolScanner.scala CoolOptions.scala \
CoolParser.scala
So this variable contains CoolParser.scala.
Next at Makefile line 76, you have this:
${SCALACOPY} :
echo "import cool_implicit._" | cat - ${COOLCOMPILERDIR}/$# > $#
This defines rules telling make how to build all the targets in the variable SCALACOPY, including CoolParser.scala.
Then at Makefile line 79, you have this:
CoolParser.scala :
echo "import cool_implicit._" | cat - ${COOLCOMPILERDIR}/$# > $#.tmp
sed 's/result.set_inheritablep(/t_Tree.s_inheritablep(result,/' \
< $#.tmp > $#
This tells make ANOTHER rule also to build CoolParser.scala, which you already provided a rule for; make will drop the first rule and use the second rule, but it will also give you a warning message telling you about it because this is very unusual and not usually what you want to do:
Makefile:79: warning: overriding recipe for target 'CoolParser.scala'
Makefile:76: warning: ignoring old recipe for target 'CoolParser.scala'
yesterday I wrote a Makefile to build a Programm which works fine.
Now, I try to build different build configurations.
What is the recommended way to build different configurations which differ in the list of source files and output paths?
I tried to use target specific variables...
Executables of the compiler toolchain.
COMPILER := ccrl
LINKER := rlink
ASSEMBLER := asrl
DEVICE_FILE := DR5F100LL.DVF
Compiler flags used to generate *.d files.
DFLAGS := \
-MM \
-MP \
-cpu=S2 \
-dev="$(DEVICE_FILE)" \
-no_warning_num=11179,11180 \
-g \
-Onothing
Compiler flags used to generate *.obj files from c source files.
CFLAGS := \
-cpu=S2 \
-c \
-dev="$(DEVICE_FILE)" \
-no_warning_num=11179,11180 \
-g \
-Onothing
Compiler flags used to generate *.obj files from assembler files.
ASMFLAGS := $(CFLAGS)
Linker flags
LDFLAGS := \
-library="${COMPILER_PATH}/lib/rl78cm4s.lib" \
-library="${COMPILER_PATH}/lib/rl78cm4r.lib" \
-library="./FFT_Library/libfft_rl78g13.lib" \
-nooptimize \
-entry=_start \
-security_id=00000000000000000000 \
-ocdbg=04 \
-user_opt_byte=EEFFE9 \
-debug \
-nocompress \
-memory=high \
-vectn=2=ffff \
-rom=.data=.dataR \
-rom=.sdata=.sdataR \
-nomessage \
-device="$(DEVICE_FILE)" \
-nologo \
-start=.const,.text,.RLIB,.SLIB,.textf,.constf,.data,.sdata/03000,.dataR,.bss/0F7F00,.sdataR,.sbss/0FFE20
Include directories
C_INCS := \
-I${COMPILER_PATH}/inc \
...
C source files used build the program.
C_SRCS_FFT_TEST := \
CodeGenerator/r_cg_cgc.c \
...
C_SRCS_HISTORY_TEST := \
CodeGenerator/r_cg_cgc.c \
...
C_SRCS_IOLINK_TEST := \
CodeGenerator/r_cg_cgc.c \
...
Assembler files used to build the program.
ASM_SRCS := \
...
Root directories of the build results.
OUT_ROOT_DIR := build
PUBLISH_ROOT_DIR := publish
.SECONDEXPANSION:
Name of the build configuration.
BUILD_CONFIG = Unknown
OUT_DIR =$(OUT_ROOT_DIR)/$(BUILD_CONFIG)
PUB_DIR =$(PUBLISH_ROOT_DIR)/$(BUILD_CONFIG)
Determine file paths of generated files.
OBJS = $(patsubst %.c,$(OUT_DIR)/%.obj,$(C_SRCS))
OBJS += $(patsubst %.asm,$(OUT_DIR)/%.obj,$(ASM_SRCS))
DEPS = $(OBJS:.obj=.d)
Filenames of the output files.
OUT_FILE = $(PUB_DIR)/MyFile.abs
MAP_FILE = $(OUT_DIR)/MyFile.map
.PHONY: build-definitions
build-definitions: fft-test history-test iolink-test
fft-test: BUILD_CONFIG=FFT_Test
fft-test: C_SRCS=$(C_SRCS_FFT_TEST)
.PHONY: fft-test
fft-test: $$(OUT_FILE)
history-test: BUILD_CONFIG=History_Test
history-test: C_SRCS=$(C_SRCS_HISTORY_TEST)
.PHONY: history-test
history-test:
#echo -e "Building $(BUILD_CONFIG)."
iolink-test: BUILD_CONFIG=IOLink_Test
iolink-test: C_SRCS=$(C_SRCS_IOLINK_TEST)
.PHONY: iolink-test
iolink-test:
#echo -e "Building $(BUILD_CONFIG)."
.PHONY: all
all: pre-build $(OUT_FILE) post-build
.PHONY: pre-build
pre-build:
#echo -e "Run pre-build target."
.PHONE: post-build
post-build:
#echo -e "Run post-build target."
.PHONY: clean
clean:
#echo -e "Run clean target."
#rm -f -v $(OUT_DIR)/LinkerSubCommand.tmp
#rm -f -v $(OBJS)
#rm -f -v $(DEPS)
#rm -f -v $(OUT_FILE)
#rm -f -v $(MAP_FILE)
How to build the dependency file from a c source file.
$(OUT_DIR)/%.d : %.c
#echo 'Building d file: $<'
#mkdir -p "$(dir $#)"
$(COMPILER) $(DFLAGS) $(C_INCS) -o "$(#:%.obj=%.d)" -MT="$#" -MT="$(#:%.obj=%.d)" "$<"
How to build the dependency file from an asm file.
$(OUT_DIR)/%.d : %.asm
#echo 'Building d file: $<'
#mkdir -p "$(dir $#)"
$(COMPILER) $(DFLAGS) $(C_INCS) -o "$(#:%.obj=%.d)" -MT="$#" -MT="$(#:%.obj=%.d)" "$<"
How to build the object file from a c source file.
$(OUT_DIR)/%.obj : %.c
#echo 'Building obj file: $<'
#mkdir -p "$(dir $#)"
$(COMPILER) $(CFLAGS) $(C_INCS) -o "$#" "$<"
#echo -e $(#:%=-input=\"%\") >> $(OUT_DIR)/LinkerSubCommand.tmp
How to build the object file from an asm file.
$(OUT_DIR)/%.obj : %.asm
#echo 'Building asm file: $<'
#mkdir -p "$(dir $#)"
$(COMPILER) $(CFLAGS) $(C_INCS) -o "$#" "$<"
#echo -e $(#:%=-input=\"%\") >> $$(OUT_DIR)/LinkerSubCommand.tmp
#
$(OBJ): %.obj: %.c $(DEPS)
How to build the output file from all object files.
%.abs : $(OBJS)
#echo -e "Building $(BUILD_CONFIG)."
#echo -e "The output directory is $(OUT_DIR)."
#echo -e "The publish directory is $(PUB_DIR)."
#echo -e "The source files are $(C_SRCS)."
#echo -e "The assembler files are $(ASM_SRCS)."
#echo -e "The generated object files are $(OBJS)."
#echo -e "Building output file is $#."
#mkdir -p "$(PUB_DIR)"
#mkdir -p "$(OUT_DIR)"
$(LINKER) $(LDFLAGS) -subcommand="$(OUT_DIR)/LinkerSubCommand.tmp" -list="$(MAP_FILE)" -output="$(OUT_FILE)"
I know that I should use private as scope of the target specific variables but than I have to download/compile a newer make Version...
I would like to know the recommended way to build such configurations.
Maybe someone can provide a simple (and complete) example?
Thanks a lot!
Michael
Makefile:
ifeq ($(config), debug)
CFLAGS := -DDEBUG -g
OUT_PATH := ./build/debug/
else ifeq ($(config), light_debug)
CFLAGS := -g
OUT_PATH := ./build/light_debug/
else #release config by default
OUT_PATH := ./build/release
endif
#...
Then make invokation is like this:
make confg=debug
or
make config=light_debug
or
make config=release
I got a directory where store my project assets, say:
+-- assets
| +-- styles
| | +-- child
| | | +-- child.css
| | +-- main.css
| +-- font.ttf
| +-- image.png
As you can see, they are several file types (this is only a sample, may have many more types) and the tree depth may vary.
How can i copy all this files into a single (flat) location? Something like this:
+-- assets
| +-- child.css
| +-- font.ttf
| +-- image.png
| +-- main.css
I tried use pattern rules but i'm pretty new in GNU Make, so nothing seems to work.
I got the recursive list of source files using the Bash globstar functionality, and modify it by Make's string manipulation functions:
BR_ASSETS := /home/user/project/assets/
BR_APP_ASSETS := /home/user/project/build/assets/
SOURCES := $(shell ls $(BR_ASSETS)**/*.*)
TARGETS := $(addprefix $(BR_APP_ASSETS),$(notdir $(SOURCES)))
What next?
Many thanks in advance.
all:
.PHONY: all
BR_ASSETS := /home/user/project/assets/
BR_APP_ASSETS := /home/user/project/build/assets/
SOURCES := $(shell find $(BR_ASSETS) -type f)
$(info SOURCES=$(SOURCES))
TARGETS := $(addprefix $(BR_APP_ASSETS),$(notdir $(SOURCES)))
# Generate rules to map sources into targets
$(foreach s,$(SOURCES),$(foreach t,$(filter %$(notdir $s),$(TARGETS)),$(info New rule: $t: $s)$(eval $t: $s)))
# All targets have the same recipe.
$(TARGETS):; $(if $(wildcard $(#D)),,mkdir -p $(#D) &&) cp $^ $#
all: $(TARGETS)
clean:; rm -rf $(BR_APP_ASSETS)
.PHONY: clean
Environment before running this Makefile:
$ find /home/user/project
/home/user/project
/home/user/project/assets
/home/user/project/assets/font.ttf
/home/user/project/assets/img.png
/home/user/project/assets/styles
/home/user/project/assets/styles/child
/home/user/project/assets/styles/child/child.css
/home/user/project/assets/styles/main.css
/home/user/project/build
Run this Makefile:
$ make -f Makefile.sample
SOURCES=/home/user/project/assets/font.ttf /home/user/project/assets/img.png /home/user/project/assets/styles/child/child.css /home/user/project/asset
s/styles/main.css
New rule: /home/user/project/build/assets/font.ttf: /home/user/project/assets/font.ttf
New rule: /home/user/project/build/assets/img.png: /home/user/project/assets/img.png
New rule: /home/user/project/build/assets/child.css: /home/user/project/assets/styles/child/child.css
New rule: /home/user/project/build/assets/main.css: /home/user/project/assets/styles/main.css
mkdir -p /home/user/project/build/assets && cp /home/user/project/assets/font.ttf /home/user/project/build/assets/font.ttf
cp /home/user/project/assets/img.png /home/user/project/build/assets/img.png
cp /home/user/project/assets/styles/child/child.css /home/user/project/build/assets/child.css
cp /home/user/project/assets/styles/main.css /home/user/project/build/assets/main.css
Environment after running this Makefile:
$ find /home/user/project
/home/user/project
/home/user/project/assets
/home/user/project/assets/font.ttf
/home/user/project/assets/img.png
/home/user/project/assets/styles
/home/user/project/assets/styles/child
/home/user/project/assets/styles/child/child.css
/home/user/project/assets/styles/main.css
/home/user/project/build
/home/user/project/build/assets
/home/user/project/build/assets/child.css
/home/user/project/build/assets/font.ttf
/home/user/project/build/assets/img.png
/home/user/project/build/assets/main.css
I have a repository structure where dependencies can either be svn:external'd either in this repository or in a super-repository which has svn:external'd this one. The externals are only one level deep and so if my repo is externalized by a super-repository, then I need to be able to detect where to find the dependency at a higher level, and copy over all relevant data. If the dependency is indeed found in my own repository, then I need to build it.
I am having problems creating my makefile recipe to do this. Here is what I have so far:
DEPENDENCIES = dep1 dep2
ROOTDIR = .
deps :
for dep in $(DEPENDENCIES); do \
if [ -e $(ROOTDIR)/ext/$$dep ]; then \
depdir = $(ROOTDIR)/ext/$$dep; \
$(MAKE) -C $depdir; \
elif [ -e $(ROOTDIR)/../$$dep ]; then \
depdir = $(ROOTDIR)/../$$dep; \
else \
$(error Could not find dependency: $$dep) \
fi \
cp $$depdir/bin/* $(ROOTDIR)/bin; \
cp $$depdir/lib/* $(ROOTDIR)/lib; \
cp $$depdir/inc/$$dep $(ROOTDIR)/inc/$$dep; \
done
First problem is the $(error ) line. I'd like to be able to throw an error, but this is clearly not subjected to the bash condition statements. This is the output:
$ make deps
makefile:108: *** Could not find dependency: $dep. Stop.
If I comment out that else statement, then I'm still having troubles
$ make deps
for dep in dep1 dep2; do \
if [ -e ./ext/$dep ]; then \
/bin/sh: -c: line 2: syntax error: unexpected end of file
make: *** [makefile:106: deps] Error 1
Could someone provide some hints regarding how to accomplish this? I'm running GNU make in both cygwin and linux environments.
Edit: I'd really prefer to keep this as close to make as possible (and as little shell stuff). I think I've gotten a little closer, but still need to repeat this for each item in $(DEPENDENCIES).
DEPENDENCIES = foo bar
ROOTDIR = .
EXTDIR = $(ROOTDIR)/ext
BINDIR = $(ROOTDIR)/bin
INCDIR = $(ROOTDIR)/inc
# Need a foreach DEP in $(DEPENDENCIES) here
ifneq("$(wildcard $(EXTDIR)/$(DEP))","")
DEPDIR = $(EXTDIR)/$(DEP)
BUILDDEP = $(MAKE) -C $(DEPDIR)/build
else ifneq("$(wildcard $(ROOTDIR)../$(dep))", "")
DEPDIR = $(ROOTDIR)/../$(dep)
else
$(error Could not find dependency: $(DEP))
endif
$(DEPDIR) :
$(BUILDDEP)
cp $(DEPDIR)/bin/* $(BINDIR)
cp $(DEPDIR)/inc/$(DEP)/* $(INCDIR)/$(DEP)
Edit2:
I think I'm getting closer. The following looks more like what I want, but it still have problems:
1) I don't know how to call each recipe
2) It doesn't give an error if it doesn't find all dependencies
3) It doesn't let me dictate the build order
4) It doesn't let me filter to use only folders listed in dependencies (it does all folders)
ifneq "$(wildcard $(EXTDIR)/%/build)" ""
$(EXTDIR)/%:
$(MAKE) -C $(EXTDIR)/%/build
cp $(EXTDIR)/%/bin/* $(BINDIR)
cp $(EXTDIR)/%/int/*.a $(INTDIR)
cp $(EXTDIR)/%/inc/%/* $(INCDIR)/%
endif
ifneq "$(wildcard $(ROOTDIR)/../%/build)" ""
DEPDIR = $(ROOTDIR)/..
$(DEPDIR)/%:
cp $(DEPDIR)/%/bin/* $(BINDIR)
cp $(DEPDIR)/%/int/*.a $(INTDIR)
cp $(DEPDIR)/%/inc/%/* $(INCDIR)/%
endif
Edit3
After being told I was trying to solve too many problems at once, I've reduced it to this:
DEPENDENCIES = dep1 dep2 dep3
for each DEP in $(DEPENDENCIES)
$(DEP) :
$(MAKE) -C ../ext/$(DEP)
How can I create a recipe ($(DEP) ) for each item in $(DEPENDENCIES)?
Solved. This solves the problem above:
DEPENDENCIES = dep1 dep2 dep3
$(DEPENDENCIES) :
$(MAKE) -C ../ext/$#
The answer is very simple. I wish I knew enough about this stuff to ask a more legible question.
I have go to some reasonable stage with my first VPI project, which is intended
to aid digital filter design. At the moment I was working with Icarus, though
I'd like to test Verilator too and other simulator as some point.
So far I have this makefile, though this is intended to build the C code and
one simple testbench. I'd like to be able to include a makefile and build/simulate
different new Verilog projects.
I haven't found much example of Makefiles for HDL projects on the net.
I'm quite happy with my implementation to some extend and can carry-on
rolling my own, though would like to see any well organised larger scale
projects. I have't yet looked at the Makefiles in OpenRISC ...
An example that I'm really looking for is of VPI testbench project, e.g. you
have done your VPI code and now want to build a small ecosystem around it
using a hierarchy of Makefiles.
Let's say, we are taking just two simulators - Icarus and Verilator.
This seems to be a vary basic makefile. In our makefiles we have usually far more targets which also include the synthesis, par and simulation. Sadly they contain very vendor specific (Xilinx & Synopsys) stuff, which make it not very generic. Also we usually have a hierarchy of makefiles. We have a general, some module specifics, and also some subprojects (e.g. the memorysystem) specific.
But in case you are interrested I post one here, to give you an impression how one could look like:
.PHONY: default
default: rtlsim
.PHONY: help
help:
#echo "Syntax:"
#echo "-------"
#echo "make [make_target] [options]"
#echo ""
#echo "Arguments:"
#echo "----------"
#echo "make_target = [bits], timing, rtlsim, rtlsimgui, laysim, laysimgui"
#echo " bits: Generate bitstream (includes P&R)"
#echo " timing: Generate timing report using timing analyzer (includes P&R)"
#echo " rtlsim: VCS RTL simulation (text mode)"
#echo " rtlsimgui: VCS RTL simulation (interactive gui mode)"
#echo " laysim: VCS post-place-and-route simulation (text mode)"
#echo " laysimgui: VCS post-place-and-route simulation (interactive gui mode)"
#echo ""
#echo "Options:"
#echo "----------"
#echo "target = [ml507], ml310"
#echo " ml507: Use Virtex-5 xc5vfx70t-1 as target FPGA (Xilinx ML507)"
#echo " ml310: Use Virtex-II Pro xc2vp30-6 as target FPGA (Xilinx ML310)"
#echo "disregard_cache_stalls = [0], 1"
#echo " 0: for normal simulation"
#echo " 1: to disregard cache stalls (results may then be incorrect, but the simulation time without cache stalls is obtained)"
#echo "physical_synthesis = [0], 1"
#echo " 0: run Synplify without physical synthesis"
#echo " 1: run Synplify with physical synthesis"
#echo "BATCH_GUI = [default], GUI"
#echo " default: run Synplify in batch mode"
#echo " GUI: start Synplify GUI instead"
#echo "toplevel = [fpga], datapath, sequencer, hw_kernel, user, plb_marc, mci_marc"
#echo " Sets the toplevel file in the HW design hierarchy; relevant for area / timing reports"
#echo "marc = [1], 2"
#echo " Chooses between usage of MARC1 and MARC2 (use the latter for 256 bit LPU transfers)"
# defaults
ifndef target
target=ml507
endif
ifndef toplevel
toplevel=fpga
endif
ifndef disregard_cache_stalls
disregard_cache_stalls=0
endif
ifndef marc
marc=1
endif
ifeq "$(target)" "ml507"
TECHNOLOGY_NAME=VIRTEX5
TECHNOLOGY_PART=XC5VFX70T
TECHNOLOGY_PACKAGE=FF1136
TECHNOLOGY_SPEED_GRADE=-1
FREQUENCY=100.000
else
TECHNOLOGY_NAME=VIRTEX2P
TECHNOLOGY_PART=XC2VP30
TECHNOLOGY_PACKAGE=FF896
TECHNOLOGY_SPEED_GRADE=-6
FREQUENCY=100.000
endif
ifndef physical_synthesis
physical_synthesis=0
endif
ifndef BATCH_GUI
BATCH_GUI=default
endif
ifeq "$(BATCH_GUI)" "default"
BATCH_TCL=batch
else
BATCH_TCL=tcl
endif
ifdef area_timing_result_file
AREA_TIMING_RESULT_FILE=$(area_timing_result_file)
else
AREA_TIMING_RESULT_FILE=area_timing_results.$(target).$(toplevel).txt
endif
ifeq ($(disregard_cache_stalls),1)
DISREGARD_CACHE_STALLS=+define+DISREGARD_CACHE_STALLS
else
DISREGARD_CACHE_STALLS=
endif
# base directory for MARC, SimEnv, AddOns, etc.
ifeq "$(target)" "ml507"
PRAKTIKUM_BASE=$(COMRADE_ROOT_DIR)/COMRADE/sim_synth/v5
else
PRAKTIKUM_BASE=$(COMRADE_ROOT_DIR)/COMRADE/sim_synth/v2p
endif
BRAM_VERILOG=$(COMRADE_ROOT_DIR)/COMRADE/sim_synth/platform_independent/bram
# command to get the directory of the current test example,
# relative to Comrade's "tests" directory
TEST_EXAMPLE=$(shell pwd | sed 's/.*tests\///g' | sed 's/\/sim_env_acem3//g')
# name of target RC executable
PROG=main
# Modlib path
MODLIB=$(COMRADE_ROOT_DIR)/modlib
# path to the instantiated verilog modules
MODULES=..
# path to the instantiated verilog blackboxes
BLACKBOXES=../blackboxes
ifeq "$(target)" "ml507"
DESIGN=user.v mci_marc.tcl
else
DESIGN=user.v plb_marc.tcl
endif
# base name of synthesis-related files
ifeq "$(target)" "ml507"
NETLIST=mci_marc
else
NETLIST=plb_marc
endif
# base name of toplevel after synthesis
TOPLEVEL=system
# current directory (which is in some cases != $(PWD)...)
CURRENT_DIR=$(shell pwd)
# "HOME" on local /scratch
SCRHOME=/scratch/$(USER)/private/tmp/$(TEST_EXAMPLE)
# directory containing MARC
ifeq ($(marc),2)
MARC=$(PRAKTIKUM_BASE)/MARC_marc2
else
MARC=$(PRAKTIKUM_BASE)/MARC
endif
# directory containing the simulation environment
ifeq ($(marc),2)
SIMENV=$(PRAKTIKUM_BASE)/SimEnv_marc2
else
SIMENV=$(PRAKTIKUM_BASE)/SimEnv
endif
# directory containing additional files (IP cores, SW, ...)
ifeq ($(marc),2)
ADDONS=$(PRAKTIKUM_BASE)/AddOns_marc2
else
ADDONS=$(PRAKTIKUM_BASE)/AddOns
endif
# ML310 Linux kernel image
VMLINUX=$(ADDONS)/zImage.elf
# TTY for serial console
CONSOLETTY=/dev/ttyS0
# path to xilinx's simulation primitives
SIMPRIMS=$(XILINX)/verilog/src/simprims
UNISIMS=$(XILINX)/verilog/src/unisims
# RC definitions
ifeq "$(target)" "ml507"
DEVICE=xc5vfx70t
PARTTYPE=$(DEVICE)-ff1136-1
DEVDES=$(TOPLEVEL)-$(DEVICE)
else
DEVICE=xc2vp30
PARTTYPE=$(DEVICE)-ff896-6
DEVDES=$(TOPLEVEL)-$(DEVICE)
endif
# this is the name of synplify target subdirectory
IMPL=Simple.$(target).fpga
# configuration files for $(VIRSIM)
CFGRTL=default-rtl
VPDRTL=$(SCRHOME)/vcdplus-rtl-$(notdir $(PWD))
CFGLAY=default-lay
VPDLAY=$(SCRHOME)/vcdplus-lay-$(notdir $(PWD))
CFGSYN=default-syn
VPDSYN=$(SCRHOME)/vcdplus-syn-$(notdir $(PWD))
MDIRRTL=csrc.rtl
MDIRLAY=csrc.lay
MDIRSYN=csrc.syn
# path to the cross OS installation directory
#CROSS=/acs/ace/rtems
#CROSS=/images/ml310/ml310_rootfs_gentoo
CROSS=/cad/tools/acs-prak/ACS07/Cross
#CROSSBIN=$(CROSS)/bin
CROSSBIN=/cad/tools/crosscompiler/powerpc-405-linux/bin
# the RTEMS/ACE2 IO server
SERVER=$(CROSSBIN)/rtemsserver -l
# the compile-flow tools
#CC=$(CROSSBIN)/sparc-rtems-gcc
CC=$(CROSSBIN)/powerpc-405-linux-gnu-gcc
#LD=$(CROSSBIN)/sparc-rtems-gcc
LD=$(CROSSBIN)/powerpc-405-linux-gnu-gcc
COPY=$(CROSSBIN)/sparc-rtems-objcopy
BIT2O=$(CROSSBIN)/bit2o
VPP=vpp
SED=sed
XC=xc
ifeq ($(SYNPLIFY_VERSION),8.8)
SYNPLIFY=synplify_pro
else
SYNPLIFY=synplify_premier_dp
endif
NGDBUILD=ngdbuild
MAP=map
PAR=par
NETGEN=netgen
BITGEN=bitgen
TRCE=trce
IMPACT=impact
XMD=xmd
VCS=vcs
SIMVRTL=simv.rtl
SIMVLAY=simv.lay
SIMVSYN=simv.syn
VIRSIM=virsim
XPOWER=xpwr
# the compile options
#CCOPTS=-fasm -specs bsp_specs -qrtems -O3 -I include -I $(CROSS)/sparc-rtems/include/rtems-ace2
CCOPTS=-O3 -I $(CROSS)/usr/include
#LDOPTS=-fasm -specs bsp_specs -qrtems -O3
LDOPTS=-O3
COPYOPTS=-O binary
SYNPLIFYOPTS=$(filter %.tcl,$(DESIGN))
NGDBUILDOPTS=-uc $(ADDONS)/$(TOPLEVEL).ucf -sd $(ADDONS) -sd $(MODLIB) -sd $(MODLIB)/$(target)
MAPOPTS=-pr b -detail -timing -ol high -xe c -w
PAROPTS=-ol high -xe c -w
BITGENOPTS=
TRCEOPTS=-v 10
TRCEOPTS_HG=-v 10 -u 10
VCSOPTS=+v2k +notimingchecks -y . -y .. -y $(MARC) +incdir+$(MARC) -y $(SIMENV) +incdir+$(SIMENV) -y $(ADDONS) +incdir+$(ADDONS) -y $(MODLIB) +incdir+$(MODLIB) -y $(BRAM_VERILOG) +incdir+$(BRAM_VERILOG) $(DISREGARD_CACHE_STALLS)
# Don't change these
ifeq ($(target),ml507)
ifeq ($(disregard_cache_stalls),1)
VCSRTLOPTS=+define+TESTBENCH=testbench_rtl -v ../simdefs.v -v $(UNISIMS)/../glbl.v $(VCSOPTS) -y $(UNISIMS) -y $(SIMPRIMS) +libext+.v $(SIMENV)/testbench_rtl.v
else
VCSRTLOPTS=+define+TESTBENCH=testbench_rtl -v ../simdefs.v -v marc.v -v $(SIMENV)/ppc440.v -v $(SIMENV)/temac.v -v $(UNISIMS)/../glbl.v $(VCSOPTS) -y $(UNISIMS) -y $(SIMPRIMS) +libext+.v $(SIMENV)/testbench_rtl.v
endif
VCSSYNOPTS=+define+TESTBENCH=testbench_syn -v ../simdefs.v -v $(SIMENV)/ppc440.v -v $(SIMENV)/temac.v -v $(IMPL)/$(NETLIST).vm -v $(UNISIMS)/../glbl.v $(VCSOPTS) -y $(UNISIMS) -y $(SIMPRIMS) +libext+.v $(SIMENV)/testbench_syn.v
VCSLAYOPTS=+define+TESTBENCH=testbench_lay -v ../simdefs.v -v $(SIMENV)/ppc440.v -v $(IMPL)/$(DEVDES).v -v $(SIMPRIMS)/../glbl.v $(VCSOPTS) -y $(SIMPRIMS) +libext+.v $(SIMENV)/testbench_lay.v
else
ifeq ($(disregard_cache_stalls),1)
VCSRTLOPTS=+define+TESTBENCH=testbench_rtl -v ../simdefs.v -v $(UNISIMS)/../glbl.v $(VCSOPTS) -y $(UNISIMS) -y $(SIMPRIMS) +libext+.v $(SIMENV)/testbench_rtl.v
else
VCSRTLOPTS=+define+TESTBENCH=testbench_rtl -v ../simdefs.v -v marc.v -v $(SIMENV)/ppc405.v -v $(UNISIMS)/../glbl.v $(VCSOPTS) -y $(UNISIMS) -y $(SIMPRIMS) +libext+.v $(SIMENV)/testbench_rtl.v
endif
VCSSYNOPTS=+define+TESTBENCH=testbench_syn -v ../simdefs.v -v $(SIMENV)/ppc405.v -v $(IMPL)/$(NETLIST).vm -v $(UNISIMS)/../glbl.v $(VCSOPTS) -y $(UNISIMS) -y $(SIMPRIMS) +libext+.v $(SIMENV)/testbench_syn.v
VCSLAYOPTS=+define+TESTBENCH=testbench_lay -v ../simdefs.v -v $(SIMENV)/ppc405.v -v $(IMPL)/$(DEVDES).v -v $(SIMPRIMS)/../glbl.v $(VCSOPTS) -y $(SIMPRIMS) +libext+.v $(SIMENV)/testbench_lay.v
endif
# make rules
default: all
.c.o:
$(CC) -c $(CCOPTS) $<
$(PROG).exe: $(PROG).o $(DEVDES).o
$(LD) -o $(PROG).exe $(PROG).o $(DEVDES).o $(LDOPTS) $(CROSS)/sparc-rtems/lib/libacevapi.a -lm
$(PROG).bin: $(PROG).exe
$(COPY) $(COPYOPTS) $(PROG).exe $(PROG).bin
$(PROG): $(PROG).o
$(LD) -o $(PROG) $(PROG).o $(LDOPTS) $(CROSS)/usr/lib/libadmxrc2.so.2
# build hardware objects
#$(SIMENV)/%.v: $(ADDONS)/%.ngc
# $(NETGEN) -w -sim -ofmt verilog $< $#
# rm $(basename $#).nlf
$(DEVDES).o: $(IMPL)/$(DEVDES).o
cp $(IMPL)/$(DEVDES).o .
$(IMPL)/$(DEVDES).o: $(IMPL)/$(DEVDES).bit
cd $(IMPL); \
$(BIT2O) $(DEVDES).bit $(DEVDES).o config_$(TOPLEVEL) ;\
cd ..
$(VPDRTL).vpd: $(MARC)/*.v marc.v $(SIMENV)/*.v $(patsubst $(ADDONS)/%.ngc,$(SIMENV)/%.v,$(wildcard $(ADDONS)/*.ngc)) $(filter %.v,$(DESIGN))
mkdir -p -m 700 $(dir $(VPDRTL))
$(VCS) -line -PP +define+BATCH -Mupdate -Mdir=$(MDIRRTL) -o $(SIMVRTL) $(VCSRTLOPTS)
./$(SIMVRTL) +vpddrivers +vpdfile+$(VPDRTL).vpd
$(VPDLAY).vpd: $(SIMENV)/*.v $(IMPL)/$(DEVDES).v
mkdir -p -m 700 $(dir $(VPDLAY))
$(VCS) -line -PP +define+BATCH -Mupdate -Mdir=$(MDIRLAY) -o $(SIMVLAY) $(VCSLAYOPTS)
./$(SIMVLAY) +vpddrivers +vpdfile+$(VPDLAY).vpd
$(VPDSYN).vpd: $(SIMENV)/*.v $(patsubst $(ADDONS)/%.ngc,$(SIMENV)/%.v,$(wildcard $(ADDONS)/*.ngc)) $(IMPL)/$(NETLIST).vm
mkdir -p -m 700 $(dir $(VPDSYN))
$(VCS) -line -PP +define+BATCH -Mupdate -Mdir=$(MDIRSYN) -o $(SIMVSYN) $(VCSSYNOPTS)
./$(SIMVSYN) +vpddrivers +vpdfile+$(VPDSYN).vpd
$(IMPL)/$(DEVDES).v: $(IMPL)/$(DEVDES).ncd
cd $(IMPL); \
$(NETGEN) -w -sim -ofmt verilog -sdf_path ../$(IMPL)/$(DEVDES).sdf $(DEVDES) -pcf $(DEVDES).pcf; \
$(SED) -i -e 's/SIM_COLLISION_CHECK = "ALL"/SIM_COLLISION_CHECK = "GENERATE_X_ONLY"/g' $(DEVDES).v ;\
cd ..
$(IMPL)/$(DEVDES).hg.twr: $(IMPL)/$(DEVDES).ncd
cd $(IMPL); \
$(TRCE) $(TRCEOPTS_HG) $(DEVDES).ncd ;\
mv $(DEVDES).twr $(DEVDES).hg.twr
cd ..
$(IMPL)/$(DEVDES).twr: $(IMPL)/$(DEVDES).ncd
cd $(IMPL); \
$(TRCE) $(TRCEOPTS) $(DEVDES).ncd ;\
cd ..
$(IMPL)/$(DEVDES).bit: $(IMPL)/$(DEVDES).ncd
cd $(IMPL); \
$(BITGEN) -w $(BITGENOPTS) $(DEVDES) $(DEVDES);\
cd ..
$(IMPL)/$(DEVDES).ncd: $(IMPL)/$(DEVDES)_map.ncd
cd $(IMPL); \
$(PAR) $(PAROPTS) $(DEVDES)_map.ncd $(DEVDES).ncd $(DEVDES).pcf ;\
cd ..
$(IMPL)/$(DEVDES)_map.ncd: $(IMPL)/$(DEVDES).ngd
cd $(IMPL); \
XIL_TIMING_ALLOW_IMPOSSIBLE=1 $(MAP) $(MAPOPTS) -o $(DEVDES)_map.ncd $(DEVDES).ngd $(DEVDES).pcf ; \
cd ..
$(IMPL)/$(DEVDES).ngd: $(IMPL)/$(NETLIST).edf $(wildcard $(ADDONS)/*.ngc) $(wildcard $(ADDONS)/*.edf)
cd $(IMPL); \
$(NGDBUILD) $(NGDBUILDOPTS) -p $(PARTTYPE) $(TOPLEVEL) $(DEVDES).ngd; \
cd ..
$(IMPL)/$(NETLIST).edf $(IMPL)/$(NETLIST).vm: $(MARC)/*.v marc.v $(wildcard $(ADDONS)/*.v) $(filter %.v,$(DESIGN)) $(filter %.tcl,$(DESIGN))
DESIGN=$(CURRENT_DIR) IMPL=$(IMPL) NETLIST=$(NETLIST) MARC=$(MARC) \
ADDONS=$(ADDONS) MODULES=$(MODULES) MODLIB=$(MODLIB) BRAM_VERILOG=$(BRAM_VERILOG) BLACKBOXES=$(BLACKBOXES) \
TECHNOLOGY_NAME=$(TECHNOLOGY_NAME) TECHNOLOGY_PART=$(TECHNOLOGY_PART) \
TECHNOLOGY_PACKAGE=$(TECHNOLOGY_PACKAGE) TECHNOLOGY_SPEED_GRADE=$(TECHNOLOGY_SPEED_GRADE) \
FREQUENCY=$(FREQUENCY) PHYSICAL_SYNTHESIS=$(physical_synthesis) \
BATCH_GUI=$(BATCH_GUI) $(SYNPLIFY) -$(BATCH_TCL) $(SYNPLIFYOPTS)
# if link_marcdefs_v_$(target)_created does not exist, the marcdefs.v link is (re-)created
link_marcdefs_v_$(target)_created:
-rm -f link_marcdefs_v_ml310_created link_marcdefs_v_ml507_created 2>/dev/null
#touch link_marcdefs_v_$(target)_created
marcdefs.v: marcdefs.$(target).v link_marcdefs_v_$(target)_created
-rm -f marcdefs.v 2>/dev/null
ln -s marcdefs.$(target).v marcdefs.v
#touch marcdefs.v
marc.v: $(MARC)/marc.vpp marcdefs.v
$(VPP) $(MARC)/marc.vpp > marc.v 2>/dev/null
.PHONY: all
all: $(PROG) bits
#echo -e "OK, ML310 Linux executable for $(PROG) built. Run it using \n\tmake linux\nand after logging in, execute \n\t$(SCRHOME)/$(PROG)"
.PHONY: rtlsimbatch
rtlsimbatch: $(VPDRTL).vpd
$(VIRSIM) +define+RTLSIM +vpdfile+$(VPDRTL).vpd +cfgfile+$(CFGRTL).cfg $(VCSRTLOPTS)
.PHONY: rtlsimgui
ifeq ($(disregard_cache_stalls),1)
rtlsimgui: $(MARC)/*.v ../simdefs.v ../stimulus.v $(SIMENV)/*.v $(filter %.v,$(DESIGN))
mkdir -p -m 700 $(dir $(VPDRTL))
$(VCS) -line -RI -Mupdate -Mdir=$(MDIRRTL) -o $(SIMVRTL) +define+RTLSIM +vpdfile+$(VPDRTL).vpd +cfgfile+$(CFGRTL).cfg $(VCSRTLOPTS)
else
rtlsimgui: $(MARC)/*.v ../simdefs.v ../stimulus.v marc.v $(SIMENV)/*.v $(patsubst $(ADDONS)/%.ngc,$(SIMENV)/%.v,$(wildcard $(ADDONS)/*.ngc)) $(filter %.v,$(DESIGN))
mkdir -p -m 700 $(dir $(VPDRTL))
$(VCS) -line -RI -Mupdate -Mdir=$(MDIRRTL) -o $(SIMVRTL) +define+RTLSIM +vpdfile+$(VPDRTL).vpd +cfgfile+$(CFGRTL).cfg $(VCSRTLOPTS)
endif
.PHONY: rtlsim
ifeq ($(disregard_cache_stalls),1)
rtlsim: marcdefs.v ../simdefs.v ../stimulus.v $(SIMENV)/*.v $(filter %.v,$(DESIGN))
mkdir -p -m 700 $(dir $(VPDRTL))
$(VCS) -line -PP -Mupdate -Mdir=$(MDIRRTL) -o $(SIMVRTL) +define+RTLSIM +vpdfile+$(VPDRTL).vpd +cfgfile+$(CFGRTL).cfg $(VCSRTLOPTS)
./$(SIMVRTL)
else
rtlsim: $(MARC)/*.v ../simdefs.v ../stimulus.v marc.v $(SIMENV)/*.v $(patsubst $(ADDONS)/%.ngc,$(SIMENV)/%.v,$(wildcard $(ADDONS)/*.ngc)) $(filter %.v,$(DESIGN))
mkdir -p -m 700 $(dir $(VPDRTL))
$(VCS) -line -PP -Mupdate -Mdir=$(MDIRRTL) -o $(SIMVRTL) +define+RTLSIM +vpdfile+$(VPDRTL).vpd +cfgfile+$(CFGRTL).cfg $(VCSRTLOPTS)
./$(SIMVRTL)
endif
.PHONY: laysimbatch
laysimbatch: $(VPDLAY).vpd
$(VIRSIM) +vpdfile+$(VPDLAY).vpd +cfgfile+$(CFGLAY).cfg $(VCSLAYOPTS)
.PHONY: laysimgui
laysimgui: $(SIMENV)/*.v $(IMPL)/$(DEVDES).v
mkdir -p -m 700 $(dir $(VPDLAY))
$(VCS) -line -RI -Mupdate -Mdir=$(MDIRLAY) -o $(SIMVLAY) +vpdfile+$(VPDLAY).vpd +cfgfile+$(CFGLAY).cfg $(VCSLAYOPTS)
.PHONY: laysim
laysim: $(SIMENV)/*.v ../simdefs.v ../stimulus.v $(IMPL)/$(DEVDES).v
mkdir -p -m 700 $(dir $(VPDLAY))
$(VCS) -line -PP -Mupdate -Mdir=$(MDIRLAY) -o $(SIMVLAY) +vpdfile+$(VPDLAY).vpd +cfgfile+$(CFGLAY).cfg $(VCSLAYOPTS)
./$(SIMVLAY)
.PHONY: synsimbatch
synsimbatch: $(VPDSYN).vpd
$(VIRSIM) +vpdfile+$(VPDSYN).vpd +cfgfile+$(CFGSYN).cfg $(VCSSYNOPTS)
.PHONY: synsim
synsim: $(SIMENV)/*.v ../simdefs.v ../stimulus.v $(patsubst $(ADDONS)/%.ngc,$(SIMENV)/%.v,$(wildcard $(ADDONS)/*.ngc)) $(IMPL)/$(NETLIST).vm
mkdir -p -m 700 $(dir $(VPDSYN))
$(VCS) -line -RI -Mupdate -Mdir=$(MDIRSYN) -o $(SIMVSYN) +vpdfile+$(VPDSYN).vpd +cfgfile+$(CFGSYN).cfg $(VCSSYNOPTS)
.PHONY: timing
ifeq "$(physical_synthesis)" "1"
# Synplify creates .edf, .ncd and .twr in one call!
timing: $(IMPL)/$(NETLIST).edf
cat $(IMPL)/par_1/$(NETLIST).twr
$(COMRADE_ROOT_DIR)/COMRADE/scripts/XilinxReportReader/xrr $(TECHNOLOGY_NAME) \
$(IMPL)/par_1/$(NETLIST)_map.mrp $(IMPL)/par_1/$(NETLIST).twr >$(AREA_TIMING_RESULT_FILE)
else
# Create only .edf by Synplify, rest using Makefile
timing: $(IMPL)/$(DEVDES).twr
cat $(IMPL)/$(DEVDES).twr
$(COMRADE_ROOT_DIR)/COMRADE/scripts/XilinxReportReader/xrr $(TECHNOLOGY_NAME) \
$(IMPL)/$(DEVDES)_map.mrp $(IMPL)/$(DEVDES).twr >$(AREA_TIMING_RESULT_FILE)
endif
# create .vcd from .vpd for power analysis
$(VPDLAY).vcd: $(VPDLAY).vpd
vpd2vcd $(VPDLAY).vpd $(VPDLAY).vcd
# create .xad from .vcd for power analysis
$(VPDLAY).xad: $(VPDLAY).vcd
/cad/tools/ise-9.2/bin/lin/vcd2xad.pl -f $(VPDLAY).vcd
# create .saif from .vcd
$(VPDLAY).saif: $(VPDLAY).vcd
vcd2saif -i $(VPDLAY).vcd -o $(VPDLAY).saif
# power analysis
.PHONY: power
power: $(IMPL)/$(DEVDES).ncd $(VPDLAY).saif
$(XPOWER) -v -a $(IMPL)/$(DEVDES).ncd $(IMPL)/$(DEVDES).pcf -s $(VPDLAY).vcd
#echo "Power results written to file \"$(IMPL)/$(DEVDES).pwr\"."
# area results
.PHONY: area
area: $(IMPL)/$(DEVDES)_map.ncd
.PHONY: area_all
area_all:
# V2P
make area_datapath toplevel=datapath
make area_sequencer toplevel=sequencer
make area_hw_kernel toplevel=hw_kernel
make area_plb_marc toplevel=plb_marc
make area
# V5
make area_datapath toplevel=datapath target=ml507
make area_sequencer toplevel=sequencer target=ml507
make area_hw_kernel toplevel=hw_kernel target=ml507
.PHONY: timing_all
timing_all:
# V2P
make timing_datapath toplevel=datapath
make timing_sequencer toplevel=sequencer
make timing_hw_kernel toplevel=hw_kernel
make timing_plb_marc toplevel=plb_marc
make timing
# V5
make timing_datapath toplevel=datapath target=ml507
make timing_sequencer toplevel=sequencer target=ml507
make timing_hw_kernel toplevel=hw_kernel target=ml507
.PHONY: bits
bits: $(IMPL)/$(DEVDES).bit
.PHONY: download
download: bits
cd $(IMPL); \
echo -e "setMode -bscan \
\nsetCable -p lpt1 \
\naddDevice -p 1 -part xccace \
\naddDevice -p 2 -file $(DEVDES).bit \
\nprogram -p 2 \
\nquit" > download.cmd ; \
$(IMPACT) -batch download.cmd ; \
cd ..
.PHONY: linux
linux: $(PROG) $(VMLINUX) download
mkdir -p -m 700 $(SCRHOME)
cp -a $(PROG) $(SCRHOME)
cd $(IMPL); \
echo -e "connect ppc hw \
\nrst \
\nafter 1700 set end 1 \
\nvwait end \
\ndow $(VMLINUX) \
\ncon \
\nexit" > download.tcl ; \
echo -e "set bps 115200 \
\nset msdos "off" \
\nset del2bs "off" \
\nbind_function 1 \"quitchr\" \
\nshell \"$(XMD) -tcl download.tcl\" \
\necho \"Linux wird auf der seriellen Konsole gestartet...\" \
\n" > download.xc ; \
$(XC) -l $(CONSOLETTY) -s download.xc ; \
cd ..
.PHONY: cosim
cosim:
make -C cosimulation/
cosimulation/simv
.PHONY: cosim_gui
cosim_gui:
make -C cosimulation/
cosimulation/simv -gui
.PHONY: cosim_clean
cosim_clean:
make clean -C cosimulation/
.PHONY: clean
clean:
rm -f $(PROG).exe $(PROG).bin $(PROG).run $(PROG).o $(PROG) $(DEVDES).o $(VPDRTL).vpd $(VPDLAY).vpd $(VPDSYN).vpd $(SIMVRTL) $(SIMVLAY) $(SIMVSYN) marc.v stdout.log vcs.key
rm -rf Simple.ml310.* Simple.ml507.* $(IMPL) $(IMPL).datapath $(IMPL).sequencer $(IMPL).user $(IMPL).plb_marc
rm -rf $(SIMVRTL).daidir $(SIMVLAY).daidir $(SIMVSYN).daidir $(MDIRRTL) $(MDIRLAY) $(MDIRSYN)
# Switch between different top-level modules
ifeq "$(toplevel)" "datapath"
include Makefile.datapath
endif
ifeq "$(toplevel)" "sequencer"
include Makefile.sequencer
endif
ifeq "$(toplevel)" "hw_kernel"
include Makefile.hw_kernel
endif
ifeq "$(toplevel)" "user"
include Makefile.user
endif
ifeq "$(toplevel)" "plb_marc"
include Makefile.plb_marc
endif
ifeq "$(toplevel)" "mci_marc"
include Makefile.mci_marc
endif