summaryrefslogtreecommitdiffstats
path: root/treemap
diff options
context:
space:
mode:
authorBert Lange <b.lange@fzd.de>2011-03-28 14:56:05 +0200
committerBert Lange <b.lange@fzd.de>2011-03-28 14:56:05 +0200
commit44cc22c01fc8f74d0595b80bced36cd143a72ce1 (patch)
tree825a638e3520659f334047d99c218ad34d4e6fea /treemap
parentf1c321e64d8c364b5079097c579a0c8c5a2ddeae (diff)
parent9c363ddbee3733179f191a6ac5d8b42769541566 (diff)
downloadzpu-44cc22c01fc8f74d0595b80bced36cd143a72ce1.zip
zpu-44cc22c01fc8f74d0595b80bced36cd143a72ce1.tar.gz
Merge stuff back in :-(
Diffstat (limited to 'treemap')
-rw-r--r--treemap/Makefile63
-rw-r--r--treemap/convert.xsl110
2 files changed, 173 insertions, 0 deletions
diff --git a/treemap/Makefile b/treemap/Makefile
new file mode 100644
index 0000000..52416fc
--- /dev/null
+++ b/treemap/Makefile
@@ -0,0 +1,63 @@
+#TOP = top
+#DIR = ../s3estarter/syn/xst
+#SCREENSHOT = s3estarter_ressources
+
+#TOP = spartan6_top
+#DIR = ../beam_position_monitor/hardware/board_sp601/synthese/xst
+#SCREENSHOT = bpm_ressources
+
+TOP = top
+DIR = ../central_trigger_generator/syn/xst
+SCREENSHOT = central_trigger_ressources
+
+
+# derived Variables
+MAPREPORTXML = $(DIR)/$(TOP)_map.xrpt
+MAPREPORT = $(DIR)/$(TOP)_map.mrp
+
+
+start = $(shell grep --line-number "^Logic Utilization:" $(DIR)/$(TOP)_map.mrp | cut -d":" -f1)
+end = $(shell grep --line-number "^Peak Memory Usage:" $(DIR)/$(TOP)_map.mrp | cut -d":" -f1)
+
+
+help:
+ @echo "run - run Treeviz"
+ @echo "convert - convert data (on unix)"
+ @echo "util - grep for utilization"
+ @echo "combine - two screenshots for better overview"
+ @echo "clean - tidy up"
+
+run: ressources.xml
+ @echo "save screeshot as $(SCREENSHOT)_grob.png and $(SCREENSHOT)_fein.png"
+ java -jar Treeviz/dist/Treeviz.jar $<
+
+convert: ressources.xml
+
+
+# useful for printing with graphic report
+# cut lines beetween "Logic Utilization" and "Average Fanout..."
+util: $(MAPREPORT)
+ @sed -n '/Logic Utilization:/,/^Average Fanout of Non-Clock Nets:/p' $(MAPREPORT)
+
+# not so useful -> confusing if hierachy to deep
+# cut lines from "Section 13" (2nd occurence) and end of file
+util_hier: $(MAPREPORT)
+ @tail -n +$(shell grep --line-number "^Section 13" $(MAPREPORT) | tail -1 | cut -d":" -f1) $(MAPREPORT)
+
+
+
+ressources.xml: $(MAPREPORTXML) convert.xsl
+ saxon-xslt $(MAPREPORTXML) convert.xsl > tmp.xml
+ # prune empty lines with sed
+ sed -e '/^[ ]*$$/d' tmp.xml > ressources.xml
+ # cleanup
+ rm -f tmp.xml
+
+
+combine: $(SCREENSHOT)_fein.png $(SCREENSHOT)_grob.png
+ composite -blend 33 $(SCREENSHOT)_fein.png $(SCREENSHOT)_grob.png $(SCREENSHOT)_mixed.png
+
+
+clean:
+ rm -f ressources.xml
+
diff --git a/treemap/convert.xsl b/treemap/convert.xsl
new file mode 100644
index 0000000..080bd00
--- /dev/null
+++ b/treemap/convert.xsl
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:output encoding="UTF-8"/>
+<xsl:strip-space elements="*" />
+<xsl:preserve-space elements="node" />
+
+<xsl:template match="tree">
+
+ <xsl:if test="@stringID='MAP_MODULE_HIERARCHY'">
+ <xsl:apply-templates />
+ </xsl:if>
+
+</xsl:template>
+
+
+<xsl:template match="node">
+
+ <xsl:variable name="nodename">
+ <xsl:value-of select="@value" />
+ </xsl:variable>
+
+ <xsl:variable name="nodeslices">
+ <xsl:call-template name="slices" />
+ </xsl:variable>
+
+ <xsl:variable name="nodeslice_reg">
+ <xsl:call-template name="slice_reg" />
+ </xsl:variable>
+
+ <xsl:variable name="nodeluts">
+ <xsl:call-template name="luts" />
+ </xsl:variable>
+
+ <xsl:variable name="nodelutram">
+ <xsl:call-template name="lutram" />
+ </xsl:variable>
+
+ <xsl:variable name="nodebrams">
+ <xsl:call-template name="brams" />
+ </xsl:variable>
+
+ <xsl:variable name="nodemul_dsp">
+ <xsl:call-template name="mul_dsp" />
+ </xsl:variable>
+
+<!--<node name="{$nodename}" size="{$nodeslices}" created="{substring(concat('0000',$nodebrams),1+string-length($nodebrams),4)}-01-01 00:00:00">-->
+ <node name="{$nodename}" slices="{$nodeslices}" slice_reg="{$nodeslice_reg}" luts="{$nodeluts}" lutram="{$nodelutram}" brams="{$nodebrams}" mul_dsp="{$nodemul_dsp}">
+ <xsl:apply-templates />
+ </node>
+
+</xsl:template>
+
+
+<xsl:template name="slices">
+ <xsl:for-each select="item">
+ <xsl:if test="@stringID='MAP_SLICES'">
+ <xsl:value-of select="@value" />
+<!-- <xsl:value-of select="@ACCUMULATED" />-->
+ </xsl:if>
+ </xsl:for-each>
+</xsl:template>
+
+
+<xsl:template name="slice_reg">
+ <xsl:for-each select="item">
+ <xsl:if test="@stringID='MAP_SLICE_REG'">
+ <xsl:value-of select="@value" />
+ </xsl:if>
+ </xsl:for-each>
+</xsl:template>
+
+
+<xsl:template name="luts">
+ <xsl:for-each select="item">
+ <xsl:if test="@label='LUTs'">
+ <xsl:value-of select="@value" />
+ </xsl:if>
+ </xsl:for-each>
+</xsl:template>
+
+
+<xsl:template name="lutram">
+ <xsl:for-each select="item">
+ <xsl:if test="@label='LUTRAM'">
+ <xsl:value-of select="@value" />
+ </xsl:if>
+ </xsl:for-each>
+</xsl:template>
+
+
+<xsl:template name="brams">
+ <xsl:for-each select="item">
+ <xsl:if test="@stringID='MAP_BRAM' or @stringID='MAP_BRAM_FIFO'">
+ <xsl:value-of select="@value" />
+ </xsl:if>
+ </xsl:for-each>
+</xsl:template>
+
+
+<xsl:template name="mul_dsp">
+ <xsl:for-each select="item">
+ <xsl:if test="@stringID='MAP_MULT18X18' or @label='DSP48A1'">
+ <xsl:value-of select="@value" />
+ </xsl:if>
+ </xsl:for-each>
+</xsl:template>
+
+
+</xsl:stylesheet>
OpenPOWER on IntegriCloud