Commit d51a4cf2 authored by Christoph Gerum's avatar Christoph Gerum

Merge branch 'master' of...

Merge branch 'master' of atreus.informatik.uni-tuebingen.de:advanced_computer_architecture/exercises
parents b4bbdc12 2cdbcee2
all:
arm-linux-gnueabihf-gcc -static daxpy.c -o daxpy
arm-linux-gnueabihf-gcc -static -O3 daxpy.c -o daxpy
o1:
arm-linux-gnueabihf-gcc -static -O1 daxpy.c -o daxpy
clean:
rm daxpy
rm daxpy daxpy.s
FILE1 = basicmath_small.c rad2deg.c cubic.c isqrt.c
FILE2 = basicmath_large.c rad2deg.c cubic.c isqrt.c
all: basicmath_small basicmath_large
basicmath_small: ${FILE1} Makefile
arm-linux-gnueabihf-gcc -static -O3 ${FILE1} -o basicmath_small -lm
basicmath_large: ${FILE2} Makefile
arm-linux-gnueabihf-gcc -static -O3 ${FILE2} -o basicmath_large -lm
clean:
rm -rf basicmath_small basicmath_large output*
#include<stdio.h>
#define N 8 // size of vector
#define R 10 // number of repetitions
/* #include<stdio.h> */
#define N 1000 // size of vector
#define R 1 // number of repetitions
// daxpy: Y = aX + Y (n size vector, a constant, X,Y vectors)
void daxpy(double* x, double* y, double a, int n)
void daxpy(int* x, int* y, int a, int n)
{
int i;
for (i = 0; i < n; i++) {
......@@ -13,32 +13,32 @@ void daxpy(double* x, double* y, double a, int n)
}
// pretty print vector
void print_vector(double* vec, int n)
{
int i;
for (i=0; i<n-1; i++) {
printf("%f,\t",vec[i]);
}
printf("%f",vec[n-1]);
printf("\n");
}
/* void print_vector(double* vec, int n) */
/* { */
/* int i; */
/* for (i=0; i<n-1; i++) { */
/* printf("%f,\t",vec[i]); */
/* } */
/* printf("%f",vec[n-1]); */
/* printf("\n"); */
/* } */
void main()
{
static double x[N], y[N];
double a = 5.5;
static int x[N], y[N];
int a = 5;
int i;
for (i = 0; i<N; i++) {
x[i] = 7.833667;
x[i] = 7+i;
y[i] = 0;
}
print_vector(y, N);
/* print_vector(y, N); */
for (i = 0; i<R; i++) {
daxpy(x,y,a,N);
}
print_vector(y,N);
/* print_vector(y,N); */
}
/* #include<stdio.h> */
#define N 1000 // size of vector
#define R 1 // number of repetitions
// daxpy: Y = aX + Y (n size vector, a constant, X,Y vectors)
void daxpy(double* x, double* y, double a, int n)
{
int i;
for (i = 0; i < n; i++) {
y[i] = a * x[i] + y[i];
}
}
// pretty print vector
/* void print_vector(double* vec, int n) */
/* { */
/* int i; */
/* for (i=0; i<n-1; i++) { */
/* printf("%f,\t",vec[i]); */
/* } */
/* printf("%f",vec[n-1]); */
/* printf("\n"); */
/* } */
void main()
{
static double x[N], y[N];
double a = 5.5;
int i;
for (i = 0; i<N; i++) {
x[i] = 7.833667+i;
y[i] = 0;
}
/* print_vector(y, N); */
for (i = 0; i<R; i++) {
daxpy(x,y,a,N);
}
/* print_vector(y,N); */
}
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="210mm"
height="150mm"
viewBox="0 0 744.09449 531.49606"
id="svg2"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="gem5_architecture.svg">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.4"
inkscape:cx="458.23661"
inkscape:cy="257.14286"
inkscape:document-units="px"
inkscape:current-layer="g3405-9"
showgrid="false"
inkscape:window-width="1920"
inkscape:window-height="1016"
inkscape:window-x="0"
inkscape:window-y="27"
inkscape:window-maximized="1" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-520.86614)">
<g
id="g3385"
transform="matrix(1.0291146,0,0,0.99986864,-44.049469,4.0749978)">
<rect
y="532.21564"
x="70.56781"
height="77.435791"
width="416.7215"
id="rect3336"
style="fill:#ffeeaa;fill-rule:evenodd;stroke:#000000;stroke-width:0.70706236px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<text
sodipodi:linespacing="125%"
id="text3356"
y="570.36212"
x="79.285728"
style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
style="font-size:27.5px"
y="570.36212"
x="79.285728"
id="tspan3358"
sodipodi:role="line">Python Configuration Script</tspan><tspan
id="tspan3360"
y="604.73712"
x="79.285728"
sodipodi:role="line" /></text>
<text
sodipodi:linespacing="125%"
id="text3362"
y="598.64789"
x="81"
style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
style="font-size:22.5px"
y="598.64789"
x="81"
id="tspan3364"
sodipodi:role="line">Instantiates the simulation objects</tspan></text>
</g>
<g
id="g3405">
<rect
y="648.79077"
x="32.85714"
height="93.571426"
width="422.14285"
id="rect3393"
style="fill:#5599ff" />
<text
sodipodi:linespacing="125%"
id="text3397"
y="686.79077"
x="133.71429"
style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
y="686.79077"
x="133.71429"
id="tspan3399"
sodipodi:role="line">gem5.opt</tspan></text>
<text
sodipodi:linespacing="125%"
id="text3401"
y="725.505"
x="40.142857"
style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
style="font-size:30px"
y="725.505"
x="40.142857"
id="tspan3403"
sodipodi:role="line">Special Python Interpreter</tspan></text>
</g>
<g
id="g3422">
<rect
y="648.07648"
x="500.57144"
height="92.85714"
width="218.57143"
id="rect3412"
style="fill:#5599ff" />
<text
sodipodi:linespacing="125%"
id="text3414"
y="670.93359"
x="606.04175"
style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
style="font-size:25px;text-align:center;text-anchor:middle"
y="670.93359"
x="610.02124"
id="tspan3416"
sodipodi:role="line">gem5 Library of </tspan><tspan
id="tspan3418"
style="font-size:25px;text-align:center;text-anchor:middle"
y="702.18359"
x="610.02124"
sodipodi:role="line">Simulation </tspan><tspan
id="tspan3420"
style="font-size:25px;text-align:center;text-anchor:middle"
y="733.43359"
x="606.04175"
sodipodi:role="line">objects</tspan></text>
</g>
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 306.42857,773.07646 0,0"
id="path3431"
inkscape:connector-type="polyline"
inkscape:connector-curvature="3" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 244.65618,613.64634 -0.31212,35.14443"
id="path3433"
inkscape:connector-type="polyline"
inkscape:connector-curvature="3"
inkscape:connection-start="#g3385"
inkscape:connection-end="#g3405" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 500.57144,694.82504 -45.57145,0.13343"
id="path3435"
inkscape:connector-type="polyline"
inkscape:connector-curvature="3"
inkscape:connection-start="#g3422"
inkscape:connection-end="#g3405" />
<g
id="g3385-3"
transform="translate(-32.7857,248.57153)">
<rect
y="532.22101"
x="62.144623"
height="77.425026"
width="429.56787"
id="rect3336-8"
style="fill:#ffeeaa;fill-rule:evenodd;stroke:#000000;stroke-width:0.71782815px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<text
sodipodi:linespacing="125%"
id="text3356-4"
y="570.36212"
x="79.285728"
style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
style="font-size:27.5px"
y="570.36212"
x="79.285728"
id="tspan3358-3"
sodipodi:role="line">C++ objects</tspan><tspan
id="tspan3360-7"
y="604.73712"
x="79.285728"
sodipodi:role="line" /></text>
<text
sodipodi:linespacing="125%"
id="text3362-4"
y="598.64789"
x="70.285713"
style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
style="font-size:22.5px"
y="598.64789"
x="70.285713"
id="tspan3364-3"
sodipodi:role="line">configured accoding to python script</tspan></text>
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 276.04012,493.79067 -0.55375,38.43034"
id="path3470"
inkscape:connector-type="polyline"
inkscape:connector-curvature="3"
inkscape:connection-start="#g3405"
inkscape:connection-end="#rect3336-8" />
</g>
<g
transform="translate(-1.071423,252.50001)"
id="g3405-9">
<rect
y="648.79077"
x="32.85714"
height="93.571426"
width="422.14285"
id="rect3393-6"
style="fill:#5599ff" />
<text
sodipodi:linespacing="125%"
id="text3397-3"
y="710.36218"
x="68.714294"
style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
y="710.36218"
x="68.714294"
id="tspan3399-9"
sodipodi:role="line">Actual Simulation</tspan></text>
</g>
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 243.63983,858.21756 -0.37518,43.07322"
id="path3502"
inkscape:connector-type="polyline"
inkscape:connector-curvature="3"
inkscape:connection-start="#g3385-3"
inkscape:connection-end="#g3405-9" />
</g>
</svg>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment